confexped.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. }
  34. $action = GETPOST('action', 'aZ09');
  35. /*
  36. * Actions
  37. */
  38. // Shipment note
  39. if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
  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. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
  60. dolibarr_set_const($db, "MAIN_SUBMODULE_DELIVERY", "1", 'chaine', 0, '', $conf->entity);
  61. header("Location: confexped.php");
  62. exit;
  63. } elseif ($action == 'disable_delivery') {
  64. dolibarr_del_const($db, "MAIN_SUBMODULE_DELIVERY", $conf->entity);
  65. header("Location: confexped.php");
  66. exit;
  67. }
  68. /*
  69. * View
  70. */
  71. $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
  72. $form = new Form($db);
  73. llxHeader("", $langs->trans("SendingsSetup"));
  74. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  75. print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
  76. print '<br>';
  77. $head = expedition_admin_prepare_head();
  78. print dol_get_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'shipment');
  79. // Miscellaneous parameters
  80. print '<table class="noborder centpercent">';
  81. print '<tr class="liste_titre">';
  82. print '<td>'.$langs->trans("Feature").'</td>';
  83. print '<td width="20">&nbsp;</td>';
  84. print '<td class="center">'.$langs->trans("Status").'</td>';
  85. print '</tr>'."\n";
  86. // expedition activation/desactivation
  87. print "<tr>";
  88. print '<td>'.$langs->trans("SendingsAbility").'</td>';
  89. print '<td>';
  90. print '</td>';
  91. print '<td class="center">';
  92. print '<span class="opacitymedium">'.img_picto($langs->trans("Required"), 'switch_on').'</span>';
  93. /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
  94. {
  95. print '<a href="confexped.php?action=activate_sending&token='.newToken().'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  96. }
  97. else
  98. {
  99. print '<a href="confexped.php?action=disable_sending&token='.newToken().'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  100. }*/
  101. print "</td>";
  102. print '</tr>';
  103. // Delivery note activate/deactivate Bon de livraison activation/desactivation
  104. print '<tr>';
  105. print '<td>';
  106. print $langs->trans("DeliveriesOrderAbility");
  107. print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
  108. print '</td>';
  109. print '<td>';
  110. print '</td>';
  111. print '<td class="center">';
  112. if (empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  113. print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_delivery&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  114. } else {
  115. print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_delivery&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
  116. }
  117. print "</td>";
  118. print '</tr>';
  119. print '</table>';
  120. print '</div>';
  121. // End of page
  122. llxFooter();
  123. $db->close();