27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31 $langs->load(
"admin");
37 $action =
GETPOST(
'action',
'aZ09');
46 'code' =>
'MAIN_DELAY_ACTIONS_TODO',
52 'code' =>
'MAIN_DELAY_PROJECT_TO_CLOSE',
56 'code' =>
'MAIN_DELAY_TASKS_TODO',
57 'img' =>
'projecttask'
62 'code' =>
'MAIN_DELAY_PROPALS_TO_CLOSE',
66 'code' =>
'MAIN_DELAY_PROPALS_TO_BILL',
72 'code' =>
'MAIN_DELAY_ORDERS_TO_PROCESS',
78 'code' =>
'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
82 'fournisseur' => array(
84 'code' =>
'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
88 'code' =>
'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
94 'code' =>
'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
98 'code' =>
'MAIN_DELAY_RUNNING_SERVICES',
104 'code' =>
'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
108 'code' =>
'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
114 'code' =>
'MAIN_DELAY_MEMBERS',
118 'expensereport' => array(
120 'code' =>
'MAIN_DELAY_EXPENSEREPORTS',
131 'code' =>
'MAIN_DELAY_HOLIDAYS',
137 $labelmeteo = array(0=>$langs->trans(
"No"), 1=>$langs->trans(
"Yes"), 2=>$langs->trans(
"OnMobileOnly"));
139 if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
140 $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7;
142 if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
143 $conf->global->MAIN_DELAY_TASKS_TODO = 7;
145 if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
146 $conf->global->MAIN_DELAY_MEMBERS = 0;
148 if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
149 $conf->global->MAIN_DELAY_ACTIONS_TODO = 7;
151 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
152 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
154 if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
155 $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
157 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
158 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
160 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
161 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
163 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
164 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
173 if ($action ==
'update') {
174 foreach ($modules as $module => $delays) {
175 if (!empty($conf->$module->enabled)) {
176 foreach ($delays as $delay) {
177 if (
GETPOST($delay[
'code']) !=
'') {
185 dolibarr_set_const($db,
"MAIN_USE_METEO_WITH_PERCENTAGE",
GETPOST(
"MAIN_USE_METEO_WITH_PERCENTAGE"),
'chaine', 0,
'', $conf->entity);
189 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
190 $plus =
'_PERCENTAGE';
193 for ($i = 0; $i < 4; $i++) {
195 dolibarr_set_const($db,
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
GETPOST(
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
'int'),
'chaine', 0,
'', $conf->entity);
213 print
load_fiche_titre($langs->trans(
"DelaysOfToleranceBeforeWarning"),
'',
'title_setup');
215 print
'<span class="opacitymedium">'.$langs->transnoentities(
"DelaysOfToleranceDesc",
img_warning(
'default',
'',
'pictowarning nopaddingleft'));
216 print
" ".$langs->trans(
"OnlyActiveElementsAreShown", DOL_URL_ROOT.
'/admin/modules.php').
"</span><br>\n";
219 if ($action ==
'edit') {
220 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" name="form_index">';
221 print
'<input type="hidden" name="token" value="'.newToken().
'">';
222 print
'<input type="hidden" name="action" value="update">';
224 print
'<table class="noborder centpercent">';
225 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td>';
226 print
'<td class="right">'.$langs->trans(
"LateWarningAfter").
'</td></tr>';
228 foreach ($modules as $module => $delays) {
229 if (!empty($conf->$module->enabled)) {
230 foreach ($delays as $delay) {
231 $value = (!empty($conf->global->{$delay[
'code']}) ? $conf->global->{$delay[
'code']}:0);
232 print
'<tr class="oddeven">';
233 print
'<td width="20px">'.img_object(
'', $delay[
'img']).
'</td>';
234 print
'<td>'.$langs->trans(
'Delays_'.$delay[
'code']).
'</td><td class="nowraponall right">';
235 print
'<input class="right maxwidth75" type="number" name="'.$delay[
'code'].
'" value="'.$value.
'"> '.$langs->trans(
"days").
'</td></tr>';
245 print
'<table class="noborder centpercent">';
246 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
248 print
'<tr class="oddeven">';
249 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="right">';
250 print
$form->selectarray(
'MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
259 print
'<table class="noborder centpercent">';
260 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
262 foreach ($modules as $module => $delays) {
263 if (!empty($conf->$module->enabled)) {
264 foreach ($delays as $delay) {
265 $value = (!empty($conf->global->{$delay[
'code']}) ? $conf->global->{$delay[
'code']}:0);
266 print
'<tr class="oddeven">';
267 print
'<td width="20px">'.img_object(
'', $delay[
'img']).
'</td>';
268 print
'<td>'.$langs->trans(
'Delays_'.$delay[
'code']).
'</td>';
269 print
'<td class="right">'.$value.
' '.$langs->trans(
"days").
'</td></tr>';
279 print
'<table class="noborder centpercent">';
280 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
282 print
'<tr class="oddeven">';
283 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="center">';
284 print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
293 if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) {
295 print
'<span class="opacitymedium">'.$langs->trans(
"DescWeather").
'</span> ';
297 if ($action ==
'edit') {
298 $str_mode_std = $langs->trans(
'MeteoStdModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoPercentageMod'));
299 $str_mode_percentage = $langs->trans(
'MeteoPercentageModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoStdMod'));
300 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
301 $str_mode_enabled = $str_mode_std;
303 $str_mode_enabled = $str_mode_percentage;
305 print
'<br><a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.
'</a>';
306 print
'<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? $conf->global->MAIN_USE_METEO_WITH_PERCENTAGE :
'').
'" />';
310 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
311 print $langs->trans(
'MeteoStdModEnabled');
313 print $langs->trans(
'MeteoPercentageModEnabled');
322 $level0 = $offset;
if (!empty($conf->global->MAIN_METEO_LEVEL0)) {
323 $level0 = $conf->global->MAIN_METEO_LEVEL0;
325 $level1 = $offset + 1 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL1)) {
326 $level1 = $conf->global->MAIN_METEO_LEVEL1;
328 $level2 = $offset + 2 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL2)) {
329 $level2 = $conf->global->MAIN_METEO_LEVEL2;
331 $level3 = $offset + 3 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL3)) {
332 $level3 = $conf->global->MAIN_METEO_LEVEL3;
334 $text =
''; $options =
'class="valignmiddle" height="60px"';
337 if ($action ==
'edit') {
338 print
'<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'' :
'style="display:none;"').
'>';
341 print
'<div class="inline-block" style="padding-right: 20px">';
343 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.
'"/></td>';
344 print
'</div><div class="inline-block" style="padding-right: 20px">';
346 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.
'"/></td>';
347 print
'</div><div class="inline-block" style="padding-right: 20px">';
349 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.
'"/></td>';
350 print
'</div><div class="inline-block" style="padding-right: 20px">';
352 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.
'"/></td>';
358 print
'<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'style="display:none;"' :
'').
'>';
361 print
'<div class="inline-block" style="padding-right: 20px">';
363 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL0').
'"/> %</td>';
364 print
'</div><div class="inline-block" style="padding-right: 20px">';
366 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL1').
'"/> %</td>';
367 print
'</div><div class="inline-block" style="padding-right: 20px">';
369 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL2').
'"/> %</td>';
370 print
'</div><div class="inline-block" style="padding-right: 20px">';
372 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL3').
'"/> %</td>';
380 <script
type=
"text/javascript">
382 $(document).ready(
function() {
384 $(
"#change_mode").click(
function() {
385 var use_percent = $(
"#MAIN_USE_METEO_WITH_PERCENTAGE");
386 var str_mode_std =
"<?php print $str_mode_std; ?>";
387 var str_mode_percentage =
"<?php print $str_mode_percentage; ?>";
389 if(use_percent.val() == 1) {
391 $(
"#standard").show();
392 $(
"#percentage").hide();
393 $(
this).html(str_mode_std);
396 $(
"#standard").hide();
397 $(
"#percentage").show();
398 $(
this).html(str_mode_percentage);
408 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
410 print
'<div class="inline-block" style="padding-right: 20px">';
412 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.
' %</td>';
413 print
'</div><div class="inline-block" style="padding-right: 20px">';
415 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.
' %</td>';
416 print
'</div><div class="inline-block" style="padding-right: 20px">';
418 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.
' %</td>';
419 print
'</div><div class="inline-block" style="padding-right: 20px">';
421 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
422 print
'</div><div class="inline-block" style="padding-right: 20px">';
424 print
' > '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
429 print
'<div class="inline-block" style="padding-right: 20px">';
431 print
' <= '.$level0;
432 print
'</div><div class="inline-block" style="padding-right: 20px">';
434 print
' <= '.$level1;
435 print
'</div><div class="inline-block" style="padding-right: 20px">';
437 print
' <= '.$level2;
438 print
'</div><div class="inline-block" style="padding-right: 20px">';
440 print
' <= '.$level3;
441 print
'</div><div class="inline-block" style="padding-right: 20px">';
443 print
' > '.$level3;
451 if ($action ==
'edit') {
452 print
$form->buttonsSaveCancel(
"Save",
'');
455 print
'<br><br><div class="tabsAction">';
456 print
'<a class="butAction" href="delais.php?action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>';