Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
b574fe4c81
6 changed files with 25 additions and 29 deletions
|
|
@ -233,7 +233,7 @@ if (isModEnabled('product')) {
|
|||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM') && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
|
||||
if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM') == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
|
|||
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
if ($file == $conf->global->BARCODE_PRODUCT_ADDON_NUM) {
|
||||
if ($file == getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
|
|
|
|||
|
|
@ -135,12 +135,12 @@ class FormWebsite
|
|||
$lasttypecontainer = '';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if (in_array($obj->typecontainer, array('library', 'service'))) {
|
||||
/*if (!getDolGlobalString('WEBSITE_ADD_PAGE_TYPE_PHPLIB')) {
|
||||
/*if (in_array($obj->typecontainer, array('library', 'service'))) {
|
||||
if (!getDolGlobalString('WEBSITE_ADD_PAGE_TYPE_PHPLIB')) {
|
||||
$i++;
|
||||
continue;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if ($obj->typecontainer != $lasttypecontainer) {
|
||||
$out .= '<option value="0" disabled>--- ';
|
||||
$transcodecontainer = ucfirst($obj->typecontainer);
|
||||
|
|
|
|||
|
|
@ -727,13 +727,13 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Deny dynamic functions '${a}(' or '$a[b](' - So we refuse '}(' and ']('
|
||||
// Deny dynamic functions '${a}(' or '$a[b](' or '$a->b(' => So we refuse '}(' and ']('
|
||||
if (preg_match('/[}\]]\(/ims', $phpfullcodestring)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", ']('), null, 'errors');
|
||||
}
|
||||
// Deny dynamic functions $xxx(
|
||||
if (preg_match('/\$[a-z0-9_]+\(/ims', $phpfullcodestring)) {
|
||||
// Deny dynamic functions '$xxx(' or '$a->b('
|
||||
if (preg_match('/\$[a-z0-9_\-\>\/\*]+\(/ims', $phpfullcodestring)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ class Product extends CommonObject
|
|||
public $accountancy_code_buy_export;
|
||||
|
||||
/**
|
||||
* @var string|int Main Barcode value, -1 for auto code
|
||||
* @var string|int Main Barcode value, -1 or 'auto' for auto code
|
||||
*/
|
||||
public $barcode;
|
||||
|
||||
|
|
@ -687,11 +687,11 @@ class Product extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Insert product into database
|
||||
* Insert product into database
|
||||
*
|
||||
* @param User $user User making insert
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int Id of product/service if OK, < 0 if KO
|
||||
* @param User $user User making insert
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int Id of product/service if OK, < 0 if KO
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -826,7 +826,7 @@ class Product extends CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
// For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts)
|
||||
if ($this->barcode == -1) {
|
||||
if ($this->barcode == '-1' || $this->barcode == 'auto') {
|
||||
$this->barcode = $this->get_barcode($this, $this->barcode_type_code);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Luracast\Restler\RestException;
|
|||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
|
||||
/**
|
||||
* \file class/api_workstations.class.php
|
||||
* \file htdocs/workstation/class/api_workstations.class.php
|
||||
* \ingroup workstation
|
||||
* \brief File for API management of Workstations.
|
||||
*/
|
||||
|
|
@ -68,7 +68,7 @@ class Workstations extends DolibarrApi
|
|||
*/
|
||||
public function get($id)
|
||||
{
|
||||
return $this->_fetch($id, '', '', '', $includestockdata, $includesubproducts, $includeparentid, false, $includetrans);
|
||||
return $this->_fetch($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,7 +88,7 @@ class Workstations extends DolibarrApi
|
|||
*/
|
||||
public function getByRef($ref)
|
||||
{
|
||||
return $this->_fetch('', $ref);
|
||||
return $this->_fetch(0, $ref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,8 +101,8 @@ class Workstations extends DolibarrApi
|
|||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
|
||||
* @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names
|
||||
* @return array Array of product objects
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @return array Array of workstation objects
|
||||
*/
|
||||
public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
|
||||
{
|
||||
|
|
@ -128,7 +128,7 @@ class Workstations extends DolibarrApi
|
|||
}
|
||||
}
|
||||
|
||||
//this query will return total products with the filters given
|
||||
// this query will return total products with the filters given
|
||||
$sqlTotals = str_replace('SELECT t.rowid, t.ref', 'SELECT count(t.rowid) as total', $sql);
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
|
@ -148,13 +148,9 @@ class Workstations extends DolibarrApi
|
|||
$i = 0;
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if (!$ids_only) {
|
||||
$workstation_static = new Workstation($this->db);
|
||||
if ($workstation_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($workstation_static), $properties);
|
||||
}
|
||||
} else {
|
||||
$obj_ret[] = $obj->rowid;
|
||||
$workstation_static = new Workstation($this->db);
|
||||
if ($workstation_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($workstation_static), $properties);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -163,7 +159,7 @@ class Workstations extends DolibarrApi
|
|||
}
|
||||
|
||||
//if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
|
||||
if ($pagination_data) {
|
||||
if ($page > 0) {
|
||||
$totalsResult = $this->db->query($sqlTotals);
|
||||
$total = $this->db->fetch_object($totalsResult)->total;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue