Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Sep 1, 2024
2 parents c8505f9 + a1a77e6 commit 5b99b70
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
16 changes: 9 additions & 7 deletions htdocs/contrat/class/contrat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2312,20 +2312,21 @@ public function load_board($user, $mode)
$now = dol_now();

if ($mode == 'inactive') {
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
$warning_delay = $conf->contract->services->inactifs->warning_delay;
$label = $langs->trans("BoardNotActivatedServices");
$labelShort = $langs->trans("BoardNotActivatedServicesShort");
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=0&sortfield=cd.date_fin_validite&sortorder=asc';
} elseif ($mode == 'expired') {
$warning_delay = $conf->contrat->services->expires->warning_delay;
$url_late = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=0&search_option=late';
} elseif ($mode == 'active') {
$warning_delay = $conf->contract->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
$url_late = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4&search_option=late';
$label = $langs->trans("BoardExpiredServices");
$labelShort = $langs->trans("BoardExpiredServicesShort");
} else {
$warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4&sortfield=cd.date_fin_validite&sortorder=asc';
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
//if ($warning_delay >= 0) $url.='&filter=expired';
$warning_delay = $conf->contract->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&sortfield=cd.date_fin_validite&sortorder=asc';
$url_late = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_option=late';
$label = $langs->trans("BoardRunningServices");
$labelShort = $langs->trans("BoardRunningServicesShort");
}
Expand All @@ -2335,6 +2336,7 @@ public function load_board($user, $mode)
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = $url;
$response->url_late = $url_late;
$response->img = img_object('', "contract");

while ($obj = $this->db->fetch_object($resql)) {
Expand Down
17 changes: 17 additions & 0 deletions htdocs/contrat/services_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
$search_contract = GETPOST("search_contract", 'alpha');
$search_service = GETPOST("search_service", 'alpha');
$search_status = GETPOST("search_status", 'alpha');
$search_option = GETPOST('search_option', 'alpha');
$search_product_category = GETPOSTINT('search_product_category');

// To support selection into combo list of status with detailed status '4&filter'
Expand Down Expand Up @@ -194,6 +195,7 @@
$search_contract = "";
$search_service = "";
$search_status = "";
$search_option = '';
$opouvertureprevuemonth = "";
$opouvertureprevueday = "";
$opouvertureprevueyear = "";
Expand Down Expand Up @@ -307,6 +309,14 @@
if ($search_status == "5") {
$sql .= " AND cd.statut = 5";
}
if ($search_option == 'late' && $search_status != '0') {
$warning_date = $db->idate(dol_now() - $conf->contract->services->expires->warning_delay);
$sql .= " AND cd.date_fin_validite < '".addslashes($warning_date)."'";
}
if ($search_option == 'late' && $search_status == '0') {
$warning_date = $db->idate(dol_now() - $conf->contract->services->expires->warning_delay);
$sql .= " AND (cd.date_ouverture_prevue < '".addslashes($warning_date)."' OR cd.date_fin_validite < '".addslashes($warning_date)."')";
}
if ($search_subprice) {
$sql .= natural_search("cd.subprice", $search_subprice, 1);
}
Expand Down Expand Up @@ -477,6 +487,9 @@
if ($search_status) {
$param .= '&amp;search_status='.urlencode($search_status);
}
if ($search_option) {
$param .= "&amp;search_option=".urlencode($search_option);
}
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
$param .= '&amp;filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
}
Expand Down Expand Up @@ -552,6 +565,10 @@
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= '</div>';
}
// alert on late date
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Alert').' <input type="checkbox" name="search_option" value="late"'.($search_option == 'late' ? ' checked' : '').'>';
$moreforfilter .= '</div>';

$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
Expand Down

0 comments on commit 5b99b70

Please sign in to comment.