ADD : Filters more filters on customer price tab
This commit is contained in:
parent
29414251f5
commit
8c017ad422
@ -365,13 +365,15 @@ class Productcustomerprice extends CommonObject
|
||||
foreach ($filter as $key => $value) {
|
||||
if (strpos($key, 'date')) // To allow $filter['YEAR(s.dated)']=>$year
|
||||
{
|
||||
$sql .= ' AND '.$key.' = \''.$value.'\'';
|
||||
$sql .= ' AND '.$key.' = \''.$this->db->escape($value).'\'';
|
||||
} elseif ($key == 'soc.nom') {
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
} elseif ($key == 'prod.ref') {
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 'prod.ref' || $key == 'prod.label') {
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 't.price' || $key == 't.price_ttc') {
|
||||
$sql .= ' AND ' . $key . ' LIKE \'%' . price2num($value) . '%\'';
|
||||
} else {
|
||||
$sql .= ' AND '.$key.' = '.$value;
|
||||
$sql .= ' AND '.$key.' = '.$this->db->escape($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,9 @@ $langs->loadLangs(array("products", "companies", "bills"));
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$search_prod = GETPOST('search_prod', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_price = GETPOST('search_price');
|
||||
$search_price_ttc = GETPOST('search_price_ttc');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
|
||||
@ -70,7 +73,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_prod = '';
|
||||
$search_prod = $search_label = $search_price = $search_price_ttc = '';
|
||||
}
|
||||
|
||||
if ($action == 'add_customer_price_confirm' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||
@ -259,6 +262,18 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
$filter ['prod.ref'] = $search_prod;
|
||||
}
|
||||
|
||||
if (! empty($search_label)) {
|
||||
$filter ['prod.label'] = $search_label;
|
||||
}
|
||||
|
||||
if (! empty($search_price)) {
|
||||
$filter ['t.price'] = $search_price;
|
||||
}
|
||||
|
||||
if (! empty($search_price_ttc)) {
|
||||
$filter ['t.price_ttc'] = $search_price_ttc;
|
||||
}
|
||||
|
||||
if ($action == 'add_customer_price') {
|
||||
// Create mode
|
||||
|
||||
@ -521,7 +536,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||
}
|
||||
|
||||
$option = '&search_prod='.$search_prod.'&id='.$object->id;
|
||||
$option = '&search_prod=' . $search_prod . '&id=' . $object->id . '&label=' . $search_label .'&price=' . $search_price . '&price_ttc=' . $search_price_ttc;
|
||||
|
||||
print '<!-- view specific price for each product -->'."\n";
|
||||
|
||||
@ -534,7 +549,8 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Product").'</td>';
|
||||
print '<td>' . $langs->trans("Ref") . '</td>';
|
||||
print '<td>' . $langs->trans("product") . '</td>';
|
||||
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
|
||||
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
|
||||
print '<td class="right">'.$langs->trans("VAT").'</td>';
|
||||
@ -550,7 +566,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_prod" value="'.$search_prod.'" size="20"></td>';
|
||||
print '<td class="liste_titre" colspan="8"> </td>';
|
||||
print '<td class="liste_titre" ><input type="text" class="flat" name="search_label" value="' . $search_label . '" size="20"></td>';
|
||||
print '<td class="liste_titre" colspan="3"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_price" value="' . $search_price . '" size="10"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_price_ttc" value="' . $search_price_ttc . '" size="10"></td>';
|
||||
print '<td class="liste_titre" colspan="3"> </td>';
|
||||
// Print the search button
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
@ -569,6 +589,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
$staticprod->fetch($line->fk_product);
|
||||
|
||||
print "<td>".$staticprod->getNomUrl(1)."</td>";
|
||||
print "<td>" . $staticprod->label ."</td>";
|
||||
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
|
||||
|
||||
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user