confexped.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
  4. * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/admin/confexped.php
  21. * \ingroup produit
  22. * \brief Page to setup sending module
  23. */
  24. require("../main.inc.php");
  25. require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
  26. $langs->load("admin");
  27. $langs->load("sendings");
  28. $langs->load("deliveries");
  29. if (!$user->admin)
  30. accessforbidden();
  31. if ($_GET["action"] == 'activate_sending')
  32. {
  33. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
  34. Header("Location: confexped.php");
  35. exit;
  36. }
  37. else if ($_GET["action"] == 'disable_sending')
  38. {
  39. dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity);
  40. Header("Location: confexped.php");
  41. exit;
  42. }
  43. else if ($_GET["action"] == 'activate_delivery')
  44. {
  45. dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1",'chaine',0,'',$conf->entity);
  46. Header("Location: confexped.php");
  47. exit;
  48. }
  49. else if ($_GET["action"] == 'disable_delivery')
  50. {
  51. dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON",$conf->entity);
  52. Header("Location: confexped.php");
  53. exit;
  54. }
  55. /*
  56. * Affiche page
  57. */
  58. $dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/";
  59. $html=new Form($db);
  60. llxHeader("","");
  61. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  62. print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup');
  63. print '<br>';
  64. $h = 0;
  65. $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
  66. $head[$h][1] = $langs->trans("Setup");
  67. $hselected=$h;
  68. $h++;
  69. if ($conf->global->MAIN_SUBMODULE_EXPEDITION)
  70. {
  71. $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
  72. $head[$h][1] = $langs->trans("Sending");
  73. $h++;
  74. }
  75. if ($conf->global->MAIN_SUBMODULE_LIVRAISON)
  76. {
  77. $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php";
  78. $head[$h][1] = $langs->trans("Receivings");
  79. $h++;
  80. }
  81. dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
  82. /*
  83. * Formulaire parametres divers
  84. */
  85. $var=true;
  86. print '<table class="noborder" width="100%">';
  87. print '<tr class="liste_titre">';
  88. print '<td>'.$langs->trans("Feature").'</td>';
  89. print '<td align="center" width="20">&nbsp;</td>';
  90. print '<td align="center" width="100">'.$langs->trans("Status").'</td>';
  91. print '</tr>'."\n";
  92. // expedition activation/desactivation
  93. $var=!$var;
  94. print "<tr ".$bc[$var].">";
  95. print '<td>'.$langs->trans("SendingsAbility").'</td>';
  96. print '<td align="center" width="20">';
  97. print '</td>';
  98. print '<td align="center" width="100">';
  99. if($conf->global->MAIN_SUBMODULE_EXPEDITION == 0)
  100. {
  101. print '<a href="confexped.php?action=activate_sending">'.img_picto($langs->trans("Disabled"),'off').'</a>';
  102. }
  103. else if($conf->global->MAIN_SUBMODULE_EXPEDITION == 1)
  104. {
  105. print '<a href="confexped.php?action=disable_sending">'.img_picto($langs->trans("Enabled"),'on').'</a>';
  106. }
  107. print "</td>";
  108. print '</tr>';
  109. // Bon de livraison activation/desactivation
  110. $var=!$var;
  111. print '<tr '.$bc[$var].'>';
  112. print '<td>'.$langs->trans("DeliveriesOrderAbility").'</td>';
  113. print '<td align="center" width="20">';
  114. print '</td>';
  115. print '<td align="center" width="100">';
  116. if($conf->global->MAIN_SUBMODULE_LIVRAISON == 0)
  117. {
  118. print '<a href="confexped.php?action=activate_delivery">'.img_picto($langs->trans("Disabled"),'off').'</a>';
  119. }
  120. else if($conf->global->MAIN_SUBMODULE_LIVRAISON == 1)
  121. {
  122. print '<a href="confexped.php?action=disable_delivery">'.img_picto($langs->trans("Enabled"),'on').'</a>';
  123. }
  124. print "</td>";
  125. print '</tr>';
  126. print '</table>';
  127. print '</div>';
  128. print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
  129. $db->close();
  130. llxFooter();
  131. ?>