FIX Returns

This commit is contained in:
atm-lena 2022-09-08 11:40:40 +02:00
parent 81ed97e9fc
commit 444ba4bf46
4 changed files with 8 additions and 6 deletions

View File

@ -66,7 +66,7 @@ $idproduct = GETPOST('idproduct', 'int');
top_httphead();
if ($action == 'getDurationUnitByProduct') {
if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) {
$product = new Product($db);
$res = $product->fetch($idproduct);

View File

@ -65,7 +65,9 @@ if (empty($outputalsopricetotalwithtax)) {
}
// add html5 elements
$domData = ' data-element="'.$line->element.'service"';
if($filtertype == 1) $domData = ' data-element="'.$line->element.'service"';
else $domData = ' data-element="'.$line->element.'"';
$domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';

View File

@ -427,9 +427,9 @@ class CUnits // extends CommonObject
{
if ($mode == 'short_label') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, ' AND unit_type = "'.$unit_type.'"');
return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, ' AND unit_type = "'.$this->db->escape($unit_type).'"');
} elseif ($mode == 'code') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, ' AND unit_type = "'. $unit_type .'"');
return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, ' AND unit_type = "'. $this->db->escape($unit_type) .'"');
}
return $code;

View File

@ -8539,11 +8539,11 @@ function dol_osencode($str)
* @param string $fieldkey Field to search the key into
* @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @param string $filters Filter on other fields
* @param string $filters Filter on other fields
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = array())
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '')
{
global $cache_codes;