supplier_proposal_extrafields.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. // Load Dolibarr environment
  21. require '../../main.inc.php';
  22. require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  24. // Load translation files required by the page
  25. $langs->loadLangs(array('companies', 'admin', 'supplier_proposal'));
  26. $extrafields = new ExtraFields($db);
  27. $form = new Form($db);
  28. // List of supported format
  29. $tmptype2label = ExtraFields::$type2label;
  30. $type2label = array('');
  31. foreach ($tmptype2label as $key => $val) {
  32. $type2label[$key] = $langs->transnoentitiesnoconv($val);
  33. }
  34. $action = GETPOST('action', 'aZ09');
  35. $attrname = GETPOST('attrname', 'alpha');
  36. $elementtype = 'supplier_proposal'; //Must be the $table_element of the class that manage extrafield
  37. if (!$user->admin) {
  38. accessforbidden();
  39. }
  40. /*
  41. * Actions
  42. */
  43. require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
  44. /*
  45. * View
  46. */
  47. $textobject = $langs->transnoentitiesnoconv("CommRequests");
  48. llxHeader('', $langs->trans("SupplierProposalSetup"));
  49. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  50. print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title_setup');
  51. $head = supplier_proposal_admin_prepare_head();
  52. print dol_get_fiche_head($head, 'attributes', $langs->trans("CommRequests"), -1, 'supplier_proposal');
  53. require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
  54. print dol_get_fiche_end();
  55. // Creation of an optional field
  56. if ($action == 'create') {
  57. print "<br>";
  58. print load_fiche_titre($langs->trans('NewAttribute'));
  59. require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
  60. }
  61. // Edition of an optional field
  62. if ($action == 'edit' && !empty($attrname)) {
  63. print "<br>";
  64. print load_fiche_titre($langs->trans("FieldEdition", $attrname));
  65. require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
  66. }
  67. // End of page
  68. llxFooter();
  69. $db->close();