27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31 $langs->load(
"admin");
35 $action =
GETPOST(
'action',
'aZ09');
36 if (empty($action)) $action =
'edit';
42 'code' =>
'MAIN_DELAY_ACTIONS_TODO',
48 'code' =>
'MAIN_DELAY_PROJECT_TO_CLOSE',
52 'code' =>
'MAIN_DELAY_TASKS_TODO',
53 'img' =>
'projecttask'
58 'code' =>
'MAIN_DELAY_PROPALS_TO_CLOSE',
62 'code' =>
'MAIN_DELAY_PROPALS_TO_BILL',
68 'code' =>
'MAIN_DELAY_ORDERS_TO_PROCESS',
74 'code' =>
'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
78 'fournisseur' => array(
80 'code' =>
'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
84 'code' =>
'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
90 'code' =>
'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
94 'code' =>
'MAIN_DELAY_RUNNING_SERVICES',
100 'code' =>
'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
104 'code' =>
'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
110 'code' =>
'MAIN_DELAY_MEMBERS',
114 'expensereport' => array(
116 'code' =>
'MAIN_DELAY_EXPENSEREPORTS',
127 'code' =>
'MAIN_DELAY_HOLIDAYS',
133 $labelmeteo = array(0=>$langs->trans(
"No"), 1=>$langs->trans(
"Yes"), 2=>$langs->trans(
"OnMobileOnly"));
135 if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
136 $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7;
138 if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
139 $conf->global->MAIN_DELAY_TASKS_TODO = 7;
141 if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
142 $conf->global->MAIN_DELAY_MEMBERS = 0;
144 if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
145 $conf->global->MAIN_DELAY_ACTIONS_TODO = 7;
147 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
148 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
150 if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
151 $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 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_ORDERS_TO_PROCESS)) {
157 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
159 if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
160 $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
169 if ($action ==
'update')
171 foreach ($modules as $module => $delays)
173 if (!empty($conf->$module->enabled))
175 foreach ($delays as $delay)
177 if (
GETPOST($delay[
'code']) !=
'')
185 dolibarr_set_const($db,
"MAIN_DISABLE_METEO", $_POST[
"MAIN_DISABLE_METEO"],
'chaine', 0,
'', $conf->entity);
186 dolibarr_set_const($db,
"MAIN_USE_METEO_WITH_PERCENTAGE",
GETPOST(
"MAIN_USE_METEO_WITH_PERCENTAGE"),
'chaine', 0,
'', $conf->entity);
190 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus =
'_PERCENTAGE';
192 for ($i = 0; $i < 4; $i++) {
193 if (
GETPOSTISSET(
'MAIN_METEO'.$plus.
'_LEVEL'.$i))
dolibarr_set_const($db,
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
GETPOST(
'MAIN_METEO'.$plus.
'_LEVEL'.$i,
'int'),
'chaine', 0,
'', $conf->entity);
206 $form =
new Form($db);
212 print '<span class="opacitymedium">'.$langs->transnoentities(
"DelaysOfToleranceDesc",
img_warning(
'default',
'',
'pictowarning nopaddingleft'));
213 print " ".$langs->trans(
"OnlyActiveElementsAreShown", DOL_URL_ROOT.
'/admin/modules.php').
"</span><br>\n";
216 if ($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><td class="center" width="120px">'.$langs->trans(
"Value").
'</td></tr>';
225 foreach ($modules as $module => $delays)
227 if (!empty($conf->$module->enabled))
229 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">';
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(
"Parameter").
'</td><td class="center" width="120px">'.$langs->trans(
"Value").
'</td></tr>';
248 print '<tr class="oddeven">';
249 print '<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="center">';
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="center" width="120px">'.$langs->trans(
"Value").
'</td></tr>';
262 foreach ($modules as $module => $delays)
264 if (!empty($conf->$module->enabled))
266 foreach ($delays as $delay)
268 $value = (!empty($conf->global->{$delay[
'code']}) ? $conf->global->{$delay[
'code']}:0);
269 print '<tr class="oddeven">';
270 print '<td width="20px">'.img_object(
'', $delay[
'img']).
'</td>';
271 print '<td>'.$langs->trans(
'Delays_'.$delay[
'code']).
'</td>';
272 print '<td class="right">'.$value.
' '.$langs->trans(
"days").
'</td></tr>';
282 print '<table class="noborder centpercent">';
283 print '<tr class="liste_titre"><td>'.$langs->trans(
"Parameter").
'</td><td class="center" width="120px">'.$langs->trans(
"Value").
'</td></tr>';
285 print '<tr class="oddeven">';
286 print '<td>'.$langs->trans(
"MAIN_DISABLE_METEO").
'</td><td class="center">';
287 print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
296 if ($conf->global->MAIN_DISABLE_METEO != 1) {
298 print '<span class="opacitymedium">'.$langs->trans(
"DescWeather").
'</span> ';
300 if ($action ==
'edit') {
301 $str_mode_std = $langs->trans(
'MeteoStdModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoPercentageMod'));
302 $str_mode_percentage = $langs->trans(
'MeteoPercentageModEnabled').
' : '.$langs->trans(
'MeteoUseMod', $langs->transnoentitiesnoconv(
'MeteoStdMod'));
303 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
304 else $str_mode_enabled = $str_mode_percentage;
305 print '<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="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.
'" />';
310 if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE))
print $langs->trans(
'MeteoStdModEnabled');
311 else print $langs->trans(
'MeteoPercentageModEnabled');
319 $level0 = $offset;
if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0;
320 $level1 = $offset + 1 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1;
321 $level2 = $offset + 2 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2;
322 $level3 = $offset + 3 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3;
323 $text =
''; $options =
'class="valignmiddle" height="60px"';
326 if ($action ==
'edit') {
327 print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'' :
'style="display:none;"').
'>';
330 print
'<div class="inline-block" style="padding-right: 20px">';
332 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.
'"/></td>';
333 print
'</div><div class="inline-block" style="padding-right: 20px">';
335 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.
'"/></td>';
336 print
'</div><div class="inline-block" style="padding-right: 20px">';
338 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.
'"/></td>';
339 print
'</div><div class="inline-block" style="padding-right: 20px">';
341 print
' <= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.
'"/></td>';
347 print
'<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ?
'style="display:none;"' :
'').
'>';
350 print
'<div class="inline-block" style="padding-right: 20px">';
352 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.
'"/> %</td>';
353 print
'</div><div class="inline-block" style="padding-right: 20px">';
355 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.
'"/> %</td>';
356 print
'</div><div class="inline-block" style="padding-right: 20px">';
358 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.
'"/> %</td>';
359 print
'</div><div class="inline-block" style="padding-right: 20px">';
361 print
' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
'"/> %</td>';
369 <script
type=
"text/javascript">
371 $(document).ready(
function() {
373 $(
"#change_mode").click(
function() {
374 var use_percent = $(
"#MAIN_USE_METEO_WITH_PERCENTAGE");
375 var str_mode_std =
"<?php print $str_mode_std; ?>";
376 var str_mode_percentage =
"<?php print $str_mode_percentage; ?>";
378 if(use_percent.val() == 1) {
380 $(
"#standard").show();
381 $(
"#percentage").hide();
382 $(
this).html(str_mode_std);
385 $(
"#standard").hide();
386 $(
"#percentage").show();
387 $(
this).html(str_mode_percentage);
397 if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
399 print
'<div class="inline-block" style="padding-right: 20px">';
401 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.
' %</td>';
402 print
'</div><div class="inline-block" style="padding-right: 20px">';
404 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.
' %</td>';
405 print
'</div><div class="inline-block" style="padding-right: 20px">';
407 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.
' %</td>';
408 print
'</div><div class="inline-block" style="padding-right: 20px">';
410 print
' <= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
411 print
'</div><div class="inline-block" style="padding-right: 20px">';
413 print
' > '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.
' %</td>';
418 print
'<div class="inline-block" style="padding-right: 20px">';
420 print
' <= '.$level0;
421 print
'</div><div class="inline-block" style="padding-right: 20px">';
423 print
' <= '.$level1;
424 print
'</div><div class="inline-block" style="padding-right: 20px">';
426 print
' <= '.$level2;
427 print
'</div><div class="inline-block" style="padding-right: 20px">';
429 print
' <= '.$level3;
430 print
'</div><div class="inline-block" style="padding-right: 20px">';
432 print
' > '.$level3;
440 if ($action ==
'edit') {
441 print
'<br><div class="center"><input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></div>';
444 print
'<br><div class="tabsAction">';
445 print
'<a class="butAction" href="delais.php?action=edit">'.$langs->trans(
"Modify").
'</a></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_weather($titlealt, $picto, $moreatt= '', $pictoisfullpath=0, $morecss= '')
Show weather picto.
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).
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type