diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4687a841807..51b031b5c7c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -43,12 +43,12 @@ class FactureRec extends CommonInvoice * @var string ID to identify managed object */ public $element='facturerec'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture_rec'; - + public $table_element_line='facturedet_rec'; public $fk_element='fk_facture'; public $picto='bill'; @@ -440,14 +440,15 @@ class FactureRec extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recupere les lignes de factures predefinies dans this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); // Retreive all extrafield for line @@ -1182,6 +1183,7 @@ class FactureRec extends CommonInvoice return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1192,9 +1194,9 @@ 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) { + // phpcs:enable global $langs; $langs->load('bills'); @@ -1213,7 +1215,7 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if ($recur) @@ -1227,7 +1229,7 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($recur) { @@ -1240,7 +1242,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 3) + elseif ($mode == 3) { if ($recur) { @@ -1254,7 +1256,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if ($recur) @@ -1268,7 +1270,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 5 || $mode == 6) + elseif ($mode == 5 || $mode == 6) { $prefix=''; if ($mode == 5) $prefix='Short'; @@ -1653,7 +1655,7 @@ class FactureLigneRec extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedetrec'; - + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index da0d66b2784..cb38b954736 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -57,12 +57,12 @@ class Facture extends CommonInvoice * @var string ID to identify managed object */ public $element='facture'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture'; - + public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; public $picto='bill'; @@ -1406,14 +1406,15 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all detailed lines into this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; @@ -1666,15 +1667,16 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * * @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) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1767,6 +1769,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -1774,9 +1777,9 @@ 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) { + // phpcs:enable global $user; $error=0; @@ -2001,6 +2004,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 @@ -2010,9 +2014,9 @@ 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='') { + // phpcs:enable $error=0; if ($this->paye != 1) @@ -2060,6 +2064,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Fonction utilisee quand un paiement prelevement est refuse, @@ -2068,9 +2073,9 @@ 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) { + // phpcs:enable $error=0; $this->db->begin(); @@ -2108,6 +2113,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because @@ -2118,9 +2124,9 @@ 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='') { + // phpcs:enable dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); @@ -2472,6 +2478,7 @@ class Facture extends CommonInvoice return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2479,9 +2486,9 @@ 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) { + // phpcs:enable global $conf,$langs; $error=0; @@ -3038,6 +3045,7 @@ class Facture extends CommonInvoice else return $situation_percent < $obj->situation_percent; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update invoice line with percentage * @@ -3045,9 +3053,9 @@ class Facture extends CommonInvoice * @param int $percent Percentage * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_percent($line, $percent) { + // phpcs:enable global $mysoc,$user; include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; @@ -3135,6 +3143,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set percent discount * @@ -3143,9 +3152,9 @@ 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) { + // phpcs:enable // Clean parameters if (empty($remise)) $remise=0; @@ -3200,6 +3209,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set absolute discount * @@ -3208,9 +3218,9 @@ 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) { + // phpcs:enable if (empty($remise)) $remise=0; if ($user->rights->facture->creer) @@ -3401,6 +3411,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices (eventually filtered on a user) into an array * @@ -3414,9 +3425,9 @@ 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') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -3476,6 +3487,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be replaced by another invoice. * Invoices matching the following rules are returned: @@ -3484,9 +3496,9 @@ 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) { + // phpcs:enable global $conf; $return = array(); @@ -3525,6 +3537,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be corrected by a credit note. * Invoices matching the following rules are returned: @@ -3533,9 +3546,9 @@ 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) { + // phpcs:enable global $conf; $return = array(); @@ -3599,6 +3612,7 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a withdrawal request for a standing order. * Use the remain to pay excluding all existing open direct debit requests. @@ -3607,9 +3621,9 @@ 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) { + // phpcs:enable $error=0; @@ -3710,6 +3724,7 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Supprime une demande de prelevement * @@ -3717,9 +3732,9 @@ 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) { + // phpcs:enable $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql .= ' WHERE rowid = '.$did; $sql .= ' AND traite = 0'; @@ -3736,15 +3751,16 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * 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) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3982,14 +3998,15 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * 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() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -4096,25 +4113,27 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the first of a cycle * * @return boolean */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_first() { + // phpcs:enable return ($this->situation_counter == 1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array containing the previous situations as Facture objects * * @return mixed -1 if error, array of previous situations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_sits() { + // phpcs:enable global $conf; $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; @@ -4187,15 +4206,16 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the last in its cycle * * @return bool Last of the cycle status * */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_last_in_cycle() { + // phpcs:enable global $conf; if (!empty($this->situation_cycle_ref)) { @@ -4262,7 +4282,7 @@ class FactureLigne extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedet'; - + /** * @var string Name of table without prefix where object is stored */ @@ -4825,15 +4845,16 @@ class FactureLigne extends CommonInvoiceLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base des champs total_xxx de ligne de facture * TODO What is goal of this method ? * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); dol_syslog(get_class($this)."::update_total", LOG_DEBUG); @@ -4866,6 +4887,7 @@ class FactureLigne extends CommonInvoiceLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns situation_percent of the previous line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. @@ -4873,9 +4895,9 @@ class FactureLigne extends CommonInvoiceLine * @param int $invoiceid Invoice id * @return int >= 0 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_progress($invoiceid) { + // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { return 0; } else { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a5f7c3134d7..b1197260240 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -37,12 +37,12 @@ class Tva extends CommonObject * @var string ID to identify managed object */ public $element='tva'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='tva'; - + public $picto='payment'; var $tms; @@ -51,12 +51,12 @@ class Tva extends CommonObject var $amount; var $type_payment; var $num_payment; - + /** * @var string proper name for given parameter */ public $label; - + var $fk_bank; var $fk_user_creat; var $fk_user_modif; @@ -363,15 +363,16 @@ class Tva extends CommonObject return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_collectee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; @@ -403,15 +404,16 @@ class Tva extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_payee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.total_tva) as total_tva"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -444,15 +446,16 @@ class Tva extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_reglee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."tva as f"; @@ -636,15 +639,16 @@ class Tva extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment tva and line generate into llx_bank * * @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) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -800,6 +804,7 @@ class Tva extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -807,9 +812,9 @@ 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 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage return ''; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1949f696a86..3e18b7944f2 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -67,6 +67,7 @@ class ActionsCardCompany extends ActionsCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -75,9 +76,9 @@ 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='') { + // phpcs:enable global $conf, $langs, $user, $mysoc; global $form, $formadmin, $formcompany;