30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40$action =
GETPOST(
'action',
'aZ09');
49 'code' =>
'MAIN_DELAY_ACTIONS_TODO',
55 'code' =>
'MAIN_DELAY_PROJECT_TO_CLOSE',
59 'code' =>
'MAIN_DELAY_TASKS_TODO',
60 'img' =>
'projecttask'
65 'code' =>
'MAIN_DELAY_PROPALS_TO_CLOSE',
69 'code' =>
'MAIN_DELAY_PROPALS_TO_BILL',
75 'code' =>
'MAIN_DELAY_ORDERS_TO_PROCESS',
81 'code' =>
'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
85 'fournisseur' => array(
87 'code' =>
'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
91 'code' =>
'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
97 'code' =>
'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
101 'code' =>
'MAIN_DELAY_RUNNING_SERVICES',
107 'code' =>
'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
111 'code' =>
'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
117 'code' =>
'MAIN_DELAY_MEMBERS',
121 'expensereport' => array(
123 'code' =>
'MAIN_DELAY_EXPENSEREPORTS',
134 'code' =>
'MAIN_DELAY_HOLIDAYS',
140$labelmeteo = array(0 => $langs->trans(
"No"), 1 => $langs->trans(
"Yes"), 2 => $langs->trans(
"OnMobileOnly"));
142if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
143 $conf->global->MAIN_DELAY_MEMBERS = 0;
145if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
146 $conf->global->MAIN_DELAY_ACTIONS_TODO = 7;
148if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
149 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
151if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
152 $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
154if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
155 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
157if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
158 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
160if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
161 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
170if ($action ==
'update') {
171 foreach ($modules as $module => $delays) {
172 if (isModEnabled($module)) {
173 foreach ($delays as $delay) {
174 if (
GETPOST($delay[
'code']) !=
'') {
182 dolibarr_set_const($db,
"MAIN_USE_METEO_WITH_PERCENTAGE",
GETPOST(
"MAIN_USE_METEO_WITH_PERCENTAGE"),
'chaine', 0,
'', $conf->entity);
187 $plus =
'_PERCENTAGE';
190 for ($i = 0; $i < 4; $i++) {
191 if (GETPOSTISSET(
'MAIN_METEO'.$plus.
'_LEVEL'.$i)) {
206$form =
new Form($db);
208llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-delais');
210print
load_fiche_titre($langs->trans(
"DelaysOfToleranceBeforeWarning"),
'',
'title_setup');
212print
'<span class="opacitymedium">'.$langs->transnoentities(
"DelaysOfToleranceDesc",
img_warning(
'default',
'',
'pictowarning nopaddingleft'));
213print
" ".$langs->trans(
"OnlyActiveElementsAreShown", DOL_URL_ROOT.
'/admin/modules.php').
"</span><br>\n";
217if ($action ==
'edit') {
218 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" name="form_index">';
219 print
'<input type="hidden" name="token" value="'.newToken().
'">';
220 print
'<input type="hidden" name="action" value="update">';
222 print
'<table class="noborder centpercent">';
223 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td>';
224 print
'<td class="right">'.$langs->trans(
"LateWarningAfter").
'</td></tr>';
226 foreach ($modules as $module => $delays) {
227 if (isModEnabled($module)) {
228 foreach ($delays as $delay) {
230 print
'<tr class="oddeven">';
231 print
'<td width="20px">' .
img_object(
'', $delay[
'img']) .
'</td>';
232 print
'<td>' . $langs->trans(
'Delays_' . $delay[
'code']) .
'</td><td class="nowraponall right">';
233 print
'<input class="right maxwidth75" type="number" name="' . $delay[
'code'] .
'" value="' . $value .
'"> ' . $langs->trans(
"days") .
'</td></tr>';
243 print
'<table class="noborder centpercent">';
244 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
246 print
'<tr class="oddeven">';
247 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="right">';
248 print $form->selectarray(
'MAIN_DISABLE_METEO', $labelmeteo, (!
getDolGlobalString(
'MAIN_DISABLE_METEO') ? 0 : $conf->global->MAIN_DISABLE_METEO));
257 print
'<table class="noborder centpercent">';
258 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"DelaysOfToleranceBeforeWarning").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
260 foreach ($modules as $module => $delays) {
261 if (isModEnabled($module)) {
262 foreach ($delays as $delay) {
264 print
'<tr class="oddeven">';
265 print
'<td width="20px">' .
img_object(
'', $delay[
'img']) .
'</td>';
266 print
'<td>' . $langs->trans(
'Delays_' . $delay[
'code']) .
'</td>';
267 print
'<td class="right">' . $value .
' ' . $langs->trans(
"days") .
'</td></tr>';
277 print
'<table class="noborder centpercent">';
278 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Option").
'</td><td class="right">'.$langs->trans(
"Value").
'</td></tr>';
280 print
'<tr class="oddeven">';
281 print
'<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="center">';
292$str_mode_percentage =
null;
296 print
'<span class="opacitymedium">'.$langs->trans(
"DescWeather").
'</span> ';
298 if ($action ==
'edit') {
299 $str_mode_std = $langs->trans(
'MeteoStdModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoPercentageMod'));
300 $str_mode_percentage = $langs->trans(
'MeteoPercentageModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoStdMod'));
302 $str_mode_enabled = $str_mode_std;
304 $str_mode_enabled = $str_mode_percentage;
306 print
'<br><a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.
'</a>';
307 print
'<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.(getDolGlobalString(
'MAIN_USE_METEO_WITH_PERCENTAGE') ? $conf->global->MAIN_USE_METEO_WITH_PERCENTAGE :
'').
'" />';
312 print $langs->trans(
'MeteoStdModEnabled');
314 print $langs->trans(
'MeteoPercentageModEnabled');
327 $level1 = $offset + $cursor;
331 $level2 = $offset + 2 * $cursor;
335 $level3 = $offset + 3 * $cursor;
340 $options =
'class="valignmiddle" height="60px"';
343 if ($action ==
'edit') {
344 print
'<div id="standard" '.(!
getDolGlobalString(
'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" '.(!
getDolGlobalString(
'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>';
384 <script
type=
"text/javascript">
386 $(document).ready(
function() {
388 $(
"#change_mode").click(
function() {
389 var use_percent = $(
"#MAIN_USE_METEO_WITH_PERCENTAGE");
390 var str_mode_std =
"<?php print $str_mode_std; ?>";
391 var str_mode_percentage =
"<?php print $str_mode_percentage; ?>";
393 if(use_percent.val() == 1) {
395 $(
"#standard").show();
396 $(
"#percentage").hide();
397 $(
this).html(str_mode_std);
400 $(
"#standard").hide();
401 $(
"#percentage").show();
402 $(
this).html(str_mode_percentage);
414 print
'<div class="inline-block" style="padding-right: 20px">';
417 print
'</div><div class="inline-block" style="padding-right: 20px">';
420 print
'</div><div class="inline-block" style="padding-right: 20px">';
423 print
'</div><div class="inline-block" style="padding-right: 20px">';
426 print
'</div><div class="inline-block" style="padding-right: 20px">';
433 print
'<div class="inline-block" style="padding-right: 20px">';
435 print
' <= '.$level0;
436 print
'</div><div class="inline-block" style="padding-right: 20px">';
438 print
' <= '.$level1;
439 print
'</div><div class="inline-block" style="padding-right: 20px">';
441 print
' <= '.$level2;
442 print
'</div><div class="inline-block" style="padding-right: 20px">';
444 print
' <= '.$level3;
445 print
'</div><div class="inline-block" style="padding-right: 20px">';
447 print
' > '.$level3;
455if ($action ==
'edit') {
456 print $form->buttonsSaveCancel(
"Save",
'');
459 print
'<br><br><div class="tabsAction">';
460 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
img_weather($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $morecss='')
Show weather picto.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.