From 850ac34020898c6ab08f4d3cd052efe594c663cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Aug 2018 17:26:32 +0200 Subject: [PATCH 1/9] mark non camelCaps function --- dev/setup/codesniffer/ruleset.xml | 4 +- .../class/accountancysystem.class.php | 2 +- .../class/accountingaccount.class.php | 3 + .../class/accountingjournal.class.php | 1 + .../accountancy/class/bookkeeping.class.php | 6 +- .../actions_adherentcard_common.class.php | 2 + .../actions_adherentcard_default.class.php | 3 +- htdocs/adherents/class/adherent.class.php | 12 +++ .../adherents/class/adherent_type.class.php | 3 + htdocs/adherents/class/subscription.class.php | 1 + .../admin/dolistore/class/dolistore.class.php | 8 +- htdocs/api/class/api.class.php | 1 + htdocs/asset/class/asset.class.php | 3 +- htdocs/asset/class/asset_type.class.php | 1 + htdocs/blockedlog/class/authority.class.php | 2 +- htdocs/blockedlog/class/blockedlog.class.php | 1 - htdocs/categories/class/categorie.class.php | 17 +++ htdocs/comm/action/class/actioncomm.class.php | 11 +- .../action/class/actioncommreminder.class.php | 2 +- .../comm/action/class/cactioncomm.class.php | 1 + htdocs/comm/action/class/ical.class.php | 15 +++ .../mailing/class/advtargetemailing.class.php | 13 ++- .../html.formadvtargetemailing.class.php | 2 +- htdocs/comm/mailing/class/mailing.class.php | 4 +- htdocs/comm/propal/class/propal.class.php | 21 +++- htdocs/commande/class/commande.class.php | 21 +++- htdocs/compta/bank/class/account.class.php | 31 ++++-- .../bank/class/paymentvarious.class.php | 2 + .../deplacement/class/deplacement.class.php | 2 +- .../facture/class/facture-rec.class.php | 6 +- htdocs/compta/facture/class/facture.class.php | 22 ++++ .../compta/localtax/class/localtax.class.php | 15 ++- .../cheque/class/remisecheque.class.php | 8 +- .../compta/paiement/class/paiement.class.php | 11 +- .../class/bonprelevement.class.php | 17 ++- .../class/ligneprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 2 +- .../salaries/class/paymentsalary.class.php | 2 + .../sociales/class/cchargesociales.class.php | 35 +++--- .../sociales/class/chargesociales.class.php | 4 +- .../class/paymentsocialcontribution.class.php | 4 +- htdocs/compta/tva/class/tva.class.php | 17 +-- .../actions_contactcard_common.class.php | 2 +- .../actions_contactcard_default.class.php | 3 +- htdocs/contact/class/contact.class.php | 7 ++ htdocs/contrat/class/contrat.class.php | 12 +++ htdocs/core/class/CMailFile.class.php | 10 +- htdocs/core/class/CSMSFile.class.php | 3 +- htdocs/core/class/antivir.class.php | 2 +- htdocs/core/class/canvas.class.php | 2 + htdocs/core/class/comment.class.php | 2 +- .../core/class/commondocgenerator.class.php | 23 ++-- htdocs/core/class/commoninvoice.class.php | 6 +- htdocs/core/class/commonobject.class.php | 33 +++++- .../class/commonstickergenerator.class.php | 37 ++++--- htdocs/core/class/discount.class.php | 2 + htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/class/dolgraph.class.php | 33 +++++- htdocs/core/class/dolreceiptprinter.class.php | 27 +++-- .../core/class/emailsenderprofile.class.php | 1 + htdocs/core/class/extrafields.class.php | 1 + htdocs/core/class/fiscalyear.class.php | 1 + htdocs/core/class/genericobject.class.php | 19 ++-- htdocs/core/class/html.form.class.php | 46 +++++++- .../core/class/html.formaccounting.class.php | 7 +- htdocs/core/class/html.formactions.class.php | 2 + htdocs/core/class/html.formadmin.class.php | 19 ++-- htdocs/core/class/html.formbarcode.class.php | 3 +- htdocs/core/class/html.formcompany.class.php | 14 ++- htdocs/core/class/html.formcontract.class.php | 23 ++-- htdocs/core/class/html.formcron.class.php | 1 + htdocs/core/class/html.formfile.class.php | 5 +- .../class/html.formintervention.class.php | 1 + htdocs/core/class/html.formmail.class.php | 6 ++ htdocs/core/class/html.formother.class.php | 23 +++- htdocs/core/class/html.formprojet.class.php | 5 +- htdocs/core/class/html.formpropal.class.php | 7 +- htdocs/core/class/html.formsms.class.php | 2 +- .../class/html.formsocialcontrib.class.php | 2 +- htdocs/core/class/interfaces.class.php | 1 + htdocs/core/class/ldap.class.php | 3 + htdocs/core/class/menu.class.php | 7 +- htdocs/core/class/openid.class.php | 38 +++++-- htdocs/core/class/rssparser.class.php | 5 +- htdocs/core/class/smtps.class.php | 8 +- htdocs/core/class/translate.class.php | 3 + htdocs/core/db/Database.interface.php | 18 ++++ htdocs/core/db/mssql.class.php | 21 +++- htdocs/core/db/mysqli.class.php | 19 +++- htdocs/core/db/pgsql.class.php | 18 ++++ htdocs/core/db/sqlite3.class.php | 23 +++- htdocs/core/modules/DolibarrModules.class.php | 18 ++++ htdocs/core/modules/action/modules_action.php | 2 + htdocs/core/modules/action/rapport.pdf.php | 4 +- .../core/modules/bank/doc/pdf_ban.modules.php | 18 ++-- .../bank/doc/pdf_sepamandate.modules.php | 98 ++++++++--------- htdocs/core/modules/bank/modules_bank.php | 14 +-- .../barcode/mod_barcode_product_standard.php | 13 +-- .../modules/cheque/doc/pdf_blochet.class.php | 15 +-- .../modules/cheque/mod_chequereceipt_mint.php | 1 + .../cheque/mod_chequereceipt_thyme.php | 2 +- .../modules/cheque/modules_chequereceipts.php | 4 +- .../doc/doc_generic_order_odt.modules.php | 2 +- .../commande/doc/pdf_einstein.modules.php | 21 ++-- .../commande/doc/pdf_proforma.modules.php | 1 - .../modules/commande/mod_commande_marbre.php | 1 + .../modules/commande/mod_commande_saphir.php | 2 +- .../modules/commande/modules_commande.php | 13 +-- .../doc/doc_generic_contract_odt.modules.php | 2 +- .../contract/doc/pdf_strato.modules.php | 30 +++--- .../modules/contract/mod_contract_magre.php | 2 +- .../modules/contract/mod_contract_serpis.php | 1 + .../modules/contract/modules_contract.php | 1 + .../modules/dons/html_cerfafr.modules.php | 2 + htdocs/core/modules/dons/modules_don.php | 2 +- .../doc/doc_generic_shipment_odt.modules.php | 2 +- .../expedition/doc/pdf_merou.modules.php | 37 +++---- .../expedition/doc/pdf_rouget.modules.php | 29 ++--- .../expedition/mod_expedition_ribera.php | 2 +- .../expedition/mod_expedition_safor.php | 1 + .../modules/expedition/modules_expedition.php | 1 + .../doc/pdf_standard.modules.php | 28 ++--- .../expensereport/modules_expensereport.php | 6 +- .../modules/export/export_csv.modules.php | 15 ++- .../modules/export/export_excel.modules.php | 14 ++- .../export/export_excel2007.modules.php | 6 +- .../modules/export/export_tsv.modules.php | 14 ++- htdocs/core/modules/export/modules_export.php | 3 +- .../doc/doc_generic_invoice_odt.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 23 ++-- .../core/modules/facture/modules_facture.php | 1 + .../fichinter/doc/pdf_soleil.modules.php | 26 ++--- htdocs/core/modules/fichinter/mod_pacific.php | 1 - .../modules/fichinter/modules_fichinter.php | 3 +- .../holiday/mod_holiday_immaculate.php | 1 + .../modules/holiday/mod_holiday_madonna.php | 1 + .../core/modules/holiday/modules_holiday.php | 9 +- .../modules/import/import_csv.modules.php | 16 ++- .../modules/import/import_xlsx.modules.php | 16 ++- htdocs/core/modules/import/modules_import.php | 2 +- .../livraison/doc/pdf_typhon.modules.php | 37 +++---- .../modules/livraison/mod_livraison_jade.php | 1 + .../livraison/mod_livraison_saphir.php | 2 +- .../modules/livraison/modules_livraison.php | 1 + .../mailings/advthirdparties.modules.php | 1 + .../modules/mailings/contacts1.modules.php | 2 +- .../core/modules/mailings/example.modules.php | 6 +- .../core/modules/mailings/fraise.modules.php | 1 + .../modules/mailings/modules_mailings.php | 8 +- .../core/modules/mailings/pomme.modules.php | 16 +-- .../modules/mailings/thirdparties.modules.php | 2 +- .../thirdparties_services_expired.modules.php | 2 +- .../modules/mailings/xinputfile.modules.php | 2 +- .../modules/mailings/xinputuser.modules.php | 4 +- .../modules/member/doc/pdf_standard.class.php | 4 +- htdocs/core/modules/member/modules_cards.php | 17 +-- .../core/modules/payment/mod_payment_ant.php | 2 +- .../modules/payment/mod_payment_cicada.php | 1 + .../modules/printing/modules_printing.php | 1 - .../modules/printing/printgcp.modules.php | 3 + .../modules/printing/printipp.modules.php | 4 + .../doc/pdf_standardlabel.class.php | 6 +- .../printsheet/doc/pdf_tcpdflabel.class.php | 45 ++++---- .../modules/printsheet/modules_labels.php | 5 +- .../doc/doc_generic_product_odt.modules.php | 2 +- .../product/doc/pdf_standard.modules.php | 8 +- .../product/mod_codeproduct_elephant.php | 3 +- .../modules/product/modules_product.class.php | 6 +- .../modules_product_batch.class.php | 18 ++-- .../doc/doc_generic_project_odt.modules.php | 9 ++ .../project/doc/pdf_baleine.modules.php | 33 +++--- .../project/doc/pdf_beluga.modules.php | 27 ++--- .../project/doc/pdf_timespent.modules.php | 6 +- .../modules/project/mod_project_simple.php | 2 +- .../modules/project/mod_project_universal.php | 2 +- .../core/modules/project/modules_project.php | 5 +- .../task/doc/doc_generic_task_odt.modules.php | 9 ++ .../modules/project/task/mod_task_simple.php | 2 +- .../project/task/mod_task_universal.php | 2 +- .../modules/project/task/modules_task.php | 5 +- .../doc/doc_generic_proposal_odt.modules.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 42 ++++---- .../core/modules/propale/modules_propale.php | 1 + .../modules/rapport/pdf_paiement.class.php | 3 +- .../societe/doc/doc_generic_odt.modules.php | 6 +- .../societe/mod_codeclient_elephant.php | 3 +- .../modules/societe/mod_codeclient_monkey.php | 3 +- .../societe/mod_codecompta_aquarium.php | 2 +- .../societe/mod_codecompta_panicum.php | 2 +- .../modules/societe/modules_societe.class.php | 11 +- .../doc/doc_generic_stock_odt.modules.php | 2 +- .../stock/doc/pdf_standard.modules.php | 102 +++++++++--------- .../stock/doc/pdf_stdmovement.modules.php | 8 +- .../core/modules/stock/modules_movement.php | 3 +- htdocs/core/modules/stock/modules_stock.php | 1 + .../modules_facturefournisseur.php | 11 +- .../pdf/pdf_canelle.modules.php | 36 ++++--- .../mod_commande_fournisseur_muguet.php | 2 +- .../mod_commande_fournisseur_orchidee.php | 2 +- .../modules_commandefournisseur.php | 1 + .../pdf/pdf_muscadet.modules.php | 33 +++--- .../doc/pdf_standard.modules.php | 35 +++--- .../mod_supplier_payment_brodator.php | 2 +- .../mod_supplier_payment_bronan.php | 1 + .../modules_supplier_payment.php | 3 +- ..._generic_supplier_proposal_odt.modules.php | 2 +- .../doc/pdf_aurore.modules.php | 43 ++++---- .../modules_supplier_proposal.php | 1 + .../user/doc/doc_generic_user_odt.modules.php | 7 +- .../core/modules/user/modules_user.class.php | 7 +- .../doc/doc_generic_usergroup_odt.modules.php | 2 +- .../usergroup/modules_usergroup.class.php | 13 +-- htdocs/cron/class/cronjob.class.php | 4 + htdocs/don/class/don.class.php | 6 ++ htdocs/don/class/donstats.class.php | 2 +- htdocs/don/class/paymentdonation.class.php | 2 + htdocs/ecm/class/ecmdirectory.class.php | 5 + htdocs/ecm/class/ecmfiles.class.php | 3 +- htdocs/expedition/class/expedition.class.php | 15 ++- .../class/expensereport.class.php | 15 +++ .../class/paymentexpensereport.class.php | 8 +- htdocs/exports/class/export.class.php | 7 +- htdocs/fichinter/class/fichinter.class.php | 8 +- htdocs/fourn/class/fournisseur.class.php | 4 +- .../class/fournisseur.commande.class.php | 15 ++- .../fournisseur.commande.dispatch.class.php | 1 + .../fourn/class/fournisseur.facture.class.php | 28 +++-- .../fourn/class/fournisseur.product.class.php | 11 +- htdocs/fourn/class/paiementfourn.class.php | 8 +- htdocs/holiday/class/holiday.class.php | 6 +- htdocs/hrm/class/establishment.class.php | 9 +- htdocs/imports/class/import.class.php | 2 + htdocs/livraison/class/livraison.class.php | 6 ++ htdocs/loan/class/loan.class.php | 2 + htdocs/loan/class/loanschedule.class.php | 3 +- htdocs/loan/class/paymentloan.class.php | 6 +- .../mailmanspip/class/mailmanspip.class.php | 5 + .../template/class/myobject.class.php | 1 + .../mailinglist_mymodule_myobject.modules.php | 2 +- .../core/modules/modMyModule.class.php | 28 ++--- .../class/opensurveysondage.class.php | 2 + .../product/actions_card_product.class.php | 3 +- .../service/actions_card_service.class.php | 3 +- .../product/class/html.formproduct.class.php | 5 +- htdocs/product/class/product.class.php | 47 +++++++- .../class/productcustomerprice.class.php | 4 +- .../class/propalmergepdfproduct.class.php | 6 +- .../class/price_expression.class.php | 6 +- .../price_global_variable_updater.class.php | 2 + .../class/price_parser.class.php | 2 +- .../inventory/class/inventory.class.php | 3 +- htdocs/product/stock/class/entrepot.class.php | 8 +- .../stock/class/mouvementstock.class.php | 2 + .../product/stock/class/productlot.class.php | 10 +- .../class/productstockentrepot.class.php | 1 + htdocs/projet/class/project.class.php | 10 +- htdocs/projet/class/task.class.php | 3 + htdocs/resource/class/dolresource.class.php | 8 ++ .../class/html.formresource.class.php | 23 ++-- .../canvas/actions_card_common.class.php | 2 + .../company/actions_card_company.class.php | 2 +- .../actions_card_individual.class.php | 2 +- htdocs/societe/class/address.class.php | 2 + htdocs/societe/class/client.class.php | 1 + .../class/companypaymentmode.class.php | 3 +- htdocs/societe/class/societe.class.php | 53 +++++++-- htdocs/societe/class/societeaccount.class.php | 1 + .../class/supplier_proposal.class.php | 17 ++- htdocs/ticket/class/actions_ticket.class.php | 1 + htdocs/ticket/class/ticket.class.php | 2 + htdocs/user/class/user.class.php | 24 ++++- htdocs/user/class/userbankaccount.class.php | 1 - htdocs/user/class/usergroup.class.php | 4 +- htdocs/website/class/website.class.php | 2 +- htdocs/website/class/websitepage.class.php | 1 + test/phpunit/CoreTest.php | 1 + 276 files changed, 1792 insertions(+), 817 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index c1136b668c5..375ddd0dcc0 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -346,9 +346,9 @@ 0 - + 0 diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index f14a3e7f761..144b7a675f4 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -130,4 +130,4 @@ class AccountancySystem return $result; } -} \ No newline at end of file +} diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 257c2af0111..eae9b387761 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -494,6 +494,7 @@ class AccountingAccount extends CommonObject * @param int $id Id * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_desactivate($id) { $result = $this->checkUsage(); @@ -526,6 +527,7 @@ class AccountingAccount extends CommonObject * @param int $id Id * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_activate($id) { $this->db->begin(); @@ -564,6 +566,7 @@ class AccountingAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 454de6d7b84..8d06684459b 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -252,6 +252,7 @@ class AccountingJournal extends CommonObject * @param int $mode 0=libelle long, 1=libelle court * @return string Label of type */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibType($nature,$mode=0) { global $langs; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f7fed2e2b5b..2caae52dcb8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1539,6 +1539,7 @@ class BookKeeping extends CommonObject * @param string $model Model * @return int Result */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function export_bookkeping($model = 'ebp') { global $conf; @@ -1695,7 +1696,8 @@ class BookKeeping extends CommonObject * @param int $select_out Set value returned by select 0=rowid (default), 1=account_number * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @return string String with HTML select - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { global $conf; @@ -1759,6 +1761,7 @@ class BookKeeping extends CommonObject * @param string $account Accounting account * @return string Root account */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_racine($account = null) { global $conf; @@ -1799,6 +1802,7 @@ class BookKeeping extends CommonObject * @param string $account Accounting account * @return string Account desc */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_desc($account = null) { global $conf; diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index f49d1cecb99..57fabdecd17 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -76,6 +76,7 @@ abstract class ActionsAdherentCardCommon * @param int $id Id * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { global $conf, $langs, $user, $canvas; @@ -231,6 +232,7 @@ abstract class ActionsAdherentCardCommon * * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function assign_post() { global $langs, $mysoc; diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index 451f46f899f..415474ef70e 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -74,6 +74,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @param int $id Id * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { global $limit, $offset, $sortfield, $sortorder; @@ -130,6 +131,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { global $conf, $langs; @@ -139,4 +141,3 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon $this->list_datas = array(); } } - diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 5d7664b13aa..00c41d7a500 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -139,6 +139,7 @@ class Adherent extends CommonObject * @param string $errors_to erros to * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') { global $conf,$langs; @@ -629,6 +630,7 @@ class Adherent extends CommonObject * @param User $user User making change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_end_date($user) { $this->db->begin(); @@ -983,6 +985,7 @@ class Adherent extends CommonObject * @param string $login login of member * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_login($login) { global $conf; @@ -1013,6 +1016,7 @@ class Adherent extends CommonObject * @param string $lastname Lastname * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_name($firstname,$lastname) { global $conf; @@ -1186,6 +1190,7 @@ class Adherent extends CommonObject * * @return int <0 si KO, >0 si OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_subscriptions() { global $langs; @@ -1736,6 +1741,7 @@ class Adherent extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_abo() { global $conf,$langs; @@ -1793,6 +1799,7 @@ class Adherent extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_abo() { global $conf,$langs; @@ -1976,6 +1983,7 @@ class Adherent extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) { global $langs; @@ -2065,6 +2073,7 @@ class Adherent extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf; @@ -2101,6 +2110,7 @@ class Adherent extends CommonObject * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -2246,6 +2256,7 @@ class Adherent extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { global $conf; @@ -2262,6 +2273,7 @@ class Adherent extends CommonObject * * @return array Tableau info des attributs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { global $conf,$langs; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index ca8372c04ed..548bfc21c93 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -287,6 +287,7 @@ class AdherentType extends CommonObject * * @return array List of types of members */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { global $conf,$langs; @@ -422,6 +423,7 @@ class AdherentType extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { global $conf; @@ -438,6 +440,7 @@ class AdherentType extends CommonObject * * @return array Tableau info des attributs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { global $conf,$langs; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 1c4007780b9..47a3eb66f50 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -361,6 +361,7 @@ class Subscription extends CommonObject * @param int $statut Id statut * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut) { global $langs; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 660886c835d..cdbe461edde 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -160,6 +160,7 @@ class Dolistore * @param int $parent Id of parent category * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_categories($parent = 0) { if (!isset($this->categories)) die('not possible'); @@ -206,6 +207,7 @@ class Dolistore * * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_products() { global $langs, $conf; @@ -282,16 +284,19 @@ class Dolistore return $html; } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_previous_link($text = '<<') { return ''.$text.''; } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_link($text = '>>') { return ''.$text.''; } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_previous_url() { $param_array = array(); @@ -309,6 +314,7 @@ class Dolistore return $this->url."&".$param; } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_url() { $param_array = array(); @@ -326,6 +332,7 @@ class Dolistore return $this->url."&".$param; } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function version_compare($v1, $v2) { $v1 = explode('.', $v1); @@ -355,4 +362,3 @@ class Dolistore return $ret; } } - diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 5918b1a5414..6c2f92510dd 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -273,6 +273,7 @@ class DolibarrApi * @param array $matches Array of found string by regex search * @return string Forged criteria. Example: "t.field like 'abc%'" */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function _forge_criteria_callback($matches) { global $db; diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 4ab05ce675c..f5e9af6f8df 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -336,6 +336,7 @@ class Asset extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; @@ -461,4 +462,4 @@ class Asset extends CommonObject return 0; } -} \ No newline at end of file +} diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index 51ea3a0c799..4f633fb273a 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -279,6 +279,7 @@ class AssetType extends CommonObject * * @return array List of types of members */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { global $conf,$langs; diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index b1084b01a54..e6fdd1d38a1 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -330,4 +330,4 @@ class BlockedLogAuthority return 1; } -} \ No newline at end of file +} diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 0210491fba7..cbe0e6860f8 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1055,4 +1055,3 @@ class BlockedLog } } - diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 70b2108dd4c..2ea63cc7bfc 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -635,6 +635,7 @@ class Categorie extends CommonObject * @param string $type Type of category ('product', ...) * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_type($obj, $type) { global $user,$langs,$conf; @@ -737,6 +738,7 @@ class Categorie extends CommonObject * * @return int 1 if OK, -1 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_type($obj,$type) { global $user,$langs,$conf; @@ -957,6 +959,7 @@ class Categorie extends CommonObject * * @return array|int <0 KO, array ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_filles() { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; @@ -986,6 +989,7 @@ class Categorie extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function load_motherof() { global $conf; @@ -1030,6 +1034,7 @@ class Categorie extends CommonObject * * @return array Array of categories. this->cats and this->motherof are set. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($type, $markafterid=0) { global $conf, $langs; @@ -1113,6 +1118,7 @@ class Categorie extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=1000) { dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); @@ -1153,6 +1159,7 @@ class Categorie extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function debug_cats() { // Display $this->cats @@ -1176,6 +1183,7 @@ class Categorie extends CommonObject * @param boolean $parent Just parent categories if true * @return array Table of Object Category */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_categories($type=null, $parent=false) { if (! is_numeric($type)) $type = $this->MAP_ID[$type]; @@ -1211,6 +1219,7 @@ class Categorie extends CommonObject * * @return integer 1 if already exist, 0 otherwise, -1 if error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function already_exists() { $type=$this->type; @@ -1261,6 +1270,7 @@ class Categorie extends CommonObject * @param int $type Type of category (0, 1, ...) * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_main_categories($type=null) { return $this->get_all_categories($type, true); @@ -1275,6 +1285,7 @@ class Categorie extends CommonObject * @param int $nocolor 0 * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_all_ways($sep = " >> ", $url='', $nocolor=0) { $ways = array(); @@ -1328,6 +1339,7 @@ class Categorie extends CommonObject * * @return int|array <0 KO, array OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_meres() { $parents = array(); @@ -1363,6 +1375,7 @@ class Categorie extends CommonObject * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_ways() { $ways = array(); @@ -1578,6 +1591,7 @@ class Categorie extends CommonObject * @param string $file Nom du fichier uploade * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1627,6 +1641,7 @@ class Categorie extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; @@ -1681,6 +1696,7 @@ class Categorie extends CommonObject * @param string $file Path to file * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1709,6 +1725,7 @@ class Categorie extends CommonObject * @param string $file Path to file * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { $infoImg = getimagesize($file); // Recuperation des infos de l'image diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6c863580203..2d5db0a5c86 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos GarcĂ­a * Copyright (C) 2018 Nicolas ZABOURI - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -688,6 +688,7 @@ class ActionComm extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_userassigned() { $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; @@ -1012,6 +1013,7 @@ class ActionComm extends CommonObject * @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $load_state_board=0) { global $conf, $langs; @@ -1138,6 +1140,7 @@ class ActionComm extends CommonObject * @param int $datestart Date start of event * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($percent,$mode,$hidenastatus=0,$datestart='') { global $langs; @@ -1223,7 +1226,7 @@ class ActionComm extends CommonObject if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) $option = 'nolink'; - + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility @@ -1347,6 +1350,7 @@ class ActionComm extends CommonObject * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @return int <0 if error, nb of events in new file if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_exportfile($format,$type,$cachedelay,$filename,$filters) { global $conf,$langs,$dolibarr_main_url_root,$mysoc; @@ -1667,8 +1671,6 @@ class ActionComm extends CommonObject // TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done - - // Delete also very old past events (we do not keep more than 1 month record in past) $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; $this->db->query($sql); @@ -1679,4 +1681,3 @@ class ActionComm extends CommonObject } } - diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 4873db461f6..9c02e39e4f6 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -172,6 +172,7 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; @@ -226,4 +227,3 @@ class ActionCommReminder extends CommonObject } } - diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index d8496a9a4ff..2383feb0512 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -110,6 +110,7 @@ class CActionComm * @param int $shortlabel 1=Get short label instead of long label * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='', $shortlabel=0) { global $langs,$conf; diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 708b52c9151..47361e6b49f 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -53,6 +53,7 @@ class ICal * @param string $file File * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function read_file($file) { $this->file = $file; @@ -72,6 +73,7 @@ class ICal * * @return int */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_count() { return $this->event_count; @@ -82,6 +84,7 @@ class ICal * * @return int */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_count() { return $this->todo_count; @@ -203,6 +206,7 @@ class ICal * @param string $value Value * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_array($type, $key, $value) { @@ -261,6 +265,7 @@ class ICal * @param string $text Text * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function retun_key_value($text) { /* @@ -284,6 +289,7 @@ class ICal * @param string $value string * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_rrule($value) { $result=array(); @@ -301,6 +307,7 @@ class ICal * @param string $ical_date String date * @return int */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_date_to_unix($ical_date) { $ical_date = str_replace('T', '', $ical_date); @@ -323,6 +330,7 @@ class ICal * @param string $value Value * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dt_date($key, $value) { $return_value=array(); @@ -350,6 +358,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sort_event_list() { $temp = $this->get_event_list(); @@ -371,6 +380,7 @@ class ICal * @param array $b Operand b * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dtstart_compare($a, $b) { return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); @@ -381,6 +391,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_list() { return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); @@ -391,6 +402,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_freebusy_list() { return $this->cal['VFREEBUSY']; @@ -401,6 +413,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_list() { return $this->cal['VTODO']; @@ -411,6 +424,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_calender_data() { return $this->cal['VCALENDAR']; @@ -421,6 +435,7 @@ class ICal * * @return array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_data() { return $this->cal; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 50d9faf0637..b1727212f9f 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -239,6 +239,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $id Id object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_mailing($id=0) { global $langs; @@ -305,6 +306,7 @@ class AdvanceTargetingMailing extends CommonObject * @param string $type_element Type target * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_element($id=0, $type_element='mailing') { global $langs; @@ -529,6 +531,7 @@ class AdvanceTargetingMailing extends CommonObject * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_thirdparty($arrayquery) { global $langs,$conf; @@ -621,16 +624,16 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_max'])) { $sqlwhere[]= " (te.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'].")"; } - } else if (($extrafields->attribute_type[$key] == 'date') || + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { if (!empty($arrayquery['options_'.$key.'_end_dt'])){ $sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')"; } - }else if ($extrafields->attribute_type[$key] == 'boolean') { + } elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key]!=''){ $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; } - }else{ + } else { if (is_array($arrayquery['options_'.$key])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','",$arrayquery['options_'.$key])."'))"; } elseif (!empty($arrayquery['options_'.$key])) { @@ -683,6 +686,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $withThirdpartyFilter add contact with tridparty filter * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_contact($arrayquery, $withThirdpartyFilter = 0) { global $langs,$conf; @@ -949,5 +953,4 @@ class AdvanceTargetingMailing extends CommonObject return $return_sql_criteria; } - -} \ No newline at end of file +} diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 7408bb27d37..8b9bd0d1fd7 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -460,4 +460,4 @@ class FormAdvTargetEmailing extends Form $this->db->free ( $resql ); return $out; } -} \ No newline at end of file +} diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 63fc0a2caab..92d92e89983 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -437,6 +437,7 @@ class Mailing extends CommonObject * * @return int 1 if OK, 0 if error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; @@ -462,6 +463,7 @@ class Mailing extends CommonObject * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; @@ -534,6 +536,7 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -638,4 +641,3 @@ class Mailing extends CommonObject } } - diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e49fe43e2c9..bab2493bd3b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -234,6 +234,7 @@ class Propal extends CommonObject * TODO Replace calls to this function by generation objet Ligne * inserted into table $this->products */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { global $conf, $mysoc; @@ -288,6 +289,7 @@ class Propal extends CommonObject * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1167,6 +1169,7 @@ class Propal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { // i love this function because $this->products is not used in create function... @@ -1556,6 +1559,7 @@ class Propal extends CommonObject * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { $this->lines=array(); @@ -1795,6 +1799,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { if (empty($date)) @@ -1862,6 +1867,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_echeance($user, $date_fin_validite, $notrigger=0) { if (! empty($user->rights->propal->creer)) @@ -1922,6 +1928,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { if (! empty($user->rights->propal->creer)) @@ -1982,6 +1989,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_availability($user, $id, $notrigger=0) { if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2051,6 +2059,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_demand_reason($user, $id, $notrigger=0) { if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2122,6 +2131,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { if (! empty($user->rights->propal->creer)) @@ -2185,6 +2195,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2250,6 +2261,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2533,6 +2545,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $notrigger=0) { $error=0; @@ -2596,6 +2609,7 @@ class Propal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') { global $user; @@ -2675,6 +2689,7 @@ class Propal extends CommonObject * @param int $id Id propal * @return array Array of invoices id */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InvoiceArrayList($id) { $ga = array(); @@ -2955,6 +2970,7 @@ class Propal extends CommonObject * @return int >0 si ok, <0 si ko * @deprecated use set_demand_reason */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { global $user; @@ -3094,6 +3110,7 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { global $conf; @@ -3139,6 +3156,7 @@ class Propal extends CommonObject * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { global $conf, $langs; @@ -3309,6 +3327,7 @@ class Propal extends CommonObject * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -4189,6 +4208,7 @@ class PropaleLigne extends CommonObjectLine * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); @@ -4217,4 +4237,3 @@ class PropaleLigne extends CommonObjectLine } } - diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 941c061eea1..471f0493936 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -428,6 +428,7 @@ class Commande extends CommonOrder * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { global $conf,$langs; @@ -509,6 +510,7 @@ class Commande extends CommonOrder * @param User $user Object user that change status * @return int <0 if KO, 0 if nothing is done, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_reopen($user) { $error=0; @@ -1480,6 +1482,7 @@ class Commande extends CommonOrder * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') { global $conf, $mysoc; @@ -1709,6 +1712,7 @@ class Commande extends CommonOrder * @param int $idremise Id de la remise fixe * @return int >0 si ok, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1786,6 +1790,7 @@ class Commande extends CommonOrder * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { $this->lines=array(); @@ -2012,6 +2017,7 @@ class Commande extends CommonOrder * * TODO deprecate, move to Shipping class */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_expedition() { $sql = 'SELECT count(*)'; @@ -2038,6 +2044,7 @@ class Commande extends CommonOrder * * TODO FONCTION NON FINIE A FINIR */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function stock_array($filtre_statut=self::STATUS_CANCELED) { $this->stocks = array(); @@ -2154,6 +2161,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2220,6 +2228,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2286,6 +2295,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { if ($user->rights->commande->creer) @@ -2348,8 +2358,9 @@ class Commande extends CommonOrder * @param User $user Objet utilisateur qui modifie * @param int $date_livraison Date de livraison * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 si ko, >0 si ok + * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { if ($user->rights->commande->creer) @@ -2419,6 +2430,7 @@ class Commande extends CommonOrder * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') { global $user; @@ -2556,6 +2568,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { global $user; @@ -2627,6 +2640,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { if ($user->rights->commande->creer) @@ -3237,6 +3251,7 @@ class Commande extends CommonOrder * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -3324,6 +3339,7 @@ class Commande extends CommonOrder * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$billed,$mode,$donotshowbilled=0) { global $langs, $conf; @@ -3640,6 +3656,7 @@ class Commande extends CommonOrder * * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -4266,6 +4283,7 @@ class OrderLine extends CommonOrderLine * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); @@ -4299,4 +4317,3 @@ class OrderLine extends CommonOrderLine } } } - diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 79b72a5a54c..a02186bc1c5 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -296,6 +296,7 @@ class Account extends CommonObject * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_url_line($line_id, $url_id, $url, $label, $type) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; @@ -334,6 +335,7 @@ class Account extends CommonObject * @param string $type To search using type * @return array|-1 Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_url($fk_bank='', $url_id='', $type='') { $lines = array(); @@ -775,11 +777,12 @@ class Account extends CommonObject /** - * Update BBAN (RIB) account fields + * Update BBAN (RIB) account fields * - * @param User $user Object user making update - * @return int <0 if KO, >0 if OK + * @param User $user Object user making update + * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_bban(User $user = null) { global $conf,$langs; @@ -1065,6 +1068,7 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { global $langs; @@ -1100,6 +1104,7 @@ class Account extends CommonObject * * @return boolean vrai si peut etre supprime, faux sinon */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function can_be_deleted() { $can_be_deleted=false; @@ -1170,6 +1175,7 @@ class Account extends CommonObject * @param int $filteraccountid To get info for a particular account id * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board(User $user, $filteraccountid = 0) { global $conf, $langs; @@ -1223,6 +1229,7 @@ class Account extends CommonObject * @param int $filteraccountid To get info for a particular account id * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board($filteraccountid = 0) { global $user; @@ -1852,6 +1859,7 @@ class AccountLine extends CommonObject * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_urls(User $user = null) { $nbko=0; @@ -1917,12 +1925,13 @@ class AccountLine extends CommonObject /** - * Update conciliation field + * Update conciliation field * - * @param User $user Objet user making update - * @param int $cat Category id - * @return int <0 if KO, >0 if OK + * @param User $user Objet user making update + * @param int $cat Category id + * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_conciliation(User $user, $cat) { global $conf,$langs; @@ -1985,6 +1994,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_change($rowid,$sign=1) { $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2022,6 +2032,7 @@ class AccountLine extends CommonObject * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_next($id) { return $this->datev_change($id,1); @@ -2033,6 +2044,7 @@ class AccountLine extends CommonObject * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_previous($id) { return $this->datev_change($id,-1); @@ -2046,6 +2058,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_change($rowid,$sign=1) { $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2083,6 +2096,7 @@ class AccountLine extends CommonObject * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_next($id) { return $this->dateo_change($id,1); @@ -2094,6 +2108,7 @@ class AccountLine extends CommonObject * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_previous($id) { return $this->dateo_change($id,-1); @@ -2209,6 +2224,7 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -2282,4 +2298,3 @@ class AccountLine extends CommonObject } } - diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index fe56ea99504..8bb9a369ac5 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -440,6 +440,7 @@ class PaymentVarious extends CommonObject * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank; @@ -475,6 +476,7 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 05664080ed3..6bd16b62c2d 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -300,6 +300,7 @@ class Deplacement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -447,4 +448,3 @@ class Deplacement extends CommonObject } } - diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 06f33f3f69a..84cfc2e3505 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -435,8 +435,9 @@ class FactureRec extends CommonInvoice /** * Recupere les lignes de factures predefinies dans this->lines * - * @return int 1 if OK, < 0 if KO - */ + * @return int 1 if OK, < 0 if KO + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->lines=array(); @@ -1183,6 +1184,7 @@ class FactureRec extends CommonInvoice * @param int $type Type invoice * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) { global $langs; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b09c0435bcd..04ea5fa5546 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1403,6 +1403,7 @@ class Facture extends CommonInvoice * * @return int 1 if OK, < 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->lines=array(); @@ -1664,6 +1665,7 @@ class Facture extends CommonInvoice * @param int $idremise Id of absolute discount * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1765,6 +1767,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($ref_client, $notrigger=0) { global $user; @@ -2000,6 +2003,7 @@ class Facture extends CommonInvoice * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { $error=0; @@ -2057,6 +2061,7 @@ class Facture extends CommonInvoice * @param User $user Object user that change status * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { $error=0; @@ -2106,6 +2111,7 @@ class Facture extends CommonInvoice * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_canceled($user, $close_code='', $close_note='') { @@ -2466,6 +2472,7 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user,$idwarehouse=-1) { global $conf,$langs; @@ -3031,6 +3038,7 @@ class Facture extends CommonInvoice * @param int $percent Percentage * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_percent($line, $percent) { global $mysoc,$user; @@ -3128,6 +3136,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { // Clean parameters @@ -3192,6 +3201,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { if (empty($remise)) $remise=0; @@ -3397,6 +3407,7 @@ class Facture extends CommonInvoice * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') { global $conf,$user; @@ -3466,6 +3477,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_invoices($socid=0) { global $conf; @@ -3514,6 +3526,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_invoices($socid=0) { global $conf; @@ -3587,6 +3600,7 @@ class Facture extends CommonInvoice * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement($fuser, $amount=0) { @@ -3696,6 +3710,7 @@ class Facture extends CommonInvoice * @param int $did id de la demande a supprimer * @return int <0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement_delete($fuser, $did) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; @@ -3720,6 +3735,7 @@ class Facture extends CommonInvoice * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -3963,6 +3979,7 @@ class Facture extends CommonInvoice * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -4076,6 +4093,7 @@ class Facture extends CommonInvoice * * @return boolean */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_first() { return ($this->situation_counter == 1); @@ -4086,6 +4104,7 @@ class Facture extends CommonInvoice * * @return mixed -1 if error, array of previous situations */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_sits() { global $conf; @@ -4166,6 +4185,7 @@ class Facture extends CommonInvoice * @return bool Last of the cycle status * */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_last_in_cycle() { global $conf; @@ -4796,6 +4816,7 @@ class FactureLigne extends CommonInvoiceLine * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); @@ -4837,6 +4858,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $invoiceid Invoice id * @return int >= 0 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_progress($invoiceid) { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index a75de537724..1eb5dc9618b 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -337,6 +337,7 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_collectee($year = 0) { $sql = "SELECT sum(f.localtax) as amount"; @@ -375,6 +376,7 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_payee($year = 0) { @@ -416,6 +418,7 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_reglee($year = 0) { @@ -569,6 +572,7 @@ class Localtax extends CommonObject * @param int $id Id bank account * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id; @@ -629,11 +633,12 @@ class Localtax extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) - { - global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function LibStatut($status,$mode=0) + { + global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage - return ''; - } + return ''; + } } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 189afeda59f..4b548964603 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -486,6 +486,7 @@ class RemiseCheque extends CommonObject * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -538,6 +539,7 @@ class RemiseCheque extends CommonObject * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -850,8 +852,9 @@ class RemiseCheque extends CommonObject /** * Charge les proprietes ref_previous et ref_next * - * @return int <0 if KO, 0 if OK + * @return int <0 if KO, 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_id() { global $conf; @@ -895,6 +898,7 @@ class RemiseCheque extends CommonObject * @param int $date Date creation * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date) { if ($user->rights->banque->cheque) @@ -929,6 +933,7 @@ class RemiseCheque extends CommonObject * @param int $ref ref of bordereau * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_number($user, $ref) { if ($user->rights->banque->cheque) @@ -1051,6 +1056,7 @@ class RemiseCheque extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 53a17830c09..6404db12045 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -700,6 +700,7 @@ class Paiement extends CommonObject * @param int $id_bank Id compte bancaire * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; @@ -725,6 +726,7 @@ class Paiement extends CommonObject * @param int $date New date * @return int <0 if KO, 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_date($date) { if (!empty($date) && $this->statut!=1) @@ -756,6 +758,7 @@ class Paiement extends CommonObject * @param string $num New num * @return int <0 if KO, 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_num($num) { if(!empty($num) && $this->statut!=1) @@ -1119,6 +1122,7 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -1163,11 +1167,12 @@ class Paiement extends CommonObject } /** - * Load the third party of object, from id into this->thirdparty + * Load the third party of object, from id into this->thirdparty * - * @param int $force_thirdparty_id Force thirdparty id - * @return int <0 if KO, >0 if OK + * @param int $force_thirdparty_id Force thirdparty id + * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 94d5a764a38..cedc8a1431e 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -114,6 +114,7 @@ class BonPrelevement extends CommonObject * @param string $number_key number key of account number * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) { $result = 0; @@ -325,6 +326,7 @@ class BonPrelevement extends CommonObject * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_credite() { global $user,$conf; @@ -404,6 +406,7 @@ class BonPrelevement extends CommonObject * @param int $date date of action * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infocredit($user, $date) { global $conf,$langs; @@ -551,6 +554,7 @@ class BonPrelevement extends CommonObject * @param string $method method of transmision to bank * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infotrans($user, $date, $method) { global $conf,$langs; @@ -672,6 +676,7 @@ class BonPrelevement extends CommonObject * * @return double Total amount */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SommeAPrelever() { global $conf; @@ -712,6 +717,7 @@ class BonPrelevement extends CommonObject * @param int $agence dolibarr mysoc agence * @return int 0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeleteNotification($user, $action) { $result = 0; @@ -1235,6 +1244,7 @@ class BonPrelevement extends CommonObject * @param string $action notification action * @return int 0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddNotification($db, $user, $action) { $result = 0; @@ -1467,6 +1477,7 @@ class BonPrelevement extends CommonObject * @param string $rib_dom rib domiciliation * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='') { fputs($this->file, "06"); @@ -1560,6 +1571,7 @@ class BonPrelevement extends CommonObject * @param string $row_drum rib.rowid used to generate rum * @return string Return string with SEPA part DrctDbtTxInf */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { $CrLf = "\n"; @@ -1621,6 +1633,7 @@ class BonPrelevement extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteur() { fputs($this->file, "03"); @@ -1694,6 +1707,7 @@ class BonPrelevement extends CommonObject * @param string $format FRST or RCUR or ALL * @return string String with SEPA Sender */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', $format='FRST') { // SEPA INITIALISATION @@ -1809,6 +1823,7 @@ class BonPrelevement extends CommonObject * @param int $total total amount * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregTotal($total) { fputs($this->file, "08"); @@ -1882,6 +1897,7 @@ class BonPrelevement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { if (empty($this->labelstatut)) @@ -1934,4 +1950,3 @@ class BonPrelevement extends CommonObject } } - diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index fa8545c4ea2..ba7661d60e0 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -128,6 +128,7 @@ class LignePrelevement * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -173,4 +174,3 @@ class LignePrelevement return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } } - diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 87de138e63a..e18834872d9 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -200,6 +200,7 @@ class RejetPrelevement * @param Facture $fac Invoice object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _send_email($fac) { global $langs; @@ -366,4 +367,3 @@ class RejetPrelevement } } - diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 31c616ac00d..22df2a58407 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -479,6 +479,7 @@ class PaymentSalary extends CommonObject * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; @@ -577,6 +578,7 @@ class PaymentSalary extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index a44b820c8ea..fe0983d7855 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -45,7 +45,7 @@ class Cchargesociales /** */ - + public $libelle; public $deductible; public $active; @@ -56,7 +56,7 @@ class Cchargesociales /** */ - + /** * Constructor @@ -83,7 +83,7 @@ class Cchargesociales $error = 0; // Clean parameters - + if (isset($this->libelle)) { $this->libelle = trim($this->libelle); } @@ -106,14 +106,14 @@ class Cchargesociales $this->accountancy_code = trim($this->accountancy_code); } - + // Check parameters // Put here code to add control on parameters values // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - + $sql.= 'libelle,'; $sql.= 'deductible,'; $sql.= 'active,'; @@ -122,9 +122,9 @@ class Cchargesociales $sql.= 'module'; $sql.= 'accountancy_code'; - + $sql .= ') VALUES ('; - + $sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").','; $sql .= ' '.(! isset($this->deductible)?'NULL':$this->deductible).','; $sql .= ' '.(! isset($this->active)?'NULL':$this->active).','; @@ -133,7 +133,7 @@ class Cchargesociales $sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'").','; $sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'"); - + $sql .= ')'; $this->db->begin(); @@ -206,7 +206,7 @@ class Cchargesociales $obj = $this->db->fetch_object($resql); $this->id = $obj->id; - + $this->libelle = $obj->libelle; $this->deductible = $obj->deductible; $this->active = $obj->active; @@ -215,7 +215,7 @@ class Cchargesociales $this->module = $obj->module; $this->accountancy_code = $obj->accountancy_code; - + } $this->db->free($resql); @@ -247,7 +247,7 @@ class Cchargesociales dol_syslog(__METHOD__, LOG_DEBUG); // Clean parameters - + if (isset($this->libelle)) { $this->libelle = trim($this->libelle); } @@ -270,7 +270,7 @@ class Cchargesociales $this->accountancy_code = trim($this->accountancy_code); } - + // Check parameters // Put here code to add a control on parameters values @@ -454,7 +454,7 @@ class Cchargesociales $result.= $link . $this->ref . $linkend; return $result; } - + /** * Retourne le libelle du status d'un user (actif, inactif) * @@ -473,6 +473,7 @@ class Cchargesociales * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; @@ -509,8 +510,8 @@ class Cchargesociales if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } - - + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -520,7 +521,7 @@ class Cchargesociales public function initAsSpecimen() { $this->id = 0; - + $this->libelle = ''; $this->deductible = ''; $this->active = ''; @@ -529,7 +530,7 @@ class Cchargesociales $this->module = ''; $this->accountancy_code = ''; - + } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 65e6085a650..bb4fd40edc1 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -365,6 +365,7 @@ class ChargeSociales extends CommonObject * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; @@ -380,6 +381,7 @@ class ChargeSociales extends CommonObject * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; @@ -410,6 +412,7 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { global $langs; @@ -637,4 +640,3 @@ class ChargeSociales extends CommonObject $this->type_libelle = 'Social contribution label'; } } - diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 114a2e78cf1..4061cedd8c5 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -600,6 +600,7 @@ class PaymentSocialContribution extends CommonObject * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; @@ -636,6 +637,7 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -708,5 +710,3 @@ class PaymentSocialContribution extends CommonObject return $result; } } - - diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index af330910cdf..def18a6ff7a 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -354,8 +354,9 @@ class Tva extends CommonObject * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year - * @return double Amount + * @return double Amount */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_collectee($year = 0) { @@ -395,6 +396,7 @@ class Tva extends CommonObject * @param int $year Year * @return double Amount */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_payee($year = 0) { @@ -435,6 +437,7 @@ class Tva extends CommonObject * @param int $year Year * @return double Amount */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_reglee($year = 0) { @@ -626,6 +629,7 @@ class Tva extends CommonObject * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.$id_bank; @@ -790,10 +794,11 @@ class Tva extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) - { - global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function LibStatut($status,$mode=0) + { + global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage - return ''; - } + return ''; + } } diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index ba96c865d1a..1648c0ff8e2 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -72,6 +72,7 @@ abstract class ActionsContactCardCommon * @param int $id Id * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { global $conf, $langs, $user, $canvas; @@ -307,4 +308,3 @@ abstract class ActionsContactCardCommon } } - diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index bfcb5a21142..8bfca9c6dd6 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -73,6 +73,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param int $id Id * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { global $limit, $offset, $sortfield, $sortorder; @@ -129,6 +130,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { global $conf, $langs; @@ -138,4 +140,3 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->list_datas = array(); } } - diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d7df30d5ee5..ae58d0b6e4b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -142,6 +142,7 @@ class Contact extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -475,6 +476,7 @@ class Contact extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { global $conf; @@ -491,6 +493,7 @@ class Contact extends CommonObject * * @return array Tableau info des attributs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { global $conf,$langs; @@ -567,6 +570,7 @@ class Contact extends CommonObject * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_perso($id, $user=null, $notrigger=0) { $error=0; @@ -845,6 +849,7 @@ class Contact extends CommonObject * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_ref_elements() { // Compte les elements pour lesquels il est contact @@ -1184,6 +1189,7 @@ class Contact extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { global $langs; @@ -1228,6 +1234,7 @@ class Contact extends CommonObject * @param int $statut Type (0 = public, 1 = private) * @return string Label translated */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibPubPriv($statut) { global $langs; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a867d8937c9..51ce4d39d08 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -236,6 +236,7 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $line_id, $date, $date_end='', $comment='') { $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); @@ -257,6 +258,7 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $line_id, $date_end, $comment='') { $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); @@ -698,6 +700,7 @@ class Contrat extends CommonObject * * @return ContratLigne[] Return array of contract lines */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->nbofserviceswait=0; @@ -1776,6 +1779,7 @@ class Contrat extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated This function will never be used. Status of a contract is status of its lines. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_statut($user) { dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); @@ -1814,6 +1818,7 @@ class Contrat extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { global $langs; @@ -1995,6 +2000,7 @@ class Contrat extends CommonObject * @param int $statut Status of lines to get * @return array Array of line's rowid */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function array_detail($statut=-1) { $tab=array(); @@ -2071,6 +2077,7 @@ class Contrat extends CommonObject * @param string $mode "inactive" pour services a activer, "expired" pour services expires * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { global $conf, $langs; @@ -2147,6 +2154,7 @@ class Contrat extends CommonObject * * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -2561,6 +2569,7 @@ class ContratLigne extends CommonObjectLine * @param string $moreatt More attribute * @return string Libelle */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($statut,$mode,$expired=-1,$moreatt='') { global $langs; @@ -2980,6 +2989,7 @@ class ContratLigne extends CommonObjectLine * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); @@ -3099,6 +3109,7 @@ class ContratLigne extends CommonObjectLine * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $date, $date_end = '', $comment = '') { global $langs, $conf; @@ -3156,6 +3167,7 @@ class ContratLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $date_end, $comment = '', $notrigger=0) { global $langs, $conf; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f5382a91550..2c5912deee2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -834,6 +834,7 @@ class CMailFile * @param string $sourcefile Path to file to encode * @return int <0 if KO, encoded string if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _encode_file($sourcefile) { $newsourcefile=dol_osencode($sourcefile); @@ -860,6 +861,7 @@ class CMailFile * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_mail() { global $conf,$dolibarr_main_data_root; @@ -951,6 +953,7 @@ class CMailFile * * @return string headers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_smtpheaders() { global $conf; @@ -1015,6 +1018,7 @@ class CMailFile * @param array $mimefilename_list Array of mime types * @return string mime headers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_mimeheaders($filename_list, $mimefilename_list) { $mimedone=0; @@ -1043,6 +1047,7 @@ class CMailFile * @param string $msgtext Message string * @return string String content */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_body($msgtext) { global $conf; @@ -1145,6 +1150,7 @@ class CMailFile * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_files($filename_list,$mimetype_list,$mimefilename_list) { $out = ''; @@ -1190,6 +1196,7 @@ class CMailFile * @param array $images_list Tableau * @return string Chaine images encodees */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_images($images_list) { $out = ''; @@ -1222,6 +1229,7 @@ class CMailFile * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_server_port($host,$port) { global $conf; @@ -1286,6 +1294,7 @@ class CMailFile * @param string $response Response string * @return boolean true if success */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { $_retVal = true; // Indicates if Object was created or not @@ -1512,4 +1521,3 @@ class CMailFile return $ret; } } - diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 0a149feabf4..b224d4b98b6 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -198,6 +198,7 @@ class CSMSFile * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms() { global $conf,$dolibarr_main_data_root; @@ -228,6 +229,7 @@ class CSMSFile * @param int $result Result of sms sending * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms_result($result) { global $conf,$dolibarr_main_data_root; @@ -246,4 +248,3 @@ class CSMSFile } } - diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index b5f4f0e5539..f150c32f868 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -54,6 +54,7 @@ class AntiVir * @param string $file File to scan * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dol_avscan_file($file) { global $conf; @@ -170,4 +171,3 @@ class AntiVir } } - diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index d9c496add4f..6c7be963f76 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -130,6 +130,7 @@ class Canvas * @param string $ref Object ref (if id not provided) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action='view', $id=0, $ref='') { if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref); @@ -156,6 +157,7 @@ class Canvas * @param string $action Action code * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_canvas($action) { global $db, $conf, $langs, $user, $canvas; diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 9aeebd575bf..fe7a6692d9a 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -328,4 +328,4 @@ class Comment extends CommonObject return count($this->comments); } -} \ No newline at end of file +} diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 70058ae4a7c..5e8806dfedd 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -54,6 +54,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_user($user,$outputlangs) { global $conf; @@ -90,6 +91,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_mysoc($mysoc,$outputlangs) { global $conf; @@ -148,6 +150,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_thirdparty($object,$outputlangs) { global $conf; @@ -228,7 +231,9 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array of substitution key->code */ - function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') + { global $conf; if(empty($object->country) && ! empty($object->country_code)) @@ -297,6 +302,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_other($outputlangs) { global $conf; @@ -335,6 +341,7 @@ abstract class CommonDocGenerator * @param string $array_key Name of the key for return array * @return array Array of substitution */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { global $conf; @@ -480,6 +487,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_lines($line,$outputlangs) { global $conf; @@ -558,6 +566,7 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array Array of substitution */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment($object,$outputlangs,$array_key='object') { global $conf; @@ -611,12 +620,13 @@ abstract class CommonDocGenerator /** - * Define array with couple substitution key => substitution value + * Define array with couple substitution key => substitution value * - * @param array $line Array of lines - * @param Translate $outputlangs Lang object to use for output - * @return array Substitution array + * @param array $line Array of lines + * @param Translate $outputlangs Lang object to use for output + * @return array Substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment_lines($line,$outputlangs) { global $conf; @@ -652,6 +662,7 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) { $array_other = array(); if(!empty($object)) { @@ -680,6 +691,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) { global $conf; @@ -775,4 +787,3 @@ abstract class CommonDocGenerator $pdf->line($x, $y+$h, $x, $y); } } - diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 9bab103d2e4..54d9aed45e9 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -337,6 +337,7 @@ abstract class CommonInvoice extends CommonObject * * @return int <=0 if no, >0 if yes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_erasable() { global $conf; @@ -459,6 +460,7 @@ abstract class CommonInvoice extends CommonObject * @param int $type Type invoice * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=0) { global $langs; @@ -585,8 +587,9 @@ abstract class CommonInvoice extends CommonObject * conditions de reglements de la facture et date de facturation * * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. - * @return date Date limite de reglement si ok, <0 si ko + * @return date Date limite de reglement si ok, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calculate_date_lim_reglement($cond_reglement=0) { if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; @@ -776,4 +779,3 @@ abstract class CommonInvoiceLine extends CommonObjectLine $this->db = $db; } } - diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 72ef472229d..b6b27708ffa 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -687,6 +687,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) { global $user,$langs; @@ -807,6 +808,7 @@ abstract class CommonObject * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function copy_linked_contact($objFrom, $source='internal') { $contacts = $objFrom->liste_contact(-1, $source); @@ -830,6 +832,7 @@ abstract class CommonObject * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) { // Insert into database @@ -857,6 +860,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_contact($rowid, $notrigger=0) { global $user; @@ -894,6 +898,7 @@ abstract class CommonObject * @param string $code Type of contact (code or id) * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_linked_contact($source='',$code='') { $temp = array(); @@ -931,6 +936,7 @@ abstract class CommonObject * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array Array of contacts */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_contact($statut=-1,$source='external',$list=0,$code='') { global $langs; @@ -1040,6 +1046,7 @@ abstract class CommonObject * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_type_contact($source='internal', $order='position', $option=0, $activeonly=0, $code='') { global $langs; @@ -1149,6 +1156,7 @@ abstract class CommonObject * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_contact($contactid=null) { if (empty($contactid)) $contactid=$this->contactid; @@ -1168,6 +1176,7 @@ abstract class CommonObject * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { global $conf; @@ -1230,6 +1239,7 @@ abstract class CommonObject * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_barcode() { global $conf; @@ -1277,6 +1287,7 @@ abstract class CommonObject * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_projet() { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -1297,6 +1308,7 @@ abstract class CommonObject * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product() { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -1316,6 +1328,7 @@ abstract class CommonObject * @param int $userid Id du contact * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_user($userid) { $user = new User($this->db); @@ -1329,6 +1342,7 @@ abstract class CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_origin() { if ($this->origin == 'shipping') $this->origin = 'expedition'; @@ -1498,6 +1512,7 @@ abstract class CommonObject * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_ref($filter, $fieldid, $nodbprefix=0) { global $conf, $user; @@ -2134,6 +2149,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true) { if (! $this->table_element_line) @@ -2251,6 +2267,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_up($rowid, $fk_parent_line=true) { $this->line_order(false, 'ASC', $fk_parent_line); @@ -2269,6 +2286,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_down($rowid, $fk_parent_line=true) { $this->line_order(false, 'ASC', $fk_parent_line); @@ -2311,6 +2329,7 @@ abstract class CommonObject * @param array $rows Array of rows * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_ajaxorder($rows) { $num = count($rows); @@ -2426,6 +2445,7 @@ abstract class CommonObject * @param int $fk_parent_line Parent line id * @return int Max value of rang in table of lines */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_max($fk_parent_line=0) { // Search the last rang with fk_parent_line @@ -2472,6 +2492,7 @@ abstract class CommonObject * @param string $ref_ext Update field ref_ext * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ref_ext($ref_ext) { if (! $this->table_element) @@ -2504,7 +2525,8 @@ abstract class CommonObject * @param string $suffix '', '_public' or '_private' * @return int <0 if KO, >0 if OK */ - function update_note($note,$suffix='') + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function update_note($note, $suffix='') { global $user; @@ -2556,6 +2578,7 @@ abstract class CommonObject * @deprecated * @see update_note() */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_note_public($note) { return $this->update_note($note,'_public'); @@ -2571,6 +2594,7 @@ abstract class CommonObject * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) { global $conf, $hookmanager, $action; @@ -2807,6 +2831,7 @@ abstract class CommonObject * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked, updateObjectLinked, deleteObjectLinked */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_object_linked($origin=null, $origin_id=null) { $origin = (! empty($origin) ? $origin : $this->origin); @@ -3565,6 +3590,7 @@ abstract class CommonObject * * @return string incoterms info */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_incoterms() { $out = ''; @@ -4176,6 +4202,7 @@ abstract class CommonObject * @param int $mandatory Mandatory or not * @return int <=0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0) { $this->db->begin(); @@ -4218,6 +4245,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_resource($rowid, $element, $notrigger=0) { global $user; @@ -4603,6 +4631,7 @@ abstract class CommonObject * @param User $user Object user * @return int Result of run_triggers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { global $langs,$conf; @@ -4637,6 +4666,7 @@ abstract class CommonObject * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_optionals($rowid=null, $optionsArray=null) { if (empty($rowid)) $rowid=$this->id; @@ -6414,6 +6444,7 @@ abstract class CommonObject * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_photos($modulepart, $sdir, $size=0, $nbmax=0, $nbbyrow=5, $showfilename=0, $showaction=0, $maxHeight=120, $maxWidth=160, $nolink=0, $notitle=0, $usesharelink=0) { global $conf,$user,$langs; diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 1091962f6ea..9c5d5f9046b 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -62,7 +62,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; abstract class CommonStickerGenerator { - public $code; // Code of format + public $code; // Code of format public $format; // Array with informations // protected @@ -93,7 +93,7 @@ abstract class CommonStickerGenerator { $this->db = $db; } - + /** * Function to build PDF on disk, then output on HTTP strem. * @@ -103,6 +103,7 @@ abstract class CommonStickerGenerator * @param string $outputdir Output directory for pdf file * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir=''); /** @@ -114,7 +115,7 @@ abstract class CommonStickerGenerator * @return void */ abstract function addSticker(&$pdf,$outputlangs,$param); - + /** * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne @@ -123,6 +124,7 @@ abstract class CommonStickerGenerator * @param int $pt point * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Set_Char_Size(&$pdf,$pt) { if ($pt > 3) { @@ -130,7 +132,7 @@ abstract class CommonStickerGenerator $this->_Line_Height = $this->_Get_Height_Chars($pt); $pdf->SetFont('','',$pt); } - } + } /** * protected Print dot line @@ -144,6 +146,7 @@ abstract class CommonStickerGenerator * @param int $nbPointilles Nb pointilles * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15) { $pdf->SetLineWidth($epaisseur); @@ -185,6 +188,7 @@ abstract class CommonStickerGenerator * @param int $taille Size * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) { $pdf->SetDrawColor(192,192,192); @@ -216,6 +220,7 @@ abstract class CommonStickerGenerator * @param string $dest to * @return float value value after conversion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Convert_Metric ($value, $src, $dest) { if ($src != $dest) { @@ -233,6 +238,7 @@ abstract class CommonStickerGenerator * @param int $pt Point * @return int Height chars */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Get_Height_Chars($pt) { // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes @@ -251,19 +257,20 @@ abstract class CommonStickerGenerator * @param string $format Format * @return void */ - function _Set_Format(&$pdf, $format) + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function _Set_Format(&$pdf, $format) { - $this->_Metric = $format['metric']; - $this->_Avery_Name = $format['name']; - $this->_Avery_Code = $format['code']; + $this->_Metric = $format['metric']; + $this->_Avery_Name = $format['name']; + $this->_Avery_Code = $format['code']; $this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); - $this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); - $this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); - $this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc); - $this->_X_Number = $format['NX']; - $this->_Y_Number = $format['NY']; - $this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc); - $this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc); + $this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); + $this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); + $this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc); + $this->_X_Number = $format['NX']; + $this->_Y_Number = $format['NY']; + $this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc); + $this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc); $this->Set_Char_Size($pdf, $format['font-size']); } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9fc1921aa60..9d9b6a1c96a 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -341,6 +341,7 @@ class DiscountAbsolute * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduc payment of invoice) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function link_to_invoice($rowidline,$rowidinvoice) { // Check parameters @@ -392,6 +393,7 @@ class DiscountAbsolute * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function unlink_invoice() { $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 860d89afea8..cd508c23310 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -149,6 +149,7 @@ class DolEditor * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='') { global $conf,$langs; @@ -347,4 +348,3 @@ class DolEditor } } - diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index f40d30f389e..28fbe14f287 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -130,6 +130,7 @@ class DolGraph * @param float $which_prec Precision * @return boolean */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetPrecisionY($which_prec) { $this->PrecisionY = $which_prec; @@ -142,6 +143,7 @@ class DolGraph * @param float $xi Xi * @return boolean True */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHorizTickIncrement($xi) { $this->horizTickIncrement = $xi; @@ -154,6 +156,7 @@ class DolGraph * @param float $xt Xt * @return boolean True */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetNumXTicks($xt) { $this->SetNumXTicks = $xt; @@ -166,6 +169,7 @@ class DolGraph * @param float $x Label interval * @return boolean True */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLabelInterval($x) { $this->labelInterval = $x; @@ -178,6 +182,7 @@ class DolGraph * @param boolean $bool XGrid or not * @return boolean true */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideXGrid($bool) { $this->hideXGrid = $bool; @@ -190,6 +195,7 @@ class DolGraph * @param boolean $bool YGrid or not * @return boolean true */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideYGrid($bool) { $this->hideYGrid = $bool; @@ -202,6 +208,7 @@ class DolGraph * @param string $label Y label * @return boolean|null True */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetYLabel($label) { $this->YLabel = $label; @@ -213,6 +220,7 @@ class DolGraph * @param int $w Width * @return boolean|null True */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetWidth($w) { $this->width = $w; @@ -224,6 +232,7 @@ class DolGraph * @param string $title Title * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetTitle($title) { $this->title = $title; @@ -236,6 +245,7 @@ class DolGraph * @return void * @see draw_jflot for syntax of data array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetData($data) { $this->data = $data; @@ -247,6 +257,7 @@ class DolGraph * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetDataColor($datacolor) { $this->datacolor = $datacolor; @@ -258,6 +269,7 @@ class DolGraph * @param array $type Array with type for each serie. Example: array('pie'), array('lines',...,'bars') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetType($type) { $this->type = $type; @@ -269,6 +281,7 @@ class DolGraph * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegend($legend) { $this->Legend = $legend; @@ -280,6 +293,7 @@ class DolGraph * @param int $legendwidthmin Min width * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegendWidthMin($legendwidthmin) { $this->LegendWidthMin = $legendwidthmin; @@ -291,6 +305,7 @@ class DolGraph * @param int $max Max value * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMaxValue($max) { $this->MaxValue = $max; @@ -301,6 +316,7 @@ class DolGraph * * @return int Max value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValue() { return $this->MaxValue; @@ -312,6 +328,7 @@ class DolGraph * @param int $min Min value * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMinValue($min) { $this->MinValue = $min; @@ -322,6 +339,7 @@ class DolGraph * * @return int Max value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValue() { return $this->MinValue; @@ -333,6 +351,7 @@ class DolGraph * @param int $h Height * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHeight($h) { $this->height = $h; @@ -344,6 +363,7 @@ class DolGraph * @param string $s Shading * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetShading($s) { $this->SetShading = $s; @@ -355,6 +375,7 @@ class DolGraph * @param string $s Shading * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetCssPrefix($s) { $this->cssprefix = $s; @@ -365,6 +386,7 @@ class DolGraph * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColor() { unset($this->bgcolor); @@ -375,6 +397,7 @@ class DolGraph * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColorGrid() { unset($this->bgcolorgrid); @@ -431,6 +454,7 @@ class DolGraph * @param array $bg_color array(R,G,B) ou 'onglet' ou 'default' * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColor($bg_color = array(255,255,255)) { global $theme_bgcolor,$theme_bgcoloronglet; @@ -459,6 +483,7 @@ class DolGraph * @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColorGrid($bg_colorgrid = array(255,255,255)) { global $theme_bgcolor,$theme_bgcoloronglet; @@ -486,6 +511,7 @@ class DolGraph * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetDataColor() { unset($this->datacolor); @@ -496,6 +522,7 @@ class DolGraph * * @return int Max value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValueInData() { $k = 0; @@ -521,6 +548,7 @@ class DolGraph * * @return int Min value of all data */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValueInData() { $k = 0; @@ -546,6 +574,7 @@ class DolGraph * * @return int Max value of all data */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetCeilMaxValue() { $max = $this->GetMaxValueInData(); @@ -569,6 +598,7 @@ class DolGraph * * @return double Max value of all data */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetFloorMinValue() { $min = $this->GetMinValueInData(); @@ -625,6 +655,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function draw_artichow($file,$fileurl) { global $artichow_defaultfont; @@ -813,6 +844,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function draw_jflot($file,$fileurl) { global $artichow_defaultfont; @@ -1095,4 +1127,3 @@ class DolGraph } } - diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 2499176b58b..91906497e9f 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -45,7 +45,7 @@ * Cut ticket partially * Open cash drawer * Activate buzzer - * + * * Code which can be placed everywhere * Print QR Code * Print date AAAA-MM-DD @@ -94,7 +94,7 @@ require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/Escpos.php'; - + /** * Class to manage Receipt Printers */ @@ -300,16 +300,16 @@ class dolReceiptPrinter extends Escpos function selectTypePrinter($selected='', $htmlname='printertypeid') { global $langs; - + $options = array( 1 => $langs->trans('CONNECTOR_DUMMY'), 2 => $langs->trans('CONNECTOR_FILE_PRINT'), 3 => $langs->trans('CONNECTOR_NETWORK_PRINT'), 4 => $langs->trans('CONNECTOR_WINDOWS_PRINT') ); - + $this->resprint = Form::selectarray($htmlname, $options, $selected); - + return 0; } @@ -324,7 +324,7 @@ class dolReceiptPrinter extends Escpos function selectProfilePrinter($selected='', $htmlname='printerprofileid') { global $langs; - + $options = array( 0 => $langs->trans('PROFILE_DEFAULT'), 1 => $langs->trans('PROFILE_SIMPLE'), @@ -332,7 +332,7 @@ class dolReceiptPrinter extends Escpos 3 => $langs->trans('PROFILE_P822D'), 4 => $langs->trans('PROFILE_STAR') ); - + $this->profileresprint = Form::selectarray($htmlname, $options, $selected); return 0; } @@ -347,6 +347,7 @@ class dolReceiptPrinter extends Escpos * @param string $parameter Printer parameter * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddPrinter($name, $type, $profile, $parameter) { global $conf; @@ -372,6 +373,7 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdatePrinter($name, $type, $profile, $parameter, $printerid) { global $conf; @@ -396,6 +398,7 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeletePrinter($printerid) { global $conf; @@ -418,6 +421,7 @@ class dolReceiptPrinter extends Escpos * @param int $templateid Template id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdateTemplate($name, $template, $templateid) { global $conf; @@ -441,6 +445,7 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendTestToPrinter($printerid) { global $conf; @@ -477,6 +482,7 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendToPrinter($object, $templateid, $printerid) { global $conf; @@ -520,11 +526,11 @@ class dolReceiptPrinter extends Escpos $ret = $this->InitPrinter($printerid); if ($ret>0) { setEventMessages($this->error, $this->errors, 'errors'); - } - else + } + else { $nboflines = count($vals); - for ($line=0; $line < $nboflines; $line++) + for ($line=0; $line < $nboflines; $line++) { switch ($vals[$line]['tag']) { case 'DOL_ALIGN_CENTER': @@ -638,6 +644,7 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InitPrinter($printerid) { global $conf; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 7f34165030b..e4ede83a158 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -314,6 +314,7 @@ class EmailSenderProfile extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 62122ed636c..fb6906c3456 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -748,6 +748,7 @@ class ExtraFields * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required. * @return array Array of attributes keys+label for all extra fields. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_name_optionals_label($elementtype,$forceload=false) { global $conf; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 987033d35e3..a14b541e34b 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -245,6 +245,7 @@ class Fiscalyear extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php index c89b5c31fea..49b767a6f3d 100644 --- a/htdocs/core/class/genericobject.class.php +++ b/htdocs/core/class/genericobject.class.php @@ -29,15 +29,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class GenericObject extends CommonObject { - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db=$db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db=$db; + } } - diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6fe2dffd3d3..13978b5f0cd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -658,6 +658,7 @@ class Form * @param int $disablefavorites Disable favorites * @return string HTML string with select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0) { global $conf,$langs; @@ -753,6 +754,7 @@ class Form * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with select and input */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_incoterms($selected='', $location_incoterms='', $page='', $htmlname='incoterm_id', $htmloption='', $forcecombo=1, $events=array()) { global $conf,$langs; @@ -844,6 +846,7 @@ class Form * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0) { global $db,$langs,$user,$conf; @@ -893,6 +896,7 @@ class Form * * @return int Nb of lines loaded, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_fees() { global $langs; @@ -943,6 +947,7 @@ class Form * @param int $showempty Add an empty field * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees($selected='',$htmlname='type',$showempty=0) { global $user, $langs; @@ -985,6 +990,7 @@ class Form * @return string Return select box for thirdparty. * @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0) { return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0, $limit); @@ -1009,6 +1015,7 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @return string HTML string with select box for thirdparty. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false) { global $conf,$user,$langs; @@ -1071,6 +1078,7 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML string with */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false) { global $conf,$user,$langs; @@ -1242,6 +1250,7 @@ class Form * @param int $maxvalue Max value for lines that can be selected * @return int Return number of qualifed lines in list */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) { global $langs,$conf; @@ -1327,6 +1336,7 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprected You can use selectcontacts directly (warning order of param was changed) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $events=array(), $options_only=false, $moreparam='', $htmlid='') { print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); @@ -1481,6 +1491,7 @@ class Form * @deprecated Use select_dolusers instead * @see select_dolusers() */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity='0') { print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); @@ -1509,6 +1520,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false) { global $conf,$user,$langs; @@ -1715,6 +1727,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) { global $conf, $user, $langs; @@ -1806,6 +1819,7 @@ class Form * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array()) { global $langs,$conf; @@ -1946,6 +1960,7 @@ class Form * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return array Array of keys for json */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') { global $langs,$conf,$user,$db; @@ -2422,6 +2437,7 @@ class Form * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0) { global $langs,$conf; @@ -2465,6 +2481,7 @@ class Form * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return array Array of keys for json */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0) { global $langs,$conf,$db; @@ -2687,6 +2704,7 @@ class Form * @param int $selected_supplier Pre-selected supplier if more than 1 result * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_product_fourn_price($productid, $htmlname='productfournpriceid', $selected_supplier='') { global $langs,$conf; @@ -2799,6 +2817,7 @@ class Form * @param int $showempty Add an empty field * @return integer|null */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_address($selected, $socid, $htmlname='address_id',$showempty=0) { // On recherche les utilisateurs @@ -2847,6 +2866,7 @@ class Form * * @return int Nb of lines loaded, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_conditions_paiements() { global $langs; @@ -2894,6 +2914,7 @@ class Form * * @return int Nb of lines loaded, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_availability() { global $langs; @@ -3060,6 +3081,7 @@ class Form * * @return int Nb of lines loaded, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_paiements() { global $langs; @@ -3120,6 +3142,7 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='') { global $langs, $user, $conf; @@ -3165,6 +3188,7 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') { global $langs,$user; @@ -3438,6 +3462,7 @@ class Form * @param int $showcurrency Show currency in label * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0) { global $langs, $conf; @@ -3541,6 +3566,7 @@ class Form * @return string * @see select_categories */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0) { global $conf, $langs; @@ -3630,6 +3656,7 @@ class Form * @deprecated * @see formconfirm() */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); @@ -3940,6 +3967,7 @@ class Form * @param int $nooutput No print is done. String is returned. * @return string Return html content */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) { global $langs; @@ -3994,6 +4022,7 @@ class Form * @param int $addempty Add empty entry * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) { global $langs; @@ -4027,6 +4056,7 @@ class Form * @param int $addempty Ajoute entree vide * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_availability($page, $selected='', $htmlname='availability', $addempty=0) { global $langs; @@ -4104,6 +4134,7 @@ class Form * @return string * @see select_date */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) { global $langs; @@ -4143,6 +4174,7 @@ class Form * @param array $include List of users id to include * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_users($page, $selected='', $htmlname='userid', $exclude='', $include='') { global $langs; @@ -4181,6 +4213,7 @@ class Form * @param int $active Active or not, -1 = all * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1) { global $langs; @@ -4213,6 +4246,7 @@ class Form * @param string $htmlname Name of select html field * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_code') { global $langs; @@ -4241,6 +4275,7 @@ class Form * @param string $currency Currency code to explain the rate * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { global $langs, $mysoc, $conf; @@ -4288,6 +4323,7 @@ class Form * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0, $discount_type=0) { global $conf,$langs; @@ -4377,6 +4413,7 @@ class Form * @param string $htmlname Name of HTML select. If 'none', we just show contact link. * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_contacts($page, $societe, $selected='', $htmlname='contactid') { global $langs, $conf; @@ -4425,6 +4462,7 @@ class Form * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array()) { global $langs; @@ -4461,6 +4499,7 @@ class Form * @param string $htmlname name of HTML select list * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_currency($selected='',$htmlname='currency_id') { print $this->selectCurrency($selected,$htmlname); @@ -4571,6 +4610,7 @@ class Form * @param string $country_code Country code with quotes ("'CA'", or "'CA,IN,...'") * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_vatrates($country_code) { global $langs; @@ -4651,6 +4691,7 @@ class Form * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) { global $langs,$conf,$mysoc; @@ -4840,6 +4881,7 @@ class Form * @return string|null Nothing or string if nooutput is 1 * @see form_date, select_month, select_year, select_dayofweek */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { global $conf,$langs; @@ -5206,6 +5248,7 @@ class Form * @param int $nooutput Do not output html string but return it * @return string|null */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { global $langs; @@ -6400,6 +6443,7 @@ class Form * @param int $useempty Affiche valeur vide dans liste * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0) { @@ -6780,6 +6824,7 @@ class Form * @return string * @see select_dolusers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false) { global $conf,$user,$langs; @@ -7109,4 +7154,3 @@ class Form } } - diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 17e437f5223..f32def70ea6 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -62,6 +62,7 @@ class FormAccounting extends Form * @param int $disabledajaxcombo Disable ajax combo box. * @return string String with HTML select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0) { global $conf,$langs; @@ -141,6 +142,7 @@ class FormAccounting extends Form * @param int $allcountries All countries * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_accounting_category($selected='',$htmlname='account_category', $useempty=0, $maxlen=0, $help=1, $allcountries=0) { global $db,$langs,$user,$mysoc; @@ -216,6 +218,7 @@ class FormAccounting extends Form * @param string $selectedkey Value * @return string HTML edit field */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { $options = array(); @@ -252,6 +255,7 @@ class FormAccounting extends Form * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @return string String with HTML select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') { global $conf, $langs; @@ -339,6 +343,7 @@ class FormAccounting extends Form * @param string $morecss More css * @return string String with HTML select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') { $aux_account = array(); @@ -398,6 +403,7 @@ class FormAccounting extends Form * @param string $output_format (html/opton (for option html only)/array (to return options arrays * @return string/array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') { global $conf; @@ -428,4 +434,3 @@ class FormAccounting extends Form } } } - diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 451ee0d700d..51e873485fd 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -57,6 +57,7 @@ class FormActions * @param string $morecss More css on select field * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_select_status_action($formname, $selected, $canedit=1, $htmlname='complete', $showempty=0, $onlyselect=0, $morecss='maxwidth100') { global $langs,$conf; @@ -318,6 +319,7 @@ class FormActions * @param int $nooutput 1=No output * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_actions($selected='', $htmlname='actioncode', $excludetype='', $onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0) { global $langs,$user,$form,$conf; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index fd0470c63f4..111852f2c38 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -57,7 +57,8 @@ class FormAdmin * @param string $morecss Add more css styles * @param int $showcode Add language code into label * @return string Return HTML select string with list of languages - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter=null, $showempty='', $showwarning=0, $disabled=0, $morecss='', $showcode=0) { global $langs; @@ -124,6 +125,7 @@ class FormAdmin * @param string $moreattrib More attributes on html select tag * @return integer|null */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') { global $langs,$conf; @@ -212,6 +214,7 @@ class FormAdmin * @param string[] $dirmenuarray Directories to scan * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_menu_families($selected, $htmlname, $dirmenuarray) { global $langs,$conf; @@ -282,6 +285,7 @@ class FormAdmin * @param string $htmlname Nom de la zone select * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_timezone($selected,$htmlname) { global $langs,$conf; @@ -328,14 +332,15 @@ class FormAdmin /** - * Return html select list with available languages (key='en_US', value='United States' for example) + * Return html select list with available languages (key='en_US', value='United States' for example) * - * @param string $selected Paper format pre-selected - * @param string $htmlname Name of HTML select field - * @param string $filter Value to filter on code - * @param int $showempty Add empty value - * @return string Return HTML output + * @param string $selected Paper format pre-selected + * @param string $htmlname Name of HTML select field + * @param string $filter Value to filter on code + * @param int $showempty Add empty value + * @return string Return HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_paper_format($selected='',$htmlname='paperformat_id',$filter=0,$showempty=0) { global $langs; diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index dba8c5d24e5..3e29a7d92f4 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -104,6 +104,7 @@ class FormBarCode * @param int $useempty Affiche valeur vide dans liste * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_barcode_type($selected='',$htmlname='barcodetype_id',$useempty=0) { global $langs,$conf; @@ -163,6 +164,7 @@ class FormBarCode * @param string $htmlname Nom du formulaire select * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_barcode_type($page, $selected='', $htmlname='barcodetype_id') { global $langs,$conf; @@ -181,4 +183,3 @@ class FormBarCode } } - diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 86105133c4c..2e5658d6757 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -35,7 +35,6 @@ class FormCompany var $error; - /** * Constructor * @@ -56,6 +55,7 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function typent_array($mode=0, $filter='') { global $langs,$mysoc; @@ -97,6 +97,7 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types d'effectifs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function effectif_array($mode=0, $filter='') { $effs = array(); @@ -137,6 +138,7 @@ class FormCompany * @param int $empty Add empty value in list * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0) { global $user, $langs; @@ -189,6 +191,7 @@ class FormCompany * @param string $htmlname Id of department * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_departement($selected='',$country_codeid=0, $htmlname='state_id') { print $this->select_state($selected,$country_codeid, $htmlname); @@ -207,6 +210,7 @@ class FormCompany * @return string String with HTML select * @see select_country */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_state($selected='',$country_codeid=0, $htmlname='state_id') { global $conf,$langs,$user; @@ -316,6 +320,7 @@ class FormCompany * @param string $htmlname Name of HTML select field * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_region($selected='',$htmlname='region_id') { global $conf,$langs; @@ -380,6 +385,7 @@ class FormCompany * @param string $morecss Add more css on SELECT element * @return string String with HTML select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_civility($selected='',$htmlname='civility_id',$morecss='maxwidth100') { global $conf,$langs,$user; @@ -439,6 +445,7 @@ class FormCompany * @deprecated Use print xxx->select_juridicalstatus instead * @see select_juridicalstatus() */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_forme_juridique($selected='', $country_codeid=0, $filter='') { print $this->select_juridicalstatus($selected, $country_codeid, $filter); @@ -454,6 +461,7 @@ class FormCompany * @param string $htmlname HTML name of select * @return string String with HTML select */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code') { global $conf,$langs,$user; @@ -750,6 +758,7 @@ class FormCompany * @param string $morecss More css * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='',$morecss='') { global $conf; @@ -779,6 +788,7 @@ class FormCompany * @param string $morecss More css * @return string HTML string with prof id */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_input_id_prof($idprof,$htmlname,$preselected,$country_code,$morecss='maxwidth100onsmartphone quatrevingtpercent') { global $conf,$langs; @@ -827,6 +837,7 @@ class FormCompany * @param string $htmlname HTML select name * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_localtax($local, $selected, $htmlname) { $tax=get_localtax_by_third($local); @@ -861,4 +872,3 @@ class FormCompany } } - diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index a3a3696e5f4..bf4f46ad229 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -52,6 +52,7 @@ class FormContract * @param int $showempty Show empty line * @return int Nbr of project if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) { global $db,$user,$conf,$langs; @@ -67,14 +68,14 @@ class FormContract if ($socid > 0) { // CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. - if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) + if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; $sql.= " OR c.fk_soc IS NULL)"; } - } + } if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; $sql.= " ORDER BY c.ref "; @@ -140,14 +141,14 @@ class FormContract } print ''; $db->free($resql); - + if (!empty($conf->use_javascript_ajax)) { // Make select dynamic include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; print ajax_combobox($htmlname); } - + return $num; } else @@ -156,7 +157,7 @@ class FormContract return -1; } } - + /** * Show a form to select a contract * @@ -168,10 +169,10 @@ class FormContract * @param int $showempty Show empty line * @return int Nbr of project if OK, <0 if KO */ - function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) - { - global $langs; - + function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) + { + global $langs; + print "\n"; print '
'; print ''; @@ -179,6 +180,6 @@ class FormContract $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty); print ''; print '
'; - } - + } + } diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 255868f02a5..87cc16e6eac 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -51,6 +51,7 @@ class FormCron extends Form * @param integer $readonly Select is read only or not * @return string HTML select field */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_typejob($htmlname,$selected=0,$readonly=0) { global $langs; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7c457accadf..f3092bf87b2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -73,6 +73,7 @@ class FormFile * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='', $sectiondir='') { global $conf,$langs, $hookmanager; @@ -248,6 +249,7 @@ class FormFile * @return int <0 if KO, number of shown files if OK * @deprecated Use print xxx->showdocuments() instead. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') { $this->numoffiles=0; @@ -1003,6 +1005,7 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_autoecmfiles */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0) { global $user, $conf, $langs, $hookmanager; @@ -1390,6 +1393,7 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_documents */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0) { global $user, $conf, $langs, $form; @@ -1828,4 +1832,3 @@ class FormFile } } - diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index b675ba6e674..5502d870005 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -52,6 +52,7 @@ class FormIntervention * @param int $showempty Show empty line * @return int Nbre of project if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_interventions($socid=-1, $selected='', $htmlname='interventionid', $maxlength=16, $showempty=1) { global $db,$user,$conf,$langs; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 4ce4bfee824..361f8370b78 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -132,6 +132,7 @@ class FormMail extends Form * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clear_attached_files() { global $conf,$user; @@ -156,6 +157,7 @@ class FormMail extends Form * @param string $type Mime type (can be dol_mimetype($file)) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_attached_files($path, $file='', $type='') { $listofpaths=array(); @@ -186,6 +188,7 @@ class FormMail extends Form * @param string $keytodelete Key in file array (0, 1, 2, ...) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_attached_files($keytodelete) { $listofpaths=array(); @@ -213,6 +216,7 @@ class FormMail extends Form * * @return array array('paths'=> ,'names'=>, 'mimes'=> ) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_attached_files() { $listofpaths=array(); @@ -235,6 +239,7 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_form($addfileaction='addfile',$removefileaction='removefile') { print $this->get_form($addfileaction,$removefileaction); @@ -250,6 +255,7 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return string Form to show */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_form($addfileaction='addfile', $removefileaction='removefile') { global $conf, $langs, $user, $hookmanager, $form; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 69fe03ecaa1..0a31d53d7c5 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -64,7 +64,8 @@ class FormOther * @param int $fk_user Utilisateur créant le modèle * @return void */ - function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0, $fk_user=null) + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null) { $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; @@ -114,7 +115,8 @@ class FormOther * @param int $useempty Affiche valeur vide dans liste * @return void */ - function select_import_model($selected='',$htmlname='importmodelid',$type='',$useempty=0) + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0) { $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."import_model"; @@ -161,7 +163,8 @@ class FormOther * @param string $htmlname Name of combo list * @return integer */ - function select_ecotaxes($selected='',$htmlname='ecotaxe_id') + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function select_ecotaxes($selected='', $htmlname='ecotaxe_id') { global $langs; @@ -218,7 +221,8 @@ class FormOther * @param string $country_code Country Code * @return string HTML select list */ - function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='') + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='') { global $langs; @@ -279,6 +283,7 @@ class FormOther * @param int $showempty Add also an empty line * @return string HTML select string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0) { $return = ''; } } - diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 6db6f200136..4bf80cb7d00 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -89,6 +89,7 @@ class FormSms * @param int $showform Show form tags and submit button (recommanded is to use with value 0) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_form($morecss='titlefield', $showform=1) { global $conf, $langs, $user, $form; @@ -356,4 +357,3 @@ function limitChars(textarea, limit, infodiv) } } - diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index 83886e63af8..fc86d7a05cd 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -53,6 +53,7 @@ class FormSocialContrib * @param string $morecss Add more CSS on select * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_socialcontrib($selected='',$htmlname='actioncode', $useempty=0, $maxlen=40, $help=1, $morecss='minwidth300') { global $conf,$db,$langs,$user,$mysoc; @@ -115,4 +116,3 @@ class FormSocialContrib } } - diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 655969d73f6..3a8a147f4db 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -56,6 +56,7 @@ class Interfaces * @param Conf $conf Objet conf * @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function run_triggers($action,$object,$user,$langs,$conf) { // Check parameters diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index f54caacff8b..1b3e667c68d 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -147,6 +147,7 @@ class Ldap * * @return int <0 if KO, 1 if bind anonymous, 2 if bind auth */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function connect_bind() { global $langs, $conf; @@ -650,6 +651,7 @@ class Ldap * @param array $info Attributes array * @return string Content of file */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_content($dn, $info) { $content=''; @@ -1429,6 +1431,7 @@ class Ldap * @param string $value AD time to convert * @return integer Unix timestamp */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function convert_time($value) { $dateLargeInt=$value; // nano secondes depuis 1601 !!!! diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index 17d5e06589f..b1ecbbf483c 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -73,7 +73,7 @@ class Menu /** * Insert a menu entry into this->liste * - * @param int $idafter Array key after which inserting new entry + * @param int $idafter Array key after which inserting new entry * @param string $url Url to follow on click * @param string $titre Label of menu to add * @param integer $level Level of menu to add @@ -101,9 +101,12 @@ class Menu * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_last() { - if (count($this->liste) > 1) array_pop($this->liste); + if (count($this->liste) > 1) { + array_pop($this->liste); + } } /** diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index d46481a0c60..8edd5911bad 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -51,6 +51,7 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetOpenIDServer($a) { $this->URLs['openid_server'] = $a; @@ -62,6 +63,7 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetTrustRoot($a) { $this->URLs['trust_root'] = $a; @@ -73,6 +75,7 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetCancelURL($a) { $this->URLs['cancel'] = $a; @@ -84,6 +87,7 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetApprovedURL($a) { $this->URLs['approved'] = $a; @@ -95,11 +99,12 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetRequiredFields($a) { - if (is_array($a)){ + if (is_array($a)) { $this->fields['required'] = $a; - }else{ + } else { $this->fields['required'][] = $a; } } @@ -110,11 +115,12 @@ class SimpleOpenID * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetOptionalFields($a) { - if (is_array($a)){ + if (is_array($a)) { $this->fields['optional'] = $a; - }else{ + } else { $this->fields['optional'][] = $a; } } @@ -122,13 +128,14 @@ class SimpleOpenID /** * SetIdentity * - * @param string $a Server + * @param string $a Server * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetIdentity($a) { // Set Identity URL if ((stripos($a, 'http://') === false) - && (stripos($a, 'https://') === false)){ + && (stripos($a, 'https://') === false)) { $a = 'http://'.$a; } /* @@ -152,8 +159,9 @@ class SimpleOpenID * * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetIdentity() - { // Get Identity + { return $this->openid_url_identity; } @@ -162,6 +170,7 @@ class SimpleOpenID * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetError() { $e = $this->error; @@ -175,6 +184,7 @@ class SimpleOpenID * @param string $desc Description * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ErrorStore($code, $desc = null) { $errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.'; @@ -189,6 +199,7 @@ class SimpleOpenID * * @return boolean */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function IsError() { if (count($this->error) > 0) @@ -227,6 +238,7 @@ class SimpleOpenID * @param string $openid_identity Server * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function OpenID_Standarize($openid_identity = null) { if ($openid_identity === null) @@ -273,6 +285,7 @@ class SimpleOpenID * @param string $params Params * @return boolean|unknown */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function FSOCK_Request($url, $method="GET", $params = "") { $fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds @@ -305,6 +318,7 @@ class SimpleOpenID * @param string $params Params * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function CURL_Request($url, $method="GET", $params = "") { // Remember, SSL MUST BE SUPPORTED if (is_array($params)) $params = $this->array2url($params); @@ -333,6 +347,7 @@ class SimpleOpenID * @param string $content Content * @return array Array of servers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function HTML2OpenIDServer($content) { $get = array(); @@ -359,6 +374,7 @@ class SimpleOpenID * @param string $url Url to found endpoint * @return string Endpoint */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetOpenIDServer($url='') { global $conf; @@ -369,12 +385,12 @@ class SimpleOpenID $response = getURLContent($url); list($servers, $delegates) = $this->HTML2OpenIDServer($response); - if (count($servers) == 0){ + if (count($servers) == 0) { $this->ErrorStore('OPENID_NOSERVERSFOUND'); return false; } if (isset($delegates[0]) - && ($delegates[0] != "")){ + && ($delegates[0] != "")) { $this->SetIdentity($delegates[0]); } $this->SetOpenIDServer($servers[0]); @@ -386,6 +402,7 @@ class SimpleOpenID * * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetRedirectURL() { $params = array(); @@ -410,6 +427,7 @@ class SimpleOpenID * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Redirect() { $redirect_to = $this->GetRedirectURL(); @@ -430,6 +448,7 @@ class SimpleOpenID * * @return boolean */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ValidateWithServer() { $params = array( @@ -522,4 +541,3 @@ class SimpleOpenID } } - diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 32a5842d410..9b76e2d2409 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -462,6 +462,7 @@ class RssParser * @param array $attrs Attributes of tags * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_start_element($p, $element, &$attrs) { $el = $element = strtolower($element); @@ -581,6 +582,7 @@ class RssParser * @param string $text Tag * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_cdata($p, $text) { if ($this->_format == 'atom' and $this->incontent) @@ -601,6 +603,7 @@ class RssParser * @param string $el Tag * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_end_element($p, $el) { $el = strtolower($el); @@ -669,6 +672,7 @@ class RssParser * @param string $text Text * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function append_content($text) { if ( $this->initem ) { @@ -781,4 +785,3 @@ function xml2php($xml) return $array; } - diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 7f0f8143cbd..4f220470f1f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -349,6 +349,7 @@ class SMTPs * * @return mixed $_retVal Boolean indicating success or failure on connection */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _server_connect() { // Default return value @@ -411,6 +412,7 @@ class SMTPs * * @return boolean|null $_retVal Boolean indicating success or failure of authentication */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _server_authenticate() { global $conf; @@ -1052,6 +1054,7 @@ class SMTPs * @param string $_strAddr Email address * @return array An array of the various parts of an email address */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _strip_email($_strAddr) { // Keep the orginal @@ -1094,6 +1097,7 @@ class SMTPs * * @return array Returns an array of bares addresses */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_RCPT_list() { /** @@ -1123,6 +1127,7 @@ class SMTPs * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc') * @return string|false Array of emaill address */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_email_list($_which = null) { // We need to know which address segment to pull @@ -1754,6 +1759,7 @@ class SMTPs * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3" * @return boolean True or false */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { /** @@ -1795,6 +1801,7 @@ class SMTPs * @param string $CRLF CRLF * @return boolean|null True or false */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function socket_send_str( $_strSend, $_returnCode = null, $CRLF = "\r\n" ) { if ($this->_debug) $this->log.=$_strSend; // @CHANGE LDR for log @@ -2049,4 +2056,3 @@ class SMTPs * - basic shell with some commets * */ - diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index bdcae2e33ea..c1053193506 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -764,6 +764,7 @@ class Translate * @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code * @return array List of languages */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_available_languages($langdir=DOL_DOCUMENT_ROOT,$maxlength=0,$usecode=0) { global $conf; @@ -802,6 +803,7 @@ class Translate * @param integer $searchalt Search also alernate language file * @return boolean true if exists and readable */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function file_exists($filename,$searchalt=0) { // Test si fichier dans repertoire de la langue @@ -1024,6 +1026,7 @@ class Translate * * @return array Array of translation keys lang_key => string_translation_loaded */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_translations_for_substitutions() { $substitutionarray = array(); diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index b0ad770532b..4abe445c774 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -41,6 +41,7 @@ interface Database * @param resource $resultset Resultset of request * @return array Array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset); /** @@ -77,6 +78,7 @@ interface Database * @param string $owner Username of database owner * @return resource resource defined if OK, null if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database, $charset = '', $collation = '', $owner = ''); /** @@ -102,6 +104,7 @@ interface Database * @return int Nombre de lignes * @see num_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset); /** @@ -118,6 +121,7 @@ interface Database * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table = ''); /** @@ -150,6 +154,7 @@ interface Database * @param resource $resultset Resultset of request * @return array Array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset); /** @@ -174,6 +179,7 @@ interface Database * @param string $fieldid Field name * @return int Id of row */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab, $fieldid = 'rowid'); /** @@ -254,6 +260,7 @@ interface Database * @return int Nb of lines * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset); /** @@ -289,6 +296,7 @@ interface Database * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null); /** @@ -297,6 +305,7 @@ interface Database * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table); /** @@ -315,6 +324,7 @@ interface Database * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table, $field_name, $field_desc, $field_position = ""); /** @@ -324,6 +334,7 @@ interface Database * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table, $field_name); /** @@ -334,6 +345,7 @@ interface Database * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table, $field_name, $field_desc); /** @@ -350,6 +362,7 @@ interface Database * @param string $field Optionnel : Name of field if we want description of field * @return resource Resource */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table, $field = ""); /** @@ -375,6 +388,7 @@ interface Database * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser( $dolibarr_main_db_host, $dolibarr_main_db_user, @@ -417,6 +431,7 @@ interface Database * @param string $table Name of table * @return array Array with inforation on table */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table); /** @@ -447,6 +462,7 @@ interface Database * * @return string Id connexion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId(); /** @@ -455,6 +471,7 @@ interface Database * @param resource $resultset Curseur de la requete voulue * @return Object Object result line or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset); /** @@ -463,6 +480,7 @@ interface Database * @param string $database Name of database * @return boolean true if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database); } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 4734c3364b5..adf4fb151ce 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -145,6 +145,7 @@ class DoliDBMssql extends DoliDB * @param string $database Name of database * @return boolean true if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { return @mssql_select_db($database, $this->db); @@ -465,6 +466,7 @@ class DoliDBMssql extends DoliDB * @param resource $resultset Curseur de la requete voulue * @return object|false Object result line or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -478,6 +480,7 @@ class DoliDBMssql extends DoliDB * @param resource $resultset Resultset of request * @return array|false Array or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -492,6 +495,7 @@ class DoliDBMssql extends DoliDB * @param resource $resultset Resultset of request * @return array|false Array or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -506,6 +510,7 @@ class DoliDBMssql extends DoliDB * @return int Nb of lines * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -520,6 +525,7 @@ class DoliDBMssql extends DoliDB * @return int Nombre de lignes * @see num_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -646,6 +652,7 @@ class DoliDBMssql extends DoliDB * @param string $fieldid Field name * @return int Id of row or -1 on error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { $res = $this->query("SELECT @@IDENTITY as id"); @@ -707,6 +714,7 @@ class DoliDBMssql extends DoliDB * * @return string Id connexion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { $resql=$this->query('SELECT CONNECTION_ID()'); @@ -729,6 +737,7 @@ class DoliDBMssql extends DoliDB * @param string $owner Username of database owner * @return false|resource|true resource defined if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { /*if (empty($charset)) $charset=$this->forcecharset; @@ -761,6 +770,7 @@ class DoliDBMssql extends DoliDB * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database,$table='') { $this->_results = mssql_list_tables($database, $this->db); @@ -773,6 +783,7 @@ class DoliDBMssql extends DoliDB * @param string $table Name of table * @return array Tableau des informations des champs de la table */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { @@ -796,6 +807,7 @@ class DoliDBMssql extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { // FIXME: $fulltext_keys parameter is unused @@ -869,6 +881,7 @@ class DoliDBMssql extends DoliDB * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { $sql = "DROP TABLE ".$table; @@ -886,6 +899,7 @@ class DoliDBMssql extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return false|resource|true Resource */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { $sql="DESC ".$table." ".$field; @@ -904,6 +918,7 @@ class DoliDBMssql extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra @@ -939,6 +954,7 @@ class DoliDBMssql extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { $sql = "ALTER TABLE ".$table; @@ -961,6 +977,7 @@ class DoliDBMssql extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; @@ -982,6 +999,7 @@ class DoliDBMssql extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { $sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'"; @@ -1138,6 +1156,7 @@ class DoliDBMssql extends DoliDB * @param string $fieldname Field's name to escape * @return string field's name escaped */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EscapeFieldName($fieldname) { return "[".$fieldname."]"; } @@ -1150,6 +1169,7 @@ class DoliDBMssql extends DoliDB * @param mixed $fields String for one field or array of string for multiple field * @return false|object */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetFieldInformation($table,$fields) { $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; if (is_array($fields)) @@ -1176,4 +1196,3 @@ class DoliDBMssql extends DoliDB } } - diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 23c19542ae6..cd434791310 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -173,6 +173,7 @@ class DoliDBMysqli extends DoliDB * @param string $database Name of database * @return boolean true if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); @@ -291,6 +292,7 @@ class DoliDBMysqli extends DoliDB * @param mysqli_result $resultset Curseur de la requete voulue * @return object|null Object result line or null if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -305,6 +307,7 @@ class DoliDBMysqli extends DoliDB * @param mysqli_result $resultset Resultset of request * @return array|null Array or null if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { // If resultset not provided, we take the last used by connexion @@ -318,6 +321,7 @@ class DoliDBMysqli extends DoliDB * @param mysqli_result $resultset Resultset of request * @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { // If resultset not provided, we take the last used by connexion @@ -340,6 +344,7 @@ class DoliDBMysqli extends DoliDB * @return int Nb of lines * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { // If resultset not provided, we take the last used by connexion @@ -354,6 +359,7 @@ class DoliDBMysqli extends DoliDB * @return int Nombre de lignes * @see num_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { // If resultset not provided, we take the last used by connexion @@ -463,6 +469,7 @@ class DoliDBMysqli extends DoliDB * @param string $fieldid Field name * @return int|string Id of row */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { return $this->db->insert_id; @@ -543,6 +550,7 @@ class DoliDBMysqli extends DoliDB * * @return string Id connexion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { $resql=$this->query('SELECT CONNECTION_ID()'); @@ -565,6 +573,7 @@ class DoliDBMysqli extends DoliDB * @param string $owner Username of database owner * @return bool|mysqli_result resource defined if OK, null if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; @@ -593,6 +602,7 @@ class DoliDBMysqli extends DoliDB * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') { $listtables=array(); @@ -618,6 +628,7 @@ class DoliDBMysqli extends DoliDB * @param string $table Name of table * @return array Tableau des informations des champs de la table */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { $infotables=array(); @@ -648,6 +659,7 @@ class DoliDBMysqli extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { // FIXME: $fulltext_keys parameter is unused @@ -724,6 +736,7 @@ class DoliDBMysqli extends DoliDB * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { $sql = "DROP TABLE ".$table; @@ -741,6 +754,7 @@ class DoliDBMysqli extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return bool|mysqli_result Resultset x (x->Field, x->Type, ...) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { $sql="DESC ".$table." ".$field; @@ -759,6 +773,7 @@ class DoliDBMysqli extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra @@ -808,6 +823,7 @@ class DoliDBMysqli extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { $sql = "ALTER TABLE ".$table; @@ -852,6 +868,7 @@ class DoliDBMysqli extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; @@ -873,6 +890,7 @@ class DoliDBMysqli extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'"; @@ -1082,4 +1100,3 @@ class DoliDBMysqli extends DoliDB return $result; } } - diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 8e57b29109e..be6bb0888d2 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -367,6 +367,7 @@ class DoliDBPgsql extends DoliDB * @param string $database Name of database * @return bool true if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { if ($database == $this->database_name) return true; @@ -546,6 +547,7 @@ class DoliDBPgsql extends DoliDB * @param resource $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { // If resultset not provided, we take the last used by connexion @@ -559,6 +561,7 @@ class DoliDBPgsql extends DoliDB * @param resource $resultset Resultset of request * @return false|array Array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { // If resultset not provided, we take the last used by connexion @@ -572,6 +575,7 @@ class DoliDBPgsql extends DoliDB * @param resource $resultset Resultset of request * @return false|array Array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -586,6 +590,7 @@ class DoliDBPgsql extends DoliDB * @return int Nb of lines, -1 on error * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { // If resultset not provided, we take the last used by connexion @@ -600,6 +605,7 @@ class DoliDBPgsql extends DoliDB * @return int Nb of lines * @see num_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { // If resultset not provided, we take the last used by connexion @@ -761,6 +767,7 @@ class DoliDBPgsql extends DoliDB * @param string $fieldid Field name * @return string Id of row */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { //$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab); @@ -824,6 +831,7 @@ class DoliDBPgsql extends DoliDB * * @return string Id connexion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { return '?'; @@ -842,6 +850,7 @@ class DoliDBPgsql extends DoliDB * @param string $owner Username of database owner * @return false|resource resource defined if OK, null if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; @@ -863,6 +872,7 @@ class DoliDBPgsql extends DoliDB * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') { $listtables=array(); @@ -887,6 +897,7 @@ class DoliDBPgsql extends DoliDB * @return array Tableau des informations des champs de la table * */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { $infotables=array(); @@ -932,6 +943,7 @@ class DoliDBPgsql extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { // FIXME: $fulltext_keys parameter is unused @@ -1005,6 +1017,7 @@ class DoliDBPgsql extends DoliDB * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { $sql = "DROP TABLE ".$table; @@ -1024,6 +1037,7 @@ class DoliDBPgsql extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { // Note: using ' on user does not works with pgsql @@ -1046,6 +1060,7 @@ class DoliDBPgsql extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return false|resource Resultset x (x->attname) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { $sql ="SELECT attname FROM pg_attribute, pg_type WHERE typname = '".$table."' AND attrelid = typrelid"; @@ -1066,6 +1081,7 @@ class DoliDBPgsql extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra @@ -1104,6 +1120,7 @@ class DoliDBPgsql extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { $sql = "ALTER TABLE ".$table; @@ -1146,6 +1163,7 @@ class DoliDBPgsql extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { $sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 78762f282b4..43a2217d64e 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -302,6 +302,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $database Name of database * @return boolean true if OK, false if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); @@ -496,6 +497,7 @@ class DoliDBSqlite3 extends DoliDB * @param SQLite3Result $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion @@ -515,6 +517,7 @@ class DoliDBSqlite3 extends DoliDB * @param SQLite3Result $resultset Resultset of request * @return false|array Array or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { // If resultset not provided, we take the last used by connexion @@ -530,6 +533,7 @@ class DoliDBSqlite3 extends DoliDB * @param SQLite3Result $resultset Resultset of request * @return false|array Array or false if KO or end of cursor */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { // If resultset not provided, we take the last used by connexion @@ -552,6 +556,7 @@ class DoliDBSqlite3 extends DoliDB * @return int Nb of lines * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { // FIXME: SQLite3Result does not have a queryString member @@ -571,6 +576,7 @@ class DoliDBSqlite3 extends DoliDB * @return int Nb of lines * @see affected_rows */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { // FIXME: SQLite3Result does not have a queryString member @@ -699,6 +705,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $fieldid Field name * @return int Id of row */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { return $this->db->lastInsertRowId(); @@ -778,6 +785,7 @@ class DoliDBSqlite3 extends DoliDB * * @return string Id connexion */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { return '?'; @@ -795,6 +803,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $owner Username of database owner * @return SQLite3Result resource defined if OK, null if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { if (empty($charset)) $charset=$this->forcecharset; @@ -823,6 +832,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') { $listtables=array(); @@ -849,6 +859,7 @@ class DoliDBSqlite3 extends DoliDB * @return array Tableau des informations des champs de la table * TODO modify for sqlite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { $infotables=array(); @@ -879,6 +890,7 @@ class DoliDBSqlite3 extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { // FIXME: $fulltext_keys parameter is unused @@ -951,6 +963,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { $sql = "DROP TABLE ".$table; @@ -968,6 +981,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return SQLite3Result Resource */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { $sql="DESC ".$table." ".$field; @@ -986,6 +1000,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra @@ -1028,6 +1043,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { $sql = "ALTER TABLE ".$table; @@ -1049,6 +1065,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; @@ -1071,6 +1088,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { $sql = "INSERT INTO user "; @@ -1302,6 +1320,7 @@ class DoliDBSqlite3 extends DoliDB * @param int $day Day * @return int Formatted date */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private static function calc_daynr($year, $month, $day) { $y = $year; if ($y == 0 && $month == 0) return 0; @@ -1322,6 +1341,7 @@ class DoliDBSqlite3 extends DoliDB * @param bool $sunday_first_day_of_week ??? * @return int */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private static function calc_weekday($daynr, $sunday_first_day_of_week) { $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); return $ret; @@ -1333,6 +1353,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $year Year * @return int Nb of days in year */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private static function calc_days_in_year($year) { return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365); @@ -1348,6 +1369,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $calc_year ??? * @return string ??? */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) { $daynr=self::calc_daynr($year,$month,$day); $first_daynr=self::calc_daynr($year,1,1); @@ -1388,4 +1410,3 @@ class DoliDBSqlite3 extends DoliDB } } - diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 8df3f28da3e..40c1ff5187c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1007,6 +1007,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * @param string $reldir Relative directory where to scan files * @return int <=0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_tables($reldir) { global $conf; @@ -1123,6 +1124,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_boxes($option='') { require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; @@ -1220,6 +1222,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_boxes() { global $conf; @@ -1295,6 +1298,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_cronjobs() { require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; @@ -1405,6 +1409,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_cronjobs() { global $conf; @@ -1434,6 +1439,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_tabs() { global $conf; @@ -1459,6 +1465,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if ok) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_tabs() { global $conf; @@ -1526,6 +1533,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_const() { global $conf; @@ -1595,6 +1603,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int <0 if KO, 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_const() { global $conf; @@ -1633,6 +1642,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_permissions($reinitadminperms=0, $force_entity=null, $notrigger=0) { global $conf,$user; @@ -1785,6 +1795,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_permissions() { global $conf; @@ -1810,6 +1821,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_menus() { global $user; @@ -1919,6 +1931,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_menus() { global $conf; @@ -1948,6 +1961,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_dirs() { global $langs, $conf; @@ -2009,6 +2023,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_dirs($name,$dir) { global $conf; @@ -2050,6 +2065,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_dirs() { global $conf; @@ -2075,6 +2091,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_module_parts() { global $conf; @@ -2153,6 +2170,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * * @return int Error count (0 if OK) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_module_parts() { global $conf; diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index 2971b6f59ee..8e9d2200f36 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -37,6 +37,7 @@ abstract class ModeleAction extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -62,6 +63,7 @@ abstract class ModeleAction extends CommonDocGenerator * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function action_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$langs,$user; diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 7dec29e5189..285664dea95 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -92,6 +92,7 @@ class CommActionRapport * @param Translate $outputlangs Lang object for output language * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($socid = 0, $catid = 0, $outputlangs='') { global $user,$conf,$langs,$hookmanager; @@ -99,7 +100,7 @@ class CommActionRapport if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); @@ -342,4 +343,3 @@ class CommActionRapport return $y; } } - diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 710d996757c..afecc770fb9 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -37,7 +37,7 @@ class pdf_ban extends ModeleBankAccountDoc { var $emetteur; // Objet societe qui emet var $version = 'development'; - + /** * Constructor * @@ -55,7 +55,7 @@ class pdf_ban extends ModeleBankAccountDoc $this->db = $db; $this->name = "ban"; $this->description = $langs->trans("DocumentModelBan").' (Volunteer wanted to finish)'; - + // Dimension page pour format A4 $this->type = 'pdf'; $formatarray=pdf_getFormat(); @@ -92,6 +92,7 @@ class pdf_ban extends ModeleBankAccountDoc * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { global $conf, $hookmanager, $langs, $user; @@ -99,7 +100,7 @@ class pdf_ban extends ModeleBankAccountDoc if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); @@ -119,7 +120,7 @@ class pdf_ban extends ModeleBankAccountDoc $dir = $conf->bank->dir_output . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } - + if (! file_exists($dir)) { if (dol_mkdir($dir) < 0) @@ -208,9 +209,9 @@ class pdf_ban extends ModeleBankAccountDoc $pdf->SetXY($this->marge_gauche, $curY); $pdf->MultiCell(200, 3, $outputlangs->trans("BAN").' : '.$object->account_number, 0, 'L'); - - - + + + // Show square if ($pagenb == 1) { @@ -248,7 +249,7 @@ class pdf_ban extends ModeleBankAccountDoc @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + return 1; // Pas d'erreur } else @@ -388,4 +389,3 @@ class pdf_ban extends ModeleBankAccountDoc } } - diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 2061b03d2ae..cc501124922 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -37,7 +37,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc { var $emetteur; // Objet societe qui emet var $version = 'dolibarr'; - + /** * Constructor * @@ -46,7 +46,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "bank", "withdrawals", "companies")); @@ -95,6 +95,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param null|array $moreparams More parameters * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $hookmanager, $langs, $user, $mysoc; @@ -102,10 +103,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills")); - + if (! empty($conf->bank->dir_output)) { //$nblignes = count($object->lines); // This is set later with array of tasks @@ -124,7 +125,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc else $dir = $conf->bank->dir_output . "/" . $objectref; $file = $dir . "/" . $langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref . "-".dol_sanitizeFileName($object->rum).".pdf"; } - + if (! file_exists($dir)) { if (dol_mkdir($dir) < 0) @@ -212,55 +213,55 @@ class pdf_sepamandate extends ModeleBankAccountDoc $nexY = $tab_top + 7; $posY = $curY; - + $pdf->SetFont('','', $default_font_size); - + $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY); $posY+=2; - + $pdf->SetXY($this->marge_gauche, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").')'.' : '.$object->rum, 0, 'L'); - + $posY=$pdf->GetY(); $posY+=2; $pdf->SetXY($this->marge_gauche, $posY); $ics=''; if (! empty($conf->global->PRELEVEMENT_ICS)) $ics=$conf->global->PRELEVEMENT_ICS; $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").')'.' : '.$ics, 0, 'L'); - + $posY=$pdf->GetY(); $posY+=1; $pdf->SetXY($this->marge_gauche, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L'); - + $posY=$pdf->GetY(); $posY+=1; $pdf->SetXY($this->marge_gauche, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L'); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L'); - + $posY=$pdf->GetY(); $posY+=3; - + $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY); - + $pdf->SetFont('','', $default_font_size - 1); - + $posY+=8; $pdf->SetXY($this->marge_gauche, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->transnoentitiesnoconv("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L'); - + // Your data form $posY=$pdf->GetY(); $posY+=8; $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY); $posY+=2; - + $pdf->SetFont('','', $default_font_size); - + $pdf->SetXY($this->marge_gauche, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C'); - + $thirdparty=new Societe($this->db); if ($object->socid > 0) $thirdparty->fetch($object->socid); @@ -275,7 +276,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L'); $pdf->SetXY(80, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L'); - + $address = '______________________________________________'; if ($thirdparty->id > 0) { @@ -293,7 +294,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->SetXY(80, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L'); } - + $ban = '__________________________________________________'; if (! empty($object->iban)) $ban = $object->iban; $posY=$pdf->GetY(); @@ -302,7 +303,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L'); $pdf->SetXY(80, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L'); - + $bic = '__________________________________________________'; if (! empty($object->bic)) $bic = $object->bic; $posY=$pdf->GetY(); @@ -311,8 +312,8 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L'); $pdf->SetXY(80, $posY); $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L'); - - + + $posY=$pdf->GetY(); $posY+=1; $pdf->SetXY($this->marge_gauche, $posY); @@ -338,13 +339,13 @@ class pdf_sepamandate extends ModeleBankAccountDoc $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')'; $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L'); } - + $posY=$pdf->GetY(); $posY+=3; $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY); $posY+=3; - - + + // Show square if ($pagenb == 1) { @@ -362,10 +363,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc var_dump($heightforfreetext); var_dump($heightforfooter); var_dump($bottomlasttab);*/ - + // Affiche zone infos $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); - + /* * Pied de page */ @@ -391,7 +392,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + return 1; // Pas d'erreur } else @@ -426,7 +427,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc } - + /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -436,32 +437,33 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf, $mysoc; - + $default_font_size = pdf_getPDFFontSize($outputlangs); - + $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?1:$conf->global->PDF_DIFFSIZE_TITLE); $posy+=$this->_signature_area($pdf, $object, $posy, $outputlangs); - + $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','', $default_font_size); $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0); $posy=$pdf->GetY()+2; - + $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('','', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0); $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; - + return $posy; } - - - + + + /** * Show area for the customer to sign * @@ -471,21 +473,22 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _signature_area(&$pdf, $object, $posy, $outputlangs) { $default_font_size = pdf_getPDFFontSize($outputlangs); $tab_top = $posy + 4; $tab_hl = 4; - + $posx = $this->marge_gauche; $pdf->SetXY($posx, $tab_top + 0); - + $pdf->SetFont('','', $default_font_size - 2); - + $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateOfSignature"), 0, 'L', 0); $pdf->MultiCell(100, 3, ' '); $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0); - + $posx = 120; $largcol = ($this->page_largeur - $this->marge_droite - $posx); $useborder=0; @@ -494,14 +497,14 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->SetFillColor(255,255,255); $pdf->SetXY($posx, $tab_top + 0); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1); - + $pdf->SetXY($posx, $tab_top + $tab_hl); $pdf->MultiCell($largcol, $tab_hl*3, '', 1, 'R'); - + return ($tab_hl*7); } - - + + /** * Show top header of page. * @@ -612,4 +615,3 @@ class pdf_sepamandate extends ModeleBankAccountDoc } } - diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index b0a121d7dc5..91ab575b7ca 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -40,18 +40,18 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ - static function liste_modeles($db,$maxfilenamelength=0) + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + static function liste_modeles($db, $maxfilenamelength=0) { global $conf; - $type='bankaccount'; - $liste=array(); + $type = 'bankaccount'; + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); - return $liste; + return $list; } } - diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 3e233eb1843..5453123ecff 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -224,13 +224,14 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** - * Return if a code is used (by other element) + * Return if a code is used (by other element) * - * @param DoliDB $db Handler acces base - * @param string $code Code to check - * @param Product $product Objet product - * @return int 0 if available, <0 if KO + * @param DoliDB $db Handler acces base + * @param string $code Code to check + * @param Product $product Objet product + * @return int 0 if available, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $product) { $sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product"; @@ -263,6 +264,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_syntax($codefortest, $typefortest) { global $conf; @@ -302,4 +304,3 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } } - diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index c159a7af925..464bd7eed05 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -44,7 +44,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts function __construct($db) { global $conf,$langs,$mysoc; - + // Load traductions files requiredby by page $langs->loadLangs(array("main", "bills")); @@ -77,12 +77,13 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** * Fonction to generate document on disk * - * @param RemiseCheque $object Object RemiseCheque + * @param RemiseCheque $object Object RemiseCheque * @param string $_dir Directory * @param string $number Number * @param Translate $outputlangs Lang output object * @return int 1=ok, 0=ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $_dir, $number, $outputlangs) { global $user,$conf,$langs,$hookmanager; @@ -91,7 +92,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO $sav_charset_output=$outputlangs->charset_output; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); @@ -191,7 +192,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + $outputlangs->charset_output=$sav_charset_output; return 1; // Pas d'erreur } @@ -206,11 +207,12 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Translate $outputlangs Object language for output * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Header(&$pdf, $page, $pages, $outputlangs) { global $langs; $default_font_size = pdf_getPDFFontSize($outputlangs); - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("compta", "banks")); @@ -312,6 +314,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Translate $outputlangs Object lang * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Body(&$pdf, $pagenb, $pages, $outputlangs) { // x=10 - Num @@ -384,7 +387,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts { $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); } - + return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 680357ce9bb..ac30024c924 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -142,6 +142,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function chequereceipt_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 69ee2ff2b73..eba953d63a7 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -131,10 +131,10 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function chequereceipt_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index bbf20761f5f..b51a70992df 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -115,7 +115,7 @@ abstract class ModeleNumRefChequeReceipts /** * \class ModeleChequeReceipts - * \brief Classe mere des modeles de + * \brief Classe mere des modeles de */ abstract class ModeleChequeReceipts extends CommonDocGenerator { @@ -128,6 +128,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -209,4 +210,3 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) return -1; } } - diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 4c8b4ba2dc5..17146eaa9ab 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -188,6 +188,7 @@ class doc_generic_order_odt extends ModelePDFCommandes * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -496,4 +497,3 @@ class doc_generic_order_odt extends ModelePDFCommandes } } - diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c3a5d143c48..40203247804 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -77,42 +77,42 @@ class pdf_einstein extends ModelePDFCommandes * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -213,6 +213,7 @@ class pdf_einstein extends ModelePDFCommandes * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes; @@ -652,6 +653,7 @@ class pdf_einstein extends ModelePDFCommandes * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -667,6 +669,7 @@ class pdf_einstein extends ModelePDFCommandes * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -854,6 +857,7 @@ class pdf_einstein extends ModelePDFCommandes * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1443,4 +1447,3 @@ class pdf_einstein extends ModelePDFCommandes } } - diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 918b338aa12..88fae0a3c53 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -75,4 +75,3 @@ class pdf_proforma extends pdf_einstein } } - diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 9941811006b..1adbf255a9c 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -142,6 +142,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 2c8ae2ef3e9..f0d92237e00 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -139,10 +139,10 @@ class mod_commande_saphir extends ModeleNumRefCommandes * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index aa6da728f56..4dffcdbc236 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -48,17 +48,18 @@ abstract class ModelePDFCommandes extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db,$maxfilenamelength=0) + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + static function liste_modeles($db, $maxfilenamelength=0) { global $conf; - $type='order'; - $liste=array(); + $type = 'order'; + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); - return $liste; + return $list; } } @@ -146,4 +147,4 @@ abstract class ModeleNumRefCommandes if ($this->version) return $this->version; return $langs->trans("NotAvailable"); } -} \ No newline at end of file +} diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index cd96e880d27..6fa66409023 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -178,6 +178,7 @@ class doc_generic_contract_odt extends ModelePDFContract * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -479,4 +480,3 @@ class doc_generic_contract_odt extends ModelePDFContract } } - diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index f43ec0907ca..fd4944fd335 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -43,17 +43,17 @@ class pdf_strato extends ModelePDFContract * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -63,8 +63,8 @@ class pdf_strato extends ModelePDFContract * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -75,32 +75,32 @@ class pdf_strato extends ModelePDFContract * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ @@ -170,6 +170,7 @@ class pdf_strato extends ModelePDFContract * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$hookmanager,$mysoc; @@ -177,7 +178,7 @@ class pdf_strato extends ModelePDFContract if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "dict", "companies", "contracts")); @@ -537,9 +538,9 @@ class pdf_strato extends ModelePDFContract function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; - + $default_font_size = pdf_getPDFFontSize($outputlangs); - + // Translations $outputlangs->loadLangs(array("main", "dict", "contract", "companies")); @@ -721,4 +722,3 @@ class pdf_strato extends ModelePDFContract } } - diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 54da8fc55c4..6f99672fe48 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -124,10 +124,10 @@ class mod_contract_magre extends ModelNumRefContracts * @param Object $objforref contract object * @return string Value if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contract_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 5dcb8a72baa..4febe6bd9e2 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -139,6 +139,7 @@ class mod_contract_serpis extends ModelNumRefContracts * @param Object $objforref contract object * @return string Value if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contract_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 47a882b7b56..5fd1fee8ee5 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -47,6 +47,7 @@ abstract class ModelePDFContract extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index c9d2b4984ad..bc57ec97b8e 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -72,6 +72,7 @@ class html_cerfafr extends ModeleDon * @param string $currency Currency code * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($don,$outputlangs,$currency='') { global $user,$conf,$langs,$mysoc; @@ -278,6 +279,7 @@ class html_cerfafr extends ModeleDon } } +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function chiffre_en_lettre($montant, $devise1='', $devise2='') { if(empty($devise1)) $dev1='euros'; diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 4949cce94e1..b0bc1bdb96b 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -43,6 +43,7 @@ abstract class ModeleDon extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -138,4 +139,3 @@ abstract class ModeleNumRefDons return $langs->trans("NotAvailable"); } } - diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 9c45c135ac3..c172ced1b17 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -188,6 +188,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -537,4 +538,3 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } } - diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index c4c665de56d..562ae61c14b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * Class to build sending documents with model Merou + * Class to build sending documents with model Merou */ class pdf_merou extends ModelePdfExpedition { @@ -41,17 +41,17 @@ class pdf_merou extends ModelePdfExpedition * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -61,8 +61,8 @@ class pdf_merou extends ModelePdfExpedition * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -73,37 +73,37 @@ class pdf_merou extends ModelePdfExpedition * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -153,6 +153,7 @@ class pdf_merou extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$conf,$langs,$mysoc,$hookmanager; @@ -162,10 +163,10 @@ class pdf_merou extends ModelePdfExpedition if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); - + if ($conf->expedition->dir_output) { $object->fetch_thirdparty(); @@ -331,7 +332,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetDrawColor(120,120,120); $pdf->Rect(10+3, $curY, 3, 3); $pdf->Rect(20+3, $curY, 3, 3); - + //Insertion de la reference du produit $pdf->SetXY(30, $curY); $pdf->SetFont('','B', $default_font_size - 3); @@ -424,7 +425,7 @@ class pdf_merou extends ModelePdfExpedition @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + return 1; } else @@ -456,7 +457,7 @@ class pdf_merou extends ModelePdfExpedition { global $langs; $default_font_size = pdf_getPDFFontSize($outputlangs); - + // Translations $langs->loadLangs(array("main", "bills")); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index aad7fd07c1b..46d05ea0a57 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -40,17 +40,17 @@ class pdf_rouget extends ModelePdfExpedition * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -60,8 +60,8 @@ class pdf_rouget extends ModelePdfExpedition * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -72,37 +72,37 @@ class pdf_rouget extends ModelePdfExpedition * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -184,6 +184,7 @@ class pdf_rouget extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$conf,$langs,$hookmanager; @@ -193,7 +194,7 @@ class pdf_rouget extends ModelePdfExpedition if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); @@ -661,6 +662,7 @@ class pdf_rouget extends ModelePdfExpedition * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1100,4 +1102,3 @@ class pdf_rouget extends ModelePdfExpedition } } - diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index c002da1eee2..d756f9dd3c9 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -128,10 +128,10 @@ class mod_expedition_ribera extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expedition_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 826ba6665c4..47d51e3cde5 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -137,6 +137,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expedition_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index f46fa33c5f1..e42045ca54f 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -46,6 +46,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 539830cdc71..0734fd501dd 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -52,7 +52,7 @@ class pdf_standard extends ModeleExpenseReport * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -62,8 +62,8 @@ class pdf_standard extends ModeleExpenseReport * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -74,37 +74,37 @@ class pdf_standard extends ModeleExpenseReport * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -120,7 +120,7 @@ class pdf_standard extends ModeleExpenseReport function __construct($db) { global $conf, $langs, $mysoc; - + // Translations $langs->loadLangs(array("main", "trips", "projects")); @@ -201,6 +201,7 @@ class pdf_standard extends ModeleExpenseReport * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager; @@ -208,7 +209,7 @@ class pdf_standard extends ModeleExpenseReport if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "trips", "projects", "dict")); @@ -567,7 +568,7 @@ class pdf_standard extends ModeleExpenseReport function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$hookmanager; - + // Translations $outputlangs->loadLangs(array("main", "trips", "companies")); @@ -919,4 +920,3 @@ class pdf_standard extends ModeleExpenseReport } } - diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index e97766b38f6..6490570386c 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -28,11 +28,12 @@ abstract class ModeleExpenseReport extends CommonDocGenerator /** * Return list of active generation modules - * + * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -61,6 +62,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 8d35ff63225..7a8e7c2fba1 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -149,6 +149,7 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function open_file($file,$outputlangs) { global $langs; @@ -175,6 +176,7 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { return 0; @@ -190,6 +192,7 @@ class ExportCsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { global $conf; @@ -224,6 +227,7 @@ class ExportCsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { global $conf; @@ -258,7 +262,7 @@ class ExportCsv extends ModeleExports $array = $array['options']; $newvalue = $array[$newvalue]; } - + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } @@ -273,6 +277,7 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { return 0; @@ -283,6 +288,7 @@ class ExportCsv extends ModeleExports * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { fclose($this->handle); @@ -303,14 +309,14 @@ class ExportCsv extends ModeleExports { global $conf; $addquote=0; - + // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; //$newvalue=dol_string_nohtmltag($newvalue,0,$charset); $newvalue=dol_htmlcleanlastbr($newvalue); //print $charset.' '.$newvalue."\n"; - + // Rule 1 CSV: No CR, LF in cells (except if USE_STRICT_CSV_RULES is on, we can keep record as it is but we must add quotes) $oldvalue=$newvalue; $newvalue=str_replace("\r",'',$newvalue); @@ -321,7 +327,7 @@ class ExportCsv extends ModeleExports $newvalue=$oldvalue; $addquote=1; } - + // Rule 2 CSV: If value contains ", we must escape with ", and add " if (preg_match('/"/',$newvalue)) { @@ -339,4 +345,3 @@ class ExportCsv extends ModeleExports } } - diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 00d06e8511a..57618b5e504 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -65,7 +65,7 @@ class ExportExcel extends ModeleExports $this->version='1.30'; // Driver version $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) - + if (empty($this->disabled)) { // If driver use an external library, put its name here @@ -167,6 +167,7 @@ class ExportExcel extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function open_file($file,$outputlangs) { global $user,$conf,$langs; @@ -235,6 +236,7 @@ class ExportExcel extends ModeleExports * @param Translate $outputlangs Object lang to translate values * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { //$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO @@ -252,6 +254,7 @@ class ExportExcel extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { global $conf; @@ -307,6 +310,7 @@ class ExportExcel extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { global $conf; @@ -329,14 +333,14 @@ class ExportExcel extends ModeleExports $newvalue=$this->excel_clean($newvalue); $typefield=isset($array_types[$code])?$array_types[$code]:''; - + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) { $array = unserialize($typefield); $array = $array['options']; $newvalue = $array[$newvalue]; } - + // Traduction newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { @@ -422,6 +426,7 @@ class ExportExcel extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { return 0; @@ -433,6 +438,7 @@ class ExportExcel extends ModeleExports * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { global $conf; @@ -459,6 +465,7 @@ class ExportExcel extends ModeleExports * @param string $newvalue String to clean * @return string Value cleaned */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function excel_clean($newvalue) { // Rule Dolibarr: No HTML @@ -490,4 +497,3 @@ class ExportExcel extends ModeleExports return $letter; } } - diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index df9fd9d5705..49118a8f293 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -65,7 +65,7 @@ class ExportExcel2007 extends ExportExcel $this->version='1.30'; // Driver version $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) - + if (empty($this->disabled)) { // If driver use an external library, put its name here @@ -85,7 +85,7 @@ class ExportExcel2007 extends ExportExcel $this->version_lib='1.8.0'; // No way to get info from library } } - + $this->row=0; } @@ -95,6 +95,7 @@ class ExportExcel2007 extends ExportExcel * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { global $conf; @@ -115,4 +116,3 @@ class ExportExcel2007 extends ExportExcel } } - diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index 2945c5095b8..0600841f8b5 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -143,7 +143,8 @@ class ExportTsv extends ModeleExports * @param string $file Path of filename to generate * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function open_file($file,$outputlangs) { global $langs; @@ -170,6 +171,7 @@ class ExportTsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { return 0; @@ -185,6 +187,7 @@ class ExportTsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { foreach($array_selected_sorted as $code => $value) @@ -208,6 +211,7 @@ class ExportTsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { global $conf; @@ -226,14 +230,14 @@ class ExportTsv extends ModeleExports if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]); $newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output); - + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) { $array = unserialize($typefield); $array = $array['options']; $newvalue = $array[$newvalue]; } - + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } @@ -247,6 +251,7 @@ class ExportTsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { return 0; @@ -257,6 +262,7 @@ class ExportTsv extends ModeleExports * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { fclose($this->handle); @@ -270,6 +276,7 @@ class ExportTsv extends ModeleExports * @param string $charset Input AND Output character set * @return string Value cleaned */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tsv_clean($newvalue, $charset) { // Rule Dolibarr: No HTML @@ -289,4 +296,3 @@ class ExportTsv extends ModeleExports } } - diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index 5d7e0ecac84..a5203d8cf73 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -46,6 +46,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac * @param integer $maxfilenamelength Max length of value to show * @return array List of templates (same content than array this->driverlabel) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { dol_syslog(get_class($this)."::liste_modeles"); @@ -161,5 +162,3 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac } } - - diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 21c25913543..8a3974a632d 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -187,6 +187,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -504,4 +505,3 @@ class doc_generic_invoice_odt extends ModelePDFFactures } } - diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f7e7ca1d40f..6ae35bca776 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -71,8 +71,8 @@ class pdf_crabe extends ModelePDFFactures * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -83,37 +83,37 @@ class pdf_crabe extends ModelePDFFactures * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -228,6 +228,7 @@ class pdf_crabe extends ModelePDFFactures * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; @@ -782,6 +783,7 @@ class pdf_crabe extends ModelePDFFactures * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -923,6 +925,7 @@ class pdf_crabe extends ModelePDFFactures * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -1081,6 +1084,7 @@ class pdf_crabe extends ModelePDFFactures * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1843,4 +1847,3 @@ class pdf_crabe extends ModelePDFFactures } } - diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index b5d9a2397cc..bcd21fff431 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -46,6 +46,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 551b9ded2cb..841355acd1d 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -52,7 +52,7 @@ class pdf_soleil extends ModelePDFFicheinter * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -62,8 +62,8 @@ class pdf_soleil extends ModelePDFFicheinter * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -74,37 +74,37 @@ class pdf_soleil extends ModelePDFFicheinter * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -162,6 +162,7 @@ class pdf_soleil extends ModelePDFFicheinter * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager; @@ -169,7 +170,7 @@ class pdf_soleil extends ModelePDFFicheinter if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "interventions", "dict", "companies")); @@ -552,7 +553,7 @@ class pdf_soleil extends ModelePDFFicheinter { global $conf,$langs; $default_font_size = pdf_getPDFFontSize($outputlangs); - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "interventions")); @@ -732,4 +733,3 @@ class pdf_soleil extends ModelePDFFicheinter } } - diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 7e60a6aed4b..43bf23b4731 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -144,4 +144,3 @@ class mod_pacific extends ModeleNumRefFicheinter } } - diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 8bcb2990bdb..56b57485837 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -44,6 +44,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -153,6 +154,7 @@ abstract class ModeleNumRefFicheinter * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$langs,$user; @@ -238,4 +240,3 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $ return 0; } } - diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index a00c3825f47..afd9d35387c 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -125,6 +125,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays * @param Object $objforref Holiday object * @return string Value if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function holiday_get_num($fuser, $objforref) { return $this->getNextValue($fuser, $objforref); diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index 3b77230f77f..b36200ef9d4 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -140,6 +140,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays * @param Object $objforref Holiday object * @return string Value if OK, 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function holiday_get_num($fuser,$objforref) { return $this->getNextValue($fuser,$objforref); diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 7e7865c87e8..8e7ee2880c8 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -48,17 +48,18 @@ abstract class ModelePDFHoliday extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; - $type='contract'; - $liste=array(); + $type = 'contract'; + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); - return $liste; + return $list; } } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index a6473eaeb8e..db604a5159e 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -96,6 +96,7 @@ class ImportCsv extends ModeleImports * @param Translate $outputlangs Output language * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header_example($outputlangs) { return ''; @@ -108,6 +109,7 @@ class ImportCsv extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title_example($outputlangs,$headerlinefields) { $s=join($this->separator,array_map('cleansep',$headerlinefields)); @@ -121,6 +123,7 @@ class ImportCsv extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record_example($outputlangs,$contentlinevalues) { $s=join($this->separator,array_map('cleansep',$contentlinevalues)); @@ -133,6 +136,7 @@ class ImportCsv extends ModeleImports * @param Translate $outputlangs Output language * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer_example($outputlangs) { return ''; @@ -146,6 +150,7 @@ class ImportCsv extends ModeleImports * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_open_file($file) { global $langs; @@ -177,6 +182,7 @@ class ImportCsv extends ModeleImports * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_get_nb_of_lines($file) { return dol_count_nb_of_line($file); @@ -188,6 +194,7 @@ class ImportCsv extends ModeleImports * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_header() { return 0; @@ -199,6 +206,7 @@ class ImportCsv extends ModeleImports * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_record() { global $conf; @@ -254,6 +262,7 @@ class ImportCsv extends ModeleImports * * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_close_file() { fclose($this->handle); @@ -272,6 +281,7 @@ class ImportCsv extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys) { global $langs,$conf,$user; @@ -629,8 +639,8 @@ class ImportCsv extends ModeleImports } } else { // We have a last INSERT ID. Check if we have a row referencing this foreign key. - // This is required when updating table with some extrafields. When inserting a record in parent table, we can make - // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record + // This is required when updating table with some extrafields. When inserting a record in parent table, we can make + // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record // may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid. $sqlSelect = 'SELECT rowid FROM '.$tablename; @@ -752,5 +762,3 @@ function cleansep($value) { return str_replace(array(',',';'),'/',$value); }; - - diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 7f222f523ca..75e9e0c5c7b 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -102,6 +102,7 @@ class ImportXlsx extends ModeleImports * @param Translate $outputlangs Output language * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header_example($outputlangs) { global $user,$conf,$langs; @@ -134,6 +135,7 @@ class ImportXlsx extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title_example($outputlangs,$headerlinefields) { global $conf; @@ -158,6 +160,7 @@ class ImportXlsx extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record_example($outputlangs,$contentlinevalues) { $col = 0; @@ -176,6 +179,7 @@ class ImportXlsx extends ModeleImports * @param Translate $outputlangs Output language * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer_example($outputlangs) { // return te file content as a string @@ -198,6 +202,7 @@ class ImportXlsx extends ModeleImports * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_open_file($file) { global $langs; @@ -220,6 +225,7 @@ class ImportXlsx extends ModeleImports * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_get_nb_of_lines($file) { $reader = new PHPExcel_Reader_Excel2007(); @@ -239,6 +245,7 @@ class ImportXlsx extends ModeleImports * * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_header() { // This is not called by the import code !!! @@ -256,6 +263,7 @@ class ImportXlsx extends ModeleImports * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_record() { global $conf; @@ -279,6 +287,7 @@ class ImportXlsx extends ModeleImports * * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_close_file() { $this->workbook->disconnectWorksheets(); @@ -297,7 +306,8 @@ class ImportXlsx extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ - // What is this doing here ? it is common to all imports, is should be in the parent class + // What is this doing here ? it is common to all imports, is should be in the parent class + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys) { global $langs,$conf,$user; @@ -653,8 +663,8 @@ class ImportXlsx extends ModeleImports } } else { // We have a last INSERT ID. Check if we have a row referencing this foreign key. - // This is required when updating table with some extrafields. When inserting a record in parent table, we can make - // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record + // This is required when updating table with some extrafields. When inserting a record in parent table, we can make + // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record // may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid. $sqlSelect = 'SELECT rowid FROM '.$tablename; diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 548bb128193..40f78540dc8 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -138,6 +138,7 @@ class ModeleImports * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { dol_syslog(get_class($this)."::liste_modeles"); @@ -248,4 +249,3 @@ class ModeleImports } } - diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index f3329fa9b18..9906d2c1660 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * Class to build Delivery Order documents with typhon model + * Class to build Delivery Order documents with typhon model */ class pdf_typhon extends ModelePDFDeliveryOrder { @@ -43,69 +43,69 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ public $type; - + /** * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -120,7 +120,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "bills", "sendings", "companies")); @@ -185,6 +185,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -192,7 +193,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries")); @@ -638,6 +639,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf,$mysoc; @@ -953,4 +955,3 @@ class pdf_typhon extends ModelePDFDeliveryOrder } } - diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 228b73aad8b..c09ef660dff 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -149,6 +149,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * @param Object $object Object livraison * @return string Texte descripif */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function livraison_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index 1192656bf8d..ed36e396182 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -146,10 +146,10 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * @param Object $object Objet livraison * @return string Texte descripif */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function livraison_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); } } - diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index a433f42930d..9c15b337f9f 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -45,6 +45,7 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 78aab1a5bd7..b02c943cda0 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -57,6 +57,7 @@ class mailing_advthirdparties extends MailingTargets * @param array $contactid Array of contact id to add * @return int <0 if error, number of emails added if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid) { global $conf, $langs; diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 90d81dca4a5..5b2ccd047fe 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -331,6 +331,7 @@ class mailing_contacts1 extends MailingTargets * @param array $filtersarray Optional filter data (deprecated) * @return int <0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { global $conf, $langs; @@ -448,4 +449,3 @@ class mailing_contacts1 extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index 548510f81a0..3fa9b2687cf 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -32,9 +32,9 @@ class mailing_example extends MailingTargets var $desc='Put here a description'; // CHANGE THIS: Set to 1 if selector is available for admin users only var $require_admin=0; - // CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector + // CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector var $tooltip='MyTooltipLangKey'; - + var $require_module=array(); var $picto=''; var $db; @@ -59,6 +59,7 @@ class mailing_example extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @return int <0 if error, number of emails added if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { $target = array(); @@ -144,4 +145,3 @@ class mailing_example extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index f71b6b925f0..ace612356c8 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -223,6 +223,7 @@ class mailing_fraise extends MailingTargets * @param array $filtersarray Param to filter sql request. Deprecated. Should use $_POST instead. * @return int < 0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { // Deprecation warning diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 1a97f3502b7..3cd509cd8cb 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -34,7 +34,7 @@ class MailingTargets // This can't be abstract as it is used for some method var $db; var $error; var $tooltip=''; - + /** * Constructor @@ -54,7 +54,7 @@ class MailingTargets // This can't be abstract as it is used for some method function getDesc() { global $langs, $form; - + $langs->load("mails"); $transstring="MailingModuleDesc".$this->name; $s=''; @@ -115,6 +115,7 @@ class MailingTargets // This can't be abstract as it is used for some method * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb destinataires si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_nb($mailing_id) { // Mise a jour nombre de destinataire dans table des mailings @@ -148,6 +149,7 @@ class MailingTargets // This can't be abstract as it is used for some method * @param array $cibles Array with targets * @return int < 0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id, $cibles) { global $conf; @@ -230,6 +232,7 @@ class MailingTargets // This can't be abstract as it is used for some method * @param int $mailing_id Id of emailing * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clear_target($mailing_id) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; @@ -244,4 +247,3 @@ class MailingTargets // This can't be abstract as it is used for some method } } - diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 5824f456365..2dc2cae5048 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -118,7 +118,7 @@ class mailing_pomme extends MailingTargets $s.=''; $s.=''; $s.=''; - + $s.=' '; $s.=$langs->trans("Employee").': '; $s.=''; - + return $s; } @@ -150,13 +150,14 @@ class mailing_pomme extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { // Deprecation warning if ($filtersarray) { dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING); } - + global $conf, $langs; $langs->load("companies"); @@ -169,10 +170,10 @@ class mailing_pomme extends MailingTargets $sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test $sql.= " AND u.entity IN (0,".$conf->entity.")"; $sql.= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; - if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql.= " AND u.statut=1"; - if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND u.statut=0"; - if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql.= " AND u.employee=1"; - if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql.= " AND u.employee=0"; + if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql.= " AND u.statut=1"; + if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND u.statut=0"; + if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql.= " AND u.employee=1"; + if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql.= " AND u.employee=0"; $sql.= " ORDER BY u.email"; // Stocke destinataires dans cibles @@ -222,4 +223,3 @@ class mailing_pomme extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 57a69475000..8c86ea6d1a9 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -55,6 +55,7 @@ class mailing_thirdparties extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @return int <0 if error, number of emails added if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { global $conf, $langs; @@ -321,4 +322,3 @@ class mailing_thirdparties extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 08473f3cb6d..b4592591f9a 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -80,6 +80,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @return int <0 if error, number of emails added if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { $target = array(); @@ -238,4 +239,3 @@ class mailing_thirdparties_services_expired extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 152322c2899..141b334ef21 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -117,6 +117,7 @@ class mailing_xinputfile extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { global $conf,$langs,$_FILES; @@ -222,4 +223,3 @@ class mailing_xinputfile extends MailingTargets } } - diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 794de3d9294..dbbdba7efa3 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -37,7 +37,7 @@ class mailing_xinputuser extends MailingTargets var $require_admin=0; // Module mailing actif pour user admin ou non var $picto='generic'; var $tooltip='UseFormatInputEmailToTarget'; - + /** * Constructor @@ -115,6 +115,7 @@ class mailing_xinputuser extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { global $conf,$langs,$_FILES; @@ -161,4 +162,3 @@ class mailing_xinputuser extends MailingTargets } } - diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 49acce1e2d6..85d61432dc4 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -61,6 +61,7 @@ class pdf_standard extends CommonStickerGenerator * @param string $photo Photo (full path to image file used as replacement for key __PHOTOS__ into left, right, header or footer text) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='') { global $db,$mysoc,$conf,$langs; @@ -244,6 +245,7 @@ class pdf_standard extends CommonStickerGenerator * @param int $nooutput 1=Generate only file on disk and do not return it on response * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs, $srctemplatepath, $mode='member', $nooutput=0) { global $user,$conf,$langs,$mysoc,$_Avery_Labels; @@ -323,7 +325,7 @@ class pdf_standard extends CommonStickerGenerator if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "admin", "members")); diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index f7ef8b94590..9ecbff756aa 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -44,6 +44,7 @@ class ModelePDFCards * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -70,22 +71,23 @@ class ModelePDFCards * @param string $template pdf generenate document class to use default 'standard' * @return int <0 if KO, >0 if OK */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='', $template='standard') { global $conf,$langs; $langs->load("members"); $error=0; - + // Increase limit for PDF build $err=error_reporting(); error_reporting(0); @set_time_limit(120); error_reporting($err); - + $code=''; $srctemplatepath=''; - + // Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) { @@ -108,7 +110,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o $srctemplatepath=$tmp[1]; } else $srctemplatepath=$code; - + // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array('/'); @@ -118,7 +120,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o foreach(array('doc','pdf') as $prefix) { $file = $prefix."_".$template.".class.php"; - + // On verifie l'emplacement du modele $file=dol_buildpath($reldir."core/modules/member/doc/".$file,0); if (file_exists($file)) @@ -130,8 +132,8 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o } if ($filefound) break; } - - + + // Charge le modele if ($filefound) { @@ -163,4 +165,3 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o } - diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index a09ad2355e4..ab87cbbf60e 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -131,10 +131,10 @@ class mod_payment_ant extends ModeleNumRefPayments * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 8fc05b6cdd8..951b71a0d56 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -142,6 +142,7 @@ class mod_payment_cicada extends ModeleNumRefPayments * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function payment_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index 4a6560b47fa..856b380c659 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -83,4 +83,3 @@ class PrintingDriver } } - diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 7cda95174c2..f5591e66e9b 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -220,6 +220,7 @@ class printing_printgcp extends PrintingDriver * * @return array list of printers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function getlist_available_printers() { // Token storage @@ -287,6 +288,7 @@ class printing_printgcp extends PrintingDriver * @param string $subdir subdir for file * @return int 0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_file($file, $module, $subdir='') { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -403,6 +405,7 @@ class printing_printgcp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_jobs() { global $conf, $db, $langs, $bc; diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 94d14426b55..b725a6a3965 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -75,6 +75,7 @@ class printing_printipp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_file($file, $module, $subdir='') { global $conf, $user; @@ -197,6 +198,7 @@ class printing_printipp extends PrintingDriver * * @return array list of printers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function getlist_available_printers() { global $conf,$db; @@ -217,6 +219,7 @@ class printing_printipp extends PrintingDriver * @param string $uri URI * @return array List of attributes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_printer_detail($uri) { global $conf,$db; @@ -240,6 +243,7 @@ class printing_printipp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_jobs($module) { global $conf, $db, $bc; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index d76b397ace8..7577d4820a8 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -44,7 +44,7 @@ class pdf_standardlabel extends CommonStickerGenerator function addSticker(&$pdf,$outputlangs,$param) { // use this method in future refactoring } - + /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - %LOGO% is replace with company logo @@ -59,6 +59,7 @@ class pdf_standardlabel extends CommonStickerGenerator * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') { global $mysoc, $conf, $langs; @@ -234,6 +235,7 @@ class pdf_standardlabel extends CommonStickerGenerator * @param string $filename Short file name of PDF output file * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='',$filename='tmp_address_sheet.pdf') { global $user,$conf,$langs,$mysoc,$_Avery_Labels; @@ -254,7 +256,7 @@ class pdf_standardlabel extends CommonStickerGenerator if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "admin")); diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index e527c8faaca..0aadcb2baf8 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -50,7 +50,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator 'fontsize' => 8, 'stretchtext' => 4 ); - + // set style for 2d barcode private $_style2d = array( 'border' => false, @@ -61,24 +61,24 @@ class pdf_tcpdflabel extends CommonStickerGenerator 'module_width' => 1, // width of a single module in points 'module_height' => 1 // height of a single module in points ); - + private $_align2d = 'N'; - + private $_xres = 0.4; - + /** * write barcode to pdf - * + * * @param PDF $pdf PDF reference * @param string $code code to print * @param string $encoding type of barcode * @param boolean $is2d true if 2d barcode - * @param int $x x position in user units + * @param int $x x position in user units * @param int $y y position in user units * @param int $w width in user units * @param int $h height in user units - */ - private function writeBarcode(&$pdf, $code, $encoding, $is2d, $x, $y, $w, $h) + */ + private function writeBarcode(&$pdf, $code, $encoding, $is2d, $x, $y, $w, $h) { if ($is2d) { $pdf->write2DBarcode($code, $encoding, $x, $y, $w, $h, $this->_style2d, $this->_align2d); @@ -86,7 +86,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator $pdf->write1DBarcode($code, $encoding, $x, $y, $w, $h, $this->_xres, $this->_style1d); } } - + /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * @@ -95,10 +95,10 @@ class pdf_tcpdflabel extends CommonStickerGenerator * @param array $param Associative array containing label content and optional parameters * @return void */ - function addSticker(&$pdf,$outputlangs,$param) + function addSticker(&$pdf,$outputlangs,$param) { global $mysoc,$conf; - + $textleft = $param['textleft']; $header = $param['textheader']; $footer = $param['textfooter']; @@ -106,8 +106,8 @@ class pdf_tcpdflabel extends CommonStickerGenerator $code = $param['code']; $encoding = $param['encoding']; $is2d = $param['is2d']; - - + + // We are in a new page, then we must add a page if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) { @@ -132,7 +132,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator } } - $xleft = 2; + $xleft = 2; $ytop = 2; // Top @@ -154,7 +154,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator $heighttouse = $maxheighttouse; $logoHeight = $heighttouse; $logoWidth = $heighttouse; - + //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; // Center @@ -162,7 +162,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator { // Output left area if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, 0, $logoHeight); - else if ($code && !empty($encoding)) + else if ($code && !empty($encoding)) { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse, $heighttouse); } @@ -177,7 +177,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator if (($textleft == '%LOGO%' || $textleft == '%PHOTO%' || $textleft == '%BARCODE%') && !strstr($textright, '%') ) // left part logo/barcode right part text { if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, 0); - else if ($code && !empty($encoding)) + else if ($code && !empty($encoding)) { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, $heighttouse); } @@ -187,7 +187,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator else if (($textright == '%LOGO%' || $textright == '%PHOTO%' || $textright == '%BARCODE%') && !strstr($textleft, '%')) // right part logo/barcode left part text { if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, 0); - else if ($code && !empty($encoding)) + else if ($code && !empty($encoding)) { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, $heighttouse); } @@ -203,7 +203,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator } else { $pdf->SetXY($_PosX+$xleft+$logoWidth+1, $_PosY+$ytop); $pdf->MultiCell($widthtouse-$logoWidth1-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); - } + } } else if ($textright == '%LOGO%') // right part logo left part text/barcode { @@ -214,7 +214,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator } else { $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); $pdf->MultiCell($widthtouse-$logoWidth-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); - } + } } else // text on halft left and text on half right { @@ -228,7 +228,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator { // Output right area if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$this->_Width-$widthtouse-$xleft, $_PosY+$ytop, 0, $logoHeight); - else if ($code && !empty($encoding)) + else if ($code && !empty($encoding)) { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$this->_Width-$widthtouse-$xleft, $_PosY+$ytop, $widthtouse, $heighttouse); } @@ -275,6 +275,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator * @param string $filename Short file name of PDF output file * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='',$filename='tmp_address_sheet.pdf') { global $user,$conf,$langs,$mysoc,$_Avery_Labels; @@ -295,7 +296,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "admin")); diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index bac32ec45d2..8149ea03a1b 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -44,6 +44,7 @@ class ModelePDFLabels * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -71,6 +72,7 @@ class ModelePDFLabels * @param string $filename Short file name of PDF output file * @return int <0 if KO, >0 if OK */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='', $template='standardlabel', $filename='tmp_address_sheet.pdf') { global $conf,$langs; @@ -111,7 +113,7 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp else $srctemplatepath=$code; dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); - + // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array('/'); @@ -164,4 +166,3 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp } - diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index c447639cfe1..6fc3b477603 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -202,6 +202,7 @@ class doc_generic_product_odt extends ModelePDFProduct * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $product,$langs,$conf,$mysoc,$hookmanager,$user; @@ -501,4 +502,3 @@ class doc_generic_product_odt extends ModelePDFProduct } } - diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 7e53bab7133..269aa4bd8ca 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -87,7 +87,7 @@ class pdf_standard extends ModelePDFProduct public function __construct($db) { global $conf,$langs,$mysoc; - + // Load traductions files requiredby by page $langs->loadLangs(array("main", "companies")); @@ -128,6 +128,7 @@ class pdf_standard extends ModelePDFProduct * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager; @@ -135,7 +136,7 @@ class pdf_standard extends ModelePDFProduct if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); @@ -682,7 +683,7 @@ class pdf_standard extends ModelePDFProduct function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") { global $conf,$langs,$hookmanager; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders")); @@ -836,4 +837,3 @@ class pdf_standard extends ModelePDFProduct } } - diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 32941ca1ec9..a7dfdfc9fac 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -203,6 +203,7 @@ class mod_codeproduct_elephant extends ModeleProductCode * * @return int 0 or 1 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { global $conf; @@ -281,6 +282,7 @@ class mod_codeproduct_elephant extends ModeleProductCode * @param Product $product Objet product * @return int 0 if available, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $product) { $sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product"; @@ -307,4 +309,3 @@ class mod_codeproduct_elephant extends ModeleProductCode } } - diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 83fc444f258..8b0495be89f 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -42,7 +42,8 @@ abstract class ModelePDFProduct extends CommonDocGenerator * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -140,6 +141,7 @@ abstract class ModeleProductCode * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { $liste=array(); @@ -236,10 +238,10 @@ abstract class ModeleProductCode * * @return int 0=no, 1=yes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { return 0; } } - diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 94818d17531..b51f735467e 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -24,7 +24,7 @@ * \class ModeleProductCode * \brief Parent class for product code generators */ - + /** * \file htdocs/core/modules/contract/modules_contract.php * \ingroup contract @@ -32,7 +32,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; - + /** * Parent class to manage intervention document templates */ @@ -44,20 +44,20 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ - static function liste_modeles($db,$maxfilenamelength=0) + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + static function liste_modeles($db, $maxfilenamelength=0) { global $conf; $type='product_batch'; - $liste=array(); + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); - return $liste; + $list = getListOfModels($db, $type, $maxfilenamelength); + return $list; } } - diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index d936c01139f..3c8ea0ea151 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -111,6 +111,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param string $array_key Name of the key for return array * @return array Array of substitution */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { global $conf; @@ -147,6 +148,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasks($task,$outputlangs) { global $conf; @@ -186,6 +188,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_contacts($contact,$outputlangs) { global $conf; @@ -242,6 +245,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_file($file,$outputlangs) { global $conf; @@ -260,6 +264,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_reference($refdetail,$outputlangs) { global $conf; @@ -282,6 +287,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasksressource($taskressource,$outputlangs) { global $conf; @@ -304,6 +310,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_taskstime($tasktime,$outputlangs) { global $conf; @@ -328,6 +335,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_task_file($file,$outputlangs) { global $conf; @@ -437,6 +445,7 @@ class doc_generic_project_odt extends ModelePDFProjects * @param string $srctemplatepath Full path of source filename for generator using a template file * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath) { global $user,$langs,$conf,$mysoc,$hookmanager; diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 229aec99beb..4dea22de614 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -42,69 +42,69 @@ class pdf_baleine extends ModelePDFProjects * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ public $type; - + /** * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe @@ -119,7 +119,7 @@ class pdf_baleine extends ModelePDFProjects function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "projects", "companies")); @@ -172,6 +172,7 @@ class pdf_baleine extends ModelePDFProjects * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { global $conf, $hookmanager, $langs, $user; @@ -179,7 +180,7 @@ class pdf_baleine extends ModelePDFProjects if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index b487c211376..475dd3d75e8 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -64,7 +64,7 @@ class pdf_beluga extends ModelePDFProjects function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "projects", "companies")); @@ -117,6 +117,7 @@ class pdf_beluga extends ModelePDFProjects * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { global $conf, $hookmanager, $langs, $user; @@ -126,7 +127,7 @@ class pdf_beluga extends ModelePDFProjects if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); @@ -253,7 +254,7 @@ class pdf_beluga extends ModelePDFProjects $iniY = $tab_top + $heightoftitleline + 1; $curY = $tab_top + $heightoftitleline + 1; $nexY = $tab_top + $heightoftitleline + 1; - + $listofreferent=array( 'propal'=>array( 'name'=>"Proposals", @@ -368,8 +369,8 @@ class pdf_beluga extends ModelePDFProjects //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); - - if ($key == 'agenda') + + if ($key == 'agenda') { // var_dump($elementarray); } @@ -378,11 +379,11 @@ class pdf_beluga extends ModelePDFProjects if ($num >= 0) { $nexY = $pdf->GetY() + 5; - + $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); - + $pdf->SetXY($this->posxref, $curY); $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L'); @@ -418,7 +419,7 @@ class pdf_beluga extends ModelePDFProjects $num = count($elementarray); // Loop on each lines - for ($i = 0; $i < $num; $i ++) + for ($i = 0; $i < $num; $i ++) { $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage @@ -496,10 +497,10 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage + $heightoftitleline + 1; - + // Label $pdf->SetXY($this->posxref, $curY); $posybefore=$pdf->GetY(); @@ -557,7 +558,7 @@ class pdf_beluga extends ModelePDFProjects { $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L'); } - + // Amount without tax if (empty($value['disableamount'])) { $pdf->SetXY($this->posxamountht, $curY); @@ -610,7 +611,7 @@ class pdf_beluga extends ModelePDFProjects $curY = $nexY; } } - + $nexY+=2; // Passe espace entre les lignes // Detect if some page were added automatically and output _tableau for past pages @@ -775,7 +776,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetXY($posx,$posy); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R'); } - + $pdf->SetTextColor(0,0,60); } diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 6bcfe287b70..89aeefc5fab 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -47,7 +47,7 @@ class pdf_timespent extends ModelePDFProjects function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "projects", "companies")); @@ -100,6 +100,7 @@ class pdf_timespent extends ModelePDFProjects * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { global $conf, $hookmanager, $langs, $user; @@ -107,7 +108,7 @@ class pdf_timespent extends ModelePDFProjects if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); @@ -602,4 +603,3 @@ class pdf_timespent extends ModelePDFProjects } } - diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 05256a3e61f..1f4656f5ebe 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -147,9 +147,9 @@ class mod_project_simple extends ModeleNumRefProjects * @param Project $project Object project * @return string Next not used reference */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function project_get_num($objsoc=0,$project='') { return $this->getNextValue($objsoc,$project); } } - diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index e76ed349b46..6be53915136 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -134,9 +134,9 @@ class mod_project_universal extends ModeleNumRefProjects * @param Project $project Object project * @return string Next not used reference */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function project_get_num($objsoc=0,$project='') { return $this->getNextValue($objsoc,$project); } } - diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 5f7ef3d5756..3f7c1526f9e 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -37,10 +37,11 @@ abstract class ModelePDFProjects extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 5f7ff754a65..a01e6fdfeac 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -112,6 +112,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param string $array_key Name of the key for return array * @return array Array of substitution */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { global $conf; @@ -154,6 +155,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasks($task,$outputlangs) { global $conf; @@ -183,6 +185,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_contacts($contact,$outputlangs) { global $conf; @@ -206,6 +209,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_file($file,$outputlangs) { global $conf; @@ -224,6 +228,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_reference($refdetail,$outputlangs) { global $conf; @@ -246,6 +251,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasksressource($taskressource,$outputlangs) { global $conf; @@ -268,6 +274,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_taskstime($tasktime,$outputlangs) { global $conf; @@ -291,6 +298,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_task_file($file,$outputlangs) { global $conf; @@ -400,6 +408,7 @@ class doc_generic_task_odt extends ModelePDFTask * @param string $srctemplatepath Full path of source filename for generator using a template file * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath) { global $user,$langs,$conf,$mysoc,$hookmanager; diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 1a0aa3e3445..85f361f4bc2 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -147,9 +147,9 @@ class mod_task_simple extends ModeleNumRefTask * @param Task $object Object task * @return string Next not used reference */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function task_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); } } - diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index d89acb22b06..cc3175be159 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -134,9 +134,9 @@ class mod_task_universal extends ModeleNumRefTask * @param Task $object Object task * @return string Next not used reference */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function project_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); } } - diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index 7d14ae12a3e..b08c083b4c1 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -41,8 +41,9 @@ abstract class ModelePDFTask extends CommonDocGenerator * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ - static function liste_modeles($db,$maxfilenamelength=0) + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 24477a67cc5..2f388392329 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -218,6 +218,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -525,4 +526,3 @@ class doc_generic_proposal_odt extends ModelePDFPropales } } - diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index bf78f7edae6..bef150b1e79 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -44,79 +44,79 @@ class pdf_azur extends ModelePDFPropales * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string Save the name of generated file as the main doc when generating a doc with this template */ public $update_main_doc_field; - + /** * @var string document type */ public $type; - + /** * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); - + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Objet societe qui emet */ - public $emetteur; + public $emetteur; /** @@ -127,7 +127,7 @@ class pdf_azur extends ModelePDFPropales function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "bills")); @@ -212,6 +212,7 @@ class pdf_azur extends ModelePDFPropales * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; @@ -219,7 +220,7 @@ class pdf_azur extends ModelePDFPropales if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "propal", "products")); @@ -837,6 +838,7 @@ class pdf_azur extends ModelePDFPropales * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -852,6 +854,7 @@ class pdf_azur extends ModelePDFPropales * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -1032,6 +1035,7 @@ class pdf_azur extends ModelePDFPropales * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1432,7 +1436,7 @@ class pdf_azur extends ModelePDFPropales function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills")); @@ -1665,6 +1669,7 @@ class pdf_azur extends ModelePDFPropales * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _signature_area(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -1691,4 +1696,3 @@ class pdf_azur extends ModelePDFPropales return ($tab_hl*7); } } - diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index c2d52923e4f..d65ce8316d4 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -46,6 +46,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index a645b105610..62584af5bbf 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -93,6 +93,7 @@ class pdf_paiement * @param string $outputlangs Lang output object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($_dir, $month, $year, $outputlangs) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -415,6 +416,7 @@ class pdf_paiement * @param Translate $outputlangs Object langs * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Body(&$pdf, $page, $lines, $outputlangs) { global $langs; @@ -495,4 +497,3 @@ class pdf_paiement $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $langs->transnoentities('Total')." : ".price($total), 0, 'R', 0); } } - diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 6aa4267d827..c0baf2d4c30 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -83,7 +83,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc function info($langs) { global $conf,$langs; - + // Load traductions files requiredby by page $langs->loadLangs(array("companies", "errors")); @@ -175,6 +175,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -197,7 +198,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (! is_object($outputlangs)) $outputlangs=$langs; $sav_charset_output=$outputlangs->charset_output; $outputlangs->charset_output='UTF-8'; - + // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); @@ -430,4 +431,3 @@ class doc_generic_odt extends ModeleThirdPartyDoc } } - diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 993bb2ed2b3..63dc9839b02 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -221,6 +221,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * * @return int 0 or 1 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { global $conf; @@ -300,6 +301,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if available, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $soc, $type=0) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; @@ -327,4 +329,3 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } } - diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index f4d9e5b4b33..dfced8a2f23 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -219,6 +219,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if available, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $soc, $type=0) { global $conf, $mc; @@ -255,6 +256,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode * @param string $code Code a verifier * @return int 0 si OK, <0 si KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_syntax($code) { $res = 0; @@ -271,4 +273,3 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode } } - diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index c237be0f91c..baf1978ceae 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -115,6 +115,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode * @param string $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { global $conf; @@ -212,4 +213,3 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode } } } - diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index 15099eb0538..1e990b42d69 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -75,6 +75,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode * @param int $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { $this->code=''; @@ -87,4 +88,3 @@ class mod_codecompta_panicum extends ModeleAccountancyCode return 0; // return ok } } - diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 0ed5eace2e2..ccb9006df02 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -42,6 +42,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -139,12 +140,13 @@ abstract class ModeleThirdPartyCode } /** - * Renvoi la liste des modeles de numéroation + * Renvoie la liste des modeles de numérotation * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { $liste=array(); @@ -239,8 +241,9 @@ abstract class ModeleThirdPartyCode /** * Check if mask/numbering use prefix * - * @return int 0=no, 1=yes - */ + * @return int 0=no, 1=yes + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { return 0; @@ -353,6 +356,7 @@ abstract class ModeleAccountancyCode * @param int $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { global $langs; @@ -378,6 +382,7 @@ abstract class ModeleAccountancyCode * @deprecated Use the new function generateDocument of Facture class * @see Societe::generateDocument() */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 4b4a902cb96..662d3d60485 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -202,6 +202,7 @@ class doc_generic_stock_odt extends ModelePDFStock * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $stock,$langs,$conf,$mysoc,$hookmanager,$user; @@ -501,4 +502,3 @@ class doc_generic_stock_odt extends ModelePDFStock } } - diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 66ad1413dcd..9d83cf811cd 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -87,7 +87,7 @@ class pdf_standard extends ModelePDFStock public function __construct($db) { global $conf,$langs,$mysoc; - + // Load traductions files requiredby by page $langs->loadLangs(array("main", "companies")); @@ -114,12 +114,12 @@ class pdf_standard extends ModelePDFStock // Recupere emetteur $this->emetteur=$mysoc; if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined - + // Define position of columns $this->wref = 15; $this->posxdesc=$this->marge_gauche+1; $this->posxlabel=$this->posxdesc+$this->wref; - $this->posxtva=80; + $this->posxtva=80; $this->posxqty=95; $this->posxup=115; $this->posxunit=135; @@ -157,6 +157,7 @@ class pdf_standard extends ModelePDFStock * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager; @@ -164,7 +165,7 @@ class pdf_standard extends ModelePDFStock if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries")); @@ -188,7 +189,7 @@ class pdf_standard extends ModelePDFStock $stockFournisseur = new ProductFournisseur($this->db); $supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - + $productstatic=new Product($db); if (! file_exists($dir)) @@ -268,8 +269,8 @@ class pdf_standard extends ModelePDFStock /* Affichage de la liste des produits de l'entrepot */ /* */ /* ************************************************************************** */ - - $nexY+=5; + + $nexY+=5; $nexY = $pdf->GetY(); $nexY+=10; @@ -311,7 +312,7 @@ class pdf_standard extends ModelePDFStock if ($objtp->label != '') $objp->produit = $objtp->label; } } - + $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); @@ -319,7 +320,7 @@ class pdf_standard extends ModelePDFStock $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); - + // Description of product line $curX = $this->posxdesc-1; @@ -372,13 +373,13 @@ class pdf_standard extends ModelePDFStock } $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - + $productstatic->id=$objp->rowid; $productstatic->ref = $objp->ref; $productstatic->label = $objp->produit; $productstatic->type=$objp->type; $productstatic->entity=$objp->entity; - $productstatic->status_batch=$objp->tobatch; + $productstatic->status_batch=$objp->tobatch; // Ref. $pdf->SetXY($this->posxdesc, $curY); @@ -391,12 +392,12 @@ class pdf_standard extends ModelePDFStock // Quantity $valtoshow=price2num($objp->value, 'MS'); $towrite = (empty($valtoshow)?'0':$valtoshow); - + $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $towrite, 0, 'R'); - + $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $towrite, 0, 'R'); + $totalunit+=$objp->value; - + $pdf->SetXY($this->posxup, $curY); $pdf->MultiCell($this->posxunit-$this->posxup-0.8, 3, price(price2num($objp->ppmp,'MU'), 0, $outputlangs), 0, 'R'); @@ -429,7 +430,7 @@ class pdf_standard extends ModelePDFStock } $nexY+=2; // Passe espace entre les lignes - + // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) { @@ -466,20 +467,20 @@ class pdf_standard extends ModelePDFStock if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } } - + $db->free($resql); - + /** * footer table */ $nexY = $pdf->GetY(); $nexY+=2; - $curY = $nexY; - - $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); + $curY = $nexY; + + $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); $pdf->line($this->marge_gauche, $curY-1, $this->page_largeur-$this->marge_droite, $curY-1); $pdf->SetLineStyle(array('dash'=>0)); - + $pdf->SetFont('','B',$default_font_size-1); $pdf->SetTextColor(0,0,120); @@ -487,7 +488,7 @@ class pdf_standard extends ModelePDFStock $pdf->SetXY($this->posxdesc, $curY); $pdf->MultiCell($this->wref, 3, $langs->trans("Total"), 0, 'L'); - // Quantity + // Quantity $valtoshow=price2num($totalunit, 'MS'); $towrite = empty($valtoshow)?'0':$valtoshow; @@ -736,8 +737,8 @@ class pdf_standard extends ModelePDFStock } } */ - $tab_top = $tab_top_newpage+21; - + $tab_top = $tab_top_newpage+21; + // Show square if ($pagenb == 1) { @@ -749,7 +750,7 @@ class pdf_standard extends ModelePDFStock $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos @@ -836,21 +837,21 @@ class pdf_standard extends ModelePDFStock // Output Rect //$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param - + $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); - $pdf->SetDrawColor(220,26,26); + $pdf->SetDrawColor(220,26,26); $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite, $tab_top); $pdf->SetLineStyle(array('dash'=>0)); $pdf->SetDrawColor(128,128,128); $pdf->SetTextColor(0,0,120); - + if (empty($hidetop)) { //$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->wref,3, $outputlangs->transnoentities("Ref"),'','L'); } - + //$pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -860,7 +861,7 @@ class pdf_standard extends ModelePDFStock //$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) - { + { $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxup-$this->posxqty-1,2, $outputlangs->transnoentities("Units"),'','C'); } @@ -873,7 +874,7 @@ class pdf_standard extends ModelePDFStock } //$pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); - if (empty($hidetop)) + if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("EstimatedStockValueShort"), '', @@ -887,18 +888,18 @@ class pdf_standard extends ModelePDFStock $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("SellPriceMin"),'','C'); } - //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); + //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->postotalht-1, $tab_top+1); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht,2, $outputlangs->transnoentities("EstimatedStockValueSellShort"),'','C'); } - - $pdf->SetDrawColor(220,26,26); + + $pdf->SetDrawColor(220,26,26); $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26))); - $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11); + $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11); $pdf->SetLineStyle(array('dash'=>0)); - + } /** @@ -914,7 +915,7 @@ class pdf_standard extends ModelePDFStock function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") { global $conf,$langs,$db,$hookmanager; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks")); @@ -961,7 +962,7 @@ class pdf_standard extends ModelePDFStock $text=$this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - + $pdf->SetFont('','B', $default_font_size + 3); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); @@ -981,22 +982,22 @@ class pdf_standard extends ModelePDFStock $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("LocationSummary").' :', '', 'R'); - + $posy+=4; $pdf->SetXY($posx-50,$posy); $pdf->MultiCell(150, 3, $object->lieu, '', 'R'); - - + + // Parent entrepot $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ParentWarehouse").' :', '', 'R'); - + $posy+=4; $pdf->SetXY($posx-50,$posy); $e = new Entrepot($db); - if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) + if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) { $pdf->MultiCell(150, 3, $e->libelle, '', 'R'); } @@ -1004,14 +1005,14 @@ class pdf_standard extends ModelePDFStock { $pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R'); } - + // Description $nexY = $pdf->GetY(); $nexY+=5; $pdf->SetXY($posx,$posy); $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("Description").' : '.nl2br($object->description), 0, 1); $nexY = $pdf->GetY(); - + $calcproductsunique=$object->nb_different_products(); $calcproducts=$object->nb_products(); @@ -1023,12 +1024,12 @@ class pdf_standard extends ModelePDFStock $valtoshow=price2num($calcproducts['nb'], 'MS'); $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("NumberOfProducts").' : '.(empty($valtoshow)?'0':$valtoshow), 0, 1); $nexY = $pdf->GetY(); - + // Value $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("EstimatedStockValueShort").' : '. price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency), 0, 1); $nexY = $pdf->GetY(); - - + + // Last movement $sql = "SELECT max(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -1056,7 +1057,7 @@ class pdf_standard extends ModelePDFStock $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, ''.$outputlangs->transnoentities("LastMovement").' : '.$toWrite, 0, 1); $nexY = $pdf->GetY(); - + /*if ($object->ref_client) { $posy+=5; @@ -1147,4 +1148,3 @@ class pdf_standard extends ModelePDFStock } } - diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index 5f8a62a90c6..52ed64946d9 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -88,7 +88,7 @@ class pdf_stdmovement extends ModelePDFMovement public function __construct($db) { global $conf,$langs,$mysoc; - + // Load traductions files requiredby by page $langs->loadLangs(array("main", "companies")); @@ -160,6 +160,7 @@ class pdf_stdmovement extends ModelePDFMovement * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager; @@ -167,7 +168,7 @@ class pdf_stdmovement extends ModelePDFMovement if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries")); @@ -916,7 +917,7 @@ class pdf_stdmovement extends ModelePDFMovement function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") { global $conf,$langs,$db,$hookmanager; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks")); @@ -1149,4 +1150,3 @@ class pdf_stdmovement extends ModelePDFMovement } } - diff --git a/htdocs/core/modules/stock/modules_movement.php b/htdocs/core/modules/stock/modules_movement.php index 806f500dab7..f7882246739 100644 --- a/htdocs/core/modules/stock/modules_movement.php +++ b/htdocs/core/modules/stock/modules_movement.php @@ -40,6 +40,7 @@ abstract class ModelePDFMovement extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -50,4 +51,4 @@ abstract class ModelePDFMovement extends CommonDocGenerator $liste=getListOfModels($db,$type,$maxfilenamelength); return $liste; } -} \ No newline at end of file +} diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php index a0740b50f54..279ff5b21fe 100644 --- a/htdocs/core/modules/stock/modules_stock.php +++ b/htdocs/core/modules/stock/modules_stock.php @@ -33,6 +33,7 @@ abstract class ModelePDFStock extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 7762d8ce6a5..e57ffd2ec0b 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -44,17 +44,18 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ - static function liste_modeles($db,$maxfilenamelength=0) + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + static function liste_modeles($db, $maxfilenamelength=0) { global $conf; - $type='invoice_supplier'; - $liste=array(); + $type = 'invoice_supplier'; + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); + $list = getListOfModels($db, $type, $maxfilenamelength); - return $liste; + return $list; } } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index d14a9bdcdc8..6356720a31a 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -40,75 +40,75 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ public $type; - + /** * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); - + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Objet societe qui emet */ - public $emetteur; - + public $emetteur; + /** @@ -192,7 +192,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param int $hidedesc Do not show desc * @param int $hideref Do not show ref * @return int 1=OK, 0=KO - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager,$nblignes; @@ -615,6 +616,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -935,6 +937,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -1249,4 +1252,3 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } } - diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index a39e7d004be..1f0593e3083 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -150,9 +150,9 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Texte descripif */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); } } - diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 37b8adab22e..b757c71d9c0 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -134,9 +134,9 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Texte descripif */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); } } - diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 4bd262d67fb..f5c2fb2381c 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -47,6 +47,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 9294ff1a47e..e4f6fda8e48 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -44,17 +44,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -65,48 +65,48 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); - + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Objet societe qui emet @@ -207,6 +207,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes; @@ -713,6 +714,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -728,6 +730,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -783,15 +786,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } /** - * Show total to pay + * Show total to pay * - * @param PDF $pdf Object PDF + * @param PDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1373,4 +1377,3 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } } - diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index bda0170397d..0c75e8c4832 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -42,17 +42,17 @@ class pdf_standard extends ModelePDFSuppliersPayments * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -62,54 +62,54 @@ class pdf_standard extends ModelePDFSuppliersPayments * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string */ public $version = 'dolibarr'; - + /** * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ public $marge_basse; - + /** * Issuer * @var Societe */ - public $emetteur; + public $emetteur; /** @@ -120,7 +120,7 @@ class pdf_standard extends ModelePDFSuppliersPayments function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "bills")); @@ -186,7 +186,8 @@ class pdf_standard extends ModelePDFSuppliersPayments * @param int $hidedesc Do not show desc * @param int $hideref Do not show ref * @return int 1=OK, 0=KO - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -521,6 +522,7 @@ class pdf_standard extends ModelePDFSuppliersPayments * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_cheque(&$pdf, $object, $posy, $outputlangs) { global $conf,$mysoc; @@ -814,4 +816,3 @@ class pdf_standard extends ModelePDFSuppliersPayments } } - diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 97c7b077b22..f7f97d075d5 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -131,10 +131,10 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } } - diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 9b0012ec089..e4d6b82b8a0 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -142,6 +142,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments * @param string $objforref Object for number to search * @return string Next free value */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function payment_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php index 56c5bd94ae0..7e4c954817e 100644 --- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php +++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php @@ -31,7 +31,8 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index a8497416501..26972ef31e6 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -218,6 +218,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -516,4 +517,3 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } } - diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 5f971cab2d1..6f07f64a7c5 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -42,17 +42,17 @@ class pdf_aurore extends ModelePDFSupplierProposal * @var DoliDb Database handler */ public $db; - + /** * @var string model name */ public $name; - + /** * @var string model description (short text) */ public $description; - + /** * @var string document type */ @@ -62,8 +62,8 @@ class pdf_aurore extends ModelePDFSupplierProposal * @var array() Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ - public $phpmin = array(5, 4); - + public $phpmin = array(5, 4); + /** * Dolibarr version of the loaded document * @public string @@ -74,32 +74,32 @@ class pdf_aurore extends ModelePDFSupplierProposal * @var int page_largeur */ public $page_largeur; - + /** * @var int page_hauteur */ public $page_hauteur; - + /** * @var array format */ public $format; - + /** * @var int marge_gauche */ public $marge_gauche; - + /** * @var int marge_droite */ public $marge_droite; - + /** * @var int marge_haute */ public $marge_haute; - + /** * @var int marge_basse */ @@ -120,7 +120,7 @@ class pdf_aurore extends ModelePDFSupplierProposal public function __construct($db) { global $conf, $langs, $mysoc; - + // Translations $langs->loadLangs(array("main", "bills")); @@ -160,7 +160,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxdesc=$this->marge_gauche+1; $this->posxdiscount=162; $this->postotalht=174; - + if ($conf->global->PRODUCT_USE_UNITS) { $this->posxtva=101; @@ -172,7 +172,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxup=126; $this->posxqty=145; } - + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup=$this->posxtva; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format @@ -204,6 +204,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; @@ -211,7 +212,7 @@ class pdf_aurore extends ModelePDFSupplierProposal if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal")); @@ -375,7 +376,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { $tab_top -= 2; - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); @@ -524,7 +525,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R'); } - + // Unit if($conf->global->PRODUCT_USE_UNITS) { @@ -705,6 +706,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -720,6 +722,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Langs object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { global $conf; @@ -887,6 +890,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Objet langs * @return int Position pour suite */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; @@ -1232,7 +1236,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } } - + if($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -1274,7 +1278,7 @@ class pdf_aurore extends ModelePDFSupplierProposal function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; - + // Translations $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies")); @@ -1496,4 +1500,3 @@ class pdf_aurore extends ModelePDFSupplierProposal } } - diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index b324a1b03a8..46a5a095511 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -46,6 +46,7 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index a2c15780e35..ada697b1209 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -201,6 +201,7 @@ class doc_generic_user_odt extends ModelePDFUser * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -409,7 +410,7 @@ class doc_generic_user_odt extends ModelePDFUser $odfHandler=null; // Destroy object $this->result = array('fullpath'=>$file); - + return 1; // Success } else @@ -422,7 +423,8 @@ class doc_generic_user_odt extends ModelePDFUser return -1; } - function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function get_substitutionarray_object($object,$outputlangs, $array_key='object') { $array_other=array(); foreach($object as $key => $value) { if (!is_array($value) && !is_object($value)) { @@ -433,4 +435,3 @@ class doc_generic_user_odt extends ModelePDFUser } } - diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php index 3e94ece9372..f0d18535dac 100644 --- a/htdocs/core/modules/user/modules_user.class.php +++ b/htdocs/core/modules/user/modules_user.class.php @@ -24,7 +24,7 @@ * \class ModeleProductCode * \brief Parent class for product code generators */ - + /** * \file htdocs/core/modules/contract/modules_contract.php * \ingroup contract @@ -32,7 +32,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; - + /** * Parent class to manage intervention document templates */ @@ -48,6 +48,7 @@ abstract class ModelePDFUser extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -59,4 +60,4 @@ abstract class ModelePDFUser extends CommonDocGenerator $liste=getListOfModels($db,$type,$maxfilenamelength); return $liste; } -} \ No newline at end of file +} diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 443981907e0..c7e501dcfc8 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -203,6 +203,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { global $user,$langs,$conf,$mysoc,$hookmanager; @@ -512,4 +513,3 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup } } - diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index 26edb08d57c..a2c4dcde5de 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -24,7 +24,7 @@ * \class ModeleProductCode * \brief Parent class for product code generators */ - + /** * \file htdocs/core/modules/contract/modules_contract.php * \ingroup contract @@ -32,7 +32,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; - + /** * Parent class to manage intervention document templates */ @@ -48,15 +48,16 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { global $conf; - $type='group'; - $liste=array(); + $type = 'group'; + $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); - return $liste; + $list = getListOfModels($db, $type, $maxfilenamelength); + return $list; } } \ No newline at end of file diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 3ccf27ee676..7a10f5c6021 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -372,6 +372,7 @@ class Cronjob extends CommonObject * @param int $processing Processing or not * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='', $processing=-1) { global $langs; @@ -919,6 +920,7 @@ class Cronjob extends CommonObject * @param string $userlogin User login * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function run_jobs($userlogin) { global $langs, $conf; @@ -1188,6 +1190,7 @@ class Cronjob extends CommonObject * @param timestamp $now Date returned by dol_now() * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reprogram_jobs($userlogin, $now) { dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG); @@ -1275,6 +1278,7 @@ class Cronjob extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 2fa0ee44178..8a20ae29eea 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -95,6 +95,7 @@ class Don extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { if (empty($this->labelstatut) || empty($this->labelstatushort)) @@ -694,6 +695,7 @@ class Don extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function valid_promesse($id, $userid, $notrigger=0) { global $langs, $user; @@ -743,6 +745,7 @@ class Don extends CommonObject * @param int $modepayment mode of payment * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $modepayment=0) { $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; @@ -777,6 +780,7 @@ class Don extends CommonObject * @param int $id id of donation * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($id) { $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id; @@ -806,6 +810,7 @@ class Don extends CommonObject * @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses * @return int Summ of donations */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function sum_donations($param) { global $conf; @@ -832,6 +837,7 @@ class Don extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf; diff --git a/htdocs/don/class/donstats.class.php b/htdocs/don/class/donstats.class.php index dfe74b7f691..c7e2db2e7a4 100644 --- a/htdocs/don/class/donstats.class.php +++ b/htdocs/don/class/donstats.class.php @@ -131,4 +131,4 @@ class DonationStats extends Stats return $this->_getAllByYear($sql); } -} \ No newline at end of file +} diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 8d31c292155..e2f7ad18feb 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -452,6 +452,7 @@ class PaymentDonation extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -576,6 +577,7 @@ class PaymentDonation extends CommonObject * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index a3669f909e9..18ee35c8884 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -495,6 +495,7 @@ class EcmDirectory // extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_motherof() { global $conf; @@ -544,6 +545,7 @@ class EcmDirectory // extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; @@ -570,6 +572,7 @@ class EcmDirectory // extends CommonObject * @param int $force Force reload of full arbo even if already loaded in cache $this->cats * @return array Tableau de array */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($force=0) { global $conf; @@ -659,6 +662,7 @@ class EcmDirectory // extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=0) { // Define fullpath @@ -746,6 +750,7 @@ class EcmDirectory // extends CommonObject * @param User $user Object user * @return int Result of run_triggers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { global $langs,$conf; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index df76bac3e9b..2ef219c27ee 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -342,7 +342,7 @@ class EcmFiles extends CommonObject else { $sql .= ' AND t.rowid = '.$this->db->escape($id); // rowid already unique } - + $this->db->plimit(1); // When we search on src or on hash of content (hashforfile) to solve hash conflict when several files has same content, we take first one only $this->db->order('t.rowid', 'ASC'); @@ -789,6 +789,7 @@ class EcmFiles extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 448b13f43fa..b70c59b1b52 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -380,6 +380,7 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) { $expeditionline = new ExpeditionLigne($this->db); @@ -404,6 +405,7 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line_batch($line_ext,$array_options=0) { $error = 0; @@ -799,6 +801,7 @@ class Expedition extends CommonObject * @param User $user User * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_delivery($user) { global $conf; @@ -907,6 +910,7 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function addline_batch($dbatch,$array_options=0) { global $conf,$langs; @@ -1293,6 +1297,7 @@ class Expedition extends CommonObject * * @return int >0 if OK, Otherwise if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { global $conf, $mysoc; @@ -1581,6 +1586,7 @@ class Expedition extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { global $langs; @@ -1704,6 +1710,7 @@ class Expedition extends CommonObject * @param timestamp $date_livraison Date de livraison * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { if ($user->rights->expedition->creer) @@ -1736,6 +1743,7 @@ class Expedition extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_delivery_methods() { global $langs; @@ -1763,6 +1771,7 @@ class Expedition extends CommonObject * @param id $id only this carrier, all if none * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_delivery_methods($id='') { global $langs; @@ -1798,6 +1807,7 @@ class Expedition extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_delivery_method($id='') { if ($id=='') @@ -1826,6 +1836,7 @@ class Expedition extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function activ_delivery_method($id) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; @@ -1842,6 +1853,7 @@ class Expedition extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function disable_delivery_method($id) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; @@ -1858,6 +1870,7 @@ class Expedition extends CommonObject * @param string $value Value * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetUrlTrackingStatus($value='') { if (! empty($this->shipping_method_id)) @@ -2042,6 +2055,7 @@ class Expedition extends CommonObject * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_billed() { global $user; @@ -2728,4 +2742,3 @@ class ExpeditionLigne extends CommonObjectLine } } } - diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b7c81c4d33a..2668bce4e3b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -547,6 +547,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $fuser, $notrigger = 0) { $error = 0; @@ -617,6 +618,7 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; @@ -791,6 +793,7 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_line_by_project($projectid,$user='') { global $conf,$db,$langs; @@ -946,6 +949,7 @@ class ExpenseReport extends CommonObject * * @return int <0 if OK, >0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->lines=array(); @@ -1190,6 +1194,7 @@ class ExpenseReport extends CommonObject * @param User $fuser User * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_save_from_refuse($fuser) { global $conf,$langs; @@ -1362,6 +1367,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($fuser, $notrigger = 0) { $error = 0; @@ -1422,6 +1428,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($fuser,$detail, $notrigger=0) { $error = 0; @@ -1605,6 +1612,7 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_add($ligne_total_ht,$ligne_total_tva) { $this->total_ht = $this->total_ht + $ligne_total_ht; @@ -1633,6 +1641,7 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_del($ligne_total_ht,$ligne_total_tva) { $this->total_ht = $this->total_ht - $ligne_total_ht; @@ -2051,6 +2060,7 @@ class ExpenseReport extends CommonObject * @param Date $date_fin End date * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function periode_existe($fuser, $date_debut, $date_fin) { $sql = "SELECT rowid, date_debut, date_fin"; @@ -2105,6 +2115,7 @@ class ExpenseReport extends CommonObject * * @return array Array of user ids */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_expensereport() { $users_validator=array(); @@ -2210,6 +2221,7 @@ class ExpenseReport extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf; @@ -2246,6 +2258,7 @@ class ExpenseReport extends CommonObject * @param string $option 'topay' or 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $option='topay') { global $conf, $langs; @@ -2681,6 +2694,7 @@ class ExpenseReportLine * @param int $useshortlabel Use short labels * @return string HTML select with status */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1, $useshortlabel=0) { global $db, $langs; @@ -2716,6 +2730,7 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt * @param int $active 1=Active only, 0=Unactive only, -1=All * @return string Select html */ +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees_id($selected='',$htmlname='type',$showempty=0, $active=1) { global $db,$langs,$user; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 781b22d27e7..43ff275e9b0 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -47,9 +47,9 @@ class PaymentExpenseReport extends CommonObject var $fk_bank; var $fk_user_creat; var $fk_user_modif; - //Unknow field - var $chid; - var $total; + //Unknow field + var $chid; + var $total; /** * Constructor @@ -450,6 +450,7 @@ class PaymentExpenseReport extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -604,6 +605,7 @@ class PaymentExpenseReport extends CommonObject * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 050318944d6..102552854b6 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -74,6 +74,7 @@ class Export * @param string $filter Load a particular dataset only * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { global $langs,$conf,$mysoc; @@ -213,6 +214,7 @@ class Export * @param array $array_filterValue Filter records on array of value for fields * @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..." */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_sql($indice, $array_selected, $array_filterValue) { // Build the sql request @@ -274,6 +276,7 @@ class Export * @param string $ValueField Value of the field for filter. Must not be '' * @return string sql string of then field ex : "field='xxx'>" */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterQuery($TypeField, $NameField, $ValueField) { //print $TypeField." ".$NameField." ".$ValueField; @@ -367,6 +370,7 @@ class Export * @param string $ValueField Initial value of the field to filter * @return string html string of the input field ex : "" */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterField($TypeField, $NameField, $ValueField) { global $conf,$langs; @@ -520,6 +524,7 @@ class Export * @param string $sqlquery If set, transmit the sql request for select (otherwise, sql request is generated from arrays) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '') { global $conf,$langs; @@ -823,6 +828,7 @@ class Export * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_export_model() { global $conf, $langs; @@ -873,4 +879,3 @@ class Export } } - diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d14419f49b0..a30a8b302ac 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -98,6 +98,7 @@ class Fichinter extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -628,6 +629,7 @@ class Fichinter extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { // Init/load array of translation of status @@ -970,6 +972,7 @@ class Fichinter extends CommonObject * @param date $date_delivery date of delivery * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_delivery($user, $date_delivery) { global $conf; @@ -1002,6 +1005,7 @@ class Fichinter extends CommonObject * @param string $description description * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_description($user, $description) { global $conf; @@ -1035,6 +1039,7 @@ class Fichinter extends CommonObject * @param int $contractid Description * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_contrat($user, $contractid) { global $conf; @@ -1241,6 +1246,7 @@ class Fichinter extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->lines = array(); @@ -1537,6 +1543,7 @@ class FichinterLigne extends CommonObjectLine * * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { global $conf; @@ -1640,4 +1647,3 @@ class FichinterLigne extends CommonObjectLine } } - diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index ba486e066cc..27cbf0f8bb5 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -107,6 +107,7 @@ class Fournisseur extends Societe * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -151,6 +152,7 @@ class Fournisseur extends Societe * @param string $name Category name * @return int <0 if KO, 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function CreateCategory($user, $name) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)"; @@ -177,6 +179,7 @@ class Fournisseur extends Societe * * @return array Array of suppliers */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ListArray() { global $conf; @@ -209,4 +212,3 @@ class Fournisseur extends Societe } } - diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index dfceb8d4e73..ea319666eb3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -198,7 +198,7 @@ class CommandeFournisseur extends CommonOrder * @param string $ref Ref of object * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id,$ref='') + public function fetch($id, $ref='') { global $conf; @@ -331,6 +331,7 @@ class CommandeFournisseur extends CommonOrder * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { //$result=$this->fetch_lines(); @@ -572,6 +573,7 @@ class CommandeFournisseur extends CommonOrder * @param int $billed 1=Billed * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$billed=0) { global $conf, $langs; @@ -1034,6 +1036,7 @@ class CommandeFournisseur extends CommonOrder * @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders). * @return int >0 if Ok, <0 if Ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Cancel($user, $idwarehouse=-1) { global $langs,$conf; @@ -1096,6 +1099,7 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps public function commande($user, $date, $methode, $comment='') { global $langs; @@ -1950,6 +1954,7 @@ class CommandeFournisseur extends CommonOrder * * @return 0 if Ok, <0 if Ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_methodes_commande() { $sql = "SELECT rowid, libelle"; @@ -2039,6 +2044,7 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Livraison($user, $date, $type, $comment) { global $conf, $langs; @@ -2154,6 +2160,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { if ($user->rights->fournisseur->commande->creer) @@ -2218,6 +2225,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_id_projet($user, $id_projet, $notrigger=0) { if ($user->rights->fournisseur->commande->creer) @@ -2674,6 +2682,7 @@ class CommandeFournisseur extends CommonOrder * * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -2716,6 +2725,7 @@ class CommandeFournisseur extends CommonOrder * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -2812,7 +2822,7 @@ class CommandeFournisseur extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) @@ -3475,4 +3485,3 @@ class CommandeFournisseurLigne extends CommonOrderLine } } } - diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 910115d8822..5bf92bf24f1 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -467,6 +467,7 @@ class CommandeFournisseurDispatch extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8ce8b796892..8cbd871c8f7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Alexandre Spangaro - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -659,8 +659,9 @@ class FactureFournisseur extends CommonInvoice /** * Load this->lines * - * @return int 1 si ok, < 0 si erreur + * @return int 1 si ok, < 0 si erreur */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; @@ -883,6 +884,7 @@ class FactureFournisseur extends CommonInvoice * @param int $idremise Id of absolute discount * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1136,6 +1138,7 @@ class FactureFournisseur extends CommonInvoice * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { global $conf,$langs; @@ -1184,6 +1187,7 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that change status * @return int <0 si ok, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { global $conf,$langs; @@ -1394,6 +1398,7 @@ class FactureFournisseur extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { global $conf,$langs; @@ -1952,9 +1957,10 @@ class FactureFournisseur extends CommonInvoice * Renvoi liste des factures remplacables * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee * - * @param int $socid Id societe + * @param int $socid Id societe * @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_supplier_invoices($socid=0) { global $conf; @@ -2002,6 +2008,7 @@ class FactureFournisseur extends CommonInvoice * @param int $socid Id societe * @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_supplier_invoices($socid=0) { global $conf; @@ -2050,6 +2057,7 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -2344,7 +2352,8 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @return int <0 if KO, >0 if OK - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -2748,10 +2757,10 @@ class SupplierInvoiceLine extends CommonObjectLine $this->rang = $obj->rang; $this->fk_unit = $obj->fk_unit; - $this->multicurrency_subprice = $obj->multicurrency_subprice; - $this->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $this->multicurrency_subprice = $obj->multicurrency_subprice; + $this->multicurrency_total_ht = $obj->multicurrency_total_ht; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->fetch_optionals(); @@ -3066,6 +3075,7 @@ class SupplierInvoiceLine extends CommonObjectLine * * @return int <0 si ko, >0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index e7b3a292df1..6cb1ff2bb27 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -99,6 +99,7 @@ class ProductFournisseur extends Product * @param int $id_fourn Supplier Id * @return int < 0 if error, > 0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_fournisseur($id_fourn) { $ok=1; @@ -135,6 +136,7 @@ class ProductFournisseur extends Product * @param int $rowid Line id of price * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_product_fournisseur_price($rowid) { global $conf, $user; @@ -163,10 +165,10 @@ class ProductFournisseur extends Product } } - if (empty($error)){ + if (empty($error)) { $this->db->commit(); return 1; - }else{ + } else { $this->db->rollback(); return -1; } @@ -200,6 +202,7 @@ class ProductFournisseur extends Product * @param string $desc_fourn Custom description for product_fourn_price * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='', $localtaxes_array=array(), $newdefaultvatcode='', $multicurrency_buyprice=0, $multicurrency_price_base_type='HT',$multicurrency_tx=1,$multicurrency_code='', $desc_fourn='') { global $conf, $langs; @@ -435,6 +438,7 @@ class ProductFournisseur extends Product * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { global $conf; @@ -525,6 +529,7 @@ class ProductFournisseur extends Product * @param int $offset Offset * @return array Array of Products with new properties to define supplier price */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $limit=0, $offset=0) { global $conf; @@ -623,6 +628,7 @@ class ProductFournisseur extends Product * @param int $socid get min price for specific supplier * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0) { global $conf; @@ -813,6 +819,7 @@ class ProductFournisseur extends Product * to display in table format. * @return string String with supplier price */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { global $langs; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 49a24acf72b..6de1453044f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -504,6 +504,7 @@ class PaiementFourn extends Paiement * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; @@ -762,11 +763,12 @@ class PaiementFourn extends Paiement /** - * Load the third party of object, from id into this->thirdparty + * Load the third party of object, from id into this->thirdparty * - * @param int $force_thirdparty_id Force thirdparty id - * @return int <0 if KO, >0 if OK + * @param int $force_thirdparty_id Force thirdparty id + * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c8b64790061..51a547fb940 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -418,7 +418,7 @@ class Holiday extends CommonObject } else { - // SQL Error + // SQL Error $this->error="Error ".$this->db->lasterror(); return -1; } @@ -542,7 +542,7 @@ class Holiday extends CommonObject } else { - // SQL Error + // SQL Error $this->error="Error ".$this->db->lasterror(); return -1; } @@ -921,6 +921,7 @@ class Holiday extends CommonObject * @param date $startdate Date holiday should start * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0, $startdate='') { global $langs; @@ -1576,6 +1577,7 @@ class Holiday extends CommonObject * * @return array Array of user ids */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_holiday() { $users_validator=array(); diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 8a99788d040..b219c1b4a59 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -34,7 +34,7 @@ class Establishment extends CommonObject public $fk_element = 'fk_establishment'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto='building'; - + public $id; public $ref; public $rowid; @@ -208,7 +208,7 @@ class Establishment extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_code; - $this->country = $obj->country; + $this->country = $obj->country; return 1; } @@ -264,6 +264,7 @@ class Establishment extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; @@ -386,7 +387,7 @@ class Establishment extends CommonObject return ''; } - + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -397,5 +398,5 @@ class Establishment extends CommonObject { $this->id = 0; $this->ref = 'DEAAA'; - } + } } diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index f8754193515..bb7143f8dc6 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -65,6 +65,7 @@ class Import * @param string $filter Load a particular dataset only. Index will start to 0. * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { global $langs,$conf; @@ -186,6 +187,7 @@ class Import * @param string $datatoimport Dataset to import * @return string <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_example_file($model, $headerlinefields, $contentlinevalues,$datatoimport) { global $conf,$langs; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 46b3c113ff2..1911b40a30e 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -221,6 +221,7 @@ class Livraison extends CommonObject * @param string $description Description * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line($origin_id, $qty, $fk_product, $description) { $error = 0; @@ -490,6 +491,7 @@ class Livraison extends CommonObject * @param int $sending_id Id de l'expedition qui sert de modele * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_sending($user, $sending_id) { $expedition = new Expedition($this->db); @@ -535,6 +537,7 @@ class Livraison extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_line($id, $array_options=0) { global $conf; @@ -730,6 +733,7 @@ class Livraison extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $this->lines = array(); @@ -801,6 +805,7 @@ class Livraison extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { global $langs; @@ -972,6 +977,7 @@ class Livraison extends CommonObject * @param timestamp $date_livraison Date de livraison * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { if ($user->rights->expedition->creer) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 7843694585f..789a3367d79 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -332,6 +332,7 @@ class Loan extends CommonObject * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; @@ -366,6 +367,7 @@ class Loan extends CommonObject * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { global $langs; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index a430f79366e..811143602e0 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -367,6 +367,7 @@ class LoanSchedule extends CommonObject } } + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calc_mens($capital,$rate,$nbterm) { $result=''; @@ -452,6 +453,7 @@ class LoanSchedule extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function trans_paiment() { require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; @@ -540,4 +542,3 @@ class LoanSchedule extends CommonObject return $result; } } - diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 595aead109e..975f091fdcc 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -209,8 +209,8 @@ class PaymentLoan extends CommonObject $this->type_code = $obj->type_code; $this->type_libelle = $obj->type_libelle; - $this->bank_account = $obj->fk_account; - $this->bank_line = $obj->fk_bank; + $this->bank_account = $obj->fk_account; + $this->bank_line = $obj->fk_bank; } $this->db->free($resql); @@ -250,7 +250,6 @@ class PaymentLoan extends CommonObject if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); // Check parameters - // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_loan SET"; @@ -478,6 +477,7 @@ class PaymentLoan extends CommonObject * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { $sql = "UPDATE ".MAIN_DB_PREFIX."payment_loan SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index f7ae2608da5..8782e683f8a 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -169,6 +169,7 @@ class MailmanSpip * @param Adherent $object Object with data (->firstname, ->lastname, ->email and ->login) * @return int =0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_spip($object) { dol_syslog(get_class($this)."::add_to_spip"); @@ -211,6 +212,7 @@ class MailmanSpip * @param Adherent $object Object with data (->login) * @return int =0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_spip($object) { dol_syslog(get_class($this)."::del_to_spip"); @@ -250,6 +252,7 @@ class MailmanSpip * @param object $object Object with data (->login) * @return int 1=exists, 0=does not exists, -1=error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_in_spip($object) { if ($this->isSpipEnabled()) @@ -301,6 +304,7 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_mailman($object,$listes='') { global $conf,$langs,$user; @@ -373,6 +377,7 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_mailman($object,$listes='') { global $conf,$langs,$user; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index c6cd6fae901..22e1fb1940d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -366,6 +366,7 @@ class MyObject extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status, $mode=0) { if (empty($this->labelstatus)) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index cd8612cb7d1..dd9cbc80c0e 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -95,6 +95,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int <0 if error, number of emails added if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { $target = array(); @@ -197,4 +198,3 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets } } - diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 8169cd9961f..075d90cf63c 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -74,7 +74,7 @@ class modMyModule extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; - + //Url to the file with your last numberversion of this module $this->url_last_version = 'http://www.example.com/versionmodule.txt'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) @@ -89,19 +89,19 @@ class modMyModule extends DolibarrModules // for specific path of parts (eg: /mymodule/core/modules/barcode) // for specific css file (eg: /mymodule/css/mymodule.css.php) $this->module_parts = array( - 'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) - 'login' => 0, // Set this to 1 if module has its own login method file (core/login) - 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) - 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) - 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) - 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) - 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) - 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) - 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file - 'js' => array('/mymodule/js/mymodule.js.php'), // Set this to relative path of js file if module must load a js on all pages - 'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' - 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users - ); + 'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) + 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) + 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file + 'js' => array('/mymodule/js/mymodule.js.php'), // Set this to relative path of js file if module must load a js on all pages + 'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' + 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users + ); // Data directories to create when module is enabled. // Example: this->dirs = array("/mymodule/temp","/mymodule/subdir"); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index d80bac70b79..09fa55768bf 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -464,6 +464,7 @@ class Opensurveysondage extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { $ret=array(); @@ -621,6 +622,7 @@ class Opensurveysondage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode) { global $langs, $conf; diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index a6a182fc64f..b6c036825c8 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -72,6 +72,7 @@ class ActionsCardProduct * @param string $ref Ref of object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { global $limit, $offset, $sortfield, $sortorder; @@ -304,6 +305,7 @@ class ActionsCardProduct * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { global $conf, $langs; @@ -433,4 +435,3 @@ class ActionsCardProduct } } - diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 108c6ccb748..4f418517c6b 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -71,6 +71,7 @@ class ActionsCardService * @param string $ref Ref of object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { global $limit, $offset, $sortfield, $sortorder; @@ -282,6 +283,7 @@ class ActionsCardService * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { global $conf; @@ -365,4 +367,3 @@ class ActionsCardService } } - diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 6ae31645a50..3fa1ada3b15 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,6 +167,7 @@ class FormProduct * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return String full label with all parents, separated by ' >> ' */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function get_parent_path($tab, $final_label='') { if(empty($final_label)) $final_label = $tab['label']; @@ -284,6 +285,7 @@ class FormProduct * @param int $adddefault Add empty unit called "Default" * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { print $this->load_measuring_units($name, $measuring_style, $default, $adddefault); @@ -299,6 +301,7 @@ class FormProduct * @param int $adddefault Add empty unit called "Default" * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { global $langs,$conf,$mysoc; @@ -483,4 +486,4 @@ class FormProduct } } } -} \ No newline at end of file +} diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d19f8f86732..bc5d609c48a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -688,13 +688,14 @@ class Product extends CommonObject /** * Check barcode * - * @param string $valuetotest Value to test + * @param string $valuetotest Value to test * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK * -1 ErrorBadBarCodeSyntax * -2 ErrorBarCodeRequired * -3 ErrorBarCodeAlreadyUsed */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_barcode($valuetotest,$typefortest) { global $conf; @@ -1445,6 +1446,7 @@ class Product extends CommonObject * @param int $level price level to change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _log_price($user,$level=0) { global $conf; @@ -1483,6 +1485,7 @@ class Product extends CommonObject * @param int $rowid Line id to delete * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function log_price_delete($user, $rowid) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; @@ -1516,6 +1519,7 @@ class Product extends CommonObject * @param int $fk_soc If of supplier * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0) { global $conf; @@ -2211,6 +2215,7 @@ class Product extends CommonObject * @param int $socid Id societe * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_propale($socid=0) { global $conf; @@ -2254,6 +2259,7 @@ class Product extends CommonObject * @param int $socid Id thirdparty * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_proposal_supplier($socid=0) { global $conf; @@ -2299,6 +2305,7 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Array of stats (nb=nb of order, qty=qty ordered) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) { global $conf,$user; @@ -2395,6 +2402,7 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualStock = 0) { global $conf,$user; @@ -2438,6 +2446,7 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) { global $conf,$user; @@ -2485,6 +2494,7 @@ class Product extends CommonObject * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0) { global $conf,$user; @@ -2526,6 +2536,7 @@ class Product extends CommonObject * @param int $socid Id societe * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_contrat($socid=0) { global $conf; @@ -2568,6 +2579,7 @@ class Product extends CommonObject * @param int $socid Id societe * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture($socid=0) { global $conf; @@ -2610,6 +2622,7 @@ class Product extends CommonObject * @param int $socid Id societe * @return array Tableau des stats */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture_fournisseur($socid=0) { global $conf; @@ -2654,6 +2667,7 @@ class Product extends CommonObject * @param int $year Year (0=current year) * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _get_stats($sql, $mode, $year=0) { $resql = $this->db->query($sql); @@ -2720,6 +2734,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf; @@ -2756,6 +2771,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf; @@ -2791,6 +2807,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf; @@ -2826,6 +2843,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf; @@ -2861,6 +2879,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf, $user; @@ -2895,6 +2914,7 @@ class Product extends CommonObject * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { global $conf, $user; @@ -2928,6 +2948,7 @@ class Product extends CommonObject * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { // Clean parameters @@ -2984,6 +3005,7 @@ class Product extends CommonObject * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { // Clean parameters @@ -3016,6 +3038,7 @@ class Product extends CommonObject * @param int $fk_child Id du produit a ne plus lie * @return int < 0 if KO, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_sousproduit($fk_parent, $fk_child) { if (! is_numeric($fk_parent)) $fk_parent=0; @@ -3042,6 +3065,7 @@ class Product extends CommonObject * @param int $fk_child Id du produit lie * @return int < 0 si erreur, > 0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_sousproduit($fk_parent, $fk_child) { $sql = "SELECT fk_product_pere, qty, incdec"; @@ -3085,6 +3109,7 @@ class Product extends CommonObject * @param float $quantity Quantity minimum for price * @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity) { global $conf; @@ -3184,6 +3209,7 @@ class Product extends CommonObject * * @return array Tableau des id de fournisseur */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_suppliers() { global $conf; @@ -3218,6 +3244,7 @@ class Product extends CommonObject * @param int $toId Id product target * @return nt < 0 if KO, > 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_price($fromId, $toId) { $this->db->begin(); @@ -3246,6 +3273,7 @@ class Product extends CommonObject * @param int $toId Product id * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_associations($fromId, $toId) { $this->db->begin(); @@ -3272,6 +3300,7 @@ class Product extends CommonObject * @param int $toId Id produit cible * @return int < 0 si erreur, > 0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_fournisseurs($fromId, $toId) { $this->db->begin(); @@ -3323,6 +3352,7 @@ class Product extends CommonObject * @param int $id_parent Id parent * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_parent=0) { global $conf,$langs; @@ -3378,6 +3408,7 @@ class Product extends CommonObject * @param int $multiply Because each sublevel must be multiplicated by parent nb * @return array $this->res */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_arbo_each_prod($multiply=1) { $this->res = array(); @@ -3527,6 +3558,7 @@ class Product extends CommonObject * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sousproduits_arbo() { $parent=array(); @@ -3730,6 +3762,7 @@ class Product extends CommonObject * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0,$type=0) { global $conf, $langs; @@ -3830,6 +3863,7 @@ class Product extends CommonObject * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='', $origin_element='', $origin_id=null) { if ($id_entrepot) @@ -3878,6 +3912,7 @@ class Product extends CommonObject * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='', $origin_element='', $origin_id=null) { if ($id_entrepot) @@ -3923,6 +3958,7 @@ class Product extends CommonObject * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock, getBatchInfo */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stock($option='') { global $conf; @@ -3996,6 +4032,7 @@ class Product extends CommonObject * @return int < 0 if KO, > 0 if OK * @see load_stock, getBatchInfo */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_virtual_stock() { global $conf; @@ -4095,6 +4132,7 @@ class Product extends CommonObject * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { global $conf; @@ -4135,6 +4173,7 @@ class Product extends CommonObject * @param string $sdir Directory to scan * @return boolean True if at least one photo is available, False if not */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_photo_available($sdir) { include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; @@ -4172,6 +4211,7 @@ class Product extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -4226,6 +4266,7 @@ class Product extends CommonObject * @param string $file Chemin de l'image * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -4261,6 +4302,7 @@ class Product extends CommonObject * @param string $file Path to file * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { $file_osencoded=dol_osencode($file); @@ -4274,6 +4316,7 @@ class Product extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user, $hookmanager; @@ -4339,6 +4382,7 @@ class Product extends CommonObject * @param string $type Barcode type (ean, isbn, ...) * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_barcode($object,$type='') { global $conf; @@ -4466,6 +4510,7 @@ class Product extends CommonObject * * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function min_recommended_price() { global $conf; diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index fdff7b1fe6d..e1eddde724d 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -304,6 +304,7 @@ class Productcustomerprice extends CommonObject * @param array $filter Filter for select * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) { global $langs; @@ -342,7 +343,7 @@ class Productcustomerprice extends CommonObject $sql .= " AND prod.rowid=t.fk_product "; $sql .= " AND prod.entity IN (" . getEntity('product') . ")"; $sql .= " AND t.entity IN (" . getEntity('productprice') . ")"; - + // Manage filter if (count($filter) > 0) { foreach ( $filter as $key => $value ) { @@ -417,6 +418,7 @@ class Productcustomerprice extends CommonObject * @param array $filter Filter for sql request * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_log($sortorder, $sortfield, $limit, $offset, $filter = array()) { global $langs; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 92c6ffadca4..c82cbf279aa 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -223,6 +223,7 @@ class Propalmergepdfproduct extends CommonObject * @param string $lang Lang string code * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_product($product_id, $lang='') { global $langs,$conf; @@ -313,9 +314,6 @@ class Propalmergepdfproduct extends CommonObject if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod); if (isset($this->lang)) $this->lang=trim($this->lang); - - - // Check parameters // Put here code to add a control on parameters values @@ -440,6 +438,7 @@ class Propalmergepdfproduct extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_product($user, $product_id, $lang_id='', $notrigger=0) { global $conf, $langs; @@ -501,6 +500,7 @@ class Propalmergepdfproduct extends CommonObject * @param User $user User that deletes * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_file($user) { global $conf, $langs; diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 5ce3068c144..b3f47b4a224 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -127,7 +127,7 @@ class PriceExpression $this->error='ErrorWrongParameters'; return -1; } - + $sql = "SELECT title, expression"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$id; @@ -161,6 +161,7 @@ class PriceExpression * * @return array Array of price expressions */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_price_expression() { $sql = "SELECT rowid, title, expression"; @@ -199,6 +200,7 @@ class PriceExpression * @param String $title Title of expression * @return int < 0 if KO, 0 if OK but not found, > 0 rowid */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_title($title) { $sql = "SELECT rowid"; @@ -299,7 +301,7 @@ class PriceExpression $error=0; $rowid = $this->id; - + $this->db->begin(); if (! $error) diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index f4595062098..d68c7e5318c 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -538,6 +538,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_next_update($next_update, $user=0, $notrigger=0) { $error=0; @@ -582,6 +583,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_status($last_status, $user=0, $notrigger=0) { $error=0; diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 867a30faaeb..3249671d173 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -335,4 +335,4 @@ class PriceParser )); return $this->parseExpression($product, $expression, $extra_values); } -} \ No newline at end of file +} diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index dc4f600b529..66411a0f978 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -76,7 +76,7 @@ class Inventory extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), - 'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth200'), + 'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth200'), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToThirparty'), @@ -340,6 +340,7 @@ class Inventory extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 039918ea66c..c99ac259bd3 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -416,6 +416,7 @@ class Entrepot extends CommonObject * @param int $status Status * @return array Array list of warehouses */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_array($status=1) { $liste = array(); @@ -446,6 +447,7 @@ class Entrepot extends CommonObject * * @return Array Array('nb'=>Nb, 'value'=>Value) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_different_products() { $ret=array(); @@ -478,6 +480,7 @@ class Entrepot extends CommonObject * * @return Array Array('nb'=>Nb, 'value'=>Value) */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_products() { $ret=array(); @@ -524,6 +527,7 @@ class Entrepot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -648,6 +652,7 @@ class Entrepot extends CommonObject * * @return string String full path to current warehouse separated by " >> " */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo() { global $user,$langs,$conf; @@ -690,6 +695,7 @@ class Entrepot extends CommonObject * @param array() $TChildWarehouses array which will contain all children (param by reference) * @return array() $TChildWarehouses array which will contain all children */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children_warehouses($id, &$TChildWarehouses) { $sql = 'SELECT rowid @@ -707,7 +713,7 @@ class Entrepot extends CommonObject return $TChildWarehouses; } - + /** * Create object on disk * diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 41c00b7361c..151a625fdc6 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -864,6 +864,7 @@ class MouvementStock extends CommonObject * @param int $origintype Type origin * @return string */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_origin($fk_origin, $origintype) { $origin=''; @@ -1016,6 +1017,7 @@ class MouvementStock extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($mode=0) { global $langs; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 8370e8ce080..6332c401ac1 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -166,7 +166,7 @@ class Productlot extends CommonObject $error++; } } - + if (! $error && ! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. @@ -234,7 +234,7 @@ class Productlot extends CommonObject //$this->ref = $obj->fk_product.'_'.$obj->batch; $this->batch = $obj->batch; - $this->entity = (!empty($obj->entity)?$obj->entity:$conf->entity); // Prevent "null" entity + $this->entity = (!empty($obj->entity)?$obj->entity:$conf->entity); // Prevent "null" entity $this->fk_product = $obj->fk_product; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); @@ -300,7 +300,7 @@ class Productlot extends CommonObject // Check parameters // Put here code to add a control on parameters values - + if (empty($this->oldcopy)) { $org=new self($this->db); @@ -340,7 +340,7 @@ class Productlot extends CommonObject $error++; } } - + if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -481,6 +481,7 @@ class Productlot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -582,4 +583,3 @@ class Productlot extends CommonObject } } - diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index cbca4e5854d..2c1c22fcce2 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -523,6 +523,7 @@ class ProductStockEntrepot extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e117dc3eb39..68d7080521a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -480,6 +480,7 @@ class Project extends CommonObject * @param int $socid To filter on a particular third party * @return array List of projects */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($socid='') { global $conf; @@ -526,6 +527,7 @@ class Project extends CommonObject * @param string $projectkey Equivalent key to fk_projet for actual type * @return mixed Array list of object ids linked to project, < 0 or string if error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='', $projectkey='fk_projet') { $elements = array(); @@ -877,6 +879,7 @@ class Project extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0) { global $langs; @@ -1548,7 +1551,8 @@ class Project extends CommonObject * @param string $tableName Table of the element to update * @param int $elementSelectId Key-rowid of the line of the element to update * @return int 1 if OK or < 0 if KO - */ + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_element($tableName, $elementSelectId) { $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; @@ -1582,6 +1586,7 @@ class Project extends CommonObject * @param int $elementSelectId Key-rowid of the line of the element to update * @return int 1 if OK or < 0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_element($tableName, $elementSelectId) { $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; @@ -1712,6 +1717,7 @@ class Project extends CommonObject * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -1795,6 +1801,7 @@ class Project extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -1972,4 +1979,3 @@ class Project extends CommonObject } } - diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 46f04b08932..52f1facb548 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1706,6 +1706,7 @@ class Task extends CommonObject * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0) { // list of Statut of the task @@ -1822,6 +1823,7 @@ class Task extends CommonObject * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -1894,6 +1896,7 @@ class Task extends CommonObject * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 515f08f6053..ca6df17965e 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -332,6 +332,7 @@ class Dolresource extends CommonObject * @param int $id id object * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_element_resource($id) { global $langs; @@ -480,6 +481,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='') { global $conf; @@ -576,6 +578,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter='') { global $conf; @@ -654,6 +657,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='') { global $conf; @@ -730,6 +734,7 @@ class Dolresource extends CommonObject * @deprecated, remplaced by hook getElementResources * @see getElementResources() */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_available() { global $conf; @@ -749,6 +754,7 @@ class Dolresource extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_element_resource($user=null, $notrigger=0) { global $conf, $langs; @@ -875,6 +881,7 @@ class Dolresource extends CommonObject * * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_code_type_resource() { global $langs; @@ -963,6 +970,7 @@ class Dolresource extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index ed667fad8ab..6002b0c1f44 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -69,6 +69,7 @@ class FormResource * @param int $limit Limit number of answers * @return string HTML string with */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array(), $filterkey='', $outputmode=0, $limit=20) { global $conf,$user,$langs; @@ -149,17 +150,18 @@ class FormResource } /** - * Return html list of tickets type + * Return html list of tickets type * - * @param string $selected Id du type pre-selectionne - * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @return void + * @param string $selected Id du type pre-selectionne + * @param string $htmlname Nom de la zone select + * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) + * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code + * @param int $empty 1=peut etre vide, 0 sinon + * @param int $noadmininfo 0=Add admin info, 1=Disable admin info + * @param int $maxlength Max length of label + * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_resource($selected='',$htmlname='type_resource',$filtertype='',$format=0, $empty=0, $noadmininfo=0,$maxlength=0) { global $langs,$user; @@ -203,7 +205,4 @@ class FormResource if ($user->admin && ! $noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } - - } - diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 37082f4140b..74616ec7d5b 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -67,6 +67,7 @@ abstract class ActionsCardCommon * @param string $ref Ref of object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { global $conf, $langs, $user, $mysoc, $canvas; @@ -364,6 +365,7 @@ abstract class ActionsCardCommon * @param string $action Action string * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function assign_post($action) { global $langs, $mysoc; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 419a5ecb73e..2718e7e8d3c 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -75,6 +75,7 @@ class ActionsCardCompany extends ActionsCardCommon * @param string $ref Ref of object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { global $conf, $langs, $user, $mysoc; @@ -220,4 +221,3 @@ class ActionsCardCompany extends ActionsCardCommon } } - diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 78064004e37..380ee3513a8 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -92,6 +92,7 @@ class ActionsCardIndividual extends ActionsCardCommon * @param string $ref Ref of object * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { global $conf, $langs; @@ -136,4 +137,3 @@ class ActionsCardIndividual extends ActionsCardCommon } } - diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 43e46008910..599b48153ad 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -238,6 +238,7 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($socid, $user=null) { global $langs, $conf; @@ -331,6 +332,7 @@ class Address * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_address($id, $user=null) { global $langs; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 59eea72c2c7..26fd6d4e2cd 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -52,6 +52,7 @@ class Client extends Societe * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 4403d5b8fde..cc40a697cad 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -18,7 +18,7 @@ /** * \file class/companypaymentmode.class.php - * \ingroup monmodule + * \ingroup company * \brief This file is a CRUD class file for CompanyPaymentMode (Create/Read/Update/Delete) */ @@ -455,6 +455,7 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c70d0a1a3e2..0289c5aa745 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -569,6 +569,7 @@ class Societe extends CommonObject * @param User $user Object user * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_individual(User $user) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -1579,6 +1580,7 @@ class Societe extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_as_client() { if ($this->id) @@ -1608,6 +1610,7 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_client($remise, $note, User $user) { global $conf, $langs; @@ -1669,6 +1672,7 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_supplier($remise, $note, User $user) { global $conf, $langs; @@ -1732,6 +1736,7 @@ class Societe extends CommonObject * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, id of discount record if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_except($remise, User $user, $desc, $tva_tx=0, $discount_type=0) { global $langs; @@ -1873,6 +1878,7 @@ class Societe extends CommonObject * @param User $user Use making change * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_price_level($price_level, User $user) { if ($this->id) @@ -1910,13 +1916,14 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_commercial(User $user, $commid) { $error=0; - - - - + + + + if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; @@ -1934,7 +1941,7 @@ class Societe extends CommonObject } else { $this->context=array('commercial_modified'=>$commid); - + $result=$this->call_trigger('COMPANY_LINK_SALE_REPRESENTATIVE',$user); if ($result < 0) $error++; } @@ -1948,14 +1955,15 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_commercial(User $user, $commid) { $error=0; $this->context=array('commercial_modified'=>$commid); - + $result=$this->call_trigger('COMPANY_UNLINK_SALE_REPRESENTATIVE',$user); if ($result < 0) $error++; - + if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux "; @@ -2168,6 +2176,7 @@ class Societe extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -2216,6 +2225,7 @@ class Societe extends CommonObject * @param int $addthirdparty 1=Add also a record for thirdparty email * @return array Array of contacts emails */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_email_array($addthirdparty=0) { global $langs; @@ -2235,6 +2245,7 @@ class Societe extends CommonObject * * @return array Array of contacts emails */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_phone_array() { global $langs; @@ -2257,6 +2268,7 @@ class Societe extends CommonObject * @param int $hidedisabled 1=Hide contact if disabled * @return array Array of contacts emails or mobile. Example: array(id=>'Name ') */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_property_array($mode='email', $hidedisabled=0) { global $langs; @@ -2323,6 +2335,7 @@ class Societe extends CommonObject * * @return array tableau des contacts */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array() { $contacts = array(); @@ -2355,6 +2368,7 @@ class Societe extends CommonObject * * @return array $contacts tableau des contacts */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array_objects() { require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; @@ -2392,6 +2406,7 @@ class Societe extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of contact with format: "Full name " */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_get_property($rowid,$mode) { $contact_property=''; @@ -2430,6 +2445,7 @@ class Societe extends CommonObject * @param string $mode 'label' or 'rum' or 'format' * @return string Bank number */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_rib($mode='label') { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -2465,6 +2481,7 @@ class Societe extends CommonObject * * @return array|int 0 if KO, Array of CompanyBanckAccount if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_rib() { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -2496,6 +2513,7 @@ class Societe extends CommonObject * @param int $type Should be 0 to say customer * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codeclient($objsoc=0,$type=0) { global $conf; @@ -2526,6 +2544,7 @@ class Societe extends CommonObject * @param int $type Should be 1 to say supplier * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codefournisseur($objsoc=0,$type=1) { global $conf; @@ -2553,6 +2572,7 @@ class Societe extends CommonObject * * @return int 0=No, 1=Yes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codeclient_modifiable() { global $conf; @@ -2587,6 +2607,7 @@ class Societe extends CommonObject * * @return int 0=No, 1=Yes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codefournisseur_modifiable() { global $conf; @@ -2625,6 +2646,7 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codeclient() { global $conf; @@ -2660,6 +2682,7 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codefournisseur() { global $conf; @@ -2694,6 +2717,7 @@ class Societe extends CommonObject * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codecompta($type) { global $conf; @@ -2742,6 +2766,7 @@ class Societe extends CommonObject * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_parent($id) { if ($this->id) @@ -2770,6 +2795,7 @@ class Societe extends CommonObject * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_verifiable($idprof) { global $conf; @@ -2809,6 +2835,7 @@ class Societe extends CommonObject * @param int $socid Id of thirdparty to exclude (if update) * @return boolean True if exists, False if not */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_exists($idprof, $value, $socid=0) { $field = $idprof; @@ -2867,6 +2894,7 @@ class Societe extends CommonObject * @return int <=0 if KO, >0 if OK * TODO better to have this in a lib than into a business class */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_check($idprof,$soc) { global $conf; @@ -3016,6 +3044,7 @@ class Societe extends CommonObject * @return string Url or empty string if no URL known * TODO better in a lib than into business class */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_url($idprof,$thirdparty) { global $conf,$langs,$hookmanager; @@ -3065,6 +3094,7 @@ class Societe extends CommonObject * * @return bool true si la societe a des projets, false sinon */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function has_projects() { $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; @@ -3166,6 +3196,7 @@ class Societe extends CommonObject * * @return int 0 if success, <> 0 if error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadSupplierCateg() { $this->SupplierCategories = array(); @@ -3194,6 +3225,7 @@ class Societe extends CommonObject * @param int $categorie_id Id of category * @return int 0 if success, <> 0 if error */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFournisseurInCategory($categorie_id) { if ($categorie_id > 0 && $this->id > 0) @@ -3219,6 +3251,7 @@ class Societe extends CommonObject * @param string $socalias Alias name of third party to force * @return int <0 if KO, id of created account if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member(Adherent $member, $socname='', $socalias='') { global $user,$langs; @@ -3493,6 +3526,7 @@ class Societe extends CommonObject * @param int $fk_prospectlevel Prospect level * @return string label of level */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspLevel($fk_prospectlevel) { global $langs; @@ -3514,6 +3548,7 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_prospect_level(User $user) { return $this->update($this->id, $user); @@ -3539,6 +3574,7 @@ class Societe extends CommonObject * @param string $label Label to use for status for added status * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspCommStatut($statut, $mode=0, $label='') { global $langs; @@ -3591,6 +3627,7 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_OutstandingBill(User $user) { return $this->update($this->id, $user); @@ -3755,6 +3792,7 @@ class Societe extends CommonObject * @return int Amount in debt for thirdparty * @deprecated */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_OutstandingBill() { /* Accurate value of remain to pay is to sum remaintopay for each invoice @@ -3808,6 +3846,7 @@ class Societe extends CommonObject * @param int $statut Id statut * @return string Libelle du statut */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibCustProspStatut($statut) { global $langs; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 7340a319534..3fc3082e5bf 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -398,6 +398,7 @@ class SocieteAccount extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { global $langs; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index c3b6e4b3338..e37092b28e5 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -207,6 +207,7 @@ class SupplierProposal extends CommonObject * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { global $conf, $mysoc; @@ -256,6 +257,7 @@ class SupplierProposal extends CommonObject * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1071,6 +1073,7 @@ class SupplierProposal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { $this->products=$this->lines; @@ -1500,6 +1503,7 @@ class SupplierProposal extends CommonObject * @param int $date_livraison Delivery date * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { if (! empty($user->rights->supplier_proposal->creer)) @@ -1529,6 +1533,7 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise) { $remise=trim($remise)?trim($remise):0; @@ -1562,6 +1567,7 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise) { $remise=trim($remise)?trim($remise):0; @@ -1831,6 +1837,7 @@ class SupplierProposal extends CommonObject * @param User $user Object user that modify * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user) { global $conf,$langs; @@ -1864,6 +1871,7 @@ class SupplierProposal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC') { global $conf,$user; @@ -2120,8 +2128,9 @@ class SupplierProposal extends CommonObject * * @param int $statut id statut * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label + * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { // Init/load array of translation of status @@ -2163,8 +2172,9 @@ class SupplierProposal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { global $conf, $user, $langs; @@ -2323,6 +2333,7 @@ class SupplierProposal extends CommonObject * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf, $user; @@ -3152,6 +3163,7 @@ class SupplierProposalLine extends CommonObjectLine * * @return int <0 if ko, >0 if ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); @@ -3180,4 +3192,3 @@ class SupplierProposalLine extends CommonObjectLine } } - diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index f49325a5bc5..75d2fc5c68d 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -1295,6 +1295,7 @@ class ActionsTicket * @param int $fieldid Id * @return int 0 */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_ref($filter, $fieldid) { $this->getInstanceDao(); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4430ae3e0f0..1d6593d62ef 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1166,6 +1166,7 @@ class Ticket extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { global $langs; @@ -2445,6 +2446,7 @@ class Ticket extends CommonObject * @param string $sdir Directory to scan * @return boolean True if at least one photo is available, False if not */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_photo_available($sdir) { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6205d42e1cf..11f85b64382 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1177,6 +1177,7 @@ class User extends CommonObject * @param string $password Password to force * @return int <0 if error, if OK returns id of created user */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_contact($contact,$login='',$password='') { global $conf,$user,$langs; @@ -1254,6 +1255,7 @@ class User extends CommonObject * @param string $login Login to force * @return int <0 if KO, if OK, return id of created account */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member($member,$login='') { global $conf,$user,$langs; @@ -1325,6 +1327,7 @@ class User extends CommonObject * * @return integer erreur <0, si ok renvoi le nbre de droits par defaut positionnes */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_default_rights() { global $conf; @@ -1655,6 +1658,7 @@ class User extends CommonObject * * @return <0 si echec, >=0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_last_login_date() { $now=dol_now(); @@ -1822,6 +1826,7 @@ class User extends CommonObject * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @TODO Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_password($user, $password='', $changelater=0) { global $conf,$langs; @@ -1933,6 +1938,7 @@ class User extends CommonObject * * @return <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_clicktodial() { $sql = "SELECT url, login, pass, poste "; @@ -1969,6 +1975,7 @@ class User extends CommonObject * * @return integer */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_clicktodial() { $this->db->begin(); @@ -2011,6 +2018,7 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetInGroup($group, $entity, $notrigger=0) { global $conf, $langs, $user; @@ -2071,6 +2079,7 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function RemoveFromGroup($group, $entity, $notrigger=0) { global $conf,$langs,$user; @@ -2304,13 +2313,13 @@ class User extends CommonObject //Check user's rights to see an other user if((!$user->rights->user->user->lire && $this->id !=$user->id)) $option='nolink'; - + if ($option == 'xxx') { $linkstart = ''; $linkend=''; } - + if ($option == 'nolink') { $linkstart = ''; @@ -2342,6 +2351,7 @@ class User extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -2390,6 +2400,7 @@ class User extends CommonObject * 2=Return key only (RDN) (uid=qqq) * @return string DN */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { global $conf; @@ -2405,6 +2416,7 @@ class User extends CommonObject * * @return array Tableau info des attributs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { global $conf,$langs; @@ -2676,6 +2688,7 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ldap2dolibarr(&$ldapuser) { // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) @@ -2711,6 +2724,7 @@ class User extends CommonObject * @return void * @see getAllChildIds */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children() { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; @@ -2742,6 +2756,7 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps private function load_parentof() { global $conf; @@ -2784,6 +2799,7 @@ class User extends CommonObject * @param string $filter SQL filter on users * @return array Array of users $this->users. Note: $this->parentof is also set. */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_tree($deleteafterid=0, $filter='') { global $conf, $user; @@ -2922,6 +2938,7 @@ class User extends CommonObject * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) * @return int < 0 if KO (infinit loop), >= 0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_user($id_user,$protection=0) { dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); @@ -2981,6 +2998,7 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $conf; @@ -3053,6 +3071,7 @@ class User extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of user with format: "Full name " */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function user_get_property($rowid,$mode) { $user_property=''; @@ -3147,4 +3166,3 @@ class User extends CommonObject } } - diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 77385f84179..b1769edea6f 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -206,4 +206,3 @@ class UserBankAccount extends Account return $rib; } } - diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9c2f3437fa4..594b8bf928c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -804,6 +804,7 @@ class UserGroup extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { global $langs; @@ -897,6 +898,7 @@ class UserGroup extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { global $conf; @@ -913,6 +915,7 @@ class UserGroup extends CommonObject * * @return array Tableau info des attributs */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { global $conf,$langs; @@ -1004,4 +1007,3 @@ class UserGroup extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } - diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index a6b5dcc51f7..1bb58f66f7d 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -691,6 +691,7 @@ class Website extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; @@ -920,4 +921,3 @@ class Website extends CommonObject } } - diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index c0b6aaa7ab9..023baf09c7b 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -471,6 +471,7 @@ class WebsitePage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { global $langs; diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 54ebca5ac67..a97da0c0ad6 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -257,6 +257,7 @@ class CoreTest extends PHPUnit_Framework_TestCase * @param string $type 1=GET, 0=POST, 2=PHP_SELF * @return int >0 if there is an injection */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function test_sql_and_script_inject($val, $type) { $inj = 0; From 3210181a3da41707921b728da7bc72381ba2e985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Aug 2018 10:21:34 +0200 Subject: [PATCH 2/9] rule for private function is different --- dev/setup/codesniffer/ruleset.xml | 4 +- dev/translation/autotranslator.class.php | 1 + .../actions_adherentcard_common.class.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- .../actions_contactcard_common.class.php | 45 ++++++++++--------- htdocs/core/class/dolgraph.class.php | 4 +- htdocs/core/class/extrafields.class.php | 3 ++ htdocs/core/db/sqlite3.class.php | 8 ++-- .../product/class/html.formproduct.class.php | 2 +- htdocs/product/class/productbatch.class.php | 3 +- .../canvas/actions_card_common.class.php | 4 +- htdocs/user/class/user.class.php | 2 +- 12 files changed, 43 insertions(+), 37 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 375ddd0dcc0..e16dfa29fcc 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -349,9 +349,9 @@ - + 0 diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 47d6a25ec15..2acbc2d7e10 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -73,6 +73,7 @@ class autoTranslator * * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function parse_refLangTranslationFiles() { diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 57fabdecd17..9707b520277 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -232,7 +232,7 @@ abstract class ActionsAdherentCardCommon * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { global $langs, $mysoc; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 2ea63cc7bfc..549bb5af29b 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -989,7 +989,7 @@ class Categorie extends CommonObject * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function load_motherof() { global $conf; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 1648c0ff8e2..21977e6fb32 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -260,33 +260,34 @@ abstract class ActionsContactCardCommon * * @return string HTML output */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { global $langs, $mysoc; - $this->object->old_name = $_POST["old_name"]; - $this->object->old_firstname = $_POST["old_firstname"]; + $this->object->old_name = $_POST["old_name"]; + $this->object->old_firstname = $_POST["old_firstname"]; - $this->object->socid = $_POST["socid"]; - $this->object->lastname = $_POST["name"]; - $this->object->firstname = $_POST["firstname"]; - $this->object->civility_id = $_POST["civility_id"]; - $this->object->poste = $_POST["poste"]; - $this->object->address = $_POST["address"]; - $this->object->zip = $_POST["zipcode"]; - $this->object->town = $_POST["town"]; - $this->object->fk_departement = $_POST["state_id"]; - $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; - $this->object->state_id = $_POST["state_id"]; - $this->object->phone_pro = $_POST["phone_pro"]; - $this->object->phone_perso = $_POST["phone_perso"]; - $this->object->phone_mobile = $_POST["phone_mobile"]; - $this->object->fax = $_POST["fax"]; - $this->object->email = $_POST["email"]; - $this->object->jabberid = $_POST["jabberid"]; - $this->object->priv = $_POST["priv"]; - $this->object->note = $_POST["note"]; - $this->object->canvas = $_POST["canvas"]; + $this->object->socid = $_POST["socid"]; + $this->object->lastname = $_POST["name"]; + $this->object->firstname = $_POST["firstname"]; + $this->object->civility_id = $_POST["civility_id"]; + $this->object->poste = $_POST["poste"]; + $this->object->address = $_POST["address"]; + $this->object->zip = $_POST["zipcode"]; + $this->object->town = $_POST["town"]; + $this->object->fk_departement = $_POST["state_id"]; + $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; + $this->object->state_id = $_POST["state_id"]; + $this->object->phone_pro = $_POST["phone_pro"]; + $this->object->phone_perso = $_POST["phone_perso"]; + $this->object->phone_mobile = $_POST["phone_mobile"]; + $this->object->fax = $_POST["fax"]; + $this->object->email = $_POST["email"]; + $this->object->jabberid = $_POST["jabberid"]; + $this->object->priv = $_POST["priv"]; + $this->object->note = $_POST["note"]; + $this->object->canvas = $_POST["canvas"]; // We set country_id, and country_code label of the chosen country if ($this->object->country_id) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 28fbe14f287..4a9b45aa54f 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -655,7 +655,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_artichow($file,$fileurl) { global $artichow_defaultfont; @@ -844,7 +844,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_jflot($file,$fileurl) { global $artichow_defaultfont; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index fb6906c3456..36e31bf2437 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -309,6 +309,7 @@ class ExtraFields * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $default='', $computed='',$entity='', $langfile='', $enabled='1') { global $conf,$user; @@ -463,6 +464,7 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function delete_label($attrname, $elementtype='member') { global $conf; @@ -630,6 +632,7 @@ class ExtraFields * @param int $totalizable Is extrafield totalizable on list * @return int <=0 if KO, >0 if OK */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$help='',$default='',$computed='',$entity='',$langfile='',$enabled='1', $totalizable=0) { global $conf, $user; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 43a2217d64e..e5e0dd8cc5a 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1320,7 +1320,7 @@ class DoliDBSqlite3 extends DoliDB * @param int $day Day * @return int Formatted date */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_daynr($year, $month, $day) { $y = $year; if ($y == 0 && $month == 0) return 0; @@ -1341,7 +1341,7 @@ class DoliDBSqlite3 extends DoliDB * @param bool $sunday_first_day_of_week ??? * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_weekday($daynr, $sunday_first_day_of_week) { $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); return $ret; @@ -1353,7 +1353,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $year Year * @return int Nb of days in year */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_days_in_year($year) { return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365); @@ -1369,7 +1369,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $calc_year ??? * @return string ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) { $daynr=self::calc_daynr($year,$month,$day); $first_daynr=self::calc_daynr($year,1,1); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 3fa1ada3b15..1bbfb8f7aa5 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,7 +167,7 @@ class FormProduct * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return String full label with all parents, separated by ' >> ' */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function get_parent_path($tab, $final_label='') { if(empty($final_label)) $final_label = $tab['label']; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index b52514a4195..c4839d8992d 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -398,8 +398,9 @@ class Productbatch extends CommonObject /** * Clean fields (triming) * - * @return void + * @return void */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function clean_param() { if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 74616ec7d5b..9a8319e6a00 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -365,7 +365,7 @@ abstract class ActionsCardCommon * @param string $action Action string * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post($action) { global $langs, $mysoc; @@ -382,7 +382,7 @@ abstract class ActionsCardCommon $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->state_id = $_POST["state_id"]; - $this->object->phone = $_POST["tel"]; + $this->object->phone = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = $_POST["email"]; $this->object->url = $_POST["url"]; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 11f85b64382..f5e7954398a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2756,7 +2756,7 @@ class User extends CommonObject * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function load_parentof() { global $conf; From d68f176e7e70adcf155a5b68ef2517efcf3bb59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 16 Aug 2018 14:59:06 +0200 Subject: [PATCH 3/9] replace obsolete phpcs tags --- htdocs/api/class/api_access.class.php | 5 ++--- htdocs/core/modules/modAsset.class.php | 4 ---- htdocs/core/modules/modDav.class.php | 4 ---- .../template/core/modules/modMyModule.class.php | 4 ---- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index d067d6e2ad6..5495009917a 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -59,14 +59,13 @@ class DolibarrApiAccess implements iAuthenticate */ public static $user = ''; - // @codingStandardsIgnoreStart - /** * Check access * * @return bool * @throws RestException */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __isAllowed() { global $conf, $db; @@ -172,11 +171,11 @@ class DolibarrApiAccess implements iAuthenticate * @example Digest * @example OAuth */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __getWWWAuthenticateString() { return ''; } - // @codingStandardsIgnoreEnd /** * Verify access diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index d6a50ab9b07..c227352225d 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -27,15 +27,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; -// The class name should start with a lower case mod for Dolibarr to pick it up -// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule. -// @codingStandardsIgnoreStart /** * Description and activation class for module FixedAssets */ class modAsset extends DolibarrModules { - // @codingStandardsIgnoreEnd /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDav.class.php b/htdocs/core/modules/modDav.class.php index 77c3f8feef7..d15aed7cc30 100644 --- a/htdocs/core/modules/modDav.class.php +++ b/htdocs/core/modules/modDav.class.php @@ -26,15 +26,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; -// The class name should start with a lower case mod for Dolibarr to pick it up -// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule. -// @codingStandardsIgnoreStart /** * Description and activation class for module dav */ class modDav extends DolibarrModules { - // @codingStandardsIgnoreEnd /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 075d90cf63c..f516f60a98d 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -28,15 +28,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; -// The class name should start with a lower case mod for Dolibarr to pick it up -// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule. -// @codingStandardsIgnoreStart /** * Description and activation class for module MyModule */ class modMyModule extends DolibarrModules { - // @codingStandardsIgnoreEnd /** * Constructor. Define names, constants, directories, boxes, permissions * From 4196febb675ff7773015d43653f2a05bb3b1ba64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Aug 2018 09:40:04 +0200 Subject: [PATCH 4/9] tabs added --- htdocs/commande/class/commande.class.php | 6290 +++++++++++----------- 1 file changed, 3145 insertions(+), 3145 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 805390d8d14..4d6f50538c3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -42,116 +42,116 @@ require_once DOL_DOCUMENT_ROOT .'/multicurrency/class/multicurrency.class.php'; */ class Commande extends CommonOrder { - /** + /** * @var string ID to identify managed object */ public $element='commande'; - - /** + + /** * @var string Name of table without prefix where object is stored */ public $table_element='commande'; - - public $table_element_line = 'commandedet'; - public $class_element_line = 'OrderLine'; - public $fk_element = 'fk_commande'; - public $picto = 'order'; - /** - * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - * @var int - */ - public $ismultientitymanaged = 1; - /** - * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user - * @var integer - */ - public $restrictiononfksoc = 1; - /** - * {@inheritdoc} - */ - protected $table_ref_field = 'ref'; + public $table_element_line = 'commandedet'; + public $class_element_line = 'OrderLine'; + public $fk_element = 'fk_commande'; + public $picto = 'order'; + /** + * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + * @var int + */ + public $ismultientitymanaged = 1; + /** + * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * @var integer + */ + public $restrictiononfksoc = 1; + + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; /** * Client ID * @var int */ - public $socid; + public $socid; - public $ref_client; - public $ref_int; - public $contactid; + public $ref_client; + public $ref_int; + public $contactid; /** * Status of the order * @var int */ - public $statut; + public $statut; /** * Billed * @var int */ - public $billed; // billed or not + public $billed; // billed or not - public $brouillon; - public $cond_reglement_code; + public $brouillon; + public $cond_reglement_code; - public $fk_account; + public $fk_account; - /** - * It holds the label of the payment mode. Use it in case translation cannot be found. - * @var string - */ - public $mode_reglement; + /** + * It holds the label of the payment mode. Use it in case translation cannot be found. + * @var string + */ + public $mode_reglement; - /** - * Payment mode id - * @var int - */ - public $mode_reglement_id; - /** - * Payment mode code - * @var string - */ - public $mode_reglement_code; - /** - * Availability delivery time id - * @var int - */ - public $availability_id; - /** - * Availability delivery time code - * @var string - */ - public $availability_code; - /** - * Label of availability delivery time. Use it in case translation cannot be found. - * @var string - */ - public $availability; + /** + * Payment mode id + * @var int + */ + public $mode_reglement_id; + /** + * Payment mode code + * @var string + */ + public $mode_reglement_code; + /** + * Availability delivery time id + * @var int + */ + public $availability_id; + /** + * Availability delivery time code + * @var string + */ + public $availability_code; + /** + * Label of availability delivery time. Use it in case translation cannot be found. + * @var string + */ + public $availability; - public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) - public $demand_reason_code; - public $date; // Date commande + public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) + public $demand_reason_code; + public $date; // Date commande /** * @deprecated * @see date */ - public $date_commande; - public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) - public $fk_remise_except; - public $remise_percent; - public $remise_absolue; - public $info_bits; - public $rang; - public $special_code; - public $source; // Order mode. How we received order (by phone, by email, ...) - public $extraparams=array(); + public $date_commande; + public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) + public $fk_remise_except; + public $remise_percent; + public $remise_absolue; + public $info_bits; + public $rang; + public $special_code; + public $source; // Order mode. How we received order (by phone, by email, ...) + public $extraparams=array(); - public $linked_objects=array(); + public $linked_objects=array(); - public $user_author_id; - public $user_valid; + public $user_author_id; + public $user_valid; /** * @var OrderLine[] @@ -168,10 +168,10 @@ class Commande extends CommonOrder public $oldcopy; - /** - * ERR Not enough stock - */ - const STOCK_NOT_ENOUGH_FOR_ORDER = -3; + /** + * ERR Not enough stock + */ + const STOCK_NOT_ENOUGH_FOR_ORDER = -3; /** * Canceled status @@ -197,447 +197,447 @@ class Commande extends CommonOrder const STATUS_CLOSED = 3; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; - $this->remise = 0; - $this->remise_percent = 0; + $this->remise = 0; + $this->remise_percent = 0; - $this->products = array(); - } + $this->products = array(); + } - /** + /** * Returns the reference to the following non used Order depending on the active numbering module * defined into COMMANDE_ADDON * * @param Societe $soc Object thirdparty * @return string Order free reference */ - function getNextNumRef($soc) - { - global $langs, $conf; - $langs->load("order"); + function getNextNumRef($soc) + { + global $langs, $conf; + $langs->load("order"); - if (! empty($conf->global->COMMANDE_ADDON)) - { - $mybool=false; + if (! empty($conf->global->COMMANDE_ADDON)) + { + $mybool=false; - $file = $conf->global->COMMANDE_ADDON.".php"; + $file = $conf->global->COMMANDE_ADDON.".php"; $classname = $conf->global->COMMANDE_ADDON; // Include file with class $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/commande/"); + $dir = dol_buildpath($reldir."core/modules/commande/"); - // Load file with numbering class (if found) - $mybool|=@include_once $dir.$file; - } + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } - if (! $mybool) - { - dol_print_error('',"Failed to include file ".$file); - return ''; - } + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } - $obj = new $classname(); - $numref = $obj->getNextValue($soc,$this); + $obj = new $classname(); + $numref = $obj->getNextValue($soc,$this); - if ($numref != "") - { - return $numref; - } - else + if ($numref != "") + { + return $numref; + } + else { $this->error=$obj->error; - //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); - return ""; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined"); - return ""; - } - } - - - /** - * Validate order - * - * @param User $user User making status change - * @param int $idwarehouse Id of warehouse to use for stock decrease - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <=0 if OK, 0=Nothing done, >0 if KO - */ - function valid($user, $idwarehouse=0, $notrigger=0) - { - global $conf,$langs; - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $error=0; - - // Protection - if ($this->statut == self::STATUS_VALIDATED) - { - dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); - return 0; - } - - if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - } - - $now=dol_now(); - - $this->db->begin(); - - // Definition du nom de module de numerotation de commande - $soc = new Societe($this->db); - $soc->fetch($this->socid); - - // Class of company linked to order - $result=$soc->set_as_client(); - - // Define new ref - if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life - { - $num = $this->getNextNumRef($soc); - } - else + //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); + return ""; + } + } + else { - $num = $this->ref; - } - $this->newref = $num; + print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined"); + return ""; + } + } - // Validate - $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET ref = '".$num."',"; - $sql.= " fk_statut = ".self::STATUS_VALIDATED.","; - $sql.= " date_valid='".$this->db->idate($now)."',"; - $sql.= " fk_user_valid = ".$user->id; - $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid()", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) - { - dol_print_error($this->db); - $this->error=$this->db->lasterror(); - $error++; - } + /** + * Validate order + * + * @param User $user User making status change + * @param int $idwarehouse Id of warehouse to use for stock decrease + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <=0 if OK, 0=Nothing done, >0 if KO + */ + function valid($user, $idwarehouse=0, $notrigger=0) + { + global $conf,$langs; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - if (! $error) - { - // If stock is incremented on validate order, we must increment it - if ($result >= 0 && ! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) - { - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - $langs->load("agenda"); + $error=0; - // Loop on each line - $cpt=count($this->lines); - for ($i = 0; $i < $cpt; $i++) - { - if ($this->lines[$i]->fk_product > 0) - { - $mouvP = new MouvementStock($this->db); + // Protection + if ($this->statut == self::STATUS_VALIDATED) + { + dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); + return 0; + } + + if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) + { + $this->error='NotEnoughPermissions'; + dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); + return -1; + } + + $now=dol_now(); + + $this->db->begin(); + + // Definition du nom de module de numerotation de commande + $soc = new Societe($this->db); + $soc->fetch($this->socid); + + // Class of company linked to order + $result=$soc->set_as_client(); + + // Define new ref + if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + { + $num = $this->getNextNumRef($soc); + } + else + { + $num = $this->ref; + } + $this->newref = $num; + + // Validate + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; + $sql.= " SET ref = '".$num."',"; + $sql.= " fk_statut = ".self::STATUS_VALIDATED.","; + $sql.= " date_valid='".$this->db->idate($now)."',"; + $sql.= " fk_user_valid = ".$user->id; + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::valid()", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) + { + dol_print_error($this->db); + $this->error=$this->db->lasterror(); + $error++; + } + + if (! $error) + { + // If stock is incremented on validate order, we must increment it + if ($result >= 0 && ! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); + + // Loop on each line + $cpt=count($this->lines); + for ($i = 0; $i < $cpt; $i++) + { + if ($this->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; - // We decrement stock of product (and sub-products) - $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num)); - if ($result < 0) - { - $error++; - $this->error=$mouvP->error; - } - } - if ($error) break; - } - } - } + // We decrement stock of product (and sub-products) + $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num)); + if ($result < 0) + { + $error++; + $this->error=$mouvP->error; + } + } + if ($error) break; + } + } + } - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('ORDER_VALIDATE',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->oldref = $this->ref; - - // Rename directory if dir was a temporary ref - if (preg_match('/^[\(]?PROV/i', $this->ref)) - { - // On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref) - // in order not to lose the attachments - $oldref = dol_sanitizeFileName($this->ref); - $newref = dol_sanitizeFileName($num); - $dirsource = $conf->commande->dir_output.'/'.$oldref; - $dirdest = $conf->commande->dir_output.'/'.$newref; - if (file_exists($dirsource)) - { - dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); - - if (@rename($dirsource, $dirdest)) - { - dol_syslog("Rename ok"); - // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); - foreach($listoffiles as $fileentry) - { - $dirsource=$fileentry['name']; - $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); - $dirsource=$fileentry['path'].'/'.$dirsource; - $dirdest=$fileentry['path'].'/'.$dirdest; - @rename($dirsource, $dirdest); - } - } - } - } - } - - // Set new ref and current status - if (! $error) - { - $this->ref = $num; - $this->statut = self::STATUS_VALIDATED; - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else + if (! $error && ! $notrigger) { - $this->db->rollback(); - return -1; - } - } + // Call trigger + $result=$this->call_trigger('ORDER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers + } - /** - * Set draft status - * - * @param User $user Object user that modify - * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) - * @return int <0 if KO, >0 if OK - */ + if (! $error) + { + $this->oldref = $this->ref; + + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref) + // in order not to lose the attachments + $oldref = dol_sanitizeFileName($this->ref); + $newref = dol_sanitizeFileName($num); + $dirsource = $conf->commande->dir_output.'/'.$oldref; + $dirdest = $conf->commande->dir_output.'/'.$newref; + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); + + if (@rename($dirsource, $dirdest)) + { + dol_syslog("Rename ok"); + // Rename docs starting with $oldref with $newref + $listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + foreach($listoffiles as $fileentry) + { + $dirsource=$fileentry['name']; + $dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource); + $dirsource=$fileentry['path'].'/'.$dirsource; + $dirdest=$fileentry['path'].'/'.$dirdest; + @rename($dirsource, $dirdest); + } + } + } + } + } + + // Set new ref and current status + if (! $error) + { + $this->ref = $num; + $this->statut = self::STATUS_VALIDATED; + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } + + /** + * Set draft status + * + * @param User $user Object user that modify + * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) + * @return int <0 if KO, >0 if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_draft($user, $idwarehouse=-1) - { - global $conf,$langs; + function set_draft($user, $idwarehouse=-1) + { + global $conf,$langs; - $error=0; + $error=0; - // Protection - if ($this->statut <= self::STATUS_DRAFT) - { - return 0; - } + // Protection + if ($this->statut <= self::STATUS_DRAFT) + { + return 0; + } - if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - } + if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) + { + $this->error='Permission denied'; + return -1; + } - $this->db->begin(); + $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET fk_statut = ".self::STATUS_DRAFT; - $sql.= " WHERE rowid = ".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; + $sql.= " SET fk_statut = ".self::STATUS_DRAFT; + $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); - if ($this->db->query($sql)) - { - // If stock is decremented on validate order, we must reincrement it - if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) - { - $result = 0; + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); + if ($this->db->query($sql)) + { + // If stock is decremented on validate order, we must reincrement it + if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + { + $result = 0; - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - $langs->load("agenda"); + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); - $num=count($this->lines); - for ($i = 0; $i < $num; $i++) - { - if ($this->lines[$i]->fk_product > 0) - { - $mouvP = new MouvementStock($this->db); - $mouvP->origin = &$this; - // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); - if ($result < 0) { $error++; $this->error=$mouvP->error; break; } - } - } - } + $num=count($this->lines); + for ($i = 0; $i < $num; $i++) + { + if ($this->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($this->db); + $mouvP->origin = &$this; + // We increment stock of product (and sub-products) + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + if ($result < 0) { $error++; $this->error=$mouvP->error; break; } + } + } + } - if (!$error) { - // Call trigger - $result=$this->call_trigger('ORDER_UNVALIDATE',$user); - if ($result < 0) $error++; - } + if (!$error) { + // Call trigger + $result=$this->call_trigger('ORDER_UNVALIDATE',$user); + if ($result < 0) $error++; + } - if (!$error) { - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return 1; - }else { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -1; - } - } + if (!$error) { + $this->statut=self::STATUS_DRAFT; + $this->db->commit(); + return 1; + }else { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } - /** - * Tag the order as validated (opened) - * Function used when order is reopend after being closed. - * - * @param User $user Object user that change status - * @return int <0 if KO, 0 if nothing is done, >0 if OK - */ + /** + * Tag the order as validated (opened) + * Function used when order is reopend after being closed. + * + * @param User $user Object user that change status + * @return int <0 if KO, 0 if nothing is done, >0 if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_reopen($user) - { - $error=0; + function set_reopen($user) + { + $error=0; - if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) - { - dol_syslog(get_class($this)."::set_reopen order has not status closed", LOG_WARNING); - return 0; - } + if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) + { + dol_syslog(get_class($this)."::set_reopen order has not status closed", LOG_WARNING); + return 0; + } - $this->db->begin(); + $this->db->begin(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql.= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0'; - $sql.= ' WHERE rowid = '.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0'; + $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - // Call trigger - $result=$this->call_trigger('ORDER_REOPEN',$user); - if ($result < 0) $error++; - // End call triggers - } - else - { - $error++; - $this->error=$this->db->lasterror(); - dol_print_error($this->db); - } + dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + // Call trigger + $result=$this->call_trigger('ORDER_REOPEN',$user); + if ($result < 0) $error++; + // End call triggers + } + else + { + $error++; + $this->error=$this->db->lasterror(); + dol_print_error($this->db); + } - if (! $error) - { - $this->statut = self::STATUS_VALIDATED; - $this->billed = 0; + if (! $error) + { + $this->statut = self::STATUS_VALIDATED; + $this->billed = 0; - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } - /** - * Close order - * - * @param User $user Objet user that close - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, >0 if OK - */ - function cloture($user, $notrigger=0) - { - global $conf; + /** + * Close order + * + * @param User $user Objet user that close + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, >0 if OK + */ + function cloture($user, $notrigger=0) + { + global $conf; - $error=0; + $error=0; - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) - { - $this->db->begin(); + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) + { + $this->db->begin(); - $now=dol_now(); + $now=dol_now(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql.= ' SET fk_statut = '.self::STATUS_CLOSED.','; - $sql.= ' fk_user_cloture = '.$user->id.','; - $sql.= " date_cloture = '".$this->db->idate($now)."'"; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET fk_statut = '.self::STATUS_CLOSED.','; + $sql.= ' fk_user_cloture = '.$user->id.','; + $sql.= " date_cloture = '".$this->db->idate($now)."'"; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; - if ($this->db->query($sql)) - { - if (! $notrigger) - { - // Call trigger - $result=$this->call_trigger('ORDER_CLOSE',$user); - if ($result < 0) $error++; - // End call triggers - } + if ($this->db->query($sql)) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('ORDER_CLOSE',$user); + if ($result < 0) $error++; + // End call triggers + } - if (! $error) - { - $this->statut=self::STATUS_CLOSED; + if (! $error) + { + $this->statut=self::STATUS_CLOSED; - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$this->db->lasterror(); + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } - } - return 0; - } + $this->db->rollback(); + return -1; + } + } + return 0; + } - /** - * Cancel an order - * If stock is decremented on order validation, we must reincrement it - * - * @param int $idwarehouse Id warehouse to use for stock change. - * @return int <0 if KO, >0 if OK - */ + /** + * Cancel an order + * If stock is decremented on order validation, we must reincrement it + * + * @param int $idwarehouse Id warehouse to use for stock change. + * @return int <0 if KO, >0 if OK + */ function cancel($idwarehouse=-1) { global $conf,$user,$langs; @@ -680,10 +680,10 @@ class Commande extends CommonOrder if (! $error) { - // Call trigger - $result=$this->call_trigger('ORDER_CANCEL',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('ORDER_CANCEL',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -711,24 +711,24 @@ class Commande extends CommonOrder } } - /** - * Create order - * Note that this->ref can be set or empty. If empty, we will use "(PROV)" - * - * @param User $user Objet user that make creation - * @param int $notrigger Disable all triggers - * @return int <0 if KO, >0 if OK - */ - function create($user, $notrigger=0) - { - global $conf,$langs; - $error=0; + /** + * Create order + * Note that this->ref can be set or empty. If empty, we will use "(PROV)" + * + * @param User $user Objet user that make creation + * @param int $notrigger Disable all triggers + * @return int <0 if KO, >0 if OK + */ + function create($user, $notrigger=0) + { + global $conf,$langs; + $error=0; - // Clean parameters - $this->brouillon = 1; // set command as draft + // Clean parameters + $this->brouillon = 1; // set command as draft // $date_commande is deprecated - $date = ($this->date_commande ? $this->date_commande : $this->date); + $date = ($this->date_commande ? $this->date_commande : $this->date); // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); @@ -740,412 +740,412 @@ class Commande extends CommonOrder $this->multicurrency_tx = 1; } - dol_syslog(get_class($this)."::create user=".$user->id); + dol_syslog(get_class($this)."::create user=".$user->id); - // Check parameters - if (! empty($this->ref)) // We check that ref is not already used - { - $result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used - if ($result > 0) - { - $this->error='ErrorRefAlreadyExists'; - dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING); - $this->db->rollback(); - return -1; - } - } + // Check parameters + if (! empty($this->ref)) // We check that ref is not already used + { + $result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used + if ($result > 0) + { + $this->error='ErrorRefAlreadyExists'; + dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING); + $this->db->rollback(); + return -1; + } + } - $soc = new Societe($this->db); - $result=$soc->fetch($this->socid); - if ($result < 0) - { - $this->error="Failed to fetch company"; - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); - return -2; - } - if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) - { - $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source")); - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); - return -1; - } + $soc = new Societe($this->db); + $result=$soc->fetch($this->socid); + if ($result < 0) + { + $this->error="Failed to fetch company"; + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); + return -2; + } + if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) + { + $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source")); + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); + return -1; + } - $now=dol_now(); + $now=dol_now(); - $this->db->begin(); + $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; - $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int"; - $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; - $sql.= ", fk_shipping_method"; - $sql.= ", fk_warehouse"; - $sql.= ", remise_absolue, remise_percent"; - $sql.= ", fk_incoterms, location_incoterms"; - $sql.= ", entity"; - $sql.= ", fk_multicurrency"; - $sql.= ", multicurrency_code"; - $sql.= ", multicurrency_tx"; - $sql.= ")"; - $sql.= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id; - $sql.= ", ".($this->fk_project>0?$this->fk_project:"null"); - $sql.= ", '".$this->db->idate($date)."'"; - $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->db->escape($this->source):'null'); - $sql.= ", '".$this->db->escape($this->note_private)."'"; - $sql.= ", '".$this->db->escape($this->note_public)."'"; - $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); - $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); - $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); - $sql.= ", '".$this->db->escape($this->modelpdf)."'"; - $sql.= ", ".($this->cond_reglement_id>0?$this->cond_reglement_id:"null"); - $sql.= ", ".($this->mode_reglement_id>0?$this->mode_reglement_id:"null"); - $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); - $sql.= ", ".($this->availability_id>0?$this->availability_id:"null"); - $sql.= ", ".($this->demand_reason_id>0?$this->demand_reason_id:"null"); - $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); - $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL'); - $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); - $sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL'); - $sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL'); - $sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0); - $sql.= ", ".(int) $this->fk_incoterms; - $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".$conf->entity; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; + $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int"; + $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; + $sql.= ", fk_shipping_method"; + $sql.= ", fk_warehouse"; + $sql.= ", remise_absolue, remise_percent"; + $sql.= ", fk_incoterms, location_incoterms"; + $sql.= ", entity"; + $sql.= ", fk_multicurrency"; + $sql.= ", multicurrency_code"; + $sql.= ", multicurrency_tx"; + $sql.= ")"; + $sql.= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id; + $sql.= ", ".($this->fk_project>0?$this->fk_project:"null"); + $sql.= ", '".$this->db->idate($date)."'"; + $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->db->escape($this->source):'null'); + $sql.= ", '".$this->db->escape($this->note_private)."'"; + $sql.= ", '".$this->db->escape($this->note_public)."'"; + $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); + $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); + $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); + $sql.= ", '".$this->db->escape($this->modelpdf)."'"; + $sql.= ", ".($this->cond_reglement_id>0?$this->cond_reglement_id:"null"); + $sql.= ", ".($this->mode_reglement_id>0?$this->mode_reglement_id:"null"); + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".($this->availability_id>0?$this->availability_id:"null"); + $sql.= ", ".($this->demand_reason_id>0?$this->demand_reason_id:"null"); + $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); + $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL'); + $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); + $sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL'); + $sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL'); + $sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; + $sql.= ", ".$conf->entity; $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; - $sql.= ")"; + $sql.= ")"; - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande'); + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande'); - if ($this->id) - { - $fk_parent_line=0; - $num=count($this->lines); + if ($this->id) + { + $fk_parent_line=0; + $num=count($this->lines); - /* - * Insert products details into db - */ - for ($i=0;$i<$num;$i++) - { - $line = $this->lines[$i]; + /* + * Insert products details into db + */ + for ($i=0;$i<$num;$i++) + { + $line = $this->lines[$i]; - // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array - //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. - if (! is_object($line)) $line = (object) $line; + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. + if (! is_object($line)) $line = (object) $line; - // Reset fk_parent_line for no child products and special product - if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { - $fk_parent_line = 0; - } + // Reset fk_parent_line for no child products and special product + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { + $fk_parent_line = 0; + } // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')'; - $result = $this->addline( - $line->desc, - $line->subprice, - $line->qty, - $vatrate, - $line->localtax1_tx, - $line->localtax2_tx, - $line->fk_product, - $line->remise_percent, - $line->info_bits, - $line->fk_remise_except, - 'HT', - 0, - $line->date_start, - $line->date_end, - $line->product_type, - $line->rang, - $line->special_code, - $fk_parent_line, - $line->fk_fournprice, - $line->pa_ht, - $line->label, - $line->array_options, - $line->fk_unit, - $this->element, - $line->id - ); - if ($result < 0) - { - if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) - { - $this->error=$this->db->lasterror(); - dol_print_error($this->db); - } - $this->db->rollback(); - return -1; - } - // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { - $fk_parent_line = $result; - } - } - - // update ref - $initialref='(PROV'.$this->id.')'; - if (! empty($this->ref)) $initialref=$this->ref; - - $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id; - if ($this->db->query($sql)) - { - if ($this->id) - { - $this->ref = $initialref; - - if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects - { - $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds - } - - // Add object linked - if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects)) - { - foreach($this->linked_objects as $origin => $tmp_origin_id) - { - if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) - { - foreach($tmp_origin_id as $origin_id) - { - $ret = $this->add_object_linked($origin, $origin_id); - if (! $ret) - { - $this->error=$this->db->lasterror(); - $error++; - } - } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) - { - $origin_id = $tmp_origin_id; - $ret = $this->add_object_linked($origin, $origin_id); - if (! $ret) - { - $this->error=$this->db->lasterror(); - $error++; - } - } - } - } - - if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object - { - $originforcontact = $this->origin; - $originidforcontact = $this->origin_id; - if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order - { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; - $exp = new Expedition($this->db); - $exp->fetch($this->origin_id); - $exp->fetchObjectLinked(); - if (count($exp->linkedObjectsIds['commande']) > 0) - { - foreach ($exp->linkedObjectsIds['commande'] as $key => $value) - { - $originforcontact = 'commande'; - if (is_object($value)) $originidforcontact = $value->id; - else $originidforcontact = $value; - break; // We take first one - } - } - } - - $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - - $resqlcontact = $this->db->query($sqlcontact); - if ($resqlcontact) - { - while($objcontact = $this->db->fetch_object($resqlcontact)) - { - //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; - $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object - } - } - else dol_print_error($resqlcontact); - } - } - - if (! $error) - { - $result=$this->insertExtraFields(); - if ($result < 0) $error++; - } - - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('ORDER_CREATE',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return $this->id; - } - else + $result = $this->addline( + $line->desc, + $line->subprice, + $line->qty, + $vatrate, + $line->localtax1_tx, + $line->localtax2_tx, + $line->fk_product, + $line->remise_percent, + $line->info_bits, + $line->fk_remise_except, + 'HT', + 0, + $line->date_start, + $line->date_end, + $line->product_type, + $line->rang, + $line->special_code, + $fk_parent_line, + $line->fk_fournprice, + $line->pa_ht, + $line->label, + $line->array_options, + $line->fk_unit, + $this->element, + $line->id + ); + if ($result < 0) { - $this->db->rollback(); - return -1*$error; + if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) + { + $this->error=$this->db->lasterror(); + dol_print_error($this->db); + } + $this->db->rollback(); + return -1; } - } - else + // Defined the new fk_parent_line + if ($result > 0 && $line->product_type == 9) { + $fk_parent_line = $result; + } + } + + // update ref + $initialref='(PROV'.$this->id.')'; + if (! empty($this->ref)) $initialref=$this->ref; + + $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id; + if ($this->db->query($sql)) + { + if ($this->id) + { + $this->ref = $initialref; + + if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects + { + $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds + } + + // Add object linked + if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects)) + { + foreach($this->linked_objects as $origin => $tmp_origin_id) + { + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + { + foreach($tmp_origin_id as $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + $this->error=$this->db->lasterror(); + $error++; + } + } + } + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + $this->error=$this->db->lasterror(); + $error++; + } + } + } + } + + if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object + { + $originforcontact = $this->origin; + $originidforcontact = $this->origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($this->db); + $exp->fetch($this->origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); + } + } + + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('ORDER_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1*$error; + } + } + else { $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } - } - } - else + $this->db->rollback(); + return -1; + } + } + } + else { - dol_print_error($this->db); - $this->db->rollback(); - return -1; - } - } + dol_print_error($this->db); + $this->db->rollback(); + return -1; + } + } - /** - * Load an object from its id and create a new one in database - * - * @param int $socid Id of thirdparty - * @return int New id of clone - */ - function createFromClone($socid=0) - { - global $user,$hookmanager; + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone($socid=0) + { + global $user,$hookmanager; - $error=0; + $error=0; - $this->context['createfromclone'] = 'createfromclone'; + $this->context['createfromclone'] = 'createfromclone'; - $this->db->begin(); + $this->db->begin(); // get lines so they will be clone foreach($this->lines as $line) $line->fetch_optionals(); - // Load source object - $objFrom = clone $this; + // Load source object + $objFrom = clone $this; - // Change socid if needed - if (! empty($socid) && $socid != $this->socid) - { - $objsoc = new Societe($this->db); + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); - if ($objsoc->fetch($socid)>0) - { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = 0; - $this->fk_delivery_address = 0; - } + if ($objsoc->fetch($socid)>0) + { + $this->socid = $objsoc->id; + $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = 0; + $this->fk_delivery_address = 0; + } - // TODO Change product price if multi-prices - } + // TODO Change product price if multi-prices + } - $this->id=0; + $this->id=0; $this->ref = ''; - $this->statut=self::STATUS_DRAFT; + $this->statut=self::STATUS_DRAFT; - // Clear fields - $this->user_author_id = $user->id; - $this->user_valid = ''; + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; $this->date = dol_now(); $this->date_commande = dol_now(); - $this->date_creation = ''; - $this->date_validation = ''; - $this->ref_client = ''; + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_client = ''; - // Create clone - $result=$this->create($user); - if ($result < 0) $error++; + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; - if (! $error) - { - // Hook of thirdparty module - if (is_object($hookmanager)) - { - $parameters=array('objFrom'=>$objFrom); - $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; - } - } + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + } - unset($this->context['createfromclone']); + unset($this->context['createfromclone']); - // End - if (! $error) - { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -1; - } - } + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } - /** - * Load an object from a proposal and create a new order into database - * - * @param Object $object Object source - * @param User $user User making creation - * @return int <0 if KO, 0 if nothing done, 1 if OK - */ - function createFromProposal($object, User $user) - { - global $conf, $hookmanager; + /** + * Load an object from a proposal and create a new order into database + * + * @param Object $object Object source + * @param User $user User making creation + * @return int <0 if KO, 0 if nothing done, 1 if OK + */ + function createFromProposal($object, User $user) + { + global $conf, $hookmanager; dol_include_once('/core/class/extrafields.class.php'); - $error=0; + $error=0; - $this->date_commande = dol_now(); - $this->source = 0; + $this->date_commande = dol_now(); + $this->source = 0; - $num=count($object->lines); - for ($i = 0; $i < $num; $i++) - { - $line = new OrderLine($this->db); + $num=count($object->lines); + for ($i = 0; $i < $num; $i++) + { + $line = new OrderLine($this->db); - $line->libelle = $object->lines[$i]->libelle; - $line->label = $object->lines[$i]->label; - $line->desc = $object->lines[$i]->desc; - $line->price = $object->lines[$i]->price; - $line->subprice = $object->lines[$i]->subprice; - $line->vat_src_code = $object->lines[$i]->vat_src_code; - $line->tva_tx = $object->lines[$i]->tva_tx; - $line->localtax1_tx = $object->lines[$i]->localtax1_tx; - $line->localtax2_tx = $object->lines[$i]->localtax2_tx; - $line->qty = $object->lines[$i]->qty; - $line->fk_remise_except = $object->lines[$i]->fk_remise_except; - $line->remise_percent = $object->lines[$i]->remise_percent; - $line->fk_product = $object->lines[$i]->fk_product; - $line->info_bits = $object->lines[$i]->info_bits; - $line->product_type = $object->lines[$i]->product_type; - $line->rang = $object->lines[$i]->rang; - $line->special_code = $object->lines[$i]->special_code; - $line->fk_parent_line = $object->lines[$i]->fk_parent_line; - $line->fk_unit = $object->lines[$i]->fk_unit; + $line->libelle = $object->lines[$i]->libelle; + $line->label = $object->lines[$i]->label; + $line->desc = $object->lines[$i]->desc; + $line->price = $object->lines[$i]->price; + $line->subprice = $object->lines[$i]->subprice; + $line->vat_src_code = $object->lines[$i]->vat_src_code; + $line->tva_tx = $object->lines[$i]->tva_tx; + $line->localtax1_tx = $object->lines[$i]->localtax1_tx; + $line->localtax2_tx = $object->lines[$i]->localtax2_tx; + $line->qty = $object->lines[$i]->qty; + $line->fk_remise_except = $object->lines[$i]->fk_remise_except; + $line->remise_percent = $object->lines[$i]->remise_percent; + $line->fk_product = $object->lines[$i]->fk_product; + $line->info_bits = $object->lines[$i]->info_bits; + $line->product_type = $object->lines[$i]->product_type; + $line->rang = $object->lines[$i]->rang; + $line->special_code = $object->lines[$i]->special_code; + $line->fk_parent_line = $object->lines[$i]->fk_parent_line; + $line->fk_unit = $object->lines[$i]->fk_unit; - $line->date_start = $object->lines[$i]->date_start; - $line->date_end = $object->lines[$i]->date_end; + $line->date_start = $object->lines[$i]->date_start; + $line->date_end = $object->lines[$i]->date_end; $line->fk_fournprice = $object->lines[$i]->fk_fournprice; $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); @@ -1153,34 +1153,34 @@ class Commande extends CommonOrder $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; - // get extrafields from original line + // get extrafields from original line $object->lines[$i]->fetch_optionals(); foreach($object->lines[$i]->array_options as $options_key => $value) $line->array_options[$options_key] = $value; $this->lines[$i] = $line; - } + } - $this->socid = $object->socid; - $this->fk_project = $object->fk_project; - $this->cond_reglement_id = $object->cond_reglement_id; - $this->mode_reglement_id = $object->mode_reglement_id; - $this->fk_account = $object->fk_account; - $this->availability_id = $object->availability_id; - $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; - $this->shipping_method_id = $object->shipping_method_id; - $this->warehouse_id = $object->warehouse_id; - $this->fk_delivery_address = $object->fk_delivery_address; - $this->contact_id = $object->contactid; - $this->ref_client = $object->ref_client; - $this->note_private = $object->note_private; - $this->note_public = $object->note_public; + $this->socid = $object->socid; + $this->fk_project = $object->fk_project; + $this->cond_reglement_id = $object->cond_reglement_id; + $this->mode_reglement_id = $object->mode_reglement_id; + $this->fk_account = $object->fk_account; + $this->availability_id = $object->availability_id; + $this->demand_reason_id = $object->demand_reason_id; + $this->date_livraison = $object->date_livraison; + $this->shipping_method_id = $object->shipping_method_id; + $this->warehouse_id = $object->warehouse_id; + $this->fk_delivery_address = $object->fk_delivery_address; + $this->contact_id = $object->contactid; + $this->ref_client = $object->ref_client; + $this->note_private = $object->note_private; + $this->note_public = $object->note_public; - $this->origin = $object->element; - $this->origin_id = $object->id; + $this->origin = $object->element; + $this->origin_id = $object->id; - // get extrafields from original line + // get extrafields from original line $object->fetch_optionals($object->id); $e = new ExtraFields($this->db); @@ -1191,129 +1191,129 @@ class Commande extends CommonOrder $this->array_options[$options_key] = $value; } } - // Possibility to add external linked objects with hooks - $this->linked_objects[$this->origin] = $this->origin_id; - if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) - { - $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); - } + // Possibility to add external linked objects with hooks + $this->linked_objects[$this->origin] = $this->origin_id; + if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) + { + $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); + } - $ret = $this->create($user); + $ret = $this->create($user); - if ($ret > 0) - { - // Actions hooked (by external module) - $hookmanager->initHooks(array('orderdao')); + if ($ret > 0) + { + // Actions hooked (by external module) + $hookmanager->initHooks(array('orderdao')); - $parameters=array('objFrom'=>$object); - $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; + $parameters=array('objFrom'=>$object); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; - if (! $error) - { - // Ne pas passer par la commande provisoire - if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) - { - $this->fetch($ret); - $this->valid($user); - } - return $ret; - } - else return -1; - } - else return -1; - } + if (! $error) + { + // Ne pas passer par la commande provisoire + if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) + { + $this->fetch($ret); + $this->valid($user); + } + return $ret; + } + else return -1; + } + else return -1; + } - /** - * Add an order line into database (linked to product/service or not) - * - * @param string $desc Description of line - * @param float $pu_ht Unit price (without tax) - * @param float $qty Quantite - * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') - * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) - * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) - * @param int $fk_product Id of product - * @param float $remise_percent Pourcentage de remise de la ligne - * @param int $info_bits Bits de type de lignes - * @param int $fk_remise_except Id remise - * @param string $price_base_type HT or TTC - * @param float $pu_ttc Prix unitaire TTC - * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. - * @param int $rang Position of line - * @param int $special_code Special code (also used by externals modules!) - * @param int $fk_parent_line Parent line - * @param int $fk_fournprice Id supplier price - * @param int $pa_ht Buying price (without tax) - * @param string $label Label + /** + * Add an order line into database (linked to product/service or not) + * + * @param string $desc Description of line + * @param float $pu_ht Unit price (without tax) + * @param float $qty Quantite + * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) + * @param int $fk_product Id of product + * @param float $remise_percent Pourcentage de remise de la ligne + * @param int $info_bits Bits de type de lignes + * @param int $fk_remise_except Id remise + * @param string $price_base_type HT or TTC + * @param float $pu_ttc Prix unitaire TTC + * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. + * @param int $rang Position of line + * @param int $special_code Special code (also used by externals modules!) + * @param int $fk_parent_line Parent line + * @param int $fk_fournprice Id supplier price + * @param int $pa_ht Buying price (without tax) + * @param string $label Label * @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) - * @param string $fk_unit Code of the unit to use. Null to use the default one - * @param string $origin 'order', ... - * @param int $origin_id Id of origin object + * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param string $origin 'order', ... + * @param int $origin_id Id of origin object * @param double $pu_ht_devise Unit price in currency - * @return int >0 if OK, <0 if KO - * - * @see add_product - * - * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel - * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini - * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) - * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) - */ + * @return int >0 if OK, <0 if KO + * + * @see add_product + * + * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel + * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini + * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) + * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) + */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0) - { - global $mysoc, $conf, $langs, $user; + { + global $mysoc, $conf, $langs, $user; $logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent"; $logtext.= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start"; $logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise"; - dol_syslog(get_class($this).$logtext, LOG_DEBUG); + dol_syslog(get_class($this).$logtext, LOG_DEBUG); - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - // Clean parameters - if (empty($remise_percent)) $remise_percent=0; - if (empty($qty)) $qty=0; - if (empty($info_bits)) $info_bits=0; - if (empty($rang)) $rang=0; - if (empty($txtva)) $txtva=0; - if (empty($txlocaltax1)) $txlocaltax1=0; - if (empty($txlocaltax2)) $txlocaltax2=0; - if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; - if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0; + // Clean parameters + if (empty($remise_percent)) $remise_percent=0; + if (empty($qty)) $qty=0; + if (empty($info_bits)) $info_bits=0; + if (empty($rang)) $rang=0; + if (empty($txtva)) $txtva=0; + if (empty($txlocaltax1)) $txlocaltax1=0; + if (empty($txlocaltax2)) $txlocaltax2=0; + if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0; - $remise_percent=price2num($remise_percent); - $qty=price2num($qty); - $pu_ht=price2num($pu_ht); - $pu_ht_devise=price2num($pu_ht_devise); - $pu_ttc=price2num($pu_ttc); - $pa_ht=price2num($pa_ht); - $txtva = price2num($txtva); - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); - if ($price_base_type=='HT') - { - $pu=$pu_ht; - } - else - { - $pu=$pu_ttc; - } - $label=trim($label); - $desc=trim($desc); + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); + $pu_ttc=price2num($pu_ttc); + $pa_ht=price2num($pa_ht); + $txtva = price2num($txtva); + $txlocaltax1 = price2num($txlocaltax1); + $txlocaltax2 = price2num($txlocaltax2); + if ($price_base_type=='HT') + { + $pu=$pu_ht; + } + else + { + $pu=$pu_ttc; + } + $label=trim($label); + $desc=trim($desc); - // Check parameters - if ($type < 0) return -1; + // Check parameters + if ($type < 0) return -1; - if ($this->statut == self::STATUS_DRAFT) - { - $this->db->begin(); + if ($this->statut == self::STATUS_DRAFT) + { + $this->db->begin(); - $product_type=$type; + $product_type=$type; if (!empty($fk_product)) { $product=new Product($this->db); @@ -1322,105 +1322,105 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $langs->load("errors"); - $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; } } // Calcul du total TTC et de la TVA pour la ligne a partir de - // qty, pu, remise_percent et txtva - // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker - // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + // qty, pu, remise_percent et txtva + // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker + // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - // Clean vat code - $vat_src_code=''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); - /*var_dump($txlocaltax1); - var_dump($txlocaltax2); - var_dump($localtaxes_type); - var_dump($tabprice); - var_dump($tabprice[9]); - var_dump($tabprice[10]); - exit;*/ + /*var_dump($txlocaltax1); + var_dump($txlocaltax2); + var_dump($localtaxes_type); + var_dump($tabprice); + var_dump($tabprice[9]); + var_dump($tabprice[10]); + exit;*/ - $total_ht = $tabprice[0]; - $total_tva = $tabprice[1]; - $total_ttc = $tabprice[2]; - $total_localtax1 = $tabprice[9]; - $total_localtax2 = $tabprice[10]; + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + $total_localtax1 = $tabprice[9]; + $total_localtax2 = $tabprice[10]; $pu_ht = $tabprice[3]; // MultiCurrency $multicurrency_total_ht = $tabprice[16]; - $multicurrency_total_tva = $tabprice[17]; - $multicurrency_total_ttc = $tabprice[18]; + $multicurrency_total_tva = $tabprice[17]; + $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; - // Rang to use - $rangtouse = $rang; - if ($rangtouse == -1) - { - $rangmax = $this->line_max($fk_parent_line); - $rangtouse = $rangmax + 1; - } + // Rang to use + $rangtouse = $rang; + if ($rangtouse == -1) + { + $rangmax = $this->line_max($fk_parent_line); + $rangtouse = $rangmax + 1; + } - // TODO A virer - // Anciens indicateurs: $price, $remise (a ne plus utiliser) - $price = $pu; - $remise = 0; - if ($remise_percent > 0) - { - $remise = round(($pu * $remise_percent / 100), 2); - $price = $pu - $remise; - } + // TODO A virer + // Anciens indicateurs: $price, $remise (a ne plus utiliser) + $price = $pu; + $remise = 0; + if ($remise_percent > 0) + { + $remise = round(($pu * $remise_percent / 100), 2); + $price = $pu - $remise; + } - // Insert line - $this->line=new OrderLine($this->db); + // Insert line + $this->line=new OrderLine($this->db); - $this->line->context = $this->context; + $this->line->context = $this->context; - $this->line->fk_commande=$this->id; - $this->line->label=$label; - $this->line->desc=$desc; - $this->line->qty=$qty; + $this->line->fk_commande=$this->id; + $this->line->label=$label; + $this->line->desc=$desc; + $this->line->qty=$qty; - $this->line->vat_src_code=$vat_src_code; - $this->line->tva_tx=$txtva; - $this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0); - $this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0); - $this->line->localtax1_type=$localtaxes_type[0]; - $this->line->localtax2_type=$localtaxes_type[2]; - $this->line->fk_product=$fk_product; + $this->line->vat_src_code=$vat_src_code; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0); + $this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0); + $this->line->localtax1_type=$localtaxes_type[0]; + $this->line->localtax2_type=$localtaxes_type[2]; + $this->line->fk_product=$fk_product; $this->line->product_type=$product_type; - $this->line->fk_remise_except=$fk_remise_except; - $this->line->remise_percent=$remise_percent; - $this->line->subprice=$pu_ht; - $this->line->rang=$rangtouse; - $this->line->info_bits=$info_bits; - $this->line->total_ht=$total_ht; - $this->line->total_tva=$total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->total_ttc=$total_ttc; - $this->line->special_code=$special_code; - $this->line->origin=$origin; - $this->line->origin_id=$origin_id; - $this->line->fk_parent_line=$fk_parent_line; - $this->line->fk_unit=$fk_unit; + $this->line->fk_remise_except=$fk_remise_except; + $this->line->remise_percent=$remise_percent; + $this->line->subprice=$pu_ht; + $this->line->rang=$rangtouse; + $this->line->info_bits=$info_bits; + $this->line->total_ht=$total_ht; + $this->line->total_tva=$total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->total_ttc=$total_ttc; + $this->line->special_code=$special_code; + $this->line->origin=$origin; + $this->line->origin_id=$origin_id; + $this->line->fk_parent_line=$fk_parent_line; + $this->line->fk_unit=$fk_unit; - $this->line->date_start=$date_start; - $this->line->date_end=$date_end; + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; @@ -1430,188 +1430,188 @@ class Commande extends CommonOrder $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = $pu_ht_devise; $this->line->multicurrency_total_ht = $multicurrency_total_ht; - $this->line->multicurrency_total_tva = $multicurrency_total_tva; - $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - // TODO Ne plus utiliser - $this->line->price=$price; - $this->line->remise=$remise; + // TODO Ne plus utiliser + $this->line->price=$price; + $this->line->remise=$remise; if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } - $result=$this->line->insert($user); - if ($result > 0) - { - // Reorder if child line - if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); + $result=$this->line->insert($user); + if ($result > 0) + { + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - // Mise a jour informations denormalisees au niveau de la commande meme - $result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. - if ($result > 0) - { - $this->db->commit(); - return $this->line->rowid; - } - else - { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$this->line->error; - dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); - $this->db->rollback(); - return -2; - } - } + // Mise a jour informations denormalisees au niveau de la commande meme + $result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + if ($result > 0) + { + $this->db->commit(); + return $this->line->rowid; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->line->error; + dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); + $this->db->rollback(); + return -2; + } + } else { - dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); + dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; - } - } + } + } - /** - * Add line into array - * $this->client must be loaded - * - * @param int $idproduct Product Id - * @param float $qty Quantity - * @param float $remise_percent Product discount relative - * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @return void - * - * TODO Remplacer les appels a cette fonction par generation objet Ligne - * insere dans tableau $this->products - */ + /** + * Add line into array + * $this->client must be loaded + * + * @param int $idproduct Product Id + * @param float $qty Quantity + * @param float $remise_percent Product discount relative + * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @return void + * + * TODO Remplacer les appels a cette fonction par generation objet Ligne + * insere dans tableau $this->products + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') - { - global $conf, $mysoc; + function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') + { + global $conf, $mysoc; - if (! $qty) $qty = 1; + if (! $qty) $qty = 1; - if ($idproduct > 0) - { - $prod=new Product($this->db); - $prod->fetch($idproduct); + if ($idproduct > 0) + { + $prod=new Product($this->db); + $prod->fetch($idproduct); - $tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id); - $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); - if (empty($tva_tx)) $tva_npr=0; - $vat_src_code = ''; // May be defined into tva_tx + $tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id); + $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $vat_src_code = ''; // May be defined into tva_tx - $localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr); - $localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr); + $localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr); + $localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr); - // multiprix - if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) - $price = $prod->multiprices[$this->thirdparty->price_level]; - else - $price = $prod->price; + // multiprix + if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) + $price = $prod->multiprices[$this->thirdparty->price_level]; + else + $price = $prod->price; - $line=new OrderLine($this->db); + $line=new OrderLine($this->db); - $line->context = $this->context; + $line->context = $this->context; - $line->fk_product=$idproduct; - $line->desc=$prod->description; - $line->qty=$qty; - $line->subprice=$price; - $line->remise_percent=$remise_percent; - $line->vat_src_code=$vat_src_code; - $line->tva_tx=$tva_tx; - $line->localtax1_tx=$localtax1_tx; - $line->localtax2_tx=$localtax2_tx; - $line->ref=$prod->ref; - $line->libelle=$prod->label; - $line->product_desc=$prod->description; - $line->fk_unit=$prod->fk_unit; + $line->fk_product=$idproduct; + $line->desc=$prod->description; + $line->qty=$qty; + $line->subprice=$price; + $line->remise_percent=$remise_percent; + $line->vat_src_code=$vat_src_code; + $line->tva_tx=$tva_tx; + $line->localtax1_tx=$localtax1_tx; + $line->localtax2_tx=$localtax2_tx; + $line->ref=$prod->ref; + $line->libelle=$prod->label; + $line->product_desc=$prod->description; + $line->fk_unit=$prod->fk_unit; - // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - // Save the start and end date of the line in the object - if ($date_start) { $line->date_start = $date_start; } - if ($date_end) { $line->date_end = $date_end; } + // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + // Save the start and end date of the line in the object + if ($date_start) { $line->date_start = $date_start; } + if ($date_end) { $line->date_end = $date_end; } - $this->lines[] = $line; + $this->lines[] = $line; - /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE - if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) - { - $prod = new Product($this->db); - $prod->fetch($idproduct); - $prod -> get_sousproduits_arbo(); - $prods_arbo = $prod->get_arbo_each_prod(); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - // print "id : ".$value[1].' :qty: '.$value[0].'
'; - if(! in_array($value[1],$this->products)) - $this->add_product($value[1], $value[0]); + /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE + if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) + { + $prod = new Product($this->db); + $prod->fetch($idproduct); + $prod -> get_sousproduits_arbo(); + $prods_arbo = $prod->get_arbo_each_prod(); + if(count($prods_arbo) > 0) + { + foreach($prods_arbo as $key => $value) + { + // print "id : ".$value[1].' :qty: '.$value[0].'
'; + if(! in_array($value[1],$this->products)) + $this->add_product($value[1], $value[0]); - } - } + } + } - } - **/ - } - } + } + **/ + } + } - /** - * Get object and lines from database - * - * @param int $id Id of object to load - * @param string $ref Ref of object - * @param string $ref_ext External reference of object - * @param string $ref_int Internal reference of other object - * @return int >0 if OK, <0 if KO, 0 if not found - */ - function fetch($id, $ref='', $ref_ext='', $ref_int='') - { + /** + * Get object and lines from database + * + * @param int $id Id of object to load + * @param string $ref Ref of object + * @param string $ref_ext External reference of object + * @param string $ref_int Internal reference of other object + * @return int >0 if OK, <0 if KO, 0 if not found + */ + function fetch($id, $ref='', $ref_ext='', $ref_int='') + { - // Check parameters - if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; + // Check parameters + if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; - $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; - $sql.= ', c.fk_account'; - $sql.= ', c.date_commande'; - $sql.= ', c.date_livraison'; - $sql.= ', c.fk_shipping_method'; - $sql.= ', c.fk_warehouse'; - $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; - $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; - $sql.= ', c.fk_incoterms, c.location_incoterms'; + $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; + $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; + $sql.= ', c.fk_account'; + $sql.= ', c.date_commande'; + $sql.= ', c.date_livraison'; + $sql.= ', c.fk_shipping_method'; + $sql.= ', c.fk_warehouse'; + $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; + $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; + $sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; - $sql.= ", i.libelle as libelle_incoterms"; - $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; - $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; - $sql.= ', ca.code as availability_code, ca.label as availability_label'; - $sql.= ', dr.code as demand_reason_code'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid'; + $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; + $sql.= ', ca.code as availability_code, ca.label as availability_label'; + $sql.= ', dr.code as demand_reason_code'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE c.rowid=".$id; else $sql.= " WHERE c.entity IN (".getEntity('commande').")"; // Dont't use entity if you use rowid - if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; - if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; - if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; + if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; + if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; + if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); @@ -1620,50 +1620,50 @@ class Commande extends CommonOrder $this->id = $obj->rowid; $this->entity = $obj->entity; - $this->ref = $obj->ref; - $this->ref_client = $obj->ref_client; - $this->ref_customer = $obj->ref_client; - $this->ref_ext = $obj->ref_ext; - $this->ref_int = $obj->ref_int; - $this->socid = $obj->fk_soc; - $this->statut = $obj->fk_statut; - $this->user_author_id = $obj->fk_user_author; - $this->user_valid = $obj->fk_user_valid; - $this->total_ht = $obj->total_ht; - $this->total_tva = $obj->total_tva; - $this->total_localtax1 = $obj->total_localtax1; - $this->total_localtax2 = $obj->total_localtax2; - $this->total_ttc = $obj->total_ttc; - $this->date = $this->db->jdate($obj->date_commande); - $this->date_commande = $this->db->jdate($obj->date_commande); - $this->remise = $obj->remise; - $this->remise_percent = $obj->remise_percent; - $this->remise_absolue = $obj->remise_absolue; - $this->source = $obj->source; - $this->billed = $obj->billed; - $this->note = $obj->note_private; // deprecated - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->fk_project = $obj->fk_projet; - $this->modelpdf = $obj->model_pdf; - $this->last_main_doc = $obj->last_main_doc; - $this->mode_reglement_id = $obj->fk_mode_reglement; - $this->mode_reglement_code = $obj->mode_reglement_code; - $this->mode_reglement = $obj->mode_reglement_libelle; - $this->cond_reglement_id = $obj->fk_cond_reglement; - $this->cond_reglement_code = $obj->cond_reglement_code; - $this->cond_reglement = $obj->cond_reglement_libelle; - $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; - $this->fk_account = $obj->fk_account; - $this->availability_id = $obj->fk_availability; - $this->availability_code = $obj->availability_code; - $this->availability = $obj->availability_label; - $this->demand_reason_id = $obj->fk_input_reason; - $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; - $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; - $this->fk_delivery_address = $obj->fk_delivery_address; + $this->ref = $obj->ref; + $this->ref_client = $obj->ref_client; + $this->ref_customer = $obj->ref_client; + $this->ref_ext = $obj->ref_ext; + $this->ref_int = $obj->ref_int; + $this->socid = $obj->fk_soc; + $this->statut = $obj->fk_statut; + $this->user_author_id = $obj->fk_user_author; + $this->user_valid = $obj->fk_user_valid; + $this->total_ht = $obj->total_ht; + $this->total_tva = $obj->total_tva; + $this->total_localtax1 = $obj->total_localtax1; + $this->total_localtax2 = $obj->total_localtax2; + $this->total_ttc = $obj->total_ttc; + $this->date = $this->db->jdate($obj->date_commande); + $this->date_commande = $this->db->jdate($obj->date_commande); + $this->remise = $obj->remise; + $this->remise_percent = $obj->remise_percent; + $this->remise_absolue = $obj->remise_absolue; + $this->source = $obj->source; + $this->billed = $obj->billed; + $this->note = $obj->note_private; // deprecated + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->fk_project = $obj->fk_projet; + $this->modelpdf = $obj->model_pdf; + $this->last_main_doc = $obj->last_main_doc; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; + $this->cond_reglement_id = $obj->fk_cond_reglement; + $this->cond_reglement_code = $obj->cond_reglement_code; + $this->cond_reglement = $obj->cond_reglement_libelle; + $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; + $this->fk_account = $obj->fk_account; + $this->availability_id = $obj->fk_availability; + $this->availability_code = $obj->availability_code; + $this->availability = $obj->availability_label; + $this->demand_reason_id = $obj->fk_input_reason; + $this->demand_reason_code = $obj->demand_reason_code; + $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; + $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; + $this->fk_delivery_address = $obj->fk_delivery_address; //Incoterms $this->fk_incoterms = $obj->fk_incoterms; @@ -1678,209 +1678,209 @@ class Commande extends CommonOrder $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); - $this->lines = array(); + $this->lines = array(); - if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; + if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; - // Retreive all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); + // Retreive all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); - $this->db->free($result); + $this->db->free($result); - /* - * Lines - */ - $result=$this->fetch_lines(); - if ($result < 0) - { - return -3; - } - return 1; - } - else - { - $this->error='Order with id '.$id.' not found sql='.$sql; - return 0; - } - } - else - { - $this->error=$this->db->error(); - return -1; - } - } + /* + * Lines + */ + $result=$this->fetch_lines(); + if ($result < 0) + { + return -3; + } + return 1; + } + else + { + $this->error='Order with id '.$id.' not found sql='.$sql; + return 0; + } + } + else + { + $this->error=$this->db->error(); + return -1; + } + } - /** - * Adding line of fixed discount in the order in DB - * - * @param int $idremise Id de la remise fixe - * @return int >0 si ok, <0 si ko - */ + /** + * Adding line of fixed discount in the order in DB + * + * @param int $idremise Id de la remise fixe + * @return int >0 si ok, <0 si ko + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function insert_discount($idremise) - { - global $langs; + function insert_discount($idremise) + { + global $langs; - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - $this->db->begin(); + $this->db->begin(); - $remise=new DiscountAbsolute($this->db); - $result=$remise->fetch($idremise); + $remise=new DiscountAbsolute($this->db); + $result=$remise->fetch($idremise); - if ($result > 0) - { - if ($remise->fk_facture) // Protection against multiple submission - { - $this->error=$langs->trans("ErrorDiscountAlreadyUsed"); - $this->db->rollback(); - return -5; - } + if ($result > 0) + { + if ($remise->fk_facture) // Protection against multiple submission + { + $this->error=$langs->trans("ErrorDiscountAlreadyUsed"); + $this->db->rollback(); + return -5; + } - $line = new OrderLine($this->db); + $line = new OrderLine($this->db); - $line->fk_commande=$this->id; - $line->fk_remise_except=$remise->id; - $line->desc=$remise->description; // Description ligne - $line->vat_src_code=$remise->vat_src_code; - $line->tva_tx=$remise->tva_tx; - $line->subprice=-$remise->amount_ht; - $line->price=-$remise->amount_ht; - $line->fk_product=0; // Id produit predefini - $line->qty=1; - $line->remise=0; - $line->remise_percent=0; - $line->rang=-1; - $line->info_bits=2; + $line->fk_commande=$this->id; + $line->fk_remise_except=$remise->id; + $line->desc=$remise->description; // Description ligne + $line->vat_src_code=$remise->vat_src_code; + $line->tva_tx=$remise->tva_tx; + $line->subprice=-$remise->amount_ht; + $line->price=-$remise->amount_ht; + $line->fk_product=0; // Id produit predefini + $line->qty=1; + $line->remise=0; + $line->remise_percent=0; + $line->rang=-1; + $line->info_bits=2; - $line->total_ht = -$remise->amount_ht; - $line->total_tva = -$remise->amount_tva; - $line->total_ttc = -$remise->amount_ttc; + $line->total_ht = -$remise->amount_ht; + $line->total_tva = -$remise->amount_tva; + $line->total_ttc = -$remise->amount_ttc; - $result=$line->insert(); - if ($result > 0) - { - $result=$this->update_price(1); - if ($result > 0) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$line->error; - $this->db->rollback(); - return -2; - } - } - else - { - $this->db->rollback(); - return -2; - } - } + $result=$line->insert(); + if ($result > 0) + { + $result=$this->update_price(1); + if ($result > 0) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$line->error; + $this->db->rollback(); + return -2; + } + } + else + { + $this->db->rollback(); + return -2; + } + } - /** - * Load array lines - * - * @param int $only_product Return only physical products - * @return int <0 if KO, >0 if OK - */ + /** + * Load array lines + * + * @param int $only_product Return only physical products + * @return int <0 if KO, >0 if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fetch_lines($only_product=0) - { - $this->lines=array(); + function fetch_lines($only_product=0) + { + $this->lines=array(); - $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; - $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,'; - $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; - $sql.= ' l.fk_unit,'; + $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; + $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,'; + $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; + $sql.= ' l.fk_unit,'; $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; - $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; - $sql.= ' WHERE l.fk_commande = '.$this->id; - if ($only_product) $sql .= ' AND p.fk_product_type = 0'; - $sql .= ' ORDER BY l.rang, l.rowid'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; + $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; + $sql.= ' WHERE l.fk_commande = '.$this->id; + if ($only_product) $sql .= ' AND p.fk_product_type = 0'; + $sql .= ' ORDER BY l.rang, l.rowid'; - dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows($result); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); - $i = 0; - while ($i < $num) - { - $objp = $this->db->fetch_object($result); + $i = 0; + while ($i < $num) + { + $objp = $this->db->fetch_object($result); - $line = new OrderLine($this->db); + $line = new OrderLine($this->db); - $line->rowid = $objp->rowid; - $line->id = $objp->rowid; - $line->fk_commande = $objp->fk_commande; - $line->commande_id = $objp->fk_commande; - $line->label = $objp->custom_label; - $line->desc = $objp->description; - $line->description = $objp->description; // Description line - $line->product_type = $objp->product_type; - $line->qty = $objp->qty; + $line->rowid = $objp->rowid; + $line->id = $objp->rowid; + $line->fk_commande = $objp->fk_commande; + $line->commande_id = $objp->fk_commande; + $line->label = $objp->custom_label; + $line->desc = $objp->description; + $line->description = $objp->description; // Description line + $line->product_type = $objp->product_type; + $line->qty = $objp->qty; - $line->vat_src_code = $objp->vat_src_code; - $line->tva_tx = $objp->tva_tx; - $line->localtax1_tx = $objp->localtax1_tx; - $line->localtax2_tx = $objp->localtax2_tx; - $line->localtax1_type = $objp->localtax1_type; - $line->localtax2_type = $objp->localtax2_type; - $line->total_ht = $objp->total_ht; - $line->total_ttc = $objp->total_ttc; - $line->total_tva = $objp->total_tva; - $line->total_localtax1 = $objp->total_localtax1; - $line->total_localtax2 = $objp->total_localtax2; - $line->subprice = $objp->subprice; - $line->fk_remise_except = $objp->fk_remise_except; - $line->remise_percent = $objp->remise_percent; - $line->price = $objp->price; - $line->fk_product = $objp->fk_product; + $line->vat_src_code = $objp->vat_src_code; + $line->tva_tx = $objp->tva_tx; + $line->localtax1_tx = $objp->localtax1_tx; + $line->localtax2_tx = $objp->localtax2_tx; + $line->localtax1_type = $objp->localtax1_type; + $line->localtax2_type = $objp->localtax2_type; + $line->total_ht = $objp->total_ht; + $line->total_ttc = $objp->total_ttc; + $line->total_tva = $objp->total_tva; + $line->total_localtax1 = $objp->total_localtax1; + $line->total_localtax2 = $objp->total_localtax2; + $line->subprice = $objp->subprice; + $line->fk_remise_except = $objp->fk_remise_except; + $line->remise_percent = $objp->remise_percent; + $line->price = $objp->price; + $line->fk_product = $objp->fk_product; $line->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); $line->pa_ht = $marginInfos[0]; - $line->marge_tx = $marginInfos[1]; - $line->marque_tx = $marginInfos[2]; - $line->rang = $objp->rang; - $line->info_bits = $objp->info_bits; - $line->special_code = $objp->special_code; - $line->fk_parent_line = $objp->fk_parent_line; + $line->marge_tx = $marginInfos[1]; + $line->marque_tx = $marginInfos[2]; + $line->rang = $objp->rang; + $line->info_bits = $objp->info_bits; + $line->special_code = $objp->special_code; + $line->fk_parent_line = $objp->fk_parent_line; - $line->ref = $objp->product_ref; - $line->product_ref = $objp->product_ref; - $line->libelle = $objp->product_label; - $line->product_label = $objp->product_label; - $line->product_desc = $objp->product_desc; - $line->product_tobatch = $objp->product_tobatch; - $line->fk_product_type = $objp->fk_product_type; // Produit ou service - $line->fk_unit = $objp->fk_unit; + $line->ref = $objp->product_ref; + $line->product_ref = $objp->product_ref; + $line->libelle = $objp->product_label; + $line->product_label = $objp->product_label; + $line->product_desc = $objp->product_desc; + $line->product_tobatch = $objp->product_tobatch; + $line->fk_product_type = $objp->fk_product_type; // Produit ou service + $line->fk_unit = $objp->fk_unit; - $line->weight = $objp->weight; - $line->weight_units = $objp->weight_units; - $line->volume = $objp->volume; - $line->volume_units = $objp->volume_units; + $line->weight = $objp->weight; + $line->weight_units = $objp->weight_units; + $line->volume = $objp->volume; + $line->volume_units = $objp->volume_units; - $line->date_start = $this->db->jdate($objp->date_start); - $line->date_end = $this->db->jdate($objp->date_end); + $line->date_start = $this->db->jdate($objp->date_start); + $line->date_end = $this->db->jdate($objp->date_end); // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; @@ -1890,819 +1890,819 @@ class Commande extends CommonOrder $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - $this->lines[$i] = $line; + $this->lines[$i] = $line; - $i++; - } + $i++; + } - $this->db->free($result); + $this->db->free($result); - return 1; - } - else - { - $this->error=$this->db->error(); - return -3; - } - } + return 1; + } + else + { + $this->error=$this->db->error(); + return -3; + } + } - /** - * Return number of line with type product. - * - * @return int <0 if KO, Nbr of product lines if OK - */ - function getNbOfProductsLines() - { - $nb=0; - foreach($this->lines as $line) - { - if ($line->product_type == 0) $nb++; - } - return $nb; - } + /** + * Return number of line with type product. + * + * @return int <0 if KO, Nbr of product lines if OK + */ + function getNbOfProductsLines() + { + $nb=0; + foreach($this->lines as $line) + { + if ($line->product_type == 0) $nb++; + } + return $nb; + } - /** - * Return number of line with type service. - * - * @return int <0 if KO, Nbr of service lines if OK - */ - function getNbOfServicesLines() - { - $nb=0; - foreach($this->lines as $line) - { - if ($line->product_type == 1) $nb++; - } - return $nb; - } + /** + * Return number of line with type service. + * + * @return int <0 if KO, Nbr of service lines if OK + */ + function getNbOfServicesLines() + { + $nb=0; + foreach($this->lines as $line) + { + if ($line->product_type == 1) $nb++; + } + return $nb; + } - /** - * Count numbe rof shipments for this order - * - * @return int <0 if KO, Nb of shipment found if OK - */ - function getNbOfShipments() - { - $nb = 0; + /** + * Count numbe rof shipments for this order + * + * @return int <0 if KO, Nb of shipment found if OK + */ + function getNbOfShipments() + { + $nb = 0; - $sql = 'SELECT COUNT(DISTINCT ed.fk_expedition) as nb'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,'; - $sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd'; - $sql.= ' WHERE'; - $sql.= ' ed.fk_origin_line = cd.rowid'; - $sql.= ' AND cd.fk_commande =' .$this->id; - //print $sql; + $sql = 'SELECT COUNT(DISTINCT ed.fk_expedition) as nb'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,'; + $sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd'; + $sql.= ' WHERE'; + $sql.= ' ed.fk_origin_line = cd.rowid'; + $sql.= ' AND cd.fk_commande =' .$this->id; + //print $sql; - dol_syslog(get_class($this)."::getNbOfShipments", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { + dol_syslog(get_class($this)."::getNbOfShipments", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { $obj = $this->db->fetch_object($resql); if ($obj) $nb = $obj->nb; $this->db->free($resql); - return $nb; - } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - } + return $nb; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } - /** - * Load array this->expeditions of lines of shipments with nb of products sent for each order line - * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order - * - * @param int $filtre_statut Filter on shipment status - * @return int <0 if KO, Nb of lines found if OK - */ - function loadExpeditions($filtre_statut=-1) - { - $this->expeditions = array(); + /** + * Load array this->expeditions of lines of shipments with nb of products sent for each order line + * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order + * + * @param int $filtre_statut Filter on shipment status + * @return int <0 if KO, Nb of lines found if OK + */ + function loadExpeditions($filtre_statut=-1) + { + $this->expeditions = array(); - $sql = 'SELECT cd.rowid, cd.fk_product,'; - $sql.= ' sum(ed.qty) as qty'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,'; - if ($filtre_statut >= 0) $sql.= ' '.MAIN_DB_PREFIX.'expedition as e,'; - $sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd'; - $sql.= ' WHERE'; - if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND'; - $sql.= ' ed.fk_origin_line = cd.rowid'; - $sql.= ' AND cd.fk_commande =' .$this->id; - if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product; - if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut; - $sql.= ' GROUP BY cd.rowid, cd.fk_product'; - //print $sql; + $sql = 'SELECT cd.rowid, cd.fk_product,'; + $sql.= ' sum(ed.qty) as qty'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,'; + if ($filtre_statut >= 0) $sql.= ' '.MAIN_DB_PREFIX.'expedition as e,'; + $sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd'; + $sql.= ' WHERE'; + if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND'; + $sql.= ' ed.fk_origin_line = cd.rowid'; + $sql.= ' AND cd.fk_commande =' .$this->id; + if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product; + if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut; + $sql.= ' GROUP BY cd.rowid, cd.fk_product'; + //print $sql; - dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $this->expeditions[$obj->rowid] = $obj->qty; - $i++; - } - $this->db->free($resql); - return $num; - } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - } + dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->expeditions[$obj->rowid] = $obj->qty; + $i++; + } + $this->db->free($resql); + return $num; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } - /** - * Returns a array with expeditions lines number - * - * @return int Nb of shipments - * - * TODO deprecate, move to Shipping class - */ + /** + * Returns a array with expeditions lines number + * + * @return int Nb of shipments + * + * TODO deprecate, move to Shipping class + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function nb_expedition() - { - $sql = 'SELECT count(*)'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; - $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; - $sql.= ' WHERE el.fk_source = '.$this->id; - $sql.= " AND el.fk_target = e.rowid"; - $sql.= " AND el.targettype = 'shipping'"; + function nb_expedition() + { + $sql = 'SELECT count(*)'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; + $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; + $sql.= ' WHERE el.fk_source = '.$this->id; + $sql.= " AND el.fk_target = e.rowid"; + $sql.= " AND el.targettype = 'shipping'"; - $resql = $this->db->query($sql); - if ($resql) - { - $row = $this->db->fetch_row($resql); - return $row[0]; - } - else dol_print_error($this->db); - } + $resql = $this->db->query($sql); + if ($resql) + { + $row = $this->db->fetch_row($resql); + return $row[0]; + } + else dol_print_error($this->db); + } - /** - * Return a array with the pending stock by product - * - * @param int $filtre_statut Filtre sur statut - * @return int 0 si OK, <0 si KO - * - * TODO FONCTION NON FINIE A FINIR - */ + /** + * Return a array with the pending stock by product + * + * @param int $filtre_statut Filtre sur statut + * @return int 0 si OK, <0 si KO + * + * TODO FONCTION NON FINIE A FINIR + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function stock_array($filtre_statut=self::STATUS_CANCELED) - { - $this->stocks = array(); + function stock_array($filtre_statut=self::STATUS_CANCELED) + { + $this->stocks = array(); - // Tableau des id de produit de la commande + // Tableau des id de produit de la commande $array_of_product=array(); - // Recherche total en stock pour chaque produit - // TODO $array_of_product est défini vide juste au dessus !! - if (count($array_of_product)) - { - $sql = "SELECT fk_product, sum(ps.reel) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; - $sql.= " WHERE ps.fk_product IN (".join(',',$array_of_product).")"; - $sql.= ' GROUP BY fk_product '; - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $this->stocks[$obj->fk_product] = $obj->total; - $i++; - } - $this->db->free($resql); - } - } - return 0; - } + // Recherche total en stock pour chaque produit + // TODO $array_of_product est défini vide juste au dessus !! + if (count($array_of_product)) + { + $sql = "SELECT fk_product, sum(ps.reel) as total"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; + $sql.= " WHERE ps.fk_product IN (".join(',',$array_of_product).")"; + $sql.= ' GROUP BY fk_product '; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->stocks[$obj->fk_product] = $obj->total; + $i++; + } + $this->db->free($resql); + } + } + return 0; + } - /** - * Delete an order line - * - * @param User $user User object - * @param int $lineid Id of line to delete - * @return int >0 if OK, 0 if nothing to do, <0 if KO - */ - function deleteline($user=null, $lineid=0) - { - if ($this->statut == self::STATUS_DRAFT) - { - $this->db->begin(); + /** + * Delete an order line + * + * @param User $user User object + * @param int $lineid Id of line to delete + * @return int >0 if OK, 0 if nothing to do, <0 if KO + */ + function deleteline($user=null, $lineid=0) + { + if ($this->statut == self::STATUS_DRAFT) + { + $this->db->begin(); - $sql = "SELECT fk_product, qty"; - $sql.= " FROM ".MAIN_DB_PREFIX."commandedet"; - $sql.= " WHERE rowid = ".$lineid; + $sql = "SELECT fk_product, qty"; + $sql.= " FROM ".MAIN_DB_PREFIX."commandedet"; + $sql.= " WHERE rowid = ".$lineid; - $result = $this->db->query($sql); - if ($result) - { - $obj = $this->db->fetch_object($result); + $result = $this->db->query($sql); + if ($result) + { + $obj = $this->db->fetch_object($result); - if ($obj) - { - $product = new Product($this->db); - $product->id = $obj->fk_product; + if ($obj) + { + $product = new Product($this->db); + $product->id = $obj->fk_product; - // Delete line - $line = new OrderLine($this->db); + // Delete line + $line = new OrderLine($this->db); - // For triggers - $line->fetch($lineid); + // For triggers + $line->fetch($lineid); - if ($line->delete($user) > 0) - { - $result=$this->update_price(1); - - if ($result > 0) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - $this->db->rollback(); - $this->error=$line->error; - return -1; - } - } - else - { - $this->db->rollback(); - return 0; - } - } - else - { - $this->db->rollback(); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - $this->error='ErrorDeleteLineNotAllowedByObjectStatus'; - return -1; - } - } - - /** - * Applique une remise relative - * - * @param User $user User qui positionne la remise - * @param float $remise Discount (percent) - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 if KO, >0 if OK - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_remise($user, $remise, $notrigger=0) - { - $remise=trim($remise)?trim($remise):0; - - if ($user->rights->commande->creer) - { - $error=0; - - $this->db->begin(); - - $remise=price2num($remise); - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql.= ' SET remise_percent = '.$remise; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } - - if (! $error) - { - $this->oldcopy= clone $this; - $this->remise_percent = $remise; - $this->update_price(1); - } - - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - } - - - /** - * Applique une remise absolue - * - * @param User $user User qui positionne la remise - * @param float $remise Discount - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 if KO, >0 if OK - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_remise_absolue($user, $remise, $notrigger=0) - { - $remise=trim($remise)?trim($remise):0; - - if ($user->rights->commande->creer) - { - $error=0; - - $this->db->begin(); - - $remise=price2num($remise); - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql.= ' SET remise_absolue = '.$remise; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } - - if (! $error) - { - $this->oldcopy= clone $this; - $this->remise_absolue = $remise; - $this->update_price(1); - } - - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - } - - - /** - * Set the order date - * - * @param User $user Object user making change - * @param int $date Date - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 if KO, >0 if OK - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_date($user, $date, $notrigger=0) - { - if ($user->rights->commande->creer) - { - $error=0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null'); - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } - - if (! $error) - { - $this->oldcopy= clone $this; - $this->date = $date; - } - - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - return -2; - } - } - - /** - * Set the planned delivery date - * - * @param User $user Objet utilisateur qui modifie - * @param int $date_livraison Date de livraison - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 si ko, >0 si ok - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_date_livraison($user, $date_livraison, $notrigger=0) - { - if ($user->rights->commande->creer) - { - $error=0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); - $sql.= " WHERE rowid = ".$this->id; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } - - if (! $error) - { - $this->oldcopy= clone $this; - $this->date_livraison = $date_livraison; - } - - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - return -2; - } - } - - /** - * Return list of orders (eventuelly filtered on a user) into an array - * - * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name) - * @param int $draft 0=not draft, 1=draft - * @param User $excluser Objet user to exclude - * @param int $socid Id third pary - * @param int $limit For pagination - * @param int $offset For pagination - * @param string $sortfield Sort criteria - * @param string $sortorder Sort order - * @return int -1 if KO, array with result if OK - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') - { - global $user; - - $ga = array(); - - $sql = "SELECT s.rowid, s.nom as name, s.client,"; - $sql.= " c.rowid as cid, c.ref"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.entity IN (".getEntity('commande').")"; - $sql.= " AND c.fk_soc = s.rowid"; - if (! $user->rights->societe->client->voir && ! $socid) //restriction - { - $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } - if ($socid) $sql.= " AND s.rowid = ".$socid; - if ($draft) $sql.= " AND c.fk_statut = ".self::STATUS_DRAFT; - if (is_object($excluser)) $sql.= " AND c.fk_user_author <> ".$excluser->id; - $sql.= $this->db->order($sortfield,$sortorder); - $sql.= $this->db->plimit($limit,$offset); - - $result=$this->db->query($sql); - if ($result) - { - $numc = $this->db->num_rows($result); - if ($numc) - { - $i = 0; - while ($i < $numc) - { - $obj = $this->db->fetch_object($result); - - if ($shortlist == 1) - { - $ga[$obj->cid] = $obj->ref; - } - else if ($shortlist == 2) - { - $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; - } - else + if ($line->delete($user) > 0) { - $ga[$i]['id'] = $obj->cid; - $ga[$i]['ref'] = $obj->ref; - $ga[$i]['name'] = $obj->name; - } - $i++; - } - } - return $ga; - } - else - { - dol_print_error($this->db); - return -1; - } - } + $result=$this->update_price(1); - /** - * Update delivery delay - * - * @param int $availability_id Id du nouveau mode - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int >0 if OK, <0 if KO - */ - function availability($availability_id, $notrigger=0) - { - global $user; + if ($result > 0) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + $this->error=$this->db->lasterror(); + return -1; + } + } + else + { + $this->db->rollback(); + $this->error=$line->error; + return -1; + } + } + else + { + $this->db->rollback(); + return 0; + } + } + else + { + $this->db->rollback(); + $this->error=$this->db->lasterror(); + return -1; + } + } + else + { + $this->error='ErrorDeleteLineNotAllowedByObjectStatus'; + return -1; + } + } - dol_syslog('Commande::availability('.$availability_id.')'); - if ($this->statut >= self::STATUS_DRAFT) - { - $error=0; - - $this->db->begin(); - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql .= ' SET fk_availability = '.$availability_id; - $sql .= ' WHERE rowid='.$this->id; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } - - if (! $error) - { - $this->oldcopy= clone $this; - $this->availability_id = $availability_id; - } - - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - $error_str='Command status do not meet requirement '.$this->statut; - dol_syslog(__METHOD__.$error_str, LOG_ERR); - $this->error=$error_str; - $this->errors[]= $this->error; - return -2; - } - } - - /** - * Update order demand_reason - * - * @param int $demand_reason_id Id of new demand - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int >0 if ok, <0 if ko - */ + /** + * Applique une remise relative + * + * @param User $user User qui positionne la remise + * @param float $remise Discount (percent) + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function demand_reason($demand_reason_id, $notrigger=0) - { - global $user; + function set_remise($user, $remise, $notrigger=0) + { + $remise=trim($remise)?trim($remise):0; - dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); - if ($this->statut >= self::STATUS_DRAFT) - { - $error=0; + if ($user->rights->commande->creer) + { + $error=0; - $this->db->begin(); + $this->db->begin(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $sql .= ' SET fk_input_reason = '.$demand_reason_id; - $sql .= ' WHERE rowid='.$this->id; + $remise=price2num($remise); - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET remise_percent = '.$remise; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - if (! $error) - { - $this->oldcopy= clone $this; - $this->demand_reason_id = $demand_reason_id; - } + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_percent = $remise; + $this->update_price(1); + } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - $error_str='order status do not meet requirement '.$this->statut; - dol_syslog(__METHOD__.$error_str, LOG_ERR); - $this->error=$error_str; - $this->errors[]= $this->error; - return -2; - } - } + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } - /** - * Set customer ref - * - * @param User $user User that make change - * @param string $ref_client Customer ref - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 if KO, >0 if OK - */ + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + } + + + /** + * Applique une remise absolue + * + * @param User $user User qui positionne la remise + * @param float $remise Discount + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function set_ref_client($user, $ref_client, $notrigger=0) - { - if ($user->rights->commande->creer) - { - $error=0; + function set_remise_absolue($user, $remise, $notrigger=0) + { + $remise=trim($remise)?trim($remise):0; - $this->db->begin(); + if ($user->rights->commande->creer) + { + $error=0; - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET'; - $sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\''); - $sql.= ' WHERE rowid = '.$this->id; + $this->db->begin(); - dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); - $resql=$this->db->query($sql); - if (!$resql) - { - $this->errors[]=$this->db->error(); - $error++; - } + $remise=price2num($remise); - if (! $error) - { - $this->oldcopy= clone $this; - $this->ref_client = $ref_client; - } + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET remise_absolue = '.$remise; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;'; - if (! $notrigger && empty($error)) - { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers - } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - return -1; - } - } + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->remise_absolue = $remise; + $this->update_price(1); + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + } + + + /** + * Set the order date + * + * @param User $user Object user making change + * @param int $date Date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function set_date($user, $date, $notrigger=0) + { + if ($user->rights->commande->creer) + { + $error=0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; + $sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null'); + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date = $date; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + return -2; + } + } + + /** + * Set the planned delivery date + * + * @param User $user Objet utilisateur qui modifie + * @param int $date_livraison Date de livraison + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 si ko, >0 si ok + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function set_date_livraison($user, $date_livraison, $notrigger=0) + { + if ($user->rights->commande->creer) + { + $error=0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; + $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->date_livraison = $date_livraison; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + return -2; + } + } + + /** + * Return list of orders (eventuelly filtered on a user) into an array + * + * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name) + * @param int $draft 0=not draft, 1=draft + * @param User $excluser Objet user to exclude + * @param int $socid Id third pary + * @param int $limit For pagination + * @param int $offset For pagination + * @param string $sortfield Sort criteria + * @param string $sortorder Sort order + * @return int -1 if KO, array with result if OK + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') + { + global $user; + + $ga = array(); + + $sql = "SELECT s.rowid, s.nom as name, s.client,"; + $sql.= " c.rowid as cid, c.ref"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE c.entity IN (".getEntity('commande').")"; + $sql.= " AND c.fk_soc = s.rowid"; + if (! $user->rights->societe->client->voir && ! $socid) //restriction + { + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } + if ($socid) $sql.= " AND s.rowid = ".$socid; + if ($draft) $sql.= " AND c.fk_statut = ".self::STATUS_DRAFT; + if (is_object($excluser)) $sql.= " AND c.fk_user_author <> ".$excluser->id; + $sql.= $this->db->order($sortfield,$sortorder); + $sql.= $this->db->plimit($limit,$offset); + + $result=$this->db->query($sql); + if ($result) + { + $numc = $this->db->num_rows($result); + if ($numc) + { + $i = 0; + while ($i < $numc) + { + $obj = $this->db->fetch_object($result); + + if ($shortlist == 1) + { + $ga[$obj->cid] = $obj->ref; + } + else if ($shortlist == 2) + { + $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; + } + else + { + $ga[$i]['id'] = $obj->cid; + $ga[$i]['ref'] = $obj->ref; + $ga[$i]['name'] = $obj->name; + } + $i++; + } + } + return $ga; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /** + * Update delivery delay + * + * @param int $availability_id Id du nouveau mode + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int >0 if OK, <0 if KO + */ + function availability($availability_id, $notrigger=0) + { + global $user; + + dol_syslog('Commande::availability('.$availability_id.')'); + if ($this->statut >= self::STATUS_DRAFT) + { + $error=0; + + $this->db->begin(); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql .= ' SET fk_availability = '.$availability_id; + $sql .= ' WHERE rowid='.$this->id; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->availability_id = $availability_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + $error_str='Command status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; + return -2; + } + } + + /** + * Update order demand_reason + * + * @param int $demand_reason_id Id of new demand + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int >0 if ok, <0 if ko + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function demand_reason($demand_reason_id, $notrigger=0) + { + global $user; + + dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); + if ($this->statut >= self::STATUS_DRAFT) + { + $error=0; + + $this->db->begin(); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql .= ' SET fk_input_reason = '.$demand_reason_id; + $sql .= ' WHERE rowid='.$this->id; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->demand_reason_id = $demand_reason_id; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + $error_str='order status do not meet requirement '.$this->statut; + dol_syslog(__METHOD__.$error_str, LOG_ERR); + $this->error=$error_str; + $this->errors[]= $this->error; + return -2; + } + } + + /** + * Set customer ref + * + * @param User $user User that make change + * @param string $ref_client Customer ref + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function set_ref_client($user, $ref_client, $notrigger=0) + { + if ($user->rights->commande->creer) + { + $error=0; + + $this->db->begin(); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET'; + $sql.= ' ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\''); + $sql.= ' WHERE rowid = '.$this->id; + + dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) + { + $this->errors[]=$this->db->error(); + $error++; + } + + if (! $error) + { + $this->oldcopy= clone $this; + $this->ref_client = $ref_client; + } + + if (! $notrigger && empty($error)) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + return -1; + } + } /** * Classify the order as invoiced @@ -2713,7 +2713,7 @@ class Commande extends CommonOrder */ function classifyBilled(User $user, $notrigger=0) { - $error = 0; + $error = 0; $this->db->begin(); @@ -2732,10 +2732,10 @@ class Commande extends CommonOrder if (! $notrigger && empty($error)) { - // Call trigger - $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -2757,7 +2757,7 @@ class Commande extends CommonOrder else { $this->error=$this->db->error(); - $this->db->rollback(); + $this->db->rollback(); return -1; } } @@ -2769,146 +2769,146 @@ class Commande extends CommonOrder */ function classifyUnBilled() { - global $conf, $user, $langs; - $error = 0; + global $conf, $user, $langs; + $error = 0; - $this->db->begin(); + $this->db->begin(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0'; - $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0'; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; - dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG); - if ($this->db->query($sql)) - { - if (! $error) - { - $this->oldcopy= clone $this; - $this->billed=1; - } + dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG); + if ($this->db->query($sql)) + { + if (! $error) + { + $this->oldcopy= clone $this; + $this->billed=1; + } - // Call trigger - $result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user); + if ($result < 0) $error++; + // End call triggers - if (! $error) - { - $this->billed=0; + if (! $error) + { + $this->billed=0; - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -1; - } + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } } - /** - * Update a line in database - * - * @param int $rowid Id of line to update - * @param string $desc Description of line - * @param float $pu Unit price - * @param float $qty Quantity - * @param float $remise_percent Percent of discount - * @param float $txtva Taux TVA - * @param float $txlocaltax1 Local tax 1 rate - * @param float $txlocaltax2 Local tax 2 rate - * @param string $price_base_type HT or TTC - * @param int $info_bits Miscellaneous informations on line - * @param int $date_start Start date of the line - * @param int $date_end End date of the line - * @param int $type Type of line (0=product, 1=service) - * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). - * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) - * @param int $fk_fournprice Id of origin supplier price - * @param int $pa_ht Price (without tax) of product when it was bought - * @param string $label Label - * @param int $special_code Special code (also used by externals modules!) + /** + * Update a line in database + * + * @param int $rowid Id of line to update + * @param string $desc Description of line + * @param float $pu Unit price + * @param float $qty Quantity + * @param float $remise_percent Percent of discount + * @param float $txtva Taux TVA + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate + * @param string $price_base_type HT or TTC + * @param int $info_bits Miscellaneous informations on line + * @param int $date_start Start date of the line + * @param int $date_end End date of the line + * @param int $type Type of line (0=product, 1=service) + * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). + * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) + * @param int $fk_fournprice Id of origin supplier price + * @param int $pa_ht Price (without tax) of product when it was bought + * @param string $label Label + * @param int $special_code Special code (also used by externals modules!) * @param array $array_options extrafields array - * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param string $fk_unit Code of the unit to use. Null to use the default one * @param double $pu_ht_devise Amount in currency - * @param int $notrigger disable line update trigger - * @return int < 0 if KO, > 0 if OK - */ + * @param int $notrigger disable line update trigger + * @return int < 0 if KO, > 0 if OK + */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0) - { - global $conf, $mysoc, $langs, $user; + { + global $conf, $mysoc, $langs, $user; - dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - if (! empty($this->brouillon)) - { - $this->db->begin(); + if (! empty($this->brouillon)) + { + $this->db->begin(); - // Clean parameters - if (empty($qty)) $qty=0; - if (empty($info_bits)) $info_bits=0; - if (empty($txtva)) $txtva=0; - if (empty($txlocaltax1)) $txlocaltax1=0; - if (empty($txlocaltax2)) $txlocaltax2=0; - if (empty($remise_percent)) $remise_percent=0; - if (empty($special_code) || $special_code == 3) $special_code=0; + // Clean parameters + if (empty($qty)) $qty=0; + if (empty($info_bits)) $info_bits=0; + if (empty($txtva)) $txtva=0; + if (empty($txlocaltax1)) $txlocaltax1=0; + if (empty($txlocaltax2)) $txlocaltax2=0; + if (empty($remise_percent)) $remise_percent=0; + if (empty($special_code) || $special_code == 3) $special_code=0; - $remise_percent=price2num($remise_percent); - $qty=price2num($qty); - $pu = price2num($pu); - $pa_ht=price2num($pa_ht); - $pu_ht_devise=price2num($pu_ht_devise); - $txtva=price2num($txtva); - $txlocaltax1=price2num($txlocaltax1); - $txlocaltax2=price2num($txlocaltax2); + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + $pu = price2num($pu); + $pa_ht=price2num($pa_ht); + $pu_ht_devise=price2num($pu_ht_devise); + $txtva=price2num($txtva); + $txlocaltax1=price2num($txlocaltax1); + $txlocaltax2=price2num($txlocaltax2); - // Calcul du total TTC et de la TVA pour la ligne a partir de - // qty, pu, remise_percent et txtva - // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker - // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + // Calcul du total TTC et de la TVA pour la ligne a partir de + // qty, pu, remise_percent et txtva + // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker + // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - // Clean vat code - $vat_src_code=''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); - $total_ht = $tabprice[0]; - $total_tva = $tabprice[1]; - $total_ttc = $tabprice[2]; - $total_localtax1 = $tabprice[9]; - $total_localtax2 = $tabprice[10]; + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + $total_localtax1 = $tabprice[9]; + $total_localtax2 = $tabprice[10]; $pu_ht = $tabprice[3]; $pu_tva = $tabprice[4]; $pu_ttc = $tabprice[5]; // MultiCurrency $multicurrency_total_ht = $tabprice[16]; - $multicurrency_total_tva = $tabprice[17]; - $multicurrency_total_ttc = $tabprice[18]; + $multicurrency_total_tva = $tabprice[17]; + $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; - // Anciens indicateurs: $price, $subprice (a ne plus utiliser) - $price = $pu_ht; + // Anciens indicateurs: $price, $subprice (a ne plus utiliser) + $price = $pu_ht; if ($price_base_type == 'TTC') { $subprice = $pu_ttc; @@ -2917,72 +2917,72 @@ class Commande extends CommonOrder { $subprice = $pu_ht; } - $remise = 0; - if ($remise_percent > 0) - { - $remise = round(($pu * $remise_percent / 100),2); - $price = ($pu - $remise); - } + $remise = 0; + if ($remise_percent > 0) + { + $remise = round(($pu * $remise_percent / 100),2); + $price = ($pu - $remise); + } - //Fetch current line from the database and then clone the object and set it in $oldline property - $line = new OrderLine($this->db); - $line->fetch($rowid); + //Fetch current line from the database and then clone the object and set it in $oldline property + $line = new OrderLine($this->db); + $line->fetch($rowid); - if (!empty($line->fk_product)) - { - $product=new Product($this->db); - $result=$product->fetch($line->fk_product); - $product_type=$product->type; + if (!empty($line->fk_product)) + { + $product=new Product($this->db); + $result=$product->fetch($line->fk_product); + $product_type=$product->type; - if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); - dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); - $this->db->rollback(); - return self::STOCK_NOT_ENOUGH_FOR_ORDER; - } - } + if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); + dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); + $this->db->rollback(); + return self::STOCK_NOT_ENOUGH_FOR_ORDER; + } + } - $staticline = clone $line; + $staticline = clone $line; - $line->oldline = $staticline; - $this->line = $line; - $this->line->context = $this->context; + $line->oldline = $staticline; + $this->line = $line; + $this->line->context = $this->context; - // Reorder if fk_parent_line change - if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) - { - $rangmax = $this->line_max($fk_parent_line); - $this->line->rang = $rangmax + 1; - } + // Reorder if fk_parent_line change + if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) + { + $rangmax = $this->line_max($fk_parent_line); + $this->line->rang = $rangmax + 1; + } - $this->line->rowid=$rowid; - $this->line->label=$label; - $this->line->desc=$desc; - $this->line->qty=$qty; + $this->line->rowid=$rowid; + $this->line->label=$label; + $this->line->desc=$desc; + $this->line->qty=$qty; - $this->line->vat_src_code = $vat_src_code; - $this->line->tva_tx = $txtva; - $this->line->localtax1_tx = $txlocaltax1; - $this->line->localtax2_tx = $txlocaltax2; + $this->line->vat_src_code = $vat_src_code; + $this->line->tva_tx = $txtva; + $this->line->localtax1_tx = $txlocaltax1; + $this->line->localtax2_tx = $txlocaltax2; $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; - $this->line->remise_percent = $remise_percent; - $this->line->subprice = $subprice; - $this->line->info_bits = $info_bits; - $this->line->special_code = $special_code; - $this->line->total_ht = $total_ht; - $this->line->total_tva = $total_tva; - $this->line->total_localtax1= $total_localtax1; - $this->line->total_localtax2= $total_localtax2; - $this->line->total_ttc = $total_ttc; - $this->line->date_start = $date_start; - $this->line->date_end = $date_end; - $this->line->product_type = $type; - $this->line->fk_parent_line = $fk_parent_line; - $this->line->skip_update_total=$skip_update_total; - $this->line->fk_unit = $fk_unit; + $this->line->remise_percent = $remise_percent; + $this->line->subprice = $subprice; + $this->line->info_bits = $info_bits; + $this->line->special_code = $special_code; + $this->line->total_ht = $total_ht; + $this->line->total_tva = $total_tva; + $this->line->total_localtax1= $total_localtax1; + $this->line->total_localtax2= $total_localtax2; + $this->line->total_ttc = $total_ttc; + $this->line->date_start = $date_start; + $this->line->date_end = $date_end; + $this->line->product_type = $type; + $this->line->fk_parent_line = $fk_parent_line; + $this->line->skip_update_total=$skip_update_total; + $this->line->fk_unit = $fk_unit; $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; @@ -2990,44 +2990,44 @@ class Commande extends CommonOrder // Multicurrency $this->line->multicurrency_subprice = $pu_ht_devise; $this->line->multicurrency_total_ht = $multicurrency_total_ht; - $this->line->multicurrency_total_tva = $multicurrency_total_tva; - $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - // TODO deprecated - $this->line->price=$price; - $this->line->remise=$remise; + // TODO deprecated + $this->line->price=$price; + $this->line->remise=$remise; if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } - $result=$this->line->update($user, $notrigger); - if ($result > 0) - { - // Reorder if child line - if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); + $result=$this->line->update($user, $notrigger); + if ($result > 0) + { + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - // Mise a jour info denormalisees - $this->update_price(1); + // Mise a jour info denormalisees + $this->update_price(1); - $this->db->commit(); - return $result; - } - else - { - $this->error=$this->line->error; + $this->db->commit(); + return $result; + } + else + { + $this->error=$this->line->error; - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=get_class($this)."::updateline Order status makes operation forbidden"; - $this->errors=array('OrderStatusMakeOperationForbidden'); - return -2; - } - } + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=get_class($this)."::updateline Order status makes operation forbidden"; + $this->errors=array('OrderStatusMakeOperationForbidden'); + return -2; + } + } /** * Update database @@ -3124,31 +3124,31 @@ class Commande extends CommonOrder } } - /** - * Delete the customer order - * - * @param User $user User object - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <=0 if KO, >0 if OK - */ - function delete($user, $notrigger=0) - { - global $conf, $langs; - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + /** + * Delete the customer order + * + * @param User $user User object + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <=0 if KO, >0 if OK + */ + function delete($user, $notrigger=0) + { + global $conf, $langs; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $error = 0; + $error = 0; - dol_syslog(get_class($this) . "::delete ".$this->id, LOG_DEBUG); + dol_syslog(get_class($this) . "::delete ".$this->id, LOG_DEBUG); - $this->db->begin(); + $this->db->begin(); - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('ORDER_DELETE',$user); - if ($result < 0) $error++; - // End call triggers - } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('ORDER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } if ($this->nb_expedition() != 0) { @@ -3156,317 +3156,317 @@ class Commande extends CommonOrder $error++; } - if (! $error) - { - // Delete order details - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - if (! $this->db->query($sql) ) - { - $error++; - $this->errors[]=$this->db->lasterror(); - } - } + if (! $error) + { + // Delete order details + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; + if (! $this->db->query($sql) ) + { + $error++; + $this->errors[]=$this->db->lasterror(); + } + } - if (! $error) - { - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; - } + if (! $error) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + } - if (! $error) - { - // Delete linked contacts - $res = $this->delete_linked_contact(); - if ($res < 0) $error++; - } + if (! $error) + { + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) $error++; + } - if (! $error) - { - // Remove extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used - { - $result=$this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } - } - } + if (! $error) + { + // Remove extrafields + if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); + } + } + } - if (! $error) - { - // Delete object - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - if (! $this->db->query($sql) ) - { - $error++; - $this->errors[]=$this->db->lasterror(); - } - } + if (! $error) + { + // Delete object + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; + if (! $this->db->query($sql) ) + { + $error++; + $this->errors[]=$this->db->lasterror(); + } + } - if (! $error) - { - // Remove directory with files - $comref = dol_sanitizeFileName($this->ref); - if ($conf->commande->dir_output && !empty($this->ref)) - { - $dir = $conf->commande->dir_output . "/" . $comref ; - $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; - if (file_exists($file)) // We must delete all files before deleting directory - { - dol_delete_preview($this); + if (! $error) + { + // Remove directory with files + $comref = dol_sanitizeFileName($this->ref); + if ($conf->commande->dir_output && !empty($this->ref)) + { + $dir = $conf->commande->dir_output . "/" . $comref ; + $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; + if (file_exists($file)) // We must delete all files before deleting directory + { + dol_delete_preview($this); - if (! dol_delete_file($file,0,0,0,$this)) // For triggers - { - $this->db->rollback(); - return 0; - } - } - if (file_exists($dir)) - { - if (! dol_delete_dir_recursive($dir)) - { - $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); - $this->db->rollback(); - return 0; - } - } - } - } + if (! dol_delete_file($file,0,0,0,$this)) // For triggers + { + $this->db->rollback(); + return 0; + } + } + if (file_exists($dir)) + { + if (! dol_delete_dir_recursive($dir)) + { + $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); + $this->db->rollback(); + return 0; + } + } + } + } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - foreach($this->errors as $errmsg) - { - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - } + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } - /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) - * - * @param User $user Object user - * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK - */ + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Object user + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function load_board($user) - { - global $conf, $langs; + function load_board($user) + { + global $conf, $langs; - $clause = " WHERE"; + $clause = " WHERE"; - $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; - $clause = " AND"; - } - $sql.= $clause." c.entity IN (".getEntity('commande').")"; - //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; - $sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected - if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; + $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = " AND"; + } + $sql.= $clause." c.entity IN (".getEntity('commande').")"; + //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; + $sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; - $resql=$this->db->query($sql); - if ($resql) - { - $response = new WorkboardResponse(); - $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; - $response->label=$langs->trans("OrdersToProcess"); - $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; - $response->img=img_object('',"order"); + $resql=$this->db->query($sql); + if ($resql) + { + $response = new WorkboardResponse(); + $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; + $response->label=$langs->trans("OrdersToProcess"); + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; + $response->img=img_object('',"order"); - $generic_commande = new Commande($this->db); + $generic_commande = new Commande($this->db); - while ($obj=$this->db->fetch_object($resql)) - { - $response->nbtodo++; + while ($obj=$this->db->fetch_object($resql)) + { + $response->nbtodo++; $response->total+= $obj->total_ht; - $generic_commande->statut = $obj->fk_statut; - $generic_commande->date_commande = $this->db->jdate($obj->date_commande); - $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); + $generic_commande->statut = $obj->fk_statut; + $generic_commande->date_commande = $this->db->jdate($obj->date_commande); + $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); - if ($generic_commande->hasDelay()) { - $response->nbtodolate++; - } - } + if ($generic_commande->hasDelay()) { + $response->nbtodolate++; + } + } - return $response; - } - else - { - $this->error=$this->db->error(); - return -1; - } - } + return $response; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } - /** - * Return source label of order - * - * @return string Label - */ - function getLabelSource() - { - global $langs; + /** + * Return source label of order + * + * @return string Label + */ + function getLabelSource() + { + global $langs; - $label=$langs->trans('OrderSource'.$this->source); + $label=$langs->trans('OrderSource'.$this->source); - if ($label == 'OrderSource') return ''; - return $label; - } + if ($label == 'OrderSource') return ''; + return $label; + } - /** - * Return status label of Order - * - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - function getLibStatut($mode) - { - return $this->LibStatut($this->statut, $this->billed, $mode); - } + /** + * Return status label of Order + * + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + function getLibStatut($mode) + { + return $this->LibStatut($this->statut, $this->billed, $mode); + } - /** - * Return label of status - * - * @param int $statut Id statut - * @param int $billed If invoiced - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto - * @param int $donotshowbilled Do not show billed status after order status - * @return string Label of status - */ + /** + * Return label of status + * + * @param int $statut Id statut + * @param int $billed If invoiced + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto + * @param int $donotshowbilled Do not show billed status after order status + * @return string Label of status + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function LibStatut($statut,$billed,$mode,$donotshowbilled=0) - { - global $langs, $conf; + function LibStatut($statut,$billed,$mode,$donotshowbilled=0) + { + global $langs, $conf; - $billedtext = ''; - if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); + $billedtext = ''; + if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); - //print 'x'.$statut.'-'.$billed; - if ($mode == 0) - { - if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled'); - if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft'); - if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext; - if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); - } - elseif ($mode == 1) - { - if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort'); - if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort'); - if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext; - if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); - } - elseif ($mode == 2) - { - if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort'); - if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort'); - if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext; - if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort'); - } - elseif ($mode == 3) - { - if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5'); - if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0'); - if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); - if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3'); - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6'); - } - elseif ($mode == 4) - { - if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled'); - if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft'); - if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext; - if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext; - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered'); - } - elseif ($mode == 5) - { - if ($statut==self::STATUS_CANCELED) return ''.$langs->trans('StatusOrderCanceledShort').' '.img_picto($langs->trans('StatusOrderCanceled'),'statut5'); - if ($statut==self::STATUS_DRAFT) return ''.$langs->trans('StatusOrderDraftShort').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0'); - if ($statut==self::STATUS_VALIDATED) return ''.$langs->trans('StatusOrderValidatedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); - if ($statut==self::STATUS_SHIPMENTONPROCESS) return ''.$langs->trans('StatusOrderSentShort').$billedtext.' '.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3'); - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut4'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderProcessedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderDeliveredShort').' '.img_picto($langs->trans('StatusOrderDelivered'),'statut6'); - } - elseif ($mode == 6) - { - if ($statut==self::STATUS_CANCELED) return ''.$langs->trans('StatusOrderCanceled').' '.img_picto($langs->trans('StatusOrderCanceled'),'statut5'); - if ($statut==self::STATUS_DRAFT) return ''.$langs->trans('StatusOrderDraft').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0'); - if ($statut==self::STATUS_VALIDATED) return ''.$langs->trans('StatusOrderValidated').$billedtext.' '.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); - if ($statut==self::STATUS_SHIPMENTONPROCESS) return ''.$langs->trans('StatusOrderSent').$billedtext.' '.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3'); - if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBill').' '.img_picto($langs->trans('StatusOrderToBill'),'statut4'); - if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderProcessed').$billedtext.' '.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); - if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderDelivered').' '.img_picto($langs->trans('StatusOrderDelivered'),'statut6'); - } + //print 'x'.$statut.'-'.$billed; + if ($mode == 0) + { + if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled'); + if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft'); + if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext; + if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); + } + elseif ($mode == 1) + { + if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort'); + if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort'); + if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext; + if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); + } + elseif ($mode == 2) + { + if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort'); + if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort'); + if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext; + if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext; + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort'); + } + elseif ($mode == 3) + { + if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5'); + if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0'); + if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); + if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6'); + } + elseif ($mode == 4) + { + if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled'); + if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft'); + if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext; + if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext; + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered'); + } + elseif ($mode == 5) + { + if ($statut==self::STATUS_CANCELED) return ''.$langs->trans('StatusOrderCanceledShort').' '.img_picto($langs->trans('StatusOrderCanceled'),'statut5'); + if ($statut==self::STATUS_DRAFT) return ''.$langs->trans('StatusOrderDraftShort').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0'); + if ($statut==self::STATUS_VALIDATED) return ''.$langs->trans('StatusOrderValidatedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); + if ($statut==self::STATUS_SHIPMENTONPROCESS) return ''.$langs->trans('StatusOrderSentShort').$billedtext.' '.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut4'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderProcessedShort').$billedtext.' '.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderDeliveredShort').' '.img_picto($langs->trans('StatusOrderDelivered'),'statut6'); + } + elseif ($mode == 6) + { + if ($statut==self::STATUS_CANCELED) return ''.$langs->trans('StatusOrderCanceled').' '.img_picto($langs->trans('StatusOrderCanceled'),'statut5'); + if ($statut==self::STATUS_DRAFT) return ''.$langs->trans('StatusOrderDraft').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0'); + if ($statut==self::STATUS_VALIDATED) return ''.$langs->trans('StatusOrderValidated').$billedtext.' '.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1'); + if ($statut==self::STATUS_SHIPMENTONPROCESS) return ''.$langs->trans('StatusOrderSent').$billedtext.' '.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3'); + if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderToBill').' '.img_picto($langs->trans('StatusOrderToBill'),'statut4'); + if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderProcessed').$billedtext.' '.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6'); + if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return ''.$langs->trans('StatusOrderDelivered').' '.img_picto($langs->trans('StatusOrderDelivered'),'statut6'); + } - } + } - /** - * Return clicable link of object (with eventually picto) - * - * @param int $withpicto Add picto into link - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param int $max Max length to show - * @param int $short ??? - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL - */ - function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1) - { - global $conf, $langs, $user; + /** + * Return clicable link of object (with eventually picto) + * + * @param int $withpicto Add picto into link + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param int $max Max length to show + * @param int $short ??? + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1) + { + global $conf, $langs, $user; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $result=''; + $result=''; - if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; - else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id; + if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; + else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id; - if (!$user->rights->commande->lire) - $option = 'nolink'; + if (!$user->rights->commande->lire) + $option = 'nolink'; - if ($option !== 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; - } + if ($option !== 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } - if ($short) return $url; + if ($short) return $url; - $label = ''; + $label = ''; if ($user->rights->commande->lire) { $label = ''.$langs->trans("ShowOrder").''; @@ -3486,231 +3486,231 @@ class Commande extends CommonOrder $linkclose=''; if (empty($notooltip) && $user->rights->commande->lire) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowOrder"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowOrder"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; } - $linkstart = ''; - $linkend=''; + $linkstart = ''; + $linkend=''; - if ($option === 'nolink') { - $linkstart = ''; - $linkend = ''; - } + if ($option === 'nolink') { + $linkstart = ''; + $linkend = ''; + } - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - return $result; - } + return $result; + } - /** - * Charge les informations d'ordre info dans l'objet commande - * - * @param int $id Id of order - * @return void - */ - function info($id) - { - $sql = 'SELECT c.rowid, date_creation as datec, tms as datem,'; - $sql.= ' date_valid as datev,'; - $sql.= ' date_cloture as datecloture,'; - $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql.= ' WHERE c.rowid = '.$id; - $result=$this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - if ($obj->fk_user_author) - { - $cuser = new User($this->db); - $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; - } + /** + * Charge les informations d'ordre info dans l'objet commande + * + * @param int $id Id of order + * @return void + */ + function info($id) + { + $sql = 'SELECT c.rowid, date_creation as datec, tms as datem,'; + $sql.= ' date_valid as datev,'; + $sql.= ' date_cloture as datecloture,'; + $sql.= ' fk_user_author, fk_user_valid, fk_user_cloture'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; + $sql.= ' WHERE c.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } - if ($obj->fk_user_valid) - { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; - } + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } - if ($obj->fk_user_cloture) - { - $cluser = new User($this->db); - $cluser->fetch($obj->fk_user_cloture); - $this->user_cloture = $cluser; - } + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); - $this->date_cloture = $this->db->jdate($obj->datecloture); - } + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + $this->date_cloture = $this->db->jdate($obj->datecloture); + } - $this->db->free($result); + $this->db->free($result); - } - else - { - dol_print_error($this->db); - } - } + } + else + { + dol_print_error($this->db); + } + } - /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void - */ - function initAsSpecimen() - { - global $langs; + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + function initAsSpecimen() + { + global $langs; - dol_syslog(get_class($this)."::initAsSpecimen"); + dol_syslog(get_class($this)."::initAsSpecimen"); - // Load array of products prodids - $num_prods = 0; - $prodids = array(); - $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."product"; - $sql.= " WHERE entity IN (".getEntity('product').")"; - $resql = $this->db->query($sql); - if ($resql) - { - $num_prods = $this->db->num_rows($resql); - $i = 0; - while ($i < $num_prods) - { - $i++; - $row = $this->db->fetch_row($resql); - $prodids[$i] = $row[0]; - } - } + // Load array of products prodids + $num_prods = 0; + $prodids = array(); + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."product"; + $sql.= " WHERE entity IN (".getEntity('product').")"; + $resql = $this->db->query($sql); + if ($resql) + { + $num_prods = $this->db->num_rows($resql); + $i = 0; + while ($i < $num_prods) + { + $i++; + $row = $this->db->fetch_row($resql); + $prodids[$i] = $row[0]; + } + } - // Initialise parametres - $this->id=0; - $this->ref = 'SPECIMEN'; - $this->specimen=1; - $this->socid = 1; - $this->date = time(); - $this->date_lim_reglement=$this->date+3600*24*30; - $this->cond_reglement_code = 'RECEP'; - $this->mode_reglement_code = 'CHQ'; - $this->availability_code = 'DSP'; - $this->demand_reason_code = 'SRC_00'; - $this->note_public='This is a comment (public)'; - $this->note_private='This is a comment (private)'; - // Lines - $nbp = 5; - $xnbp = 0; - while ($xnbp < $nbp) - { - $line=new OrderLine($this->db); + // Initialise parametres + $this->id=0; + $this->ref = 'SPECIMEN'; + $this->specimen=1; + $this->socid = 1; + $this->date = time(); + $this->date_lim_reglement=$this->date+3600*24*30; + $this->cond_reglement_code = 'RECEP'; + $this->mode_reglement_code = 'CHQ'; + $this->availability_code = 'DSP'; + $this->demand_reason_code = 'SRC_00'; + $this->note_public='This is a comment (public)'; + $this->note_private='This is a comment (private)'; + // Lines + $nbp = 5; + $xnbp = 0; + while ($xnbp < $nbp) + { + $line=new OrderLine($this->db); - $line->desc=$langs->trans("Description")." ".$xnbp; - $line->qty=1; - $line->subprice=100; - $line->price=100; - $line->tva_tx=20; - if ($xnbp == 2) - { - $line->total_ht=50; - $line->total_ttc=60; - $line->total_tva=10; - $line->remise_percent=50; - } - else - { - $line->total_ht=100; - $line->total_ttc=120; - $line->total_tva=20; - $line->remise_percent=0; - } - if ($num_prods > 0) - { - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; + $line->desc=$langs->trans("Description")." ".$xnbp; + $line->qty=1; + $line->subprice=100; + $line->price=100; + $line->tva_tx=20; + if ($xnbp == 2) + { + $line->total_ht=50; + $line->total_ttc=60; + $line->total_tva=10; + $line->remise_percent=50; + } + else + { + $line->total_ht=100; + $line->total_ttc=120; + $line->total_tva=20; + $line->remise_percent=0; + } + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; $line->product_ref='SPECIMEN'; - } + } - $this->lines[$xnbp]=$line; + $this->lines[$xnbp]=$line; - $this->total_ht += $line->total_ht; - $this->total_tva += $line->total_tva; - $this->total_ttc += $line->total_ttc; + $this->total_ht += $line->total_ht; + $this->total_tva += $line->total_tva; + $this->total_ttc += $line->total_ttc; - $xnbp++; - } - } + $xnbp++; + } + } - /** - * Charge indicateurs this->nb de tableau de bord - * - * @return int <0 si ko, >0 si ok - */ + /** + * Charge indicateurs this->nb de tableau de bord + * + * @return int <0 si ko, >0 si ok + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function load_state_board() - { - global $user; + function load_state_board() + { + global $user; - $this->nb=array(); - $clause = "WHERE"; + $this->nb=array(); + $clause = "WHERE"; - $sql = "SELECT count(co.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande as co"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) - { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; - $sql.= " WHERE sc.fk_user = " .$user->id; - $clause = "AND"; - } - $sql.= " ".$clause." co.entity IN (".getEntity('commande').")"; + $sql = "SELECT count(co.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande as co"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " WHERE sc.fk_user = " .$user->id; + $clause = "AND"; + } + $sql.= " ".$clause." co.entity IN (".getEntity('commande').")"; - $resql=$this->db->query($sql); - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { - $this->nb["orders"]=$obj->nb; - } - $this->db->free($resql); - return 1; - } - else - { - dol_print_error($this->db); - $this->error=$this->db->error(); - return -1; - } - } + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["orders"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } - /** + /** * Create an array of order lines * * @return int >0 if OK, <0 if KO - */ - function getLinesArray() - { - return $this->fetch_lines(); - } + */ + function getLinesArray() + { + return $this->fetch_lines(); + } /** * Create a document onto disk according to template module. @@ -3720,7 +3720,7 @@ class Commande extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) @@ -3763,39 +3763,39 @@ class Commande extends CommonOrder return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } - /** - * Is the customer order delayed? - * - * @return bool true if late, false if not - */ - public function hasDelay() - { - global $conf; + /** + * Is the customer order delayed? + * + * @return bool true if late, false if not + */ + public function hasDelay() + { + global $conf; - if (! ($this->statut > Commande::STATUS_DRAFT && $this->statut < Commande::STATUS_CLOSED)) { - return false; // Never late if not inside this status range - } + if (! ($this->statut > Commande::STATUS_DRAFT && $this->statut < Commande::STATUS_CLOSED)) { + return false; // Never late if not inside this status range + } - $now = dol_now(); + $now = dol_now(); - return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); - } + return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); + } - /** - * Show the customer delayed info - * - * @return string Show delayed information - */ - public function showDelay() - { - global $conf, $langs; + /** + * Show the customer delayed info + * + * @return string Show delayed information + */ + public function showDelay() + { + global $conf, $langs; - if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); - else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day'); - $text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today"); + if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day'); + $text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today"); - return $text; - } + return $text; + } } @@ -3808,10 +3808,10 @@ class OrderLine extends CommonOrderLine * @var string ID to identify managed object */ public $element='commandedet'; - + public $table_element='commandedet'; - var $oldline; + var $oldline; /** * Id of parent order @@ -3827,17 +3827,17 @@ class OrderLine extends CommonOrderLine */ public $commande_id; - // From llx_commandedet - var $fk_parent_line; - var $fk_facture; - - /** - * @var string proper name for given parameter - */ - public $label; - - var $fk_remise_except; - var $rang = 0; + // From llx_commandedet + var $fk_parent_line; + var $fk_facture; + + /** + * @var string proper name for given parameter + */ + public $label; + + var $fk_remise_except; + var $rang = 0; var $fk_fournprice; /** @@ -3845,8 +3845,8 @@ class OrderLine extends CommonOrderLine * @var float */ var $pa_ht; - var $marge_tx; - var $marque_tx; + var $marge_tx; + var $marque_tx; /** * @deprecated @@ -3854,89 +3854,89 @@ class OrderLine extends CommonOrderLine */ var $remise; - // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - // Start and end date of the line - var $date_start; - var $date_end; + // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + // Start and end date of the line + var $date_start; + var $date_end; - var $skip_update_total; // Skip update price total for special lines + var $skip_update_total; // Skip update price total for special lines - /** - * Constructor - * - * @param DoliDB $db handler d'acces base de donnee - */ - function __construct($db) - { - $this->db= $db; - } + /** + * Constructor + * + * @param DoliDB $db handler d'acces base de donnee + */ + function __construct($db) + { + $this->db= $db; + } - /** - * Load line order - * - * @param int $rowid Id line order - * @return int <0 if KO, >0 if OK - */ - function fetch($rowid) - { - $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,'; - $sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,'; - $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,'; - $sql.= ' cd.fk_unit,'; + /** + * Load line order + * + * @param int $rowid Id line order + * @return int <0 if KO, >0 if OK + */ + function fetch($rowid) + { + $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,'; + $sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,'; + $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,'; + $sql.= ' cd.fk_unit,'; $sql.= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,'; - $sql.= ' cd.date_start, cd.date_end'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; - $sql.= ' WHERE cd.rowid = '.$rowid; - $result = $this->db->query($sql); - if ($result) - { - $objp = $this->db->fetch_object($result); - $this->rowid = $objp->rowid; - $this->id = $objp->rowid; - $this->fk_commande = $objp->fk_commande; - $this->fk_parent_line = $objp->fk_parent_line; - $this->label = $objp->custom_label; - $this->desc = $objp->description; - $this->qty = $objp->qty; - $this->price = $objp->price; - $this->subprice = $objp->subprice; - $this->vat_src_code = $objp->vat_src_code; - $this->tva_tx = $objp->tva_tx; - $this->localtax1_tx = $objp->localtax1_tx; - $this->localtax2_tx = $objp->localtax2_tx; - $this->remise = $objp->remise; - $this->remise_percent = $objp->remise_percent; - $this->fk_remise_except = $objp->fk_remise_except; - $this->fk_product = $objp->fk_product; - $this->product_type = $objp->product_type; - $this->info_bits = $objp->info_bits; + $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,'; + $sql.= ' cd.date_start, cd.date_end'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; + $sql.= ' WHERE cd.rowid = '.$rowid; + $result = $this->db->query($sql); + if ($result) + { + $objp = $this->db->fetch_object($result); + $this->rowid = $objp->rowid; + $this->id = $objp->rowid; + $this->fk_commande = $objp->fk_commande; + $this->fk_parent_line = $objp->fk_parent_line; + $this->label = $objp->custom_label; + $this->desc = $objp->description; + $this->qty = $objp->qty; + $this->price = $objp->price; + $this->subprice = $objp->subprice; + $this->vat_src_code = $objp->vat_src_code; + $this->tva_tx = $objp->tva_tx; + $this->localtax1_tx = $objp->localtax1_tx; + $this->localtax2_tx = $objp->localtax2_tx; + $this->remise = $objp->remise; + $this->remise_percent = $objp->remise_percent; + $this->fk_remise_except = $objp->fk_remise_except; + $this->fk_product = $objp->fk_product; + $this->product_type = $objp->product_type; + $this->info_bits = $objp->info_bits; $this->special_code = $objp->special_code; - $this->total_ht = $objp->total_ht; - $this->total_tva = $objp->total_tva; - $this->total_localtax1 = $objp->total_localtax1; - $this->total_localtax2 = $objp->total_localtax2; - $this->total_ttc = $objp->total_ttc; + $this->total_ht = $objp->total_ht; + $this->total_tva = $objp->total_tva; + $this->total_localtax1 = $objp->total_localtax1; + $this->total_localtax2 = $objp->total_localtax2; + $this->total_ttc = $objp->total_ttc; $this->fk_fournprice = $objp->fk_fournprice; $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); $this->pa_ht = $marginInfos[0]; $this->marge_tx = $marginInfos[1]; $this->marque_tx = $marginInfos[2]; - $this->special_code = $objp->special_code; - $this->rang = $objp->rang; + $this->special_code = $objp->special_code; + $this->rang = $objp->rang; - $this->ref = $objp->product_ref; // deprecated - $this->product_ref = $objp->product_ref; - $this->libelle = $objp->product_libelle; // deprecated - $this->product_label = $objp->product_libelle; - $this->product_desc = $objp->product_desc; - $this->product_tobatch = $objp->product_tobatch; - $this->fk_unit = $objp->fk_unit; + $this->ref = $objp->product_ref; // deprecated + $this->product_ref = $objp->product_ref; + $this->libelle = $objp->product_libelle; // deprecated + $this->product_label = $objp->product_libelle; + $this->product_desc = $objp->product_desc; + $this->product_tobatch = $objp->product_tobatch; + $this->fk_unit = $objp->fk_unit; - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); $this->fk_multicurrency = $objp->fk_multicurrency; $this->multicurrency_code = $objp->multicurrency_code; @@ -3945,38 +3945,38 @@ class OrderLine extends CommonOrderLine $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - $this->db->free($result); + $this->db->free($result); - return 1; - } - else - { - $this->error = $this->db->lasterror(); - return -1; - } - } + return 1; + } + else + { + $this->error = $this->db->lasterror(); + return -1; + } + } - /** - * Delete line in database - * - * @param User $user User that modify + /** + * Delete line in database + * + * @param User $user User that modify * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 si ko, >0 si ok - */ - function delete($user=null, $notrigger=0) - { - global $conf, $user, $langs; + * @return int <0 si ko, >0 si ok + */ + function delete($user=null, $notrigger=0) + { + global $conf, $user, $langs; $error=0; - $this->db->begin(); + $this->db->begin(); - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; - dol_syslog("OrderLine::delete", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { + dol_syslog("OrderLine::delete", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { // Remove extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { @@ -3991,63 +3991,63 @@ class OrderLine extends CommonOrderLine if (! $error && ! $notrigger) { - // Call trigger - $result=$this->call_trigger('LINEORDER_DELETE',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers } - if (!$error) { - $this->db->commit(); - return 1; - } + if (!$error) { + $this->db->commit(); + return 1; + } - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - } + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } - /** - * Insert line into database - * - * @param User $user User that modify - * @param int $notrigger 1 = disable triggers - * @return int <0 if KO, >0 if OK - */ - function insert($user=null, $notrigger=0) - { - global $langs, $conf; + /** + * Insert line into database + * + * @param User $user User that modify + * @param int $notrigger 1 = disable triggers + * @return int <0 if KO, >0 if OK + */ + function insert($user=null, $notrigger=0) + { + global $langs, $conf; $error=0; - $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - dol_syslog(get_class($this)."::insert rang=".$this->rang); + dol_syslog(get_class($this)."::insert rang=".$this->rang); - // Clean parameters - if (empty($this->tva_tx)) $this->tva_tx=0; - if (empty($this->localtax1_tx)) $this->localtax1_tx=0; - if (empty($this->localtax2_tx)) $this->localtax2_tx=0; + // Clean parameters + if (empty($this->tva_tx)) $this->tva_tx=0; + if (empty($this->localtax1_tx)) $this->localtax1_tx=0; + if (empty($this->localtax2_tx)) $this->localtax2_tx=0; if (empty($this->localtax1_type)) $this->localtax1_type=0; if (empty($this->localtax2_type)) $this->localtax2_type=0; - if (empty($this->total_localtax1)) $this->total_localtax1=0; - if (empty($this->total_localtax2)) $this->total_localtax2=0; - if (empty($this->rang)) $this->rang=0; - if (empty($this->remise)) $this->remise=0; - if (empty($this->remise_percent)) $this->remise_percent=0; - if (empty($this->info_bits)) $this->info_bits=0; - if (empty($this->special_code)) $this->special_code=0; - if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise)) $this->remise=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -4063,65 +4063,65 @@ class OrderLine extends CommonOrderLine } } - // Check parameters - if ($this->product_type < 0) return -1; + // Check parameters + if ($this->product_type < 0) return -1; - $this->db->begin(); + $this->db->begin(); - // Insertion dans base de la ligne - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; - $sql.= ' (fk_commande, fk_parent_line, label, description, qty, '; - $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; - $sql.= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; - $sql.= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; - $sql.= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; - $sql.= ' fk_unit'; + // Insertion dans base de la ligne + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; + $sql.= ' (fk_commande, fk_parent_line, label, description, qty, '; + $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql.= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; + $sql.= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; + $sql.= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; + $sql.= ' fk_unit'; $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ')'; - $sql.= " VALUES (".$this->fk_commande.","; - $sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").","; - $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; - $sql.= " '".$this->db->escape($this->desc)."',"; - $sql.= " '".price2num($this->qty)."',"; - $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").","; - $sql.= " '".price2num($this->tva_tx)."',"; - $sql.= " '".price2num($this->localtax1_tx)."',"; - $sql.= " '".price2num($this->localtax2_tx)."',"; + $sql.= " VALUES (".$this->fk_commande.","; + $sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").","; + $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; + $sql.= " '".$this->db->escape($this->desc)."',"; + $sql.= " '".price2num($this->qty)."',"; + $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").","; + $sql.= " '".price2num($this->tva_tx)."',"; + $sql.= " '".price2num($this->localtax1_tx)."',"; + $sql.= " '".price2num($this->localtax2_tx)."',"; $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; - $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; - $sql.= " '".$this->db->escape($this->product_type)."',"; - $sql.= " '".price2num($this->remise_percent)."',"; - $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; - $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; - $sql.= " '".price2num($this->remise)."',"; - $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; - $sql.= ' '.$this->special_code.','; - $sql.= ' '.$this->rang.','; + $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; + $sql.= " '".$this->db->escape($this->product_type)."',"; + $sql.= " '".price2num($this->remise_percent)."',"; + $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; + $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; + $sql.= " '".price2num($this->remise)."',"; + $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; + $sql.= ' '.$this->special_code.','; + $sql.= ' '.$this->rang.','; $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").','; $sql.= ' '.price2num($this->pa_ht).','; - $sql.= " '".$this->db->escape($this->info_bits)."',"; - $sql.= " ".price2num($this->total_ht).","; - $sql.= " ".price2num($this->total_tva).","; - $sql.= " ".price2num($this->total_localtax1).","; - $sql.= " ".price2num($this->total_localtax2).","; - $sql.= " ".price2num($this->total_ttc).","; - $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; - $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; - $sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= " '".$this->db->escape($this->info_bits)."',"; + $sql.= " ".price2num($this->total_ht).","; + $sql.= " ".price2num($this->total_tva).","; + $sql.= " ".price2num($this->total_localtax1).","; + $sql.= " ".price2num($this->total_localtax2).","; + $sql.= " ".price2num($this->total_ttc).","; + $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; + $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; + $sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", ".(! empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL'); $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".$this->multicurrency_subprice; $sql.= ", ".$this->multicurrency_total_ht; $sql.= ", ".$this->multicurrency_total_tva; $sql.= ", ".$this->multicurrency_total_ttc; - $sql.= ')'; + $sql.= ')'; - dol_syslog(get_class($this)."::insert", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { @@ -4133,42 +4133,42 @@ class OrderLine extends CommonOrderLine } } - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('LINEORDER_INSERT',$user); - if ($result < 0) $error++; - // End call triggers - } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_INSERT',$user); + if ($result < 0) $error++; + // End call triggers + } - if (!$error) { - $this->db->commit(); - return 1; - } + if (!$error) { + $this->db->commit(); + return 1; + } - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -2; - } - } + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } - /** - * Update the line object into db - * - * @param User $user User that modify + /** + * Update the line object into db + * + * @param User $user User that modify * @param int $notrigger 1 = disable triggers - * @return int <0 si ko, >0 si ok - */ + * @return int <0 si ko, >0 si ok + */ function update(User $user, $notrigger=0) { global $conf,$langs; @@ -4191,7 +4191,7 @@ class OrderLine extends CommonOrderLine if (empty($this->remise)) $this->remise=0; if (empty($this->remise_percent)) $this->remise_percent=0; if (empty($this->info_bits)) $this->info_bits=0; - if (empty($this->special_code)) $this->special_code=0; + if (empty($this->special_code)) $this->special_code=0; if (empty($this->product_type)) $this->product_type=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->pa_ht)) $this->pa_ht=0; @@ -4237,7 +4237,7 @@ class OrderLine extends CommonOrderLine $sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?$this->fk_fournprice:"null"); $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , info_bits=".$this->info_bits; - $sql.= " , special_code=".$this->special_code; + $sql.= " , special_code=".$this->special_code; $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " , product_type=".$this->product_type; @@ -4247,9 +4247,9 @@ class OrderLine extends CommonOrderLine // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; - $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; - $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; - $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; + $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; + $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; $sql.= " WHERE rowid = ".$this->rowid; @@ -4269,10 +4269,10 @@ class OrderLine extends CommonOrderLine if (! $error && ! $notrigger) { - // Call trigger - $result=$this->call_trigger('LINEORDER_UPDATE',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('LINEORDER_UPDATE',$user); + if ($result < 0) $error++; + // End call triggers } if (!$error) { @@ -4296,42 +4296,42 @@ class OrderLine extends CommonOrderLine } } - /** - * Update totals of order into database - * - * @return int <0 if ko, >0 if ok - */ + /** + * Update totals of order into database + * + * @return int <0 if ko, >0 if ok + */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function update_total() - { - $this->db->begin(); + function update_total() + { + $this->db->begin(); - // Clean parameters - if (empty($this->total_localtax1)) $this->total_localtax1=0; - if (empty($this->total_localtax2)) $this->total_localtax2=0; + // Clean parameters + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; - // Mise a jour ligne en base - $sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET"; - $sql.= " total_ht='".price2num($this->total_ht)."'"; - $sql.= ",total_tva='".price2num($this->total_tva)."'"; - $sql.= ",total_localtax1='".price2num($this->total_localtax1)."'"; - $sql.= ",total_localtax2='".price2num($this->total_localtax2)."'"; - $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; - $sql.= " WHERE rowid = ".$this->rowid; + // Mise a jour ligne en base + $sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET"; + $sql.= " total_ht='".price2num($this->total_ht)."'"; + $sql.= ",total_tva='".price2num($this->total_tva)."'"; + $sql.= ",total_localtax1='".price2num($this->total_localtax1)."'"; + $sql.= ",total_localtax2='".price2num($this->total_localtax2)."'"; + $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; + $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("OrderLine::update_total", LOG_DEBUG); + dol_syslog("OrderLine::update_total", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->db->commit(); - return 1; - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -2; - } - } + $resql=$this->db->query($sql); + if ($resql) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } } From 1bdc33f28665e0dfc6b81ae27096ac4e13820459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Aug 2018 10:02:31 +0200 Subject: [PATCH 5/9] tabs added --- htdocs/commande/class/commande.class.php | 70 ++++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4d6f50538c3..64b8ae39856 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -292,7 +292,7 @@ class Commande extends CommonOrder } if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) { $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); @@ -436,7 +436,7 @@ class Commande extends CommonOrder * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { global $conf,$langs; @@ -450,7 +450,7 @@ class Commande extends CommonOrder } if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) { $this->error='Permission denied'; return -1; @@ -494,7 +494,7 @@ class Commande extends CommonOrder } if (!$error) { - $this->statut=self::STATUS_DRAFT; + $this->statut=self::STATUS_DRAFT; $this->db->commit(); return 1; }else { @@ -518,7 +518,7 @@ class Commande extends CommonOrder * @param User $user Object user that change status * @return int <0 if KO, 0 if nothing is done, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_reopen($user) { $error=0; @@ -585,7 +585,7 @@ class Commande extends CommonOrder $error=0; if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) { $this->db->begin(); @@ -931,7 +931,7 @@ class Commande extends CommonOrder $this->error=$this->db->lasterror(); $error++; } - } + } } } @@ -975,8 +975,8 @@ class Commande extends CommonOrder if (! $error) { - $result=$this->insertExtraFields(); - if ($result < 0) $error++; + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } if (! $error && ! $notrigger) @@ -1195,7 +1195,7 @@ class Commande extends CommonOrder $this->linked_objects[$this->origin] = $this->origin_id; if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) { - $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); + $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); } $ret = $this->create($user); @@ -1336,7 +1336,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - // Clean vat code + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { @@ -1490,7 +1490,7 @@ class Commande extends CommonOrder * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') { global $conf, $mysoc; @@ -1720,7 +1720,7 @@ class Commande extends CommonOrder * @param int $idremise Id de la remise fixe * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { global $langs; @@ -1798,7 +1798,7 @@ class Commande extends CommonOrder * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { $this->lines=array(); @@ -1856,10 +1856,10 @@ class Commande extends CommonOrder $line->price = $objp->price; $line->fk_product = $objp->fk_product; $line->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); - $line->pa_ht = $marginInfos[0]; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; $line->marge_tx = $marginInfos[1]; - $line->marque_tx = $marginInfos[2]; + $line->marque_tx = $marginInfos[2]; $line->rang = $objp->rang; $line->info_bits = $objp->info_bits; $line->special_code = $objp->special_code; @@ -1958,10 +1958,10 @@ class Commande extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) $nb = $obj->nb; + $obj = $this->db->fetch_object($resql); + if ($obj) $nb = $obj->nb; - $this->db->free($resql); + $this->db->free($resql); return $nb; } else @@ -2025,7 +2025,7 @@ class Commande extends CommonOrder * * TODO deprecate, move to Shipping class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_expedition() { $sql = 'SELECT count(*)'; @@ -2052,7 +2052,7 @@ class Commande extends CommonOrder * * TODO FONCTION NON FINIE A FINIR */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function stock_array($filtre_statut=self::STATUS_CANCELED) { $this->stocks = array(); @@ -2169,7 +2169,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2236,7 +2236,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { $remise=trim($remise)?trim($remise):0; @@ -2303,7 +2303,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { if ($user->rights->commande->creer) @@ -2368,7 +2368,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { if ($user->rights->commande->creer) @@ -2438,7 +2438,7 @@ class Commande extends CommonOrder * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') { global $user; @@ -2576,7 +2576,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { global $user; @@ -2648,7 +2648,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { if ($user->rights->commande->creer) @@ -2869,7 +2869,7 @@ class Commande extends CommonOrder $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu = price2num($pu); - $pa_ht=price2num($pa_ht); + $pa_ht=price2num($pa_ht); $pu_ht_devise=price2num($pu_ht_devise); $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); @@ -2882,7 +2882,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - // Clean vat code + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { @@ -3259,7 +3259,7 @@ class Commande extends CommonOrder * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { global $conf, $langs; @@ -3348,7 +3348,7 @@ class Commande extends CommonOrder * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$billed,$mode,$donotshowbilled=0) { global $langs, $conf; @@ -3665,7 +3665,7 @@ class Commande extends CommonOrder * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { global $user; @@ -4301,7 +4301,7 @@ class OrderLine extends CommonOrderLine * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { $this->db->begin(); From 57207794c2b7fd18ef295be69c25c85a3be9d348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Aug 2018 10:30:52 +0200 Subject: [PATCH 6/9] tabs added --- htdocs/commande/class/commande.class.php | 330 +++++++++++------------ 1 file changed, 165 insertions(+), 165 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 64b8ae39856..18ca50cfa66 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -872,7 +872,7 @@ class Commande extends CommonOrder $line->fk_unit, $this->element, $line->id - ); + ); if ($result < 0) { if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) @@ -931,7 +931,7 @@ class Commande extends CommonOrder $this->error=$this->db->lasterror(); $error++; } - } + } } } @@ -975,8 +975,8 @@ class Commande extends CommonOrder if (! $error) { - $result=$this->insertExtraFields(); - if ($result < 0) $error++; + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } if (! $error && ! $notrigger) @@ -1035,68 +1035,68 @@ class Commande extends CommonOrder foreach($this->lines as $line) $line->fetch_optionals(); - // Load source object - $objFrom = clone $this; + // Load source object + $objFrom = clone $this; - // Change socid if needed - if (! empty($socid) && $socid != $this->socid) - { - $objsoc = new Societe($this->db); - - if ($objsoc->fetch($socid)>0) + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = 0; - $this->fk_delivery_address = 0; + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) + { + $this->socid = $objsoc->id; + $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = 0; + $this->fk_delivery_address = 0; + } + + // TODO Change product price if multi-prices } - // TODO Change product price if multi-prices - } + $this->id=0; + $this->ref = ''; + $this->statut=self::STATUS_DRAFT; - $this->id=0; - $this->ref = ''; - $this->statut=self::STATUS_DRAFT; + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date = dol_now(); + $this->date_commande = dol_now(); + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_client = ''; - // Clear fields - $this->user_author_id = $user->id; - $this->user_valid = ''; - $this->date = dol_now(); - $this->date_commande = dol_now(); - $this->date_creation = ''; - $this->date_validation = ''; - $this->ref_client = ''; + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; - // Create clone - $result=$this->create($user); - if ($result < 0) $error++; - - if (! $error) - { - // Hook of thirdparty module - if (is_object($hookmanager)) + if (! $error) { - $parameters=array('objFrom'=>$objFrom); - $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } } - } - unset($this->context['createfromclone']); + unset($this->context['createfromclone']); - // End - if (! $error) - { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -1; - } + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } } @@ -1158,7 +1158,7 @@ class Commande extends CommonOrder foreach($object->lines[$i]->array_options as $options_key => $value) $line->array_options[$options_key] = $value; - $this->lines[$i] = $line; + $this->lines[$i] = $line; } $this->socid = $object->socid; @@ -1195,7 +1195,7 @@ class Commande extends CommonOrder $this->linked_objects[$this->origin] = $this->origin_id; if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) { - $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); + $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); } $ret = $this->create($user); @@ -1336,7 +1336,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - // Clean vat code + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { @@ -1347,12 +1347,12 @@ class Commande extends CommonOrder $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); /*var_dump($txlocaltax1); - var_dump($txlocaltax2); - var_dump($localtaxes_type); - var_dump($tabprice); - var_dump($tabprice[9]); - var_dump($tabprice[10]); - exit;*/ + var_dump($txlocaltax2); + var_dump($localtaxes_type); + var_dump($tabprice); + var_dump($tabprice[9]); + var_dump($tabprice[10]); + exit;*/ $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1512,55 +1512,55 @@ class Commande extends CommonOrder // multiprix if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) - $price = $prod->multiprices[$this->thirdparty->price_level]; - else - $price = $prod->price; + $price = $prod->multiprices[$this->thirdparty->price_level]; + else + $price = $prod->price; - $line=new OrderLine($this->db); + $line=new OrderLine($this->db); - $line->context = $this->context; + $line->context = $this->context; - $line->fk_product=$idproduct; - $line->desc=$prod->description; - $line->qty=$qty; - $line->subprice=$price; - $line->remise_percent=$remise_percent; - $line->vat_src_code=$vat_src_code; - $line->tva_tx=$tva_tx; - $line->localtax1_tx=$localtax1_tx; - $line->localtax2_tx=$localtax2_tx; - $line->ref=$prod->ref; - $line->libelle=$prod->label; - $line->product_desc=$prod->description; - $line->fk_unit=$prod->fk_unit; + $line->fk_product=$idproduct; + $line->desc=$prod->description; + $line->qty=$qty; + $line->subprice=$price; + $line->remise_percent=$remise_percent; + $line->vat_src_code=$vat_src_code; + $line->tva_tx=$tva_tx; + $line->localtax1_tx=$localtax1_tx; + $line->localtax2_tx=$localtax2_tx; + $line->ref=$prod->ref; + $line->libelle=$prod->label; + $line->product_desc=$prod->description; + $line->fk_unit=$prod->fk_unit; - // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - // Save the start and end date of the line in the object - if ($date_start) { $line->date_start = $date_start; } - if ($date_end) { $line->date_end = $date_end; } + // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + // Save the start and end date of the line in the object + if ($date_start) { $line->date_start = $date_start; } + if ($date_end) { $line->date_end = $date_end; } - $this->lines[] = $line; + $this->lines[] = $line; - /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE - if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) - { - $prod = new Product($this->db); - $prod->fetch($idproduct); - $prod -> get_sousproduits_arbo(); - $prods_arbo = $prod->get_arbo_each_prod(); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - // print "id : ".$value[1].' :qty: '.$value[0].'
'; - if(! in_array($value[1],$this->products)) - $this->add_product($value[1], $value[0]); + /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE + if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) + { + $prod = new Product($this->db); + $prod->fetch($idproduct); + $prod -> get_sousproduits_arbo(); + $prods_arbo = $prod->get_arbo_each_prod(); + if(count($prods_arbo) > 0) + { + foreach($prods_arbo as $key => $value) + { + // print "id : ".$value[1].' :qty: '.$value[0].'
'; + if(! in_array($value[1],$this->products)) + $this->add_product($value[1], $value[0]); - } - } + } + } - } - **/ + } + **/ } } @@ -1856,10 +1856,10 @@ class Commande extends CommonOrder $line->price = $objp->price; $line->fk_product = $objp->fk_product; $line->fk_fournprice = $objp->fk_fournprice; - $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); - $line->pa_ht = $marginInfos[0]; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; $line->marge_tx = $marginInfos[1]; - $line->marque_tx = $marginInfos[2]; + $line->marque_tx = $marginInfos[2]; $line->rang = $objp->rang; $line->info_bits = $objp->info_bits; $line->special_code = $objp->special_code; @@ -1958,10 +1958,10 @@ class Commande extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) $nb = $obj->nb; + $obj = $this->db->fetch_object($resql); + if ($obj) $nb = $obj->nb; - $this->db->free($resql); + $this->db->free($resql); return $nb; } else @@ -2366,7 +2366,7 @@ class Commande extends CommonOrder * @param User $user Objet utilisateur qui modifie * @param int $date_livraison Date de livraison * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 si ko, >0 si ok + * @return int <0 si ko, >0 si ok */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) @@ -2869,7 +2869,7 @@ class Commande extends CommonOrder $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu = price2num($pu); - $pa_ht=price2num($pa_ht); + $pa_ht=price2num($pa_ht); $pu_ht_devise=price2num($pu_ht_devise); $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); @@ -2882,7 +2882,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - // Clean vat code + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { @@ -3293,7 +3293,7 @@ class Commande extends CommonOrder while ($obj=$this->db->fetch_object($resql)) { $response->nbtodo++; - $response->total+= $obj->total_ht; + $response->total+= $obj->total_ht; $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); @@ -3456,60 +3456,60 @@ class Commande extends CommonOrder if (!$user->rights->commande->lire) $option = 'nolink'; - if ($option !== 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; - } - - if ($short) return $url; - - $label = ''; - - if ($user->rights->commande->lire) { - $label = ''.$langs->trans("ShowOrder").''; - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - } - - $linkclose=''; - if (empty($notooltip) && $user->rights->commande->lire) - { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if ($option !== 'nolink') { - $label=$langs->trans("ShowOrder"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; - } - $linkstart = ''; - $linkend=''; + if ($short) return $url; - if ($option === 'nolink') { - $linkstart = ''; - $linkend = ''; - } + $label = ''; - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; + if ($user->rights->commande->lire) { + $label = ''.$langs->trans("ShowOrder").''; + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } - return $result; + $linkclose=''; + if (empty($notooltip) && $user->rights->commande->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowOrder"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart = ''; + $linkend=''; + + if ($option === 'nolink') { + $linkstart = ''; + $linkend = ''; + } + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + + return $result; } @@ -3720,7 +3720,7 @@ class Commande extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) @@ -3757,7 +3757,7 @@ class Commande extends CommonOrder public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { $tables = array( - 'commande' + 'commande' ); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); From bc71aef7b4cfad53686417adfefd866aee5da326 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 14:24:02 +0200 Subject: [PATCH 7/9] Code comment --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e6e4a129232..8003b8d95cc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6121,7 +6121,7 @@ abstract class CommonObject * * @param Extrafields $extrafields Extrafield Object * @param string $mode Show output (view) or input (edit) for extrafield - * @param array $params Optional parameters + * @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan) * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) * @param string $onetrtd All fields in same tr td From 948c95c0f69fb2897a327d36879041e5e37068f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 15:34:25 +0200 Subject: [PATCH 8/9] Reduce travis test to min and max php only --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 485151dde01..86da681ce9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,6 @@ php: - '7.0' - '7.1' - '7.2' -#- hhvm only with dist: trusty - nightly env: @@ -63,6 +62,14 @@ matrix: - php: nightly # We exclude some combinations not usefull to save Travis CPU exclude: + - php: '5.5' + env: DB=mysql + - php: '5.6' + env: DB=mysql + - php: '7.0' + env: DB=mysql + - php: '7.1' + env: DB=mysql - php: '5.5' env: DB=postgresql - php: '5.6' @@ -71,8 +78,6 @@ matrix: env: DB=postgresql - php: '7.1' env: DB=postgresql - - php: hhvm - env: DB=postgresql - php: nightly env: DB=postgresql From c3438b79c8e2ab4dc49b9cc96873c9ff5b51f92c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Sep 2018 15:39:11 +0200 Subject: [PATCH 9/9] Fix merge --- htdocs/loan/class/loanschedule.class.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index be27fff9894..80341e8df0c 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -372,20 +372,16 @@ class LoanSchedule extends CommonObject } } -<<<<<<< HEAD - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function calc_mens($capital,$rate,$nbterm) -======= - /** - * Calculate mensuality - * - * @param double $capital Capital - * @param double $rate rate - * @param int $nbterm nb term - * @return double mensuality - */ - function calc_mens($capital, $rate, $nbterm) ->>>>>>> upstream/develop + /** + * Calculate mensuality + * + * @param double $capital Capital + * @param double $rate rate + * @param int $nbterm nb term + * @return double mensuality + */ + // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + function calc_mens($capital, $rate, $nbterm) { $result='';