FIX-Develop correct getwarningdelay (#34497)

* replace $conf->module->XXX->gwarning_delay by new function getwarningdelay

* replace $conf->module->XXX->gwarning_delay by new function getwarningdelay

* replace $conf->module->XXX->gwarning_delay by new function getwarningdelay

* FIX- Correct function GetwarningDelay

---------

Co-authored-by: Theobald <f.moreau@theobald-groupe.com>
This commit is contained in:
moreauftheobald
2025-07-20 19:54:06 +02:00
committed by GitHub
parent 348b562e95
commit 6c86ad3eae
11 changed files with 15 additions and 15 deletions

View File

@@ -2638,12 +2638,12 @@ class Adherent extends CommonObject
$labelShort = ''; $labelShort = '';
if ($mode == 'expired') { 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"); $label = $langs->trans("MembersWithSubscriptionToReceive");
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut='.self::STATUS_VALIDATED.'&amp;filter=outofdate'; $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut='.self::STATUS_VALIDATED.'&amp;filter=outofdate';
} elseif ($mode == 'shift') { } 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&amp;statut='.self::STATUS_DRAFT; $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut='.self::STATUS_DRAFT;
$label = $langs->trans("MembersListToValid"); $label = $langs->trans("MembersListToValid");
$labelShort = $langs->trans("ToValidate"); $labelShort = $langs->trans("ToValidate");
@@ -3075,7 +3075,7 @@ class Adherent extends CommonObject
$now = dol_now(); $now = dol_now();
return $this->datefin < ($now - $conf->adherent->subscription->warning_delay); return $this->datefin < ($now - getWarningDelay('member', 'subscription'));
} }

View File

@@ -1468,7 +1468,7 @@ while ($i < $imaxinloop) {
if ($datefin) { if ($datefin) {
$s .= dol_print_date($datefin, 'day'); $s .= dol_print_date($datefin, 'day');
if ($memberstatic->hasDelay()) { 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); $s .= " ".img_warning($langs->trans("SubscriptionLate").$textlate);
} }
} else { } else {

View File

@@ -971,7 +971,7 @@ if ($object->id > 0) {
// $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
// $urlsource = '/comm/propal/card.php?id='.$objp->cid; // $urlsource = '/comm/propal/card.php?id='.$objp->cid;
// print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir); // 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 " ".img_warning();
} }
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n"; print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
@@ -1260,7 +1260,7 @@ if ($object->id > 0) {
$late = ''; $late = '';
foreach ($contrat->lines as $line) { foreach ($contrat->lines as $line) {
if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { 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")); $late = img_warning($langs->trans("Late"));
} }
} }

View File

@@ -1187,7 +1187,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$filename = dol_sanitizeFileName($obj->ref); $filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
//$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; //$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 '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@@ -3085,7 +3085,7 @@ if ($action == 'create') {
} else { } else {
if (!empty($object->fin_validite)) { if (!empty($object->fin_validite)) {
print dol_print_date($object->fin_validite, 'day'); 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")); print img_warning($langs->trans("Late"));
} }
} else { } else {

View File

@@ -3555,13 +3555,13 @@ class Propal extends CommonObject
$status = 0; $status = 0;
$label = $labelShort = ''; $label = $labelShort = '';
if ($mode == 'opened') { if ($mode == 'opened') {
$delay_warning = $conf->propal->cloture->warning_delay; $delay_warning = getWarningDelay('propal', 'cloture');
$status = self::STATUS_VALIDATED; $status = self::STATUS_VALIDATED;
$label = $langs->transnoentitiesnoconv("PropalsToClose"); $label = $langs->transnoentitiesnoconv("PropalsToClose");
$labelShort = $langs->transnoentitiesnoconv("ToAcceptRefuse"); $labelShort = $langs->transnoentitiesnoconv("ToAcceptRefuse");
} }
if ($mode == 'signed') { if ($mode == 'signed') {
$delay_warning = $conf->propal->facturation->warning_delay; $delay_warning = getWarningDelay('propal', 'facturation');
$status = self::STATUS_SIGNED; $status = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
$labelShort = $langs->trans("ToBill"); $labelShort = $langs->trans("ToBill");

View File

@@ -321,7 +321,7 @@ if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; $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 '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@@ -842,7 +842,7 @@ if (!empty($searchCategoryProductList)) {
} }
} }
if ($search_option == 'late') { 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 // Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';

View File

@@ -143,7 +143,7 @@ class box_services_contracts extends ModeleBoxes
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
$dateline = $this->db->jdate($objp->date_line); $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")); $late = img_warning($langs->trans("Late"));
} }

View File

@@ -430,7 +430,7 @@ function getWarningDelay($module, $parmlevel1, $parmlevel2 = '')
} }
} else { } else {
if (!empty($conf->$module->$warningDelayPath->warning_delay)) { if (!empty($conf->$module->$warningDelayPath->warning_delay)) {
return (int) $conf->$module->$warningDelayPath->$parmlevel1->warning_delay; return (int) $conf->$module->$warningDelayPath->warning_delay;
} }
} }

View File

@@ -348,7 +348,7 @@ foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -2) { if ($key == 'status' && $search[$key] == -2) {
$sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))"; $sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))";
if ($search_option == 'late') { 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; continue;
} }