From 550dc622ca411bc3190a2d08c194640e2836e62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 13:40:40 +0200 Subject: [PATCH 1/7] code comment --- .../class/accountingaccount.class.php | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 9030e65b049..85f9ee39c61 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) + * Copyright (C) 2018 Frédéric France * * 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 @@ -30,6 +31,9 @@ */ class AccountingAccount extends CommonObject { + /** + * @var string Name of element + */ public $element='accounting_account'; /** @@ -59,16 +63,6 @@ class AccountingAccount extends CommonObject */ public $db; - /** - * @var string Error code (or message) - */ - public $error=''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var int ID */ @@ -79,17 +73,39 @@ class AccountingAccount extends CommonObject */ public $rowid; - public $datec; // Creation date + /** + * @var string Creation date + */ + public $datec; /** - * @var int ID + * @var string pcg version */ public $fk_pcg_version; + /** + * @var string pcg type + */ public $pcg_type; + + /** + * @var string pcg subtype + */ public $pcg_subtype; + + /** + * @var string account number + */ public $account_number; + + /** + * @var int ID parent account + */ public $account_parent; + + /** + * @var int ID category account + */ public $account_category; /** @@ -112,8 +128,10 @@ class AccountingAccount extends CommonObject */ public $fk_user_modif; - public $active; // duplicate with status - + /** + * @var int active (duplicate with status) + */ + public $active; /** * Constructor From 5f6cbda5a6489e7a41c4062ee1f4807184f56dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 22:34:00 +0200 Subject: [PATCH 2/7] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fcbee2da90e..20983ebd3c9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -990,6 +990,7 @@ class Facture extends CommonInvoice $this->user_valid = ''; $this->fk_facture_source = 0; $this->date_creation = ''; + $this->date_modification = ''; $this->date_validation = ''; $this->ref_client = ''; $this->close_code = ''; From 80bd93d600b3cc0847afbb416483054e121bf75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 22:36:12 +0200 Subject: [PATCH 3/7] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4b17ebaf0c8..9c001a480d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -298,7 +298,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . + #phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . set +e echo From f9a3dec26d2efa920840d7096a185f647938e0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 22:48:46 +0200 Subject: [PATCH 4/7] Update FactureTest.php --- .travis.yml | 4 ++-- test/phpunit/FactureTest.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c001a480d9..96a238e6ad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ # from Dolibarr GitHub repository. # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ -# We use dist: trusty to have php 5.4+ available +# We use dist: trusty to have php 5.4+ available dist: trusty sudo: required @@ -298,7 +298,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - #phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . + phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . set +e echo diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index d04844783c5..a1dd46de978 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * 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 @@ -228,7 +229,7 @@ class FactureTest extends PHPUnit_Framework_TestCase $newlocalobject, true, array( - 'newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem', + 'newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','date_modification', 'ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement', 'cond_reglement_doc','situation_cycle_ref','situation_counter','situation_final','multicurrency_total_ht','multicurrency_total_tva', 'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx' From f169ec9259a5876452195b89a9787a6f80e7c4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Oct 2018 10:37:49 +0200 Subject: [PATCH 5/7] Update ajaxdirtree.php --- htdocs/core/ajax/ajaxdirtree.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index fc01474a072..0f3ac26693a 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2007-2018 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * 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 @@ -74,7 +75,7 @@ if ($modulepart == 'ecm') $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened=$conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); } -if ($modulepart == 'medias') +elseif ($modulepart == 'medias') { $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened=$dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); @@ -96,7 +97,7 @@ if ($modulepart == 'ecm') { if (! $user->rights->ecm->read) accessforbidden(); } -if ($modulepart == 'medias') +elseif ($modulepart == 'medias') { // Always allowed } @@ -349,7 +350,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, { $files = @scandir($fullpathselecteddir); - if ($files) + if (! empty($files)) { natcasesort($files); if (count($files) > 2) /* The 2 accounts for . and .. */ From 0171301543a810dbb4071524e198914971eb2d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Oct 2018 19:19:35 +0200 Subject: [PATCH 6/7] code comment categories class --- htdocs/categories/class/categorie.class.php | 24 ++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index a9432234793..a7ddab761e0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -76,6 +76,10 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, ); + + /** + * @var array Code mapping from ID + */ public static $MAP_ID_TO_CODE = array( 0 => 'product', 1 => 'supplier', @@ -104,7 +108,8 @@ class Categorie extends CommonObject 'bank_account' => 'account', 'project' => 'project', ); - /** + + /** * @var array Category tables mapping from type string * * @note Move to const array when PHP 5.6 will be our minimum target @@ -120,7 +125,8 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', ); - /** + + /** * @var array Object class mapping from type string * * @note Move to const array when PHP 5.6 will be our minimum target @@ -136,7 +142,8 @@ class Categorie extends CommonObject 'bank_account' => 'Account', 'project' => 'Project', ); - /** + + /** * @var array Object table mapping from type string * * @note Move to const array when PHP 5.6 will be our minimum target @@ -199,7 +206,14 @@ class Categorie extends CommonObject */ public $type; - public $cats = array(); // Categories table in memory + /** + * @var array Categories table in memory + */ + public $cats = array(); + + /** + * @var array Mother of table + */ public $motherof = array(); /** @@ -1360,7 +1374,7 @@ class Categorie extends CommonObject * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...) * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category * labels, 'id'= Get array of category IDs - * @return mixed Array of category objects or < 0 if KO + * @return array|int Array of category objects or < 0 if KO */ function containing($id, $type, $mode='object') { From 59307165ce766e814fd4c0a3462b1e1369c6db8b Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Sun, 21 Oct 2018 19:45:33 +0200 Subject: [PATCH 7/7] fix the pdf merge fix the pdf merge. [See: #9824] --- htdocs/includes/tcpdi/tcpdi_parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index 038994568ac..cdeaf4f94e6 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -484,7 +484,7 @@ class tcpdi_parser { $v = $sarr[$key]; if (($key == '/Type') AND ($v[0] == PDF_TYPE_TOKEN AND ($v[1] == 'XRef'))) { $valid_crs = true; - } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) { + } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) { // first object number in the subsection $index_first = intval($v[1][0][1]); // number of entries in the subsection