From 4f7b698e9239fdde0a66be582188a8ddf3d7b651 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Nov 2019 19:42:54 +0100 Subject: [PATCH] Fix filter on sell/purchase status --- htdocs/accountancy/admin/productaccount.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 1af0e5e6209..6fedd7706d0 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -60,6 +60,8 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_current_account = GETPOST('search_current_account', 'alpha'); $search_current_account_valid = GETPOST('search_current_account_valid', 'alpha'); if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount'; +$search_onsell = GETPOST('search_onsell', 'alpha'); +$search_onpurchase = GETPOST('search_onpurchase', 'alpha'); $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha'); $btn_changeaccount = GETPOST('changeaccount', 'alpha'); @@ -100,6 +102,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_ref = ''; $search_label = ''; $search_desc = ''; + $search_onsell = ''; + $search_onpurchase = ''; $search_current_account = ''; $search_current_account_valid = '-1'; } @@ -282,6 +286,9 @@ if (strlen(trim($search_label))) { if (strlen(trim($search_desc))) { $sql .= natural_search("p.description", $search_desc); } +if ($search_onsell != '' && $search_onsell != '-1') $sql.= natural_search('p.tosell', $search_onsell, 1); +if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql.= natural_search('p.tobuy', $search_onpurchase, 1); + $sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; @@ -375,9 +382,13 @@ if ($result) print ''; if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; // On sell - if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') print ''; + if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { + print ''.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).''; + } // On buy - if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print ''; + elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + print ''.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).''; + } // Current account print ''; print ''; @@ -395,6 +406,7 @@ if ($result) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); + // On sell / On purchase if ($accounting_product_mode == 'ACCOUNTANCY_SELL') { print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center '); $fieldtosortaccount="p.accountancy_code_sell";