PageRenderTime 34ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/admin/delais.php

https://bitbucket.org/speedealing/speedealing
PHP | 237 lines | 169 code | 37 blank | 31 comment | 9 complexity | ba889ab11a76da868c2fddef83e3acf9 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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 <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/admin/delais.php
  22. * \brief Page to setup late delays
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. $langs->load("admin");
  27. if (! $user->admin) accessforbidden();
  28. $action=GETPOST('action','alpha');
  29. $modules=array(
  30. 'agenda' => array(
  31. array(
  32. 'code' => 'MAIN_DELAY_ACTIONS_TODO',
  33. 'img' => 'action'
  34. )
  35. ),
  36. 'propal' => array(
  37. array(
  38. 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
  39. 'img' => 'propal'
  40. ),
  41. array(
  42. 'code' => 'MAIN_DELAY_PROPALS_TO_BILL',
  43. 'img' => 'propal'
  44. )
  45. ),
  46. 'commande' => array(
  47. array(
  48. 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS',
  49. 'img' => 'order'
  50. )
  51. ),
  52. 'facture' => array(
  53. array(
  54. 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
  55. 'img' => 'bill'
  56. )
  57. ),
  58. 'fournisseur' => array(
  59. array(
  60. 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
  61. 'img' => 'order'
  62. ),
  63. array(
  64. 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
  65. 'img' => 'bill'
  66. )
  67. ),
  68. 'service' => array(
  69. array(
  70. 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
  71. 'img' => 'service'
  72. ),
  73. array(
  74. 'code' => 'MAIN_DELAY_RUNNING_SERVICES',
  75. 'img' => 'service'
  76. )
  77. ),
  78. 'banque' => array(
  79. array(
  80. 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
  81. 'img' => 'account'
  82. ),
  83. array(
  84. 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
  85. 'img' => 'account'
  86. )
  87. ),
  88. 'adherent' => array(
  89. array(
  90. 'code' => 'MAIN_DELAY_MEMBERS',
  91. 'img' => 'user'
  92. )
  93. ),
  94. );
  95. if ($action == 'update')
  96. {
  97. foreach($modules as $module => $delays)
  98. {
  99. if (! empty($conf->$module->enabled))
  100. {
  101. foreach($delays as $delay)
  102. {
  103. if (GETPOST($delay['code']))
  104. {
  105. dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
  106. }
  107. }
  108. }
  109. }
  110. dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
  111. }
  112. /*
  113. * View
  114. */
  115. llxHeader();
  116. print_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"),'','setup');
  117. print $langs->transnoentities("DelaysOfToleranceDesc",img_warning());
  118. print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
  119. print "<br>\n";
  120. $form = new Form($db);
  121. $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
  122. if ($action == 'edit')
  123. {
  124. print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
  125. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  126. print '<input type="hidden" name="action" value="update">';
  127. $var=true;
  128. print '<table class="noborder" width="100%">';
  129. print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
  130. foreach($modules as $module => $delays)
  131. {
  132. if (! empty($conf->$module->enabled))
  133. {
  134. foreach($delays as $delay)
  135. {
  136. $var=!$var;
  137. $value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0);
  138. print '<tr '.$bc[$var].'>';
  139. print '<td width="20px">'.img_object('',$delay['img']).'</td>';
  140. print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
  141. print '<input size="5" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
  142. }
  143. }
  144. }
  145. print '</table>';
  146. print '<br>';
  147. // Show if meteo is enabled
  148. print '<table class="noborder" width="100%">';
  149. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
  150. $var=!$var;
  151. print '<tr '.$bc[$var].'>';
  152. print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(isset($conf->global->MAIN_DISABLE_METEO)?1:0),1) . '</td></tr>';
  153. print '</table>';
  154. print '<br>';
  155. print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
  156. print '<br>';
  157. print '</form>';
  158. }
  159. else
  160. {
  161. /*
  162. * Affichage des parametres
  163. */
  164. print '<table class="noborder" width="100%">';
  165. print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
  166. $var=true;
  167. foreach($modules as $module => $delays)
  168. {
  169. if (! empty($conf->$module->enabled))
  170. {
  171. foreach($delays as $delay)
  172. {
  173. $var=!$var;
  174. $value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0);
  175. print '<tr '.$bc[$var].'>';
  176. print '<td width="20px">'.img_object('',$delay['img']).'</td>';
  177. print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
  178. print '<td>'.$value.' '.$langs->trans("days").'</td></tr>';
  179. }
  180. }
  181. }
  182. print '</table>';
  183. print '<br>';
  184. // Show if meteo is enabled
  185. print '<table class="noborder" width="100%">';
  186. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
  187. $var=!$var;
  188. print '<tr '.$bc[$var].'>';
  189. print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
  190. print '</table>';
  191. print '<br>';
  192. // Boutons d'action
  193. print '<div class="tabsAction">';
  194. print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
  195. print '</div>';
  196. }
  197. print '<br>';
  198. llxFooter();
  199. $db->close();
  200. ?>