diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index d5ed7459a75..cdeb50878d8 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2638,12 +2638,12 @@ class Adherent extends CommonObject $labelShort = ''; if ($mode == 'expired') { - $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; + $warning_delay = getWarningDelay('member', 'subscription') / 60 / 60 / 24; $label = $langs->trans("MembersWithSubscriptionToReceive"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate'; } elseif ($mode == 'shift') { - $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; + $warning_delay = getWarningDelay('member', 'subscription') / 60 / 60 / 24; $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT; $label = $langs->trans("MembersListToValid"); $labelShort = $langs->trans("ToValidate"); @@ -3075,7 +3075,7 @@ class Adherent extends CommonObject $now = dol_now(); - return $this->datefin < ($now - $conf->adherent->subscription->warning_delay); + return $this->datefin < ($now - getWarningDelay('member', 'subscription')); } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 40f16558b20..faaf50fa839 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1468,7 +1468,7 @@ while ($i < $imaxinloop) { if ($datefin) { $s .= dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { - $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; + $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil(getWarningDelay('member', 'subscription') / 60 / 60 / 24) >= 0 ? '+' : '').ceil(getWarningDelay('member', 'subscription') / 60 / 60 / 24).' '.$langs->trans("days").')'; $s .= " ".img_warning($langs->trans("SubscriptionLate").$textlate); } } else { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index bb7116eea09..3c781e95a0b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -971,7 +971,7 @@ if ($object->id > 0) { // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $urlsource = '/comm/propal/card.php?id='.$objp->cid; // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); - if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { + if (($db->jdate($objp->date_limit) < ($now - getWarningDelay('propal', 'cloture'))) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; @@ -1260,7 +1260,7 @@ if ($object->id > 0) { $late = ''; foreach ($contrat->lines as $line) { if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { - if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contract->services->expires->warning_delay) < $now) { + if (((!empty($line->date_end) ? $line->date_end : 0) + getWarningDelay('contract', 'service', 'expires')) < $now) { $late = img_warning($langs->trans("Late")); } } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 96511408887..98006b012ab 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -1187,7 +1187,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); //$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; - $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : ''; + $warning = ($db->jdate($obj->dfv) < ($now - getWarningDelay('propal', 'cloture'))) ? img_warning($langs->trans("Late")) : ''; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7730cc69ce1..d6245868ee1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -3085,7 +3085,7 @@ if ($action == 'create') { } else { if (!empty($object->fin_validite)) { print dol_print_date($object->fin_validite, 'day'); - if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) { + if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - getWarningDelay('propal', 'cloture'))) { print img_warning($langs->trans("Late")); } } else { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4d69cbf17ae..f9d0804a406 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3555,13 +3555,13 @@ class Propal extends CommonObject $status = 0; $label = $labelShort = ''; if ($mode == 'opened') { - $delay_warning = $conf->propal->cloture->warning_delay; + $delay_warning = getWarningDelay('propal', 'cloture'); $status = self::STATUS_VALIDATED; $label = $langs->transnoentitiesnoconv("PropalsToClose"); $labelShort = $langs->transnoentitiesnoconv("ToAcceptRefuse"); } if ($mode == 'signed') { - $delay_warning = $conf->propal->facturation->warning_delay; + $delay_warning = getWarningDelay('propal', 'facturation'); $status = self::STATUS_SIGNED; $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered $labelShort = $langs->trans("ToBill"); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 513b4d697a7..d2d63a32ba0 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -321,7 +321,7 @@ if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; - $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : ''; + $warning = ($db->jdate($obj->dfv) < ($now - getWarningDelay('propal', 'cloture'))) ? img_warning($langs->trans("Late")) : ''; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b52e64f0637..189cb456b72 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -842,7 +842,7 @@ if (!empty($searchCategoryProductList)) { } } if ($search_option == 'late') { - $sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'"; + $sql .= " AND p.fin_validite < '".$db->idate(dol_now() - getWarningDelay('propal', 'cloture'))."'"; } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 5d255f2887f..9993432ccb6 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -143,7 +143,7 @@ class box_services_contracts extends ModeleBoxes $thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur; $dateline = $this->db->jdate($objp->date_line); - if ($contractstatic->status == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) { + if ($contractstatic->status == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + getWarningDelay('contract', 'services', 'expires')) < $now) { $late = img_warning($langs->trans("Late")); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 830c06f5f17..a44a335e923 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -430,7 +430,7 @@ function getWarningDelay($module, $parmlevel1, $parmlevel2 = '') } } else { if (!empty($conf->$module->$warningDelayPath->warning_delay)) { - return (int) $conf->$module->$warningDelayPath->$parmlevel1->warning_delay; + return (int) $conf->$module->$warningDelayPath->warning_delay; } } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index b748217388f..f99a244f425 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -348,7 +348,7 @@ foreach ($search as $key => $val) { if ($key == 'status' && $search[$key] == -2) { $sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))"; if ($search_option == 'late') { - $sql .= " AND (t.date_end_planned < '".$db->idate(dol_now() - $conf->mrp->progress->warning_delay)."')"; + $sql .= " AND (t.date_end_planned < '".$db->idate(dol_now() - getWarningDelay('mrp', 'progress'))."')"; } continue; }