29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33 $langs->load(
"admin");
39 $action =
GETPOST(
'action',
'aZ09');
48 'code' =>
'MAIN_DELAY_ACTIONS_TODO',
54 'code' =>
'MAIN_DELAY_PROJECT_TO_CLOSE',
58 'code' =>
'MAIN_DELAY_TASKS_TODO',
59 'img' =>
'projecttask'
64 'code' =>
'MAIN_DELAY_PROPALS_TO_CLOSE',
68 'code' =>
'MAIN_DELAY_PROPALS_TO_BILL',
74 'code' =>
'MAIN_DELAY_ORDERS_TO_PROCESS',
80 'code' =>
'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
84 'fournisseur' => array(
86 'code' =>
'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
90 'code' =>
'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
96 'code' =>
'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
100 'code' =>
'MAIN_DELAY_RUNNING_SERVICES',
106 'code' =>
'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
110 'code' =>
'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
116 'code' =>
'MAIN_DELAY_MEMBERS',
120 'expensereport' => array(
122 'code' =>
'MAIN_DELAY_EXPENSEREPORTS',
133 'code' =>
'MAIN_DELAY_HOLIDAYS',
139 $labelmeteo = array(0=>$langs->trans(
"No"), 1=>$langs->trans(
"Yes"), 2=>$langs->trans(
"OnMobileOnly"));
141 if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
142 $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7;
144 if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
145 $conf->global->MAIN_DELAY_TASKS_TODO = 7;
147 if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
148 $conf->global->MAIN_DELAY_MEMBERS = 0;
150 if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
151 $conf->global->MAIN_DELAY_ACTIONS_TODO = 7;
153 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
154 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
156 if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
157 $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
159 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
160 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
162 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
163 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
165 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
166 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
175 if ($action ==
'update') {
176 foreach ($modules as $module => $delays) {
178 foreach ($delays as $delay) {
179 if (
GETPOST($delay[
'code']) !=
'') {
187 dolibarr_set_const($db,
"MAIN_USE_METEO_WITH_PERCENTAGE",
GETPOST(
"MAIN_USE_METEO_WITH_PERCENTAGE"),
'chaine', 0,
'', $conf->entity);
191 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
192 $plus =
'_PERCENTAGE';
195 for ($i = 0; $i < 4; $i++) {
197 dolibarr_set_const($db,
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
GETPOST(
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
'int'),
'chaine', 0,
'', $conf->entity);
215 print
load_fiche_titre($langs->trans(
"DelaysOfToleranceBeforeWarning"),
'',
'title_setup');
217 print
'<span class="opacitymedium">'.$langs->transnoentities(
"DelaysOfToleranceDesc",
img_warning(
'default',
'',
'pictowarning nopaddingleft'));
218 print
" ".$langs->trans(
"OnlyActiveElementsAreShown", DOL_URL_ROOT.
'/admin/modules.php').
"</span><br>\n";
221 if ($action ==
'edit') {
222 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" name="form_index">';
223 print
'<input type="hidden" name="token" value="'.newToken().
'">';
224 print
'<input type="hidden" name="action" value="update">';
226 print
'<table class="noborder centpercent">';
227 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td>';
228 print
'<td class="right">'.$langs->trans(
"LateWarningAfter").
'</td></tr>';
230 foreach ($modules as $module => $delays) {
232 foreach ($delays as $delay) {
233 $value = (!empty($conf->global->{$delay[
'code']}) ? $conf->global->{$delay[
'code']} : 0);
234 print
'<tr class="oddeven">';
235 print
'<td width="20px">' .
img_object(
'', $delay[
'img']) .
'</td>';
236 print
'<td>' . $langs->trans(
'Delays_' . $delay[
'code']) .
'</td><td class="nowraponall right">';
237 print
'<input class="right maxwidth75" type="number" name="' . $delay[
'code'] .
'" value="' . $value .
'"> ' . $langs->trans(
"days") .
'</td></tr>';
247 print
'<table class="noborder centpercent">';
248 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
250 print
'<tr class="oddeven">';
251 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="right">';
252 print
$form->selectarray(
'MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
261 print
'<table class="noborder centpercent">';
262 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
264 foreach ($modules as $module => $delays) {
266 foreach ($delays as $delay) {
267 $value = (!empty($conf->global->{$delay[
'code']}) ? $conf->global->{$delay[
'code']} : 0);
268 print
'<tr class="oddeven">';
269 print
'<td width="20px">' .
img_object(
'', $delay[
'img']) .
'</td>';
270 print
'<td>' . $langs->trans(
'Delays_' . $delay[
'code']) .
'</td>';
271 print
'<td class="right">' . $value .
' ' . $langs->trans(
"days") .
'</td></tr>';
281 print
'<table class="noborder centpercent">';
282 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
284 print
'<tr class="oddeven">';
285 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="center">';
286 print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
295 if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) {
297 print
'<span class="opacitymedium">'.$langs->trans(
"DescWeather").
'</span> ';
299 if ($action ==
'edit') {
300 $str_mode_std = $langs->trans(
'MeteoStdModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoPercentageMod'));
301 $str_mode_percentage = $langs->trans(
'MeteoPercentageModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoStdMod'));
302 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
303 $str_mode_enabled = $str_mode_std;
305 $str_mode_enabled = $str_mode_percentage;
307 print
'<br><a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.
'</a>';
308 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 :
'').
'" />';
312 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
313 print $langs->trans(
'MeteoStdModEnabled');
315 print $langs->trans(
'MeteoPercentageModEnabled');
325 if (!empty($conf->global->MAIN_METEO_LEVEL0)) {
326 $level0 = $conf->global->MAIN_METEO_LEVEL0;
328 $level1 = $offset + $cursor;
329 if (!empty($conf->global->MAIN_METEO_LEVEL1)) {
330 $level1 = $conf->global->MAIN_METEO_LEVEL1;
332 $level2 = $offset + 2 * $cursor;
333 if (!empty($conf->global->MAIN_METEO_LEVEL2)) {
334 $level2 = $conf->global->MAIN_METEO_LEVEL2;
336 $level3 = $offset + 3 * $cursor;
337 if (!empty($conf->global->MAIN_METEO_LEVEL3)) {
338 $level3 = $conf->global->MAIN_METEO_LEVEL3;
340 $text =
''; $options =
'class="valignmiddle" height="60px"';
343 if ($action ==
'edit') {
344 print
'<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'' :
'style="display:none;"').
'>';
347 print
'<div class="inline-block" style="padding-right: 20px">';
349 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.
'"/></td>';
350 print
'</div><div class="inline-block" style="padding-right: 20px">';
352 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.
'"/></td>';
353 print
'</div><div class="inline-block" style="padding-right: 20px">';
355 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.
'"/></td>';
356 print
'</div><div class="inline-block" style="padding-right: 20px">';
358 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.
'"/></td>';
364 print
'<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'style="display:none;"' :
'').
'>';
367 print
'<div class="inline-block" style="padding-right: 20px">';
369 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL0').
'"/> %</td>';
370 print
'</div><div class="inline-block" style="padding-right: 20px">';
372 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL1').
'"/> %</td>';
373 print
'</div><div class="inline-block" style="padding-right: 20px">';
375 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL2').
'"/> %</td>';
376 print
'</div><div class="inline-block" style="padding-right: 20px">';
378 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.getDolGlobalString(
'MAIN_METEO_PERCENTAGE_LEVEL3').
'"/> %</td>';
386 <script
type=
"text/javascript">
388 $(document).ready(
function() {
390 $(
"#change_mode").click(
function() {
391 var use_percent = $(
"#MAIN_USE_METEO_WITH_PERCENTAGE");
392 var str_mode_std =
"<?php print $str_mode_std; ?>";
393 var str_mode_percentage =
"<?php print $str_mode_percentage; ?>";
395 if(use_percent.val() == 1) {
397 $(
"#standard").show();
398 $(
"#percentage").hide();
399 $(
this).html(str_mode_std);
402 $(
"#standard").hide();
403 $(
"#percentage").show();
404 $(
this).html(str_mode_percentage);
414 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
416 print
'<div class="inline-block" style="padding-right: 20px">';
418 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.
' %</td>';
419 print
'</div><div class="inline-block" style="padding-right: 20px">';
421 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.
' %</td>';
422 print
'</div><div class="inline-block" style="padding-right: 20px">';
424 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.
' %</td>';
425 print
'</div><div class="inline-block" style="padding-right: 20px">';
427 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
428 print
'</div><div class="inline-block" style="padding-right: 20px">';
430 print
' > '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
435 print
'<div class="inline-block" style="padding-right: 20px">';
437 print
' <= '.$level0;
438 print
'</div><div class="inline-block" style="padding-right: 20px">';
440 print
' <= '.$level1;
441 print
'</div><div class="inline-block" style="padding-right: 20px">';
443 print
' <= '.$level2;
444 print
'</div><div class="inline-block" style="padding-right: 20px">';
446 print
' <= '.$level3;
447 print
'</div><div class="inline-block" style="padding-right: 20px">';
449 print
' > '.$level3;
457 if ($action ==
'edit') {
458 print
$form->buttonsSaveCancel(
"Save",
'');
461 print
'<br><br><div class="tabsAction">';
462 print
'<a class="butAction reposition" href="delais.php?action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_weather($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $morecss='')
Show weather picto.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.