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@capnetworks.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 <http://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. $langs->load("admin");
  30. $langs->load("sendings");
  31. $langs->load("deliveries");
  32. if (!$user->admin)
  33. accessforbidden();
  34. $action=GETPOST('action','alpha');
  35. /*
  36. * Actions
  37. */
  38. // Shipment note
  39. if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
  40. {
  41. // This option should always be set to on when module is on.
  42. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
  43. }
  44. /*
  45. if ($action == 'activate_sending')
  46. {
  47. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
  48. header("Location: confexped.php");
  49. exit;
  50. }
  51. if ($action == 'disable_sending')
  52. {
  53. dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity);
  54. header("Location: confexped.php");
  55. exit;
  56. }
  57. */
  58. // Delivery note
  59. if ($action == 'activate_delivery')
  60. {
  61. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); // We must also enable this
  62. dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1",'chaine',0,'',$conf->entity);
  63. header("Location: confexped.php");
  64. exit;
  65. }
  66. else if ($action == 'disable_delivery')
  67. {
  68. dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON",$conf->entity);
  69. header("Location: confexped.php");
  70. exit;
  71. }
  72. /*
  73. * View
  74. */
  75. $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
  76. $form=new Form($db);
  77. llxHeader("",$langs->trans("SendingsSetup"));
  78. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  79. print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup');
  80. print '<br>';
  81. $head = expedition_admin_prepare_head();
  82. dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending');
  83. // Miscellaneous parameters
  84. print '<table class="noborder" width="100%">';
  85. print '<tr class="liste_titre">';
  86. print '<td>'.$langs->trans("Feature").'</td>';
  87. print '<td width="20">&nbsp;</td>';
  88. print '<td class="center">'.$langs->trans("Status").'</td>';
  89. print '</tr>'."\n";
  90. // expedition activation/desactivation
  91. print "<tr>";
  92. print '<td>'.$langs->trans("SendingsAbility").'</td>';
  93. print '<td>';
  94. print '</td>';
  95. print '<td class="center">';
  96. print $langs->trans("Required");
  97. /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
  98. {
  99. print '<a href="confexped.php?action=activate_sending">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  100. }
  101. else
  102. {
  103. print '<a href="confexped.php?action=disable_sending">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  104. }*/
  105. print "</td>";
  106. print '</tr>';
  107. // Bon de livraison activation/desactivation
  108. print '<tr>';
  109. print '<td>';
  110. print $langs->trans("DeliveriesOrderAbility");
  111. print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
  112. print '</td>';
  113. print '<td>';
  114. print '</td>';
  115. print '<td class="center">';
  116. if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
  117. {
  118. print '<a href="confexped.php?action=activate_delivery">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  119. }
  120. else
  121. {
  122. print '<a href="confexped.php?action=disable_delivery">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  123. }
  124. print "</td>";
  125. print '</tr>';
  126. print '</table>';
  127. print '</div>';
  128. llxFooter();
  129. $db->close();