Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e7ce888cef
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2020 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -537,7 +537,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
@ -556,6 +556,9 @@ if ($search_user > 0)
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid';
|
||||
$sql .= ' AND cf.entity IN ('.getEntity('supplier_order').')';
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
@ -595,7 +598,7 @@ if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_r
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -675,6 +678,10 @@ if ($resql)
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||
|
||||
@ -252,7 +252,6 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.datec,";
|
||||
$sql .= " t.tms,";
|
||||
@ -330,7 +329,6 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.datec,";
|
||||
$sql .= " t.tms,";
|
||||
@ -363,15 +361,16 @@ class Productcustomerprice extends CommonObject
|
||||
// Manage filter
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if (strpos($key, 'date')) // To allow $filter['YEAR(s.dated)']=>$year
|
||||
{
|
||||
$sql .= ' AND '.$key.' = \''.$value.'\'';
|
||||
if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year
|
||||
$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.' = '.((int) $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,9 @@ $langs->loadLangs(array("products", "companies", "bills"));
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$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
|
||||
|
||||
@ -517,7 +532,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";
|
||||
|
||||
@ -530,7 +545,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>';
|
||||
@ -546,7 +562,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);
|
||||
@ -565,6 +585,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>";
|
||||
|
||||
@ -40,8 +40,6 @@ if ($user->socid > 0) $socid = $user->socid;
|
||||
$feature2 = 'user';
|
||||
$result = restrictedArea($user, 'user', $id, 'user', $feature2);
|
||||
|
||||
if ($user->id <> $id && !$canreaduser) accessforbidden();
|
||||
|
||||
|
||||
$result = $user2->fetch($id);
|
||||
if ($result <= 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user