confexped.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. /* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
  5. * Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>ù
  6. * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/admin/confexped.php
  23. * \ingroup produit
  24. * \brief Page to setup sending module
  25. */
  26. require '../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array('admin', 'sendings', 'deliveries'));
  31. if (!$user->admin)
  32. accessforbidden();
  33. $action = GETPOST('action', 'alpha');
  34. /*
  35. * Actions
  36. */
  37. // Shipment note
  38. if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
  39. {
  40. // This option should always be set to on when module is on.
  41. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
  42. }
  43. /*
  44. if ($action == 'activate_sending')
  45. {
  46. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
  47. header("Location: confexped.php");
  48. exit;
  49. }
  50. if ($action == 'disable_sending')
  51. {
  52. dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity);
  53. header("Location: confexped.php");
  54. exit;
  55. }
  56. */
  57. // Delivery note
  58. if ($action == 'activate_delivery')
  59. {
  60. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
  61. dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity);
  62. header("Location: confexped.php");
  63. exit;
  64. }
  65. elseif ($action == 'disable_delivery')
  66. {
  67. dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity);
  68. header("Location: confexped.php");
  69. exit;
  70. }
  71. /*
  72. * View
  73. */
  74. $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
  75. $form = new Form($db);
  76. llxHeader("", $langs->trans("SendingsSetup"));
  77. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  78. print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
  79. print '<br>';
  80. $head = expedition_admin_prepare_head();
  81. dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending');
  82. // Miscellaneous parameters
  83. print '<table class="noborder centpercent">';
  84. print '<tr class="liste_titre">';
  85. print '<td>'.$langs->trans("Feature").'</td>';
  86. print '<td width="20">&nbsp;</td>';
  87. print '<td class="center">'.$langs->trans("Status").'</td>';
  88. print '</tr>'."\n";
  89. // expedition activation/desactivation
  90. print "<tr>";
  91. print '<td>'.$langs->trans("SendingsAbility").'</td>';
  92. print '<td>';
  93. print '</td>';
  94. print '<td class="center">';
  95. print $langs->trans("Required");
  96. /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
  97. {
  98. print '<a href="confexped.php?action=activate_sending">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  99. }
  100. else
  101. {
  102. print '<a href="confexped.php?action=disable_sending">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  103. }*/
  104. print "</td>";
  105. print '</tr>';
  106. // Bon de livraison activation/desactivation
  107. print '<tr>';
  108. print '<td>';
  109. print $langs->trans("DeliveriesOrderAbility");
  110. print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
  111. print '</td>';
  112. print '<td>';
  113. print '</td>';
  114. print '<td class="center">';
  115. if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
  116. {
  117. print '<a href="confexped.php?action=activate_delivery">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  118. }
  119. else
  120. {
  121. print '<a href="confexped.php?action=disable_delivery">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
  122. }
  123. print "</td>";
  124. print '</tr>';
  125. print '</table>';
  126. print '</div>';
  127. // End of page
  128. llxFooter();
  129. $db->close();