2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2023-09-16 13:20:04 +02:00
parent 44068850ae
commit bb0c53996f
2 changed files with 10 additions and 12 deletions

View File

@@ -285,7 +285,7 @@ class Proposals extends DolibarrApi
* Get lines of a commercial proposal
*
* @param int $id Id of commercial proposal
* @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') and (d.date_start:<:'20220101')"
* @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') AND (d.date_start:<:'20220101')"
*
* @url GET {id}/lines
*
@@ -293,8 +293,6 @@ class Proposals extends DolibarrApi
*/
public function getLines($id, $sqlfilters = '')
{
$filters = "";
if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) {
throw new RestException(401);
}
@@ -308,6 +306,7 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$sql = '';
if (!empty($sqlfilters)) {
$errormessage = '';
$sql = forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);

View File

@@ -1866,11 +1866,10 @@ class Propal extends CommonObject
*
* @param int $only_product Return only physical products
* @param int $loadalsotranslation Return translation for products
* @param string $sqlfilters Filter on other fields
*
* @param string $sqlforgedfilters Filter on other fields
* @return int <0 if KO, >0 if OK
*/
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $sqlfilters = '')
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $sqlforgedfilters = '')
{
// phpcs:enable
$this->lines = array();
@@ -1888,8 +1887,8 @@ class Propal extends CommonObject
if ($only_product) {
$sql .= ' AND p.fk_product_type = 0';
}
if ($sqlfilters) {
$sql .= $sqlfilters;
if ($sqlforgedfilters) {
$sql .= $sqlforgedfilters;
}
$sql .= ' ORDER by d.rang';
@@ -3944,12 +3943,12 @@ class Propal extends CommonObject
/**
* Retrieve an array of proposal lines
*
* @param string $sqlfilters Filter on other fields
* @return int >0 if OK, <0 if KO
* @param string $sqlforgedfilters Filter on other fields
* @return int >0 if OK, <0 if KO
*/
public function getLinesArray($sqlfilters = '')
public function getLinesArray($sqlforgedfilters = '')
{
return $this->fetch_lines(0, 0, $sqlfilters);
return $this->fetch_lines(0, 0, $sqlforgedfilters);
}
/**