From d0f83141fbaa5bb61a43bf803fa5a432eb2e7098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:38:01 +0200 Subject: [PATCH 01/26] FIX: Bad variable usage --- htdocs/accountancy/admin/account.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index c42a8d7079b..340cb3e18d5 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -65,8 +65,7 @@ if ($action == 'delete') { $accounting = new AccountingAccount($db); if ($action == 'disable') { - $accounting = $accounting->fetch($id); - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } @@ -75,10 +74,7 @@ if ($action == 'disable') { setEventMessage($accounting->error, 'errors'); } } else if ($action == 'enable') { - - $accounting = $accounting->fetch($id); - - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; @@ -206,4 +202,4 @@ if ($result) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From bab1dd13e248a08bd01cd9336a7291f2bcfce7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:07 +0200 Subject: [PATCH 02/26] FIX: missing extends --- htdocs/accountancy/class/accountingaccount.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 82c3ec3ca10..f91f21343f8 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -26,7 +26,7 @@ /** * Classe permettant la gestion des comptes generaux de compta */ -class AccountingAccount +class AccountingAccount extends CommonObject { var $db; var $id; @@ -426,4 +426,4 @@ class AccountingAccount return - 1; } } -} \ No newline at end of file +} From 7b300b0a9dfdc2d9c852febb6e2c0fb02bd20e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:21 +0200 Subject: [PATCH 03/26] FIX: Missing variable declaration --- htdocs/accountancy/class/accountingaccount.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index f91f21343f8..4ecd0b3c8e1 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -107,6 +107,7 @@ class AccountingAccount extends CommonObject { global $conf, $langs; $error = 0; + $now = dol_now(); // Clean parameters if (isset($this->fk_pcg_version)) From b1ad7af527f039c0c4888408c7ae9034f4cbe26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:42:33 +0200 Subject: [PATCH 04/26] FIX: Missing extends --- htdocs/accountancy/class/bookkeeping.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 2788526de05..e9bbc7d5958 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -27,7 +27,7 @@ /** * Class to manage accountancy book keeping */ -class BookKeeping +class BookKeeping extends CommonObject { var $db; var $id; @@ -709,4 +709,4 @@ class BookKeepingLine var $fk_user_author; var $code_journal; var $piece_num; -} \ No newline at end of file +} From 64da1b1dc03326dfcc9785314948a36bd3bc1daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:43:49 +0200 Subject: [PATCH 05/26] FIX: Removed HTML file preventing PHP service --- htdocs/accountancy/customer/index.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 htdocs/accountancy/customer/index.html diff --git a/htdocs/accountancy/customer/index.html b/htdocs/accountancy/customer/index.html deleted file mode 100644 index e69de29bb2d..00000000000 From 9a141215bb279e46b7c2fda8c30e13cd489156d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:46:53 +0200 Subject: [PATCH 06/26] FIX: Moved code to where the variable is defined --- htdocs/accountancy/journal/bankjournal.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 82c3a09e20a..ef39e5668a0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -137,17 +137,18 @@ if ($result) { $tabpay = array (); $tabbq = array (); $tabtp = array (); - $tabcompany[$obj->rowid] = array ( - 'id' => $obj->socid, - 'name' => $obj->name, - 'code_client' => $obj->code_compta - ); $tabtype = array (); $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); + $tabcompany[$obj->rowid] = array ( + 'id' => $obj->socid, + 'name' => $obj->name, + 'code_client' => $obj->code_compta + ); + // Controls $compta_bank = $obj->account_number; if ($obj->label == '(SupplierInvoicePayment)') @@ -580,4 +581,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); From cc68966d7282f17176ce9baf52d188a2d69d72dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:49:07 +0200 Subject: [PATCH 07/26] FIX: Missing declaration --- htdocs/accountancy/journal/purchasesjournal.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index e0c2ceb8e36..09d93d5cd50 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -246,7 +246,9 @@ if ($action == 'export_csv') { header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_achats.csv'); - + + $companystatic = new Fournisseur($db); + if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert { foreach ( $tabfac as $key => $val ) { @@ -468,4 +470,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); From 332caa2b7124ca6e314d5b119d2ee8676c903504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:51:21 +0200 Subject: [PATCH 08/26] FIX: missing global declaration --- 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 1059d1af07d..50b9a35f4fe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2768,7 +2768,7 @@ abstract class CommonObject */ function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0) { - global $conf,$langs,$user,$object,$hookmanager; + global $conf, $hookmanager, $inputalsopricewithtax, $langs, $user; print ''; From 852758c81c0bba13e3769804695206884e91e8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:52:22 +0200 Subject: [PATCH 09/26] FIX: Removed concatenation on undeclared variable --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5cf872eb3d8..937f904c512 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1297,7 +1297,7 @@ class Form // Method with no ajax //$out.='
'; - $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); $out.=''; $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); From 4c7ae3d14b66e836b13b2fd6d11d56bb924127eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:54:04 +0200 Subject: [PATCH 10/26] FIX: Missing parameter declaration --- htdocs/core/lib/accounting.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index e7313c73aee..7b18de022f6 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -25,10 +25,11 @@ /** * Prepare array with list of admin tabs + * @param Object $object Accounting account * * @return array Array of tabs to show */ -function admin_accounting_prepare_head() +function admin_accounting_prepare_head($object) { global $langs, $conf; @@ -189,4 +190,4 @@ function length_exportsage($txt, $len, $end) } } return $res; -} \ No newline at end of file +} From 7c7276b5aaaf3c3dc515f4299e6e2e4b8ee8e892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 11:57:15 +0200 Subject: [PATCH 11/26] FIX: Removed undeclared variable --- htdocs/societe/consumption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0aa9f0e5979..10d0f69dd8e 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -67,7 +67,7 @@ if (GETPOST("button_removefilter")) } // Customer or supplier selected in drop box $thirdTypeSelect = GETPOST("third_select_id"); -$type_element = GETPOST('type_element')?GETPOST('type_element'):$type_element; +$type_element = GETPOST('type_element')?GETPOST('type_element'):''; $langs->load("companies"); From c7c809a6095ceae7697bfe9b24f6bb7a7fb5fd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 12:02:17 +0200 Subject: [PATCH 12/26] FIX: Wrong type hinting --- .../class/fournisseur.commande.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4e8c3a650b0..07964e69d58 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1062,25 +1062,25 @@ class CommandeFournisseur extends CommonOrder * Add order line * * @param string $desc Description - * @param double $pu_ht Unit price - * @param double $qty Quantity - * @param double $txtva Taux tva - * @param double $txlocaltax1 Localtax1 tax - * @param double $txlocaltax2 Localtax2 tax + * @param float $pu_ht Unit price + * @param float $qty Quantity + * @param float $txtva Taux tva + * @param float $txlocaltax1 Localtax1 tax + * @param float $txlocaltax2 Localtax2 tax * @param int $fk_product Id produit * @param int $fk_prod_fourn_price Id supplier price * @param string $fourn_ref Supplier reference - * @param double $remise_percent Remise + * @param float $remise_percent Remise * @param string $price_base_type HT or TTC - * @param double $pu_ttc Unit price TTC + * @param float $pu_ttc Unit price TTC * @param int $type Type of line (0=product, 1=service) * @param int $info_bits More information - * @param int $notrigger Disable triggers - * @param timestamp $date_start Date start of service - * @param timestamp $date_end Date end of service + * @param bool $notrigger Disable triggers + * @param int $date_start Date start of service + * @param int $date_end Date end of service * @return int <=0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0, $notrigger=false, $date_start='', $date_end='') + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null) { global $langs,$mysoc; From 3a0d4cd47f139e57d8a9c81db00d4c6ab8b27c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:22:22 +0200 Subject: [PATCH 13/26] =?UTF-8?q?FIX:=C2=A0Missing=20visibility=20of=20sta?= =?UTF-8?q?tic=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d5d16efc2e9..c4bb2afcd44 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -54,7 +54,7 @@ class ExtraFields var $error; var $errno; - static $type2label=array( + public static $type2label=array( 'varchar'=>'String', 'text'=>'TextLong', 'int'=>'Int', From 37c0b9606b7c7db25fb714b3ae3b37ae9bb8b573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:32:50 +0200 Subject: [PATCH 14/26] FIX: Removed unused variable --- scripts/accountancy/export-thirdpartyaccount.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index 2556457f38e..f1ff769059c 100644 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -164,7 +164,6 @@ if ($resql) { header('Content-Disposition: attachment;filename=export_csv.csv'); $obj = $db->fetch_object($resql); - $var = ! $var; print '"' . $obj->compta . '",'; print '"' . $obj->address . '",'; @@ -237,4 +236,4 @@ if ($resql) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From 131997eeb8684df3c6012a134ef6cabe064011a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:39:17 +0200 Subject: [PATCH 15/26] FIX: Removed undeclared variables --- htdocs/core/modules/action/rapport.pdf.php | 2 +- htdocs/core/modules/cheque/pdf/pdf_blochet.class.php | 2 +- htdocs/core/modules/rapport/pdf_paiement.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 1f03ea19d62..3bf7eddecce 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -127,7 +127,7 @@ class CommActionRapport $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 1112150a0e9..c2ac3aaa628 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -120,7 +120,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 683034156da..a4b73f22e90 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -126,7 +126,7 @@ class pdf_paiement $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $parameters=array('file'=>$file,'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks From afcebea440e2752945f67b95a43fa9d6a47ec90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:40:43 +0200 Subject: [PATCH 16/26] FIX: Missing global declaration --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- htdocs/core/modules/project/pdf/pdf_baleine.modules.php | 2 +- htdocs/core/modules/rapport/pdf_paiement.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index fa2e3c85c06..80cf628838d 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -106,7 +106,7 @@ class pdf_soleil extends ModelePDFFicheinter */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc; + global $conf, $hookmanager, $langs, $user; 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 diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index 58dd367757e..0165a01a9bc 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -92,7 +92,7 @@ class pdf_baleine extends ModelePDFProjects */ function write_file($object,$outputlangs) { - global $user,$langs,$conf; + global $conf, $hookmanager, $langs, $user; 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 diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index a4b73f22e90..6f48cc1baca 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -91,7 +91,7 @@ class pdf_paiement { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - global $user,$langs,$conf; + global $conf, $hookmanager, $langs, $user; $socid=0; if ($user->societe_id) $socid=$user->societe_id; From f68cb3bfcbbf9e659066e53d532bd27ab345256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 14:52:59 +0200 Subject: [PATCH 17/26] FIX: Variable declared boolean --- htdocs/core/modules/modSyslog.class.php | 2 +- htdocs/core/modules/modUser.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 563b2e31fa0..f2b5f80ff32 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -50,7 +50,7 @@ class modSyslog extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Activate debug logs (syslog)"; // Can be enabled / disabled only in the main company - $this->core_enabled = 1; + $this->core_enabled = true; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index a59031b4a44..55e96f02262 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -49,7 +49,7 @@ class modUser extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des utilisateurs (requis)"; - $this->always_enabled = 1; // Can't be disabled + $this->always_enabled = true; // Can't be disabled // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; From eea9a76589c6138dea1e06c8774d7c6a1522cfd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:09:03 +0200 Subject: [PATCH 18/26] FIX: Variable might not be traversable --- htdocs/accountancy/journal/bankjournal.php | 144 +++++++++++---------- htdocs/accountancy/journal/cashjournal.php | 107 +++++++-------- htdocs/comm/action/peruser.php | 77 ++++++----- htdocs/compta/bank/class/account.class.php | 8 +- htdocs/core/class/html.form.class.php | 19 +-- htdocs/core/lib/json.lib.php | 2 +- htdocs/user/class/usergroup.class.php | 2 +- 7 files changed, 192 insertions(+), 167 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ef39e5668a0..ca862098bd3 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -170,83 +170,87 @@ if ($result) { } $links = $object->get_url($obj->rowid); - foreach ( $links as $key => $val ) { + // get_url may return -1 which is not traversable + if (is_array($links)) { - $tabtype[$obj->rowid] = $links[$key]['type']; + foreach ( $links as $key => $val ) { - if ($links[$key]['type'] == 'payment') - { - $paymentstatic->id = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } - else if ($links[$key]['type'] == 'payment_supplier') - { - $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } - else if ($links[$key]['type'] == 'company') - { - $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; - $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } - else if ($links[$key]['type'] == 'sc') - { - $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $tabtype[$obj->rowid] = $links[$key]['type']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); - if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') - $reg[1] = 'SocialContribution'; - $chargestatic->lib = $langs->trans($reg[1]); - } - else + if ($links[$key]['type'] == 'payment') { - $chargestatic->lib = $links[$key]['label']; - } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) + $paymentstatic->id = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); + } + else if ($links[$key]['type'] == 'payment_supplier') { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + $paymentsupplierstatic->id = $links[$key]['url_id']; + $paymentsupplierstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); } + else if ($links[$key]['type'] == 'company') + { + $societestatic->id = $links[$key]['url_id']; + $societestatic->nom = $links[$key]['label']; + $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + } + else if ($links[$key]['type'] == 'sc') + { + $chargestatic->id = $links[$key]['url_id']; + $chargestatic->ref = $links[$key]['url_id']; + + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { + if ($reg[1] == 'socialcontribution') + $reg[1] = 'SocialContribution'; + $chargestatic->lib = $langs->trans($reg[1]); + } + else + { + $chargestatic->lib = $links[$key]['label']; + } + $chargestatic->ref = $chargestatic->lib; + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + + $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) + { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + } + } + else if ($links[$key]['type'] == 'payment_vat') + { + $paymentvatstatic->id = $links[$key]['url_id']; + $paymentvatstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + else if ($links[$key]['type'] == 'payment_salary') + { + $paymentsalstatic->id = $links[$key]['url_id']; + $paymentsalstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } + /*else { + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; + }*/ } - else if ($links[$key]['type'] == 'payment_vat') - { - $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } - else if ($links[$key]['type'] == 'payment_salary') - { - $paymentsalstatic->id = $links[$key]['url_id']; - $paymentsalstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; - } - else if ($links[$key]['type'] == 'banktransfert') - { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } - /*else { - $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; - }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index 33b1e4359c1..e2994ce57e6 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -157,64 +157,67 @@ if ($result) { } $links = $object->get_url($obj->rowid); - foreach ( $links as $key => $val ) { + // get_url may return -1 which is not traversable + if (is_array($links)) { + foreach ($links as $key => $val) { - $tabtype[$obj->rowid] = $links[$key]['type']; + $tabtype[$obj->rowid] = $links[$key]['type']; - if ($links[$key]['type'] == 'payment') { - $paymentstatic->id = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'payment_supplier') { - $paymentsupplierstatic->id = $links[$key]['url_id']; - $paymentsupplierstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'company') { + if ($links[$key]['type'] == 'payment') { + $paymentstatic->id = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); + } else if ($links[$key]['type'] == 'payment_supplier') { + $paymentsupplierstatic->id = $links[$key]['url_id']; + $paymentsupplierstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); + } else if ($links[$key]['type'] == 'company') { - $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; - $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { + $societestatic->id = $links[$key]['url_id']; + $societestatic->nom = $links[$key]['label']; + $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + } else if ($links[$key]['type'] == 'sc') { - $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; + $chargestatic->id = $links[$key]['url_id']; + $chargestatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); - if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') - $reg[1] = 'SocialContribution'; - $chargestatic->lib = $langs->trans($reg[1]); - } else { - $chargestatic->lib = $links[$key]['label']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { + if ($reg[1] == 'socialcontribution') + $reg[1] = 'SocialContribution'; + $chargestatic->lib = $langs->trans($reg[1]); + } else { + $chargestatic->lib = $links[$key]['label']; + } + $chargestatic->ref = $chargestatic->lib; + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + + $sqlmid = 'SELECT cchgsoc.accountancy_code'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; + } + } else if ($links[$key]['type'] == 'payment_vat') { + + $paymentvatstatic->id = $links[$key]['url_id']; + $paymentvatstatic->ref = $links[$key]['url_id']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; + } else if ($links[$key]['type'] == 'banktransfert') { + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); + $tabtp[$obj->rowid][$cpttva] += $obj->amount; } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; - } - } else if ($links[$key]['type'] == 'payment_vat') { - - $paymentvatstatic->id = $links[$key]['url_id']; - $paymentvatstatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; + /*else { + $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + }*/ } - /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; - }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; @@ -530,4 +533,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 8bcd1c7289b..ccb544ac4bb 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -600,41 +600,56 @@ else // Loop on each user to show calendar $sav = $tmpday; $showheader = true; -foreach ($usernames as $username) -{ - echo ""; - echo '' . $username->getNomUrl(1). ''; - $tmpday = $sav; - $i = 0; - for ($iter_day = 0; $iter_day < 7; $iter_day++) - { - if (($i + 1) < $begin_d || ($i + 1) > $end_d) - { +// listUsersForGroup may return -1 which is not traversable +if (is_array($usernames)) { + foreach ($usernames as $username) { + echo ""; + echo '' . $username->getNomUrl(1) . ''; + $tmpday = $sav; + + $i = 0; + for ($iter_day = 0; $iter_day < 7; $iter_day++) { + if (($i + 1) < $begin_d || ($i + 1) > $end_d) { + $i++; + continue; + } + + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime, 'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; + + $style = 'cal_current_month'; + if ($iter_day == 6) $style .= ' cal_other_month'; + $today = 0; + $todayarray = dol_getdate($now, 'fast'); + if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1; + if ($today) $style = 'cal_today_peruser'; + + show_day_events2( + $username, + $tmpday, + $month, + $year, + $monthshown, + $style, + $eventarray, + 0, + $maxnbofchar, + $newparam, + 1, + 300, + $showheader + ); + $i++; - continue; } - - // Show days of the current week - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime,'fast'); - $tmpday = $tmparray['mday']; - $tmpmonth = $tmparray['mon']; - $tmpyear = $tmparray['year']; - - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month'; - $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today_peruser'; - - show_day_events2($username, $tmpday, $month, $year, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader); - - $i++; + echo "\n"; + $showheader = false; } - echo "\n"; - $showheader = false; } echo "\n"; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ca6175d785..cd428f927b2 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -164,10 +164,10 @@ class Account extends CommonObject * TODO Move this into AccountLine * Return array with links from llx_bank_url * - * @param int $fk_bank To search using bank transaction id - * @param int $url_id To search using link to - * @param string $type To search using type - * @return array Array of links + * @param int $fk_bank To search using bank transaction id + * @param int $url_id To search using link to + * @param string $type To search using type + * @return array|-1 Array of links or -1 on error */ function get_url($fk_bank='', $url_id='', $type='') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 937f904c512..6b0e9b4d895 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1302,14 +1302,17 @@ class Form $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); if (count($assignedtouser)) $out.='
'; - foreach($assignedtouser as $key => $value) - { - $userstatic->fetch($key); - $out.=$userstatic->getNomUrl(1); - //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); - //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); - $out.='
'; - } + // dol_json_decode may return false on error which is not traversable + if (is_array($assignedtouser)) { + foreach($assignedtouser as $key => $value) + { + $userstatic->fetch($key); + $out.=$userstatic->getNomUrl(1); + //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); + //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); + $out.='
'; + } + } //$out.=''; return $out; diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 69dbb4eba1a..00d5970d77e 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -218,7 +218,7 @@ if (! function_exists('json_decode')) * * @param string $json Json encoded to PHP Object or Array * @param bool $assoc False return an object, true return an array. Try to always use it with true ! - * @return mixed Object or Array + * @return mixed Object or Array or false on error */ function dol_json_decode($json, $assoc=false) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b801c2660aa..9bd0d64fe4c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -178,7 +178,7 @@ class UserGroup extends CommonObject * * @param string $excludefilter Filter to exclude * @param int $mode 0=Return array of user instance, 1=Return array of users id only - * @return array Array of users + * @return array|-1 Array of users or -1 on error */ function listUsersForGroup($excludefilter='', $mode=0) { From a7964c4a9ad4af94b6796b727b304e3ebb9f43c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:20:48 +0200 Subject: [PATCH 19/26] FIX: Replaced deprecated call --- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/list.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 02602262e2c..03e31d44a96 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -63,7 +63,7 @@ if ($action == 'ventil') { $cpt = 0; foreach ( $mesCasesCochees as $maLigneCochee ) { // print '
id selectionnee : '.$monChoix."
"; - $maLigneCourante = split("_", $maLigneCochee); + $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; @@ -234,4 +234,4 @@ if ($result) { } $db->close(); -llxFooter(); \ No newline at end of file +llxFooter(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 84f548344b8..817b07c178e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -65,7 +65,7 @@ if ($action == 'ventil') { foreach ( $mesCasesCochees as $maLigneCochee ) { // print '
id selectionnee : '.$monChoix."
"; - $maLigneCourante = split("_", $maLigneCochee); + $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; From e87b1d68b6fce80fd66e255c6a654b5981232d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:22:05 +0200 Subject: [PATCH 20/26] FIX: Replaced deprecated property --- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/cashjournal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ca862098bd3..218c4dd46df 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -191,7 +191,7 @@ if ($result) { else if ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; + $societestatic->name = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; } diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index e2994ce57e6..ac7cbeb2f77 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -173,7 +173,7 @@ if ($result) { } else if ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; - $societestatic->nom = $links[$key]['label']; + $societestatic->name = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; } else if ($links[$key]['type'] == 'sc') { From c20f5b186e6e8997feb7fb0f989c69afdbec2612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:25:18 +0200 Subject: [PATCH 21/26] Qual: Updated code documentation --- htdocs/core/modules/DolibarrModules.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e4d1f834b4a..69dabf04219 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -192,10 +192,10 @@ abstract class DolibarrModules * Enables a module. * Inserts all informations into database * - * @param string[] $array_sql SQL requests to be executed when enabling module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') + * @param string[]|array $array_sql SQL requests to be executed when enabling module + * @param string $options String with options when disabling module ('newboxdefonly|noboxes') * - * @return int 1 if OK, 0 if KO + * @return int 1 if OK, 0 if KO */ function _init($array_sql, $options='') { From e9175d5d663430c9b4e21988e4d87b3b9cff52b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:26:42 +0200 Subject: [PATCH 22/26] Qual: date type doesn't exist --- htdocs/core/lib/report.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 9c701441765..d41594c3193 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -31,7 +31,7 @@ * @param string $period Period of report * @param string $periodlink Link to switch period * @param string $description Description -* @param date $builddate Date generation +* @param int $builddate Date generation * @param string $exportlink Link for export or '' * @param array $moreparam Array with list of params to add into form * @param string $calcmode Calculation mode From b21d85a1da139aafe593ba4300b3d58d3f3b102b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:28:56 +0200 Subject: [PATCH 23/26] FIX: Function was expecting a boolean not a string --- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/peruser.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2318c45f132..7cec34cb6db 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -986,7 +986,7 @@ elseif ($action == 'show_week') // View by week { // Show days of the current week $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime,'fast'); + $tmparray = dol_getdate($curtime, true); $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ccb544ac4bb..ec6243c7ae7 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -617,7 +617,7 @@ if (is_array($usernames)) { // Show days of the current week $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); - $tmparray = dol_getdate($curtime, 'fast'); + $tmparray = dol_getdate($curtime, true); $tmpday = $tmparray['mday']; $tmpmonth = $tmparray['mon']; $tmpyear = $tmparray['year']; @@ -625,7 +625,7 @@ if (is_array($usernames)) { $style = 'cal_current_month'; if ($iter_day == 6) $style .= ' cal_other_month'; $today = 0; - $todayarray = dol_getdate($now, 'fast'); + $todayarray = dol_getdate($now, true); if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) $today = 1; if ($today) $style = 'cal_today_peruser'; From bd03cb439d91954e18274024a7ec29dc3fa61811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:36:37 +0200 Subject: [PATCH 24/26] FIX: Function expects an int, not a boolean --- htdocs/comm/action/peruser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ec6243c7ae7..5afda948a77 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -800,9 +800,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = ''; //init if (empty($event->fulldayevent)) { - $a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false); - $b = dol_mktime((int) $h,30,0,$month,$day,$year,false,false); - $c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,false); + $a = dol_mktime((int) $h,0,0,$month,$day,$year,false,0); + $b = dol_mktime((int) $h,30,0,$month,$day,$year,false,0); + $c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,0); $dateendtouse=$event->date_end_in_calendar; if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++; From 0f71b7e0b0f5f5f4628355028dd33eeedee87175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Sep 2014 15:38:07 +0200 Subject: [PATCH 25/26] FIX: Typo --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20b030a9226..2acf4071052 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -822,7 +822,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false) * @param string $tzoutput true or 'gmt' => string is for Greenwich location * false or 'tzserver' => output string is for local PHP server TZ usage * 'tzuser' => output string is for local browser TZ usage - * @param Tranlsate $outputlangs Object lang that contains language for text translation. + * @param Translate $outputlangs Object lang that contains language for text translation. * @param boolean $encodetooutput false=no convert into output pagecode * @return string Formated date or '' if time is null * From 4296766ea96dfbb13de71d282ca1bcc9bd86476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 19 Sep 2014 03:03:24 +0200 Subject: [PATCH 26/26] Qual: Coding style --- htdocs/core/lib/accounting.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 7b18de022f6..69e47569b07 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -25,6 +25,7 @@ /** * Prepare array with list of admin tabs + * * @param Object $object Accounting account * * @return array Array of tabs to show