Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX late order search option (v18+) #30692

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (C) 2016-2022 Ferran Marcet <[email protected]>
* Copyright (C) 2021-2023 Frédéric France <[email protected]>
* Copyright (C) 2022 Gauthier VERDOL <[email protected]>
* Copyright (C) 2024 William Mead <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -3614,6 +3615,7 @@ public function load_board($user)
$response->label = $langs->trans("OrdersToProcess");
$response->labelShort = $langs->trans("Opened");
$response->url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&mainmenu=commercial&leftmenu=orders';
$response->url_late = DOL_URL_ROOT.'/commande/list.php?search_option=late&mainmenu=commercial&leftmenu=orders';
$response->img = img_object('', "order");

$generic_commande = new Commande($this->db);
Expand Down
17 changes: 16 additions & 1 deletion htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Copyright (C) 2016-2023 Ferran Marcet <[email protected]>
* Copyright (C) 2018 Charlene Benke <[email protected]>
* Copyright (C) 2021 Anthony Berton <[email protected]>
* Copyright (C) 2024 William Mead <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -118,6 +119,10 @@
$search_fk_shipping_method = GETPOST('search_fk_shipping_method', 'int');
$search_fk_mode_reglement = GETPOST('search_fk_mode_reglement', 'int');
$search_fk_input_reason = GETPOST('search_fk_input_reason', 'int');
$search_option = GETPOST('search_option', 'alpha');
if ($search_option == 'late') {
$search_status = '-2';
}

$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;

Expand Down Expand Up @@ -293,6 +298,7 @@
$search_fk_shipping_method = '';
$search_fk_mode_reglement = '';
$search_fk_input_reason = '';
$search_option = '';
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
Expand Down Expand Up @@ -601,6 +607,9 @@
if ($search_status != '') {
$param .= '&search_status='.urlencode($search_status);
}
if ($search_option) {
$param .= "&search_option=".urlencode($search_option);
}
if ($search_orderday) {
$param .= '&search_orderday='.urlencode($search_orderday);
}
Expand Down Expand Up @@ -915,7 +924,9 @@
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
}

if ($search_option == 'late') {
$sql .= " AND c.date_commande < '".$db->idate(dol_now() - $conf->commande->client->warning_delay)."'";
}
if ($search_datecloture_start) {
$sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'";
}
Expand Down Expand Up @@ -1169,6 +1180,9 @@
if ($search_status != '') {
$param .= '&search_status='.urlencode($search_status);
}
if ($search_option) {
$param .= "&search_option=".urlencode($search_option);
}
if ($search_datecloture_start) {
$param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y');
}
Expand Down Expand Up @@ -1466,6 +1480,7 @@
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= '</div>';
}

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