From d0b657f6e7320fa3bf170396876ec960d92d7948 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Feb 2016 02:15:29 +0100 Subject: [PATCH] Fix filter on products with spcific prices on thirdrty tab "customer prices" --- htdocs/societe/price.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index dce99d532c5..f9b924c9240 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -42,6 +42,7 @@ $langs->load("companies"); $langs->load("bills"); $action = GETPOST('action', 'alpha'); +$search_prod = GETPOST('search_prod'); // Security check $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); @@ -66,6 +67,11 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers + { + $search_prod = ''; + } + if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { $update_child_soc = GETPOST('updatechildprice'); @@ -212,7 +218,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { 't.fk_soc' => $object->id ); - $search_prod = GETPOST('search_prod'); if (! empty($search_prod)) { $filter ['prod.ref'] = $search_prod; } @@ -501,9 +506,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ' '; print ''; - if (count($prodcustprice->lines) > 0) + if (count($prodcustprice->lines) > 0 || $search_prod) { - print ''; print ''; print ' '; @@ -513,7 +517,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $searchpitco; print ''; print ''; - + } + + if (count($prodcustprice->lines) > 0) + { $var = False; foreach ($prodcustprice->lines as $line) @@ -540,7 +547,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $userstatic->getLoginUrl(1); print ''; - // Todo Edit or delete button // Action if ($user->rights->produit->creer || $user->rights->service->creer) { @@ -561,9 +567,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n"; } - } else + } + else { - print '' . $langs->trans('NoPriceSpecificToCustomer') . ''; + $colspan=9; + if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1; + print '' . $langs->trans('None') . ''; } print "";