diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 2371f6ff59a..0b0b394ace7 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -64,7 +65,7 @@ if ($type == 'bank-transfer') { // Load object if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); - $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); + $isdraft = (($object->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); if ($ret > 0) { $object->fetch_thirdparty(); } @@ -146,7 +147,7 @@ if (empty($reshook)) { } else { // We refresh object data $ret = $object->fetch($id, $ref); - $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); + $isdraft = (($object->status == Facture::STATUS_DRAFT) ? 1 : 0); if ($ret > 0) { $object->fetch_thirdparty(); } @@ -161,7 +162,7 @@ if (empty($reshook)) { } else { // We refresh object data $ret = $object->fetch($id, $ref); - $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); + $isdraft = (($object->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); if ($ret > 0) { $object->fetch_thirdparty(); } @@ -280,7 +281,7 @@ if ($object->id > 0) { //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); - if ($object->paye) { + if ($object->paid) { $resteapayer = 0; } $resteapayeraffiche = $resteapayer; @@ -755,7 +756,7 @@ if ($object->id > 0) { } // Add a transfer request - if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0) { + if ($object->status > $object::STATUS_DRAFT && $object->paid == 0 && $num == 0) { if ($resteapayer > 0) { if ($user_perms) { $remaintopaylesspendingdebit = $resteapayer - $pending; @@ -794,7 +795,7 @@ if ($object->id > 0) { } } else { if ($num == 0) { - if ($object->statut > $object::STATUS_DRAFT) { + if ($object->status > $object::STATUS_DRAFT) { print ''.$buttonlabel.''; } else { print ''.$buttonlabel.''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 59fae4217d6..0d20375bcb5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -11,6 +11,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2024 Rafael San José + * Copyright (C) 2024 MDW * * 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 @@ -339,7 +340,9 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO $facstatic->total_tva = $obj->total_tva; $facstatic->total_ttc = $obj->total_ttc; $facstatic->statut = $obj->status; + $facstatic->status = $obj->status; $facstatic->paye = $obj->paye; + $facstatic->paid = $obj->paye; $facstatic->type = $obj->type; $facstatic->ref_supplier = $obj->ref_supplier; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 9b42490727d..1135ff97b42 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Florian Henry + * Copyright (C) 2024 MDW * * 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 @@ -159,6 +160,7 @@ if (isModEnabled('supplier_invoice')) { $invoicestatic->status = $obj->fk_statut; $invoicestatic->statut = $obj->fk_statut; // For backward compatibility $invoicestatic->paye = $obj->paye; + $invoicestatic->paid = $obj->paye; $invoicestatic->type = $obj->type; $invoicestatic->date = $db->jdate($obj->datef); $invoicestatic->date_echeance = $db->jdate($obj->date_lim_reglement); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 90028857f99..c5ab1faf862 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -294,8 +295,8 @@ if ($action == 'edit') { print '   '; //var_dump($birthdatearray); - $ageyear = convertSecondToTime($now - $object->birthday, 'year') - 1970; - $agemonth = convertSecondToTime($now - $object->birthday, 'month') - 1; + $ageyear = (int) convertSecondToTime($now - $object->birthday, 'year') - 1970; + $agemonth = (int) convertSecondToTime($now - $object->birthday, 'month') - 1; if ($ageyear >= 2) { print '('.$ageyear.' '.$langs->trans("DurationYears").')'; } elseif ($agemonth >= 2) { diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 777cea5a2ed..7806477433a 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -138,6 +138,7 @@ class box_factures_fourn_imp extends ModeleBoxes //$alreadypaid = $facturestatic->getSommePaiement(); $facturestatic->paye = $objp->paye; + $facturestatic->paid = $objp->paye; $facturestatic->alreadypaid = $objp->am; $thirdpartystatic->id = $objp->socid; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 1efc998a384..95ed5249031 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -710,7 +710,9 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $facturesupplierstatic->ref_supplier = $obj->ref_supplier; $facturesupplierstatic->type = $obj->type; $facturesupplierstatic->statut = $obj->status; + $facturesupplierstatic->statusi = $obj->status; $facturesupplierstatic->paye = $obj->paye; + $facturesupplierstatic->paid = $obj->paye; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -931,7 +933,9 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; $objectstatic->paye = $obj->paye; + $objectstatic->paid = $obj->paye; $objectstatic->statut = $obj->status; + $objectstatic->status = $obj->status; $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; @@ -1260,6 +1264,8 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $facstatic->total_tva = $obj->total_tva; $facstatic->total_ttc = $obj->total_ttc; $facstatic->statut = $obj->status; + $facstatic->status = $obj->status; + $facstatic->paid = $obj->paye; $facstatic->paye = $obj->paye; $societestatic->id = $obj->socid; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 858aef6b33b..526490336d9 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -770,7 +770,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); - if (!empty($object->paye)) { + if (!empty($object->paid)) { $resteapayer = 0; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 25ff3185583..d1d6aa84f14 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3411,7 +3411,7 @@ class CommandeFournisseur extends CommonOrder /** * Returns the rights used for this class - * @return stdClass + * @return int */ public function getRights() { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index cf5f79a3ed7..9c02861a112 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -380,7 +380,7 @@ class FactureFournisseurRec extends CommonInvoice $result_insert = $this->addline( $facfourn_src->lines[$i]->fk_product, $facfourn_src->lines[$i]->ref_supplier, - $facfourn_src->lines[$i]->label, + $facfourn_src->lines[$i]->product_label, $facfourn_src->lines[$i]->desc ? $facfourn_src->lines[$i]->desc : $facfourn_src->lines[$i]->description, $facfourn_src->lines[$i]->pu_ht, $facfourn_src->lines[$i]->pu_ttc, diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 9fa472cc406..0d1e7f03642 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -147,17 +147,18 @@ class FactureFournisseur extends CommonInvoice /** * Set to 1 if the invoice is completely paid, otherwise is 0 - * @var int + * @var int<0,1> * @deprecated Use $paid */ public $paye; /** * Set to 1 if the invoice is completely paid, otherwise is 0 - * @var int + * @var int<0,1> */ public $paid; /** + * @var int * @deprecated Use $user_creation_id */ public $author; @@ -195,22 +196,32 @@ class FactureFournisseur extends CommonInvoice // Warning: Do not set default value into property definition. it must stay null. // For example to avoid to have substitution done when object is generic and not yet defined. + /** @var ?string */ public $localtax1; + /** @var ?string */ public $localtax2; + /** @var float|int */ public $total_ht; + /** @var float|int */ public $total_tva; + /** @var float|int */ public $total_localtax1; + /** @var float|int */ public $total_localtax2; + /** @var float|int */ public $total_ttc; /** * @deprecated * @see $note_private, $note_public + * @var string */ public $note; - + /** @var string */ public $note_private; + /** @var string */ public $note_public; + /** @var int */ public $propalid; /** @@ -238,6 +249,7 @@ class FactureFournisseur extends CommonInvoice /** * @deprecated + * @var ?Fournisseur */ public $fournisseur; @@ -247,7 +259,9 @@ class FactureFournisseur extends CommonInvoice */ public $fk_facture_source; + /** @var int */ public $fac_rec; + /** @var int */ public $fk_fac_rec_source; public $fields = array( @@ -419,6 +433,10 @@ class FactureFournisseur extends CommonInvoice $nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency); $previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd'); $this->socid = $_facrec->socid; + } else { + $originaldatewhen = 0; + $nextdatewhen = 0; + $previousdaynextdatewhen = 0; } $this->entity = $_facrec->entity; // Invoice created in same entity than template @@ -476,7 +494,7 @@ class FactureFournisseur extends CommonInvoice $_facrec->date_when = $now; } $next_date = $_facrec->getNextDate(); // Calculate next date - $result = $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date', '', $user, ''); + $result = $_facrec->setValueFrom('date_last_gen', $now, '', 0, 'date', '', $user, ''); //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. $result = $_facrec->setNextDate($next_date, 1); } @@ -494,9 +512,7 @@ class FactureFournisseur extends CommonInvoice if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); - } - - // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) + } // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $this); $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m'); $substitutionarray['__INVOICE_MONTH__'] = dol_print_date($this->date, '%m'); @@ -506,11 +522,10 @@ class FactureFournisseur extends CommonInvoice $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B'); $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'); $substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y'); - $substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'); - // Only for template invoice - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour'); - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour'); - $substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour'); + $substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'); // Only for template invoice + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $originaldatewhen ? dol_print_date($originaldatewhen, 'dayhour') : ''; + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $nextdatewhen ? dol_print_date($nextdatewhen, 'dayhour') : ''; + $substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = $previousdaynextdatewhen ? dol_print_date($previousdaynextdatewhen, 'dayhour') : ''; $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $_facrec->nb_gen_done; $substitutionarray['__INVOICE_COUNTER_MAX__'] = $_facrec->nb_gen_max; @@ -680,7 +695,7 @@ class FactureFournisseur extends CommonInvoice $this->updateline( $idligne, $line->desc ? $line->desc : $line->description, - $line->pu_ht, + $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, @@ -709,7 +724,7 @@ class FactureFournisseur extends CommonInvoice /* * Insert lines of template invoices */ - if (! $error && $this->fac_rec > 0) { + if (! $error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { foreach ($_facrec->lines as $i => $val) { if ($_facrec->lines[$i]->fk_product) { $prod = new Product($this->db); @@ -1156,8 +1171,12 @@ class FactureFournisseur extends CommonInvoice if (isset($this->label)) { $this->label = trim($this->label); } - if (isset($this->paye)) { - $this->paye = (int) $this->paye; + if (isset($this->paid)) { + $this->paid = (int) (bool) $this->paye; + $this->paye = $this->paid; + } elseif (isset($this->paye)) { + $this->paid = (int) (bool) $this->paye; + $this->paye = $this->paid; } if (isset($this->close_code)) { $this->close_code = trim($this->close_code); @@ -1182,14 +1201,15 @@ class FactureFournisseur extends CommonInvoice if (isset($this->total_ttc)) { $this->total_ttc = (float) $this->total_ttc; } - if (isset($this->statut)) { - $this->statut = (int) $this->statut; - } if (isset($this->status)) { $this->status = (int) $this->status; + $this->statut = $this->status; + } elseif (isset($this->statut)) { + $this->status = (int) $this->statut; + $this->statut = $this->status; } - if (isset($this->author)) { - $this->author = trim($this->author); + if (isset($this->author)) { // TODO: user_creation_id? + $this->author = trim((string) $this->author); } if (isset($this->fk_user_valid)) { $this->fk_user_valid = trim($this->fk_user_valid); @@ -1208,7 +1228,8 @@ class FactureFournisseur extends CommonInvoice $this->cond_reglement_id = (int) $this->cond_reglement_id; } if (isset($this->note_private)) { - $this->note = trim($this->note_private); + $this->note_private = trim($this->note_private); + $this->note = $this->note_private; } if (isset($this->note_public)) { $this->note_public = trim($this->note_public); @@ -1239,7 +1260,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; - $sql .= " paye=".(isset($this->paye) ? ((int) $this->paye) : "0").","; + $sql .= " paye=".(isset($this->paid) ? ((int) $this->paid) : "0").","; $sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").","; $sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").","; $sql .= " localtax1=".(isset($this->localtax1) ? ((float) $this->localtax1) : "null").","; @@ -1449,7 +1470,7 @@ class FactureFournisseur extends CommonInvoice $this->fetch_lines(); $list_rowid_det = array(); foreach ($this->lines as $key => $invoiceline) { - $list_rowid_det[] = $invoiceline->rowid; + $list_rowid_det[] = $invoiceline->id; } // Consumned discounts are freed @@ -1567,13 +1588,13 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user * @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implemented yet. * @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implemented yet. - * @return int Return integer <0 si ko, >0 si ok + * @return int<-1,1> Return integer <0 si ko, >0 si ok */ public function setPaid($user, $close_code = '', $close_note = '') { $error = 0; - if ($this->paye != 1) { + if ($this->paid != 1) { $this->db->begin(); $now = dol_now(); @@ -1766,7 +1787,7 @@ class FactureFournisseur extends CommonInvoice $this->fetch_lines(); // Check parameters - if ($this->statut > self::STATUS_DRAFT) { // This is to avoid to validate twice (avoid errors on logs and stock management) + if ($this->status > self::STATUS_DRAFT) { // This is to avoid to validate twice (avoid errors on logs and stock management) dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING); return 0; } @@ -1939,6 +1960,7 @@ class FactureFournisseur extends CommonInvoice if (!$error) { $this->ref = $this->newref; $this->statut = self::STATUS_VALIDATED; + $this->status = self::STATUS_VALIDATED; //$this->date_validation=$now; this is stored into log table } @@ -1971,7 +1993,7 @@ class FactureFournisseur extends CommonInvoice $error = 0; - if ($this->statut == self::STATUS_DRAFT) { + if ($this->status == self::STATUS_DRAFT) { dol_syslog(__METHOD__." already draft status", LOG_WARNING); return 0; } @@ -2327,8 +2349,8 @@ class FactureFournisseur extends CommonInvoice * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param double $pu_devise Amount in currency * @param string $ref_supplier Supplier ref - * @param integer $rang line rank - * @return int Return integer <0 if KO, >0 if OK + * @param int $rang Line rank + * @return int<-1,1> Return integer <0 if KO, >0 if OK */ public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = [], $fk_unit = null, $pu_devise = 0, $ref_supplier = '', $rang = 0) { @@ -2428,7 +2450,7 @@ class FactureFournisseur extends CommonInvoice $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise - $line->pu_ht = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise + $line->pu_ht = $line->subprice; // deprecated $line->pu_ttc = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ttc) : $pu_ttc); // For credit note, unit price always negative, always positive otherwise $line->remise_percent = $remise_percent; @@ -2737,9 +2759,9 @@ class FactureFournisseur extends CommonInvoice /** * getTooltipContentArray * - * @param array $params ex option, infologin + * @param array{moretitle?:string} $params ex option, infologin * @since v18 - * @return array + * @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string} */ public function getTooltipContentArray($params) { @@ -2968,12 +2990,13 @@ class FactureFournisseur extends CommonInvoice $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } $obj = new $classname(); + '@phan-var-force ModeleNumRefSuppliersInvoices $obj'; $numref = ""; $numref = $obj->getNextValue($soc, $this, $mode); @@ -3047,7 +3070,7 @@ class FactureFournisseur extends CommonInvoice $line->desc = $langs->trans("Description")." ".$xnbp; $line->qty = 1; $line->subprice = 100; - $line->pu_ht = 100; // the canelle template use pu_ht and not subprice + $line->pu_ht = $line->subprice; // the canelle template use pu_ht and not subprice $line->price = 100; $line->tva_tx = 19.6; $line->localtax1_tx = 0; @@ -3152,8 +3175,8 @@ class FactureFournisseur extends CommonInvoice // Clear fields $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier); - $object->author = $user->id; - $object->user_validation_id = 0; + $object->author = $user->id; // FIXME? user_validation_id is replacement for author + $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author $object->fk_facture_source = 0; $object->date_creation = ''; $object->date_validation = ''; @@ -3209,8 +3232,8 @@ class FactureFournisseur extends CommonInvoice * @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 - * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK + * @param ?array $moreparams Array to provide more information + * @return int<-1,1> Return integer <0 if KO, 0 if nothing done, >0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -3239,7 +3262,7 @@ class FactureFournisseur extends CommonInvoice /** * Returns the rights used for this class - * @return stdClass + * @return int */ public function getRights() { @@ -3326,7 +3349,7 @@ class FactureFournisseur extends CommonInvoice * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) - * @param array $arraydata Array of data + * @param ?array{selected?:int<0,1>} $arraydata Array of data * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '', $arraydata = null) @@ -3721,6 +3744,9 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $table_element = 'facture_fourn_det'; + /** + * @var static + */ public $oldline; /** @@ -3778,7 +3804,7 @@ class SupplierInvoiceLine extends CommonObjectLine /** * This field may contains label of line (when invoice create from order) * @var string - * @deprecated + * @deprecated Use $product_label */ public $label; @@ -3797,6 +3823,9 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $fk_code_ventilation; + /** + * @var int<0,1> + */ public $skip_update_total; // Skip update price total for special lines /** @@ -3993,7 +4022,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->product_desc = $obj->product_desc; $this->subprice = $obj->pu_ht; - $this->pu_ht = $obj->pu_ht; + $this->pu_ht = $this->subprice; $this->pu_ttc = $obj->pu_ttc; $this->tva_tx = $obj->tva_tx; $this->localtax1_tx = $obj->localtax1_tx; @@ -4013,6 +4042,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->fk_product = $obj->fk_product; $this->product_type = $obj->product_type; $this->product_label = $obj->product_label; + $this->label = $obj->product_label; $this->info_bits = $obj->info_bits; $this->fk_parent_line = $obj->fk_parent_line; $this->special_code = $obj->special_code; @@ -4093,7 +4123,7 @@ class SupplierInvoiceLine extends CommonObjectLine { global $conf; - $pu = price2num($this->pu_ht); + $pu = price2num($this->subprice); $qty = price2num($this->qty); // Check parameters @@ -4145,7 +4175,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", ref = '".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'"; $sql .= ", date_start = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : "null"); $sql .= ", date_end = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : "null"); - $sql .= ", pu_ht = ".price2num($this->pu_ht); + $sql .= ", pu_ht = ".price2num($this->subprice); $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); @@ -4328,7 +4358,11 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ')'; $sql .= " VALUES (".$this->fk_facture_fourn.","; $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").","; - $sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; + $product_label + = !empty($this->product_label) + ? $this->product_label : + (!empty($this->label) ? $this->label : null); + $sql .= " ".(!empty($product_label) ? "'".$this->db->escape($product_label)."'" : "null").","; $sql .= " '".$this->db->escape($this->desc ? $this->desc : $this->description)."',"; $sql .= " '".$this->db->escape($this->ref_supplier)."',"; $sql .= " ".price2num($this->qty).","; @@ -4394,7 +4428,7 @@ class SupplierInvoiceLine extends CommonObjectLine return -3; } } else { - $result = $discount->link_to_invoice($this->rowid, 0); + $result = $discount->link_to_invoice($this->id, 0); if ($result < 0) { $this->error = $discount->error; dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); @@ -4453,7 +4487,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", total_localtax1 = ".price2num($this->total_localtax1); $sql .= ", total_localtax2 = ".price2num($this->total_localtax2); $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= " WHERE rowid = ".((int) $this->rowid); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog("FactureFournisseurLigne.class.php::update_total", LOG_DEBUG); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e5e347d37c4..ec807f2e14e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1764,7 +1764,7 @@ if (empty($reshook)) { 0, $pu_devise, GETPOST('fourn_ref', 'alpha'), - '' + 0 ); } if ($idprod == -99 || $idprod == 0) { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f40fab2257f..6ccb99e4c6e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -345,10 +345,10 @@ if (empty($reshook)) { setEventMessages($objecttmp->ref.' '.$langs->trans("ProcessingError"), $hookmanager->errors, 'errors'); } - if ($objecttmp->statut == FactureFournisseur::STATUS_DRAFT) { + if ($objecttmp->status == FactureFournisseur::STATUS_DRAFT) { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors'); - } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) { + } elseif ($objecttmp->paid || $objecttmp->resteapayer == 0) { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors'); } elseif ($objecttmp->resteapayer < 0) { @@ -1589,6 +1589,7 @@ while ($i < $imaxinloop) { $facturestatic->alreadypaid = ($paiement ? $paiement : 0); $facturestatic->paye = $obj->paye; + $facturestatic->paid = $obj->paye; $facturestatic->date = $db->jdate($obj->datef); diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 966cde2511b..0616033cd9f 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2006-2010 Laurent Destailleur * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * 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 @@ -309,6 +310,7 @@ if ($result > 0) { $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->statut = $objp->status; + $facturestatic->status = $objp->status; $facturestatic->alreadypaid = -1; // unknown print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 73020077bc5..280d8b31459 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -487,7 +487,7 @@ if (empty($reshook)) { $product_type, $rang, false, - 0, + array(), null, $lines[$i]->rowid, 0, diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index 2c9b444655e..e4aeb57fd4f 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * 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 @@ -117,7 +118,7 @@ if ($type == 'bank-transfer') { // Load object if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); - $isdraft = (($obj->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); + $isdraft = (($obj->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); if ($ret > 0) { $object->fetch_thirdparty(); } @@ -346,21 +347,21 @@ print '
'; /* * Payments */ - $sql = "SELECT p.rowid, p.num_payment as num_payment, p.datep as dp, p.amount,"; - $sql .= " c.code as type_code,c.libelle as paiement_type,"; - $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; - $sql .= ", ".MAIN_DB_PREFIX."salary as s"; - $sql .= " WHERE p.fk_salary = ".((int) $id); - $sql .= " AND p.fk_salary = s.rowid"; - $sql .= " AND s.entity IN (".getEntity('tax').")"; - $sql .= " ORDER BY dp DESC"; +$sql = "SELECT p.rowid, p.num_payment as num_payment, p.datep as dp, p.amount,"; +$sql .= " c.code as type_code,c.libelle as paiement_type,"; +$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; +$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; +$sql .= ", ".MAIN_DB_PREFIX."salary as s"; +$sql .= " WHERE p.fk_salary = ".((int) $id); +$sql .= " AND p.fk_salary = s.rowid"; +$sql .= " AND s.entity IN (".getEntity('tax').")"; +$sql .= " ORDER BY dp DESC"; - //print $sql; - $resql = $db->query($sql); +//print $sql; +$resql = $db->query($sql); if ($resql) { $totalpaid = 0; @@ -450,23 +451,23 @@ print dol_get_fiche_end(); print '
'."\n"; $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; - $sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; - $sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; - $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; +$sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; +$sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; +$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; +$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; if ($type == 'salaire') { $sql .= " WHERE pfd.fk_salary = ".((int) $object->id); } else { $sql .= " WHERE fk_facture = ".((int) $object->id); } - $sql .= " AND pfd.traite = 0"; - $sql .= " AND pfd.type = 'ban'"; - $sql .= " ORDER BY pfd.date_demande DESC"; - $resql = $db->query($sql); +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.type = 'ban'"; +$sql .= " ORDER BY pfd.date_demande DESC"; +$resql = $db->query($sql); - $hadRequest = $db->num_rows($resql); +$hadRequest = $db->num_rows($resql); if ($object->paye == 0 && $hadRequest == 0) { if ($resteapayer > 0) { if ($user_perms) { @@ -528,31 +529,31 @@ $bprev = new BonPrelevement($db); * Withdrawals */ - print '
'; - print ''; +print '
'; +print '
'; - print ''; - // Action column +print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } - print ''; - print ''; - print ''; - print ''; +print ''; +print ''; +print ''; +print ''; if ($type == 'bank-transfer') { print ''; } else { print ''; } - print ''; - // Action column +print ''; +// Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } - print ''; +print ''; - $num = 0; +$num = 0; if ($resql) { $i = 0; @@ -653,25 +654,25 @@ if ($resql) { dol_print_error($db); } - // Past requests when bon prelevement +// Past requests when bon prelevement - $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; - $sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; - $sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; - $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; +$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; +$sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; +$sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; +$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; +$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; if ($type == 'salaire') { $sql .= " WHERE pfd.fk_salary = ".((int) $object->id); } else { $sql .= " WHERE fk_facture = ".((int) $object->id); } - $sql .= " AND pfd.traite = 1"; - $sql .= " AND pfd.type = 'ban'"; - $sql .= " ORDER BY pfd.date_demande DESC"; +$sql .= " AND pfd.traite = 1"; +$sql .= " AND pfd.type = 'ban'"; +$sql .= " ORDER BY pfd.date_demande DESC"; - $resql = $db->query($sql); +$resql = $db->query($sql); if ($resql) { $numOfBp = $db->num_rows($resql); $i = 0; @@ -766,8 +767,8 @@ if ($num == 0 && $numOfBp == 0) { print ''; } - print "
 '.$langs->trans("DateRequest").''.$langs->trans("User").''.$langs->trans("Amount").''.$langs->trans("DateProcess").''.$langs->trans("DateRequest").''.$langs->trans("User").''.$langs->trans("Amount").''.$langs->trans("DateProcess").''.$langs->trans("BankTransferReceipt").''.$langs->trans("WithdrawalReceipt").'   
'.$langs->trans("None").'
"; - print '
'; +print ""; +print '
'; // End of page llxFooter(); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 85744ccc24e..77442df3f03 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * 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 @@ -79,11 +80,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); // Define WSDL Return object @@ -94,8 +95,8 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); @@ -107,21 +108,21 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'desc' => array('name'=>'desc', 'type'=>'xsd:string'), - 'fk_product' => array('name'=>'fk_product', 'type'=>'xsd:int'), - 'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'), - 'total' => array('name'=>'total', 'type'=>'xsd:double'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'), - 'qty' => array('name'=>'qty', 'type'=>'xsd:double'), - 'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'desc' => array('name' => 'desc', 'type' => 'xsd:string'), + 'fk_product' => array('name' => 'fk_product', 'type' => 'xsd:int'), + 'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'), + 'total' => array('name' => 'total', 'type' => 'xsd:double'), + 'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'), + 'qty' => array('name' => 'qty', 'type' => 'xsd:double'), + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'), + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'), // From product - 'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string') + 'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'), + 'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'), + 'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string') ) ); @@ -133,7 +134,7 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:line[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:line[]') ), 'tns:line' ); @@ -145,29 +146,29 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'ref_supplier' => array('name'=>'ref_supplier', 'type'=>'xsd:string'), - 'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:int'), - 'fk_user_valid' => array('name'=>'fk_user_valid', 'type'=>'xsd:int'), - 'fk_thirdparty' => array('name'=>'fk_thirdparty', 'type'=>'xsd:int'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'date_invoice' => array('name'=>'date_invoice', 'type'=>'xsd:date'), - 'date_term' => array('name'=>'date_modification', 'type'=>'xsd:date'), - 'label' => array('name'=>'label', 'type'=>'xsd:date'), - 'type' => array('name'=>'type', 'type'=>'xsd:int'), - 'total_net' => array('name'=>'type', 'type'=>'xsd:double'), - 'total_vat' => array('name'=>'type', 'type'=>'xsd:double'), - 'total' => array('name'=>'type', 'type'=>'xsd:double'), - 'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'), - 'status' => array('name'=>'status', 'type'=>'xsd:int'), - 'close_code' => array('name'=>'close_code', 'type'=>'xsd:string'), - 'close_note' => array('name'=>'close_note', 'type'=>'xsd:string'), - 'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray') + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'ref' => array('name' => 'ref', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'ref_supplier' => array('name' => 'ref_supplier', 'type' => 'xsd:string'), + 'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:int'), + 'fk_user_valid' => array('name' => 'fk_user_valid', 'type' => 'xsd:int'), + 'fk_thirdparty' => array('name' => 'fk_thirdparty', 'type' => 'xsd:int'), + 'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'), + 'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'), + 'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'), + 'date_invoice' => array('name' => 'date_invoice', 'type' => 'xsd:date'), + 'date_term' => array('name' => 'date_modification', 'type' => 'xsd:date'), + 'label' => array('name' => 'label', 'type' => 'xsd:date'), + 'type' => array('name' => 'type', 'type' => 'xsd:int'), + 'total_net' => array('name' => 'type', 'type' => 'xsd:double'), + 'total_vat' => array('name' => 'type', 'type' => 'xsd:double'), + 'total' => array('name' => 'type', 'type' => 'xsd:double'), + 'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'), + 'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'), + 'status' => array('name' => 'status', 'type' => 'xsd:int'), + 'close_code' => array('name' => 'close_code', 'type' => 'xsd:string'), + 'close_note' => array('name' => 'close_note', 'type' => 'xsd:string'), + 'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray') ) ); @@ -179,7 +180,7 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:invoice[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:invoice[]') ), 'tns:invoice' ); @@ -192,7 +193,7 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:invoice[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:invoice[]') ), 'tns:invoice' ); @@ -210,9 +211,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getSupplierInvoice', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoice'=>'tns:invoice'), + array('result' => 'tns:result', 'invoice' => 'tns:invoice'), $ns, $ns.'#getSupplierInvoice', $styledoc, @@ -222,9 +223,9 @@ $server->register( $server->register( 'getSupplierInvoicesForThirdParty', // Entry values - array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'invoices'=>'tns:invoices'), + array('result' => 'tns:result', 'invoices' => 'tns:invoices'), $ns, $ns.'#getSupplierInvoicesForThirdParty', $styledoc, @@ -277,43 +278,43 @@ function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') foreach ($invoice->lines as $line) { //var_dump($line); exit; $linesresp[] = array( - 'id'=>$line->rowid, - 'type'=>$line->product_type, - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty + 'id' => $line->rowid, + 'type' => $line->product_type, + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty ); $i++; } // Create invoice $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoice'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoice' => array( 'id' => $invoice->id, 'ref' => $invoice->ref, - 'ref_supplier'=>$invoice->ref_supplier, + 'ref_supplier' => $invoice->ref_supplier, 'ref_ext' => $invoice->ref_ext, 'fk_user_author' => $invoice->fk_user_author, 'fk_user_valid' => $invoice->fk_user_valid, 'fk_thirdparty' => $invoice->fk_soc, - 'type'=>$invoice->type, - 'status'=>$invoice->statut, - 'total_net'=>$invoice->total_ht, - 'total_vat'=>$invoice->total_tva, - 'total'=>$invoice->total_ttc, - 'date_creation'=>dol_print_date($invoice->datec, 'dayhourrfc'), - 'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'), - 'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'), - 'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'), - 'label'=>$invoice->label, - 'paid'=>$invoice->paid, - 'note_private'=>$invoice->note_private, - 'note_public'=>$invoice->note_public, - 'close_code'=>$invoice->close_code, - 'close_note'=>$invoice->close_note, + 'type' => $invoice->type, + 'status' => $invoice->status, + 'total_net' => $invoice->total_ht, + 'total_vat' => $invoice->total_tva, + 'total' => $invoice->total_ttc, + 'date_creation' => dol_print_date($invoice->datec, 'dayhourrfc'), + 'date_modification' => dol_print_date($invoice->tms, 'dayhourrfc'), + 'date_invoice' => dol_print_date($invoice->date, 'dayhourrfc'), + 'date_term' => dol_print_date($invoice->date_echeance, 'dayhourrfc'), + 'label' => $invoice->label, + 'paid' => $invoice->paid, + 'note_private' => $invoice->note_private, + 'note_public' => $invoice->note_public, + 'close_code' => $invoice->close_code, + 'close_note' => $invoice->close_note, 'lines' => $linesresp, // 'lines' => array('0'=>array('id'=>222,'type'=>1), @@ -333,7 +334,7 @@ function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -402,44 +403,44 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) $linesresp = array(); foreach ($invoice->lines as $line) { $linesresp[] = array( - 'id'=>$line->rowid, - 'type'=>$line->product_type, - 'desc'=>dol_htmlcleanlastbr($line->description), - 'total_net'=>$line->total_ht, - 'total_vat'=>$line->total_tva, - 'total'=>$line->total_ttc, - 'vat_rate'=>$line->tva_tx, - 'qty'=>$line->qty, - 'product_ref'=>$line->product_ref, - 'product_label'=>$line->product_label, - 'product_desc'=>$line->product_desc, + 'id' => $line->rowid, + 'type' => $line->product_type, + 'desc' => dol_htmlcleanlastbr($line->desc), + 'total_net' => $line->total_ht, + 'total_vat' => $line->total_tva, + 'total' => $line->total_ttc, + 'vat_rate' => $line->tva_tx, + 'qty' => $line->qty, + 'product_ref' => $line->product_ref, + 'product_label' => $line->product_label, + 'product_desc' => $line->product_desc, ); } // Now define invoice $linesinvoice[] = array( - 'id'=>$invoice->id, - 'ref'=>$invoice->ref, - 'ref_supplier'=>$invoice->ref_supplier, - 'ref_ext'=>$invoice->ref_ext, + 'id' => $invoice->id, + 'ref' => $invoice->ref, + 'ref_supplier' => $invoice->ref_supplier, + 'ref_ext' => $invoice->ref_ext, 'fk_user_author' => $invoice->user_creation_id, 'fk_user_valid' => $invoice->user_validation_id, 'fk_thirdparty' => $invoice->socid, - 'type'=>$invoice->type, - 'status'=>$invoice->status, - 'total_net'=>$invoice->total_ht, - 'total_vat'=>$invoice->total_tva, - 'total'=>$invoice->total_ttc, - 'date_creation'=>dol_print_date($invoice->datec, 'dayhourrfc'), - 'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'), - 'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'), - 'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'), - 'label'=>$invoice->label, - 'paid'=>$invoice->paid, - 'note_private'=>$invoice->note_private, - 'note_public'=>$invoice->note_public, - 'close_code'=>$invoice->close_code, - 'close_note'=>$invoice->close_note, + 'type' => $invoice->type, + 'status' => $invoice->status, + 'total_net' => $invoice->total_ht, + 'total_vat' => $invoice->total_tva, + 'total' => $invoice->total_ttc, + 'date_creation' => dol_print_date($invoice->datec, 'dayhourrfc'), + 'date_modification' => dol_print_date($invoice->tms, 'dayhourrfc'), + 'date_invoice' => dol_print_date($invoice->date, 'dayhourrfc'), + 'date_term' => dol_print_date($invoice->date_echeance, 'dayhourrfc'), + 'label' => $invoice->label, + 'paid' => $invoice->paid, + 'note_private' => $invoice->note_private, + 'note_public' => $invoice->note_public, + 'close_code' => $invoice->close_code, + 'close_note' => $invoice->close_note, 'lines' => $linesresp ); @@ -448,8 +449,8 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'invoices'=>$linesinvoice + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'invoices' => $linesinvoice ); } else { @@ -460,7 +461,7 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp;