Merge pull request #22182 from frederic34/pr/dolibit-ut/22136
sample deprecated function
This commit is contained in:
commit
63109d2844
@ -8,6 +8,7 @@ For users:
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||||
|
All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|||||||
@ -1048,7 +1048,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// If there is some prices specific to the customer
|
// If there is some prices specific to the customer
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
|||||||
@ -1412,7 +1412,7 @@ class Propal extends CommonObject
|
|||||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
$prodcustprice = new Productcustomerprice($this->db);
|
$prodcustprice = new Productcustomerprice($this->db);
|
||||||
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id);
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id);
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// If there is some prices specific to the customer
|
// If there is some prices specific to the customer
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
|||||||
@ -790,7 +790,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
|||||||
@ -498,7 +498,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
|||||||
@ -1534,7 +1534,6 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
||||||
/**
|
/**
|
||||||
* Return array with list of possible values for type of contacts
|
* Return array with list of possible values for type of contacts
|
||||||
*
|
*
|
||||||
@ -1548,7 +1547,6 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '')
|
public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
$langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda'));
|
$langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda'));
|
||||||
|
|||||||
@ -1567,7 +1567,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
|||||||
$productCustomerPriceStatic = new Productcustomerprice($db);
|
$productCustomerPriceStatic = new Productcustomerprice($db);
|
||||||
$filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid);
|
$filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid);
|
||||||
|
|
||||||
$nbCustomerPrices = $productCustomerPriceStatic->fetch_all('', '', 1, 0, $filter);
|
$nbCustomerPrices = $productCustomerPriceStatic->fetchAll('', '', 1, 0, $filter);
|
||||||
|
|
||||||
if ($nbCustomerPrices > 0) {
|
if ($nbCustomerPrices > 0) {
|
||||||
$productCustomerPrice = $productCustomerPriceStatic->lines[0];
|
$productCustomerPrice = $productCustomerPriceStatic->lines[0];
|
||||||
|
|||||||
@ -590,7 +590,7 @@ class Cronjob extends CommonObject
|
|||||||
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
|
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
|
|||||||
@ -188,7 +188,7 @@ if ($action == 'fetch' && !empty($id)) {
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $object->id, 't.fk_soc' => $socid);
|
$filter = array('t.fk_product' => $object->id, 't.fk_soc' => $socid);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
|||||||
@ -1039,7 +1039,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $object->id, 't.fk_soc' => $soc->id);
|
$filter = array('t.fk_product' => $object->id, 't.fk_soc' => $soc->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||||
|
|||||||
@ -670,7 +670,7 @@ class Products extends DolibarrApi
|
|||||||
if ($thirdparty_id) {
|
if ($thirdparty_id) {
|
||||||
$filter['t.fk_soc'] .= $thirdparty_id;
|
$filter['t.fk_soc'] .= $thirdparty_id;
|
||||||
}
|
}
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($prodcustprice->lines)) {
|
if (empty($prodcustprice->lines)) {
|
||||||
|
|||||||
@ -1872,7 +1872,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$filter = array('t.fk_product' => $this->id, 't.fk_soc' => $thirdparty_buyer->id);
|
$filter = array('t.fk_product' => $this->id, 't.fk_soc' => $thirdparty_buyer->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if (count($prodcustprice->lines) > 0) {
|
if (count($prodcustprice->lines) > 0) {
|
||||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
|||||||
@ -354,11 +354,31 @@ class Productcustomerprice extends CommonObject
|
|||||||
* @param int $limit page
|
* @param int $limit page
|
||||||
* @param int $offset offset
|
* @param int $offset offset
|
||||||
* @param array $filter Filter for select
|
* @param array $filter Filter for select
|
||||||
|
* @deprecated since dolibarr v17 use fetchAll
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
|
public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetch_all is deprecated, use fetchAll instead", LOG_NOTICE);
|
||||||
|
|
||||||
|
return $this->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all customer prices in memory from database
|
||||||
|
*
|
||||||
|
* @param string $sortorder order
|
||||||
|
* @param string $sortfield field
|
||||||
|
* @param int $limit page
|
||||||
|
* @param int $offset offset
|
||||||
|
* @param array $filter Filter for select
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
* @since dolibarr v17
|
||||||
|
*/
|
||||||
|
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if (empty($sortfield)) {
|
if (empty($sortfield)) {
|
||||||
@ -421,7 +441,7 @@ class Productcustomerprice extends CommonObject
|
|||||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
@ -832,7 +852,7 @@ class Productcustomerprice extends CommonObject
|
|||||||
't.fk_product' => $this->fk_product, 't.fk_soc' => $obj->rowid
|
't.fk_product' => $this->fk_product, 't.fk_soc' => $obj->rowid
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $prodsocprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodsocprice->fetchAll('', '', 0, 0, $filter);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $prodsocprice->error;
|
$this->error = $prodsocprice->error;
|
||||||
|
|||||||
@ -2222,10 +2222,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter);
|
$nbtotalofrecords = $prodcustprice->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
$result = $prodcustprice->fetchAll($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -527,7 +527,7 @@ class Dolresource extends CommonObject
|
|||||||
if ($limit) {
|
if ($limit) {
|
||||||
$sql .= $this->db->plimit($limit, $offset);
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -169,7 +169,7 @@ if ($search_type != '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Including the previous script generate the correct SQL filter for all the extrafields
|
// Including the previous script generate the correct SQL filter for all the extrafields
|
||||||
// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake
|
// we are playing with the behaviour of the Dolresource::fetchAll() by generating a fake
|
||||||
// extrafields filter key to make it works
|
// extrafields filter key to make it works
|
||||||
$filter['ef.resource'] = $sql;
|
$filter['ef.resource'] = $sql;
|
||||||
|
|
||||||
|
|||||||
@ -532,10 +532,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$nbtotalofrecords = $prodcustprice->fetchAll('', '', 0, 0, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
$result = $prodcustprice->fetchAll($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user