Merge pull request #22182 from frederic34/pr/dolibit-ut/22136

sample deprecated function
This commit is contained in:
Laurent Destailleur 2022-10-06 12:20:15 +02:00 committed by GitHub
commit 63109d2844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 68 additions and 49 deletions

View File

@ -8,6 +8,7 @@ For users:
---------------
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
...
@ -79,7 +80,7 @@ NEW: Create contract from invoice
NEW: Database: Can store the session into database (instead of beeing managed by PHP)
NEW: Database: Some core tables are created only at module activation
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
NEW: Dictionaries - add possibility to manage countries in EEC
NEW: Dictionaries - Availibility dictionnary has a new column unit and number
NEW: Display errors in a message box after generating documents
@ -187,9 +188,9 @@ NEW: Can update rank of invoice, proposal and order lines with API update
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: Add option MAIN_API_DEBUG to save API logs into a file
Hooks:
Hooks:
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: Add hook before the public ticket list
NEW: Add hook for Notif
NEW: Add hook for more buttons
@ -221,12 +222,12 @@ NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
enable the module project if it is not visible).
* The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction"
with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL
with parameter "action" or "massaction" need the token, whatever is the value of the action.
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
* The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
* All triggers with a name XXX_UPDATE have been renamed with name XXX_MODIFY for code consistency purpose.
* Rename build_path_from_id_categ() into buildPathFromId() and set method to private.
@ -442,7 +443,7 @@ For users:
NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
NEW: Add option to disable globaly some notifications emails.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
@ -491,7 +492,7 @@ NEW: can enable/disable external calendar by default
NEW: Can hide sender name on PDF documents
NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion)
NEW: Can set the default BOM on a product
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
NEW: Can show progression of task into combo list of tasks
NEW: can upload the odt file for the product doc template
NEW: Contract - Add From/to input on search date
@ -555,7 +556,7 @@ For developers:
API:
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
NEW: add API /approve and /makeOrder for purchase orders
NEW: add API /approve and /makeOrder for purchase orders
NEW: API for knowledgemanagement
NEW: API get list of legal form of business
NEW: API list of staff units
@ -592,21 +593,21 @@ NEW: Experimental feature to manage user sessions in database
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it).
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
@ -895,10 +896,10 @@ For users:
----------
NEW: Module Recruitment to follow application to job positions is now stable.
NEW: Feature to make Stock Inventories
NEW: Several security issues after a second private bug hunting campaign.
NEW: Several security issues after a second private bug hunting campaign.
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
NEW: All main menu entries are using the picto of the module
NEW: Add a copy to clipboard button on some fields
NEW: Add a copy to clipboard button on some fields
NEW: Add an example of scheduled job to send email reminder for unpaid invoices
NEW: Add some color and picto for the direction of movement
NEW: add the column "Channel" into the list of orders
@ -969,7 +970,7 @@ NEW: can show the leave dates/holidays on the agenda view
NEW: Support color for types of event
Bank
NEW: Bank Entries : display user linked to a salary or a taxes
NEW: Bank Entries : display user linked to a salary or a taxes
NEW: Add bulk actions for Bank Transfer
ECM/GED
@ -992,7 +993,7 @@ NEW: option to automatically create a login/user when a new subscription of a me
NEW: option to select membership type on the online payment page for membership subscription or renewal
Products
NEW: Add price min and price min including tax into product export
NEW: Add price min and price min including tax into product export
NEW: Add a ref in product customer price
NEW: customer ref for product customer prices
NEW: Set status of all variants when changing status of parent
@ -1045,8 +1046,8 @@ NEW: add option in Workflow module to set a shipment as closed
for Admins
NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance
NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance
Modules
NEW: Module Recruitment is now stable
@ -1092,7 +1093,7 @@ NEW: API get the list of product ids only
NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc
NEW: add native compression in REST APIs
NEW: Product Variants API, add variant stock to response by parameter
NEW: Product API route added to get product stock and product with or without variants #13739 #17390
NEW: Product API route added to get product stock and product with or without variants #13739 #17390
Hooks
NEW: hook printFieldListTitle for cabyprodserv.php
@ -1117,8 +1118,8 @@ Following changes may create regressions for some external modules, but were nec
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
@ -1345,7 +1346,7 @@ NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credi
NEW: Module Intracomm report
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Module Recruitment to manage Job position and applications.
NEW: Several security issues after a private bug bounty campaign.
NEW: Several security issues after a private bug bounty campaign.
NEW: Accountancy - add chart of sub accounts
NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - add a menu entry to show subtotal by group
@ -1481,7 +1482,7 @@ NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
NEW: TakePOS appearance tab with more visual parameters
NEW: TakePOS add alert before changing thirdparty
NEW: TakePOS add alert before changing thirdparty
NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
@ -1492,9 +1493,9 @@ NEW: TakePOS display resiliate status for members
NEW: TakePOS Gift Receipt
NEW: TakePOS multicurrency compatibility
NEW: TakePOS multicurrency total
NEW: TakePOS print payment method and change
NEW: TakePOS print payment method and change
NEW: TakePOS restrict thirdparty to customer
NEW: TakePOS show available stock
NEW: TakePOS show available stock
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
@ -1507,8 +1508,8 @@ NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."

View File

@ -1048,7 +1048,7 @@ if (empty($reshook)) {
$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 there is some prices specific to the customer
if (count($prodcustprice->lines) > 0) {

View File

@ -1412,7 +1412,7 @@ class Propal extends CommonObject
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$prodcustprice = new Productcustomerprice($this->db);
$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 there is some prices specific to the customer
if (count($prodcustprice->lines) > 0) {

View File

@ -790,7 +790,7 @@ if (empty($reshook)) {
$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 (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price);

View File

@ -498,7 +498,7 @@ if (empty($reshook)) {
$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 (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price);

View File

@ -1534,7 +1534,6 @@ abstract class CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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 = '')
{
// phpcs:enable
global $langs, $conf;
$langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda'));

View File

@ -1567,7 +1567,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$productCustomerPriceStatic = new Productcustomerprice($db);
$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) {
$productCustomerPrice = $productCustomerPriceStatic->lines[0];

View File

@ -590,7 +590,7 @@ class Cronjob extends CommonObject
$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);
if ($resql) {
$num = $this->db->num_rows($resql);

View File

@ -188,7 +188,7 @@ if ($action == 'fetch' && !empty($id)) {
$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 (count($prodcustprice->lines) > 0) {
$found = true;

View File

@ -1039,7 +1039,7 @@ if (empty($reshook)) {
$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 (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines [0]->price);

View File

@ -670,7 +670,7 @@ class Products extends DolibarrApi
if ($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)) {

View File

@ -1872,7 +1872,7 @@ class Product extends CommonObject
$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 (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price);

View File

@ -354,11 +354,31 @@ class Productcustomerprice extends CommonObject
* @param int $limit page
* @param int $offset offset
* @param array $filter Filter for select
* @deprecated since dolibarr v17 use fetchAll
* @return int <0 if KO, >0 if OK
*/
public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
{
// 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;
if (empty($sortfield)) {
@ -421,7 +441,7 @@ class Productcustomerprice extends CommonObject
$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);
if ($resql) {
$this->lines = array();
@ -832,7 +852,7 @@ class Productcustomerprice extends CommonObject
'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) {
$error++;
$this->error = $prodsocprice->error;

View File

@ -2222,10 +2222,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// Count total nb of records
$nbtotalofrecords = '';
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) {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}

View File

@ -527,7 +527,7 @@ class Dolresource extends CommonObject
if ($limit) {
$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();
$resql = $this->db->query($sql);

View File

@ -169,7 +169,7 @@ if ($search_type != '') {
}
// 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
$filter['ef.resource'] = $sql;

View File

@ -532,10 +532,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// Count total nb of records
$nbtotalofrecords = '';
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) {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}