mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
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:
@@ -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'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 '</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 = '';
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 '<tr class="oddeven">';
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 '<tr class="oddeven">';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user