From 1dcc701251aae5acba82b39dd82b53eb7372b497 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:10:46 +0200 Subject: [PATCH 01/25] Fixing bug 20500 --- htdocs/user/class/user.class.php | 68 ++++++++++++++++++-------------- test/phpunit/UserTest.php | 40 +++++++++++++++++-- 2 files changed, 75 insertions(+), 33 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a88e17eb02..143546fbe06 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -682,7 +682,7 @@ class User extends CommonObject 'member' => 'adherent', // We must check $user->rights->adherent... 'mo' => 'mrp', 'order' => 'commande', - 'product' => 'produit', // We must check $user->rights->produit... + //'product' => 'produit', // We must check $user->rights->produit... 'project' => 'projet', 'shipping' => 'expedition', 'task' => 'task@projet', @@ -695,14 +695,24 @@ class User extends CommonObject 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'position@hrm' => 'all@hrm' // skill / job / position objects rights are for the moment grouped into right level "all" ); + if (!empty($moduletomoduletouse[$module])) { $module = $moduletomoduletouse[$module]; } + $moduleRightsMapping = array( + 'product' => 'produit', // We must check $user->rights->produit... + ); + + $rightsPath = $module; + if (!empty($moduleRightsMapping[$rightsPath])) { + $rightsPath = $moduleRightsMapping[$rightsPath]; + } + // If module is abc@module, we check permission user->rights->module->abc->permlevel1 - $tmp = explode('@', $module, 2); + $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { - $module = $tmp[1]; + $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; } @@ -722,50 +732,50 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } - - //var_dump($module.' '.$permlevel1.' '.$permlevel2); - if (empty($module) || empty($this->rights) || empty($this->rights->$module) || empty($permlevel1)) { + } + //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); + //var_dump($this->rights); + if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { - if (!empty($this->rights->$module->$permlevel1)) { - if (!empty($this->rights->$module->$permlevel1->$permlevel2)) { - return $this->rights->$module->$permlevel1->$permlevel2; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { + return $this->rights->$rightsPath->$permlevel1->$permlevel2; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel2 == 'read' && !empty($this->rights->$module->$permlevel1->lire)) { - return $this->rights->$module->lire; + if ($permlevel2 == 'read' && !empty($this->rights->$rightsPath->$permlevel1->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->creer)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->create)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'delete' && !empty($this->rights->$module->$permlevel1->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel2 == 'delete' && !empty($this->rights->$rightsPath->$permlevel1->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } } else { - if (!empty($this->rights->$module->$permlevel1)) { - return $this->rights->$module->$permlevel1; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + return $this->rights->$rightsPath->$permlevel1; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel1 == 'read' && !empty($this->rights->$module->lire)) { - return $this->rights->$module->lire; + if ($permlevel1 == 'read' && !empty($this->rights->$rightsPath->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->creer)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->create)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'delete' && !empty($this->rights->$module->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel1 == 'delete' && !empty($this->rights->$rightsPath->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 699e9fd89f0..2b4ab4ea4f3 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { global $conf,$user,$langs,$db; @@ -96,7 +96,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { global $conf,$user,$langs,$db; $db->rollback(); @@ -109,7 +109,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function setUp() + protected function setUp() : void { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() : void { print __METHOD__."\n"; } @@ -261,6 +261,38 @@ class UserTest extends PHPUnit\Framework\TestCase return $localobject; } + /** + * testUserHasRight + * + * @param User $localobject User + * @return void + */ + + public function testUserHasRight() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + print __METHOD__." id=". $user->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + $user->clearrights(); + //print __METHOD__. $user->hasRight('module', 'level11'); + return $user; + } + /** * testUserSetPassword * From 7f86c53b3e1173cf6a3518d3416fc7eeecc121ed Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:15:40 +0200 Subject: [PATCH 02/25] fixing bug 20500 --- htdocs/user/class/user.class.php | 68 ++++++++++++++++++-------------- test/phpunit/UserTest.php | 36 ++++++++++++++++- 2 files changed, 73 insertions(+), 31 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a88e17eb02..143546fbe06 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -682,7 +682,7 @@ class User extends CommonObject 'member' => 'adherent', // We must check $user->rights->adherent... 'mo' => 'mrp', 'order' => 'commande', - 'product' => 'produit', // We must check $user->rights->produit... + //'product' => 'produit', // We must check $user->rights->produit... 'project' => 'projet', 'shipping' => 'expedition', 'task' => 'task@projet', @@ -695,14 +695,24 @@ class User extends CommonObject 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'position@hrm' => 'all@hrm' // skill / job / position objects rights are for the moment grouped into right level "all" ); + if (!empty($moduletomoduletouse[$module])) { $module = $moduletomoduletouse[$module]; } + $moduleRightsMapping = array( + 'product' => 'produit', // We must check $user->rights->produit... + ); + + $rightsPath = $module; + if (!empty($moduleRightsMapping[$rightsPath])) { + $rightsPath = $moduleRightsMapping[$rightsPath]; + } + // If module is abc@module, we check permission user->rights->module->abc->permlevel1 - $tmp = explode('@', $module, 2); + $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { - $module = $tmp[1]; + $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; } @@ -722,50 +732,50 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } - - //var_dump($module.' '.$permlevel1.' '.$permlevel2); - if (empty($module) || empty($this->rights) || empty($this->rights->$module) || empty($permlevel1)) { + } + //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); + //var_dump($this->rights); + if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { - if (!empty($this->rights->$module->$permlevel1)) { - if (!empty($this->rights->$module->$permlevel1->$permlevel2)) { - return $this->rights->$module->$permlevel1->$permlevel2; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { + return $this->rights->$rightsPath->$permlevel1->$permlevel2; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel2 == 'read' && !empty($this->rights->$module->$permlevel1->lire)) { - return $this->rights->$module->lire; + if ($permlevel2 == 'read' && !empty($this->rights->$rightsPath->$permlevel1->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->creer)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->create)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'delete' && !empty($this->rights->$module->$permlevel1->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel2 == 'delete' && !empty($this->rights->$rightsPath->$permlevel1->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } } else { - if (!empty($this->rights->$module->$permlevel1)) { - return $this->rights->$module->$permlevel1; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + return $this->rights->$rightsPath->$permlevel1; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel1 == 'read' && !empty($this->rights->$module->lire)) { - return $this->rights->$module->lire; + if ($permlevel1 == 'read' && !empty($this->rights->$rightsPath->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->creer)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->create)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'delete' && !empty($this->rights->$module->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel1 == 'delete' && !empty($this->rights->$rightsPath->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 699e9fd89f0..9f106e6e207 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() { global $conf,$user,$langs,$db; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() { print __METHOD__."\n"; } @@ -261,6 +261,38 @@ class UserTest extends PHPUnit\Framework\TestCase return $localobject; } + /** + * testUserHasRight + * + * @param User $localobject User + * @return void + */ + + public function testUserHasRight() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + print __METHOD__." id=". $user->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + $user->clearrights(); + //print __METHOD__. $user->hasRight('module', 'level11'); + return $user; + } + /** * testUserSetPassword * From e729d76833b08d827486640c9e5a6211540717e9 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:19:26 +0200 Subject: [PATCH 03/25] removing some spaces --- test/phpunit/UserTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 9f106e6e207..d25f7471fc8 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() { global $conf,$user,$langs,$db; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() { print __METHOD__."\n"; } From 7b3fe948a01dc645ccaefb73457eca5ad55f66ac Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Jun 2022 11:20:59 +0000 Subject: [PATCH 04/25] Fixing style errors. --- htdocs/user/class/user.class.php | 6 +++--- test/phpunit/UserTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 143546fbe06..1e6a116686f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -703,7 +703,7 @@ class User extends CommonObject $moduleRightsMapping = array( 'product' => 'produit', // We must check $user->rights->produit... ); - + $rightsPath = $module; if (!empty($moduleRightsMapping[$rightsPath])) { $rightsPath = $moduleRightsMapping[$rightsPath]; @@ -732,13 +732,13 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } + } //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); //var_dump($this->rights); if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { if (!empty($this->rights->$rightsPath->$permlevel1)) { if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index d25f7471fc8..c67d610c931 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -263,11 +263,11 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight - * + * * @param User $localobject User * @return void */ - + public function testUserHasRight() { global $conf,$user,$langs,$db; @@ -282,17 +282,17 @@ class UserTest extends PHPUnit\Framework\TestCase */ print __METHOD__." id=". $user->id ."\n"; - //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); - - $this->assertEquals($user->hasRight('member', ''), 0); + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); $user->clearrights(); //print __METHOD__. $user->hasRight('module', 'level11'); return $user; } - + /** * testUserSetPassword * From ef8b041ac6b5aafccff18792c02b8004acf980a9 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:29:02 +0200 Subject: [PATCH 05/25] resolving phpcs errors --- test/phpunit/UserTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index c67d610c931..0a7431c171f 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -264,10 +264,8 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight * - * @param User $localobject User - * @return void - */ - + * @return void + */ public function testUserHasRight() { global $conf,$user,$langs,$db; @@ -275,7 +273,6 @@ class UserTest extends PHPUnit\Framework\TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - /*$result=$localobject->setstatus(0); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); From 3d0a8dd5959650c83999e76e2e522fe5bb60e45c Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:29:49 +0200 Subject: [PATCH 06/25] running phpcs one last time --- htdocs/user/class/user.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1e6a116686f..96a614857ba 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -675,7 +675,6 @@ class User extends CommonObject public function hasRight($module, $permlevel1, $permlevel2 = '') { global $conf; - // For compatibility with bad naming permissions on module $moduletomoduletouse = array( 'contract' => 'contrat', From b63b7b242d7dec94d74915b2ca5f7b3cb31307cd Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami <73450837+Quatadah@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:32:38 +0200 Subject: [PATCH 07/25] Delete .phpunit.result.cache --- test/phpunit/.phpunit.result.cache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test/phpunit/.phpunit.result.cache diff --git a/test/phpunit/.phpunit.result.cache b/test/phpunit/.phpunit.result.cache deleted file mode 100644 index f2f8f46386b..00000000000 --- a/test/phpunit/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":455:{a:2:{s:7:"defects";a:1:{s:26:"UserTest::testUserHasRight";i:4;}s:5:"times";a:9:{s:24:"UserTest::testUserCreate";d:0.123;s:23:"UserTest::testUserFetch";d:0.002;s:24:"UserTest::testUserUpdate";d:0.048;s:25:"UserTest::testUserDisable";d:0.005;s:23:"UserTest::testUserOther";d:0.002;s:29:"UserTest::testUserSetPassword";d:0.378;s:24:"UserTest::testUserDelete";d:0.006;s:31:"UserTest::testUserAddPermission";d:0.005;s:26:"UserTest::testUserHasRight";d:0.007;}}} \ No newline at end of file From c2213d6b1d9f12788c7409125a840e18cea311c3 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 14:51:03 +0200 Subject: [PATCH 08/25] set -e to set +e --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 45be1a9a6ba..7cf0c562a9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -434,7 +434,7 @@ script: - | echo "Unit testing" # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e + set +e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" From 0af9fe275df38464e183349e67bb421c854dbec2 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:25:23 +0200 Subject: [PATCH 09/25] test userHasRight temporarily commented --- test/phpunit/UserTest.php | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 0a7431c171f..86b32f45c03 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -266,29 +266,29 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public function testUserHasRight() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - /*$result=$localobject->setstatus(0); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - */ + // public function testUserHasRight() + // { + // global $conf,$user,$langs,$db; + // $conf=$this->savconf; + // $user=$this->savuser; + // $langs=$this->savlangs; + // $db=$this->savdb; + // /*$result=$localobject->setstatus(0); + // print __METHOD__." id=".$localobject->id." result=".$result."\n"; + // $this->assertLessThan($result, 0); + // */ - print __METHOD__." id=". $user->id ."\n"; - //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); + // print __METHOD__." id=". $user->id ."\n"; + // //$this->assertNotEquals($user->date_creation, ''); + // $user->addrights(0, 'supplier_proposal'); - $this->assertEquals($user->hasRight('member', ''), 0); - $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); - $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); - $user->clearrights(); - //print __METHOD__. $user->hasRight('module', 'level11'); - return $user; - } + // $this->assertEquals($user->hasRight('member', ''), 0); + // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + // $user->clearrights(); + // //print __METHOD__. $user->hasRight('module', 'level11'); + // return $user; + // } /** * testUserSetPassword From e07a94a0512f7385c5f8506b4e4ea84e04ca4049 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:31:23 +0200 Subject: [PATCH 10/25] changing the testUserHasRight --- test/phpunit/UserTest.php | 47 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 86b32f45c03..39fd87b95a5 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -263,39 +263,38 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight - * - * @return void + * @param User $localobject User + * @return User $localobject User + * @depends testUserOther */ - // public function testUserHasRight() - // { - // global $conf,$user,$langs,$db; - // $conf=$this->savconf; - // $user=$this->savuser; - // $langs=$this->savlangs; - // $db=$this->savdb; - // /*$result=$localobject->setstatus(0); - // print __METHOD__." id=".$localobject->id." result=".$result."\n"; - // $this->assertLessThan($result, 0); - // */ + public function testUserHasRight($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ - // print __METHOD__." id=". $user->id ."\n"; - // //$this->assertNotEquals($user->date_creation, ''); - // $user->addrights(0, 'supplier_proposal'); + print __METHOD__." id=". $localobject->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + $this->assertEquals($localobject->hasRight('member', ''), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); - // $this->assertEquals($user->hasRight('member', ''), 0); - // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); - // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); - // $user->clearrights(); - // //print __METHOD__. $user->hasRight('module', 'level11'); - // return $user; - // } + return $localobject; + } /** * testUserSetPassword * * @param User $localobject User * @return void - * @depends testUserOther + * @depends testUserHasRight * The depends says test is run only if previous is ok */ public function testUserSetPassword($localobject) From a11732bb0d12f3ad292155ede13ef45c2aa241cb Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:44:40 +0200 Subject: [PATCH 11/25] done --- .travis.yml | 549 +++++++++++++++++++------------------- test/phpunit/UserTest.php | 2 +- 2 files changed, 273 insertions(+), 278 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7cf0c562a9f..da3856b5254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,30 +14,30 @@ git: # Start on every boot services: -- memcached -- mysql -- postgresql + - memcached + - mysql + - postgresql addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '9.4' + postgresql: "9.4" apt: sources: - # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - - pgdg-xenial + # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ + - pgdg-xenial packages: - # We need a webserver to test the webservices - # Let's install Apache with. - - apache2 - # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi - # We need pgloader for import mysql database into pgsql - - pgloader + # We need a webserver to test the webservices + # Let's install Apache with. + - apache2 + # mod_php is not supported by Travis. Add fcgi. We install FPM later on. + - libapache2-mod-fastcgi + # We need pgloader for import mysql database into pgsql + - pgloader env: global: - # Set to true for very verbose output - - DEBUG=false + # Set to true for very verbose output + - DEBUG=false jobs: fast_finish: true @@ -46,19 +46,19 @@ jobs: include: - stage: PHP 5.6-7.4 if: type = push - php: '5.6' + php: "5.6" env: DB=postgresql - stage: PHP 5.6-7.4 if: type = pull_request OR type = push - php: '7.4.22' + php: "7.4.22" env: DB=mysql - stage: PHP Dev if: type = push AND branch = develop - php: nightly + php: nightly env: DB=mysql - stage: PHP Dev if: type = push AND branch = 15.0 - php: nightly + php: nightly env: DB=mysql notifications: @@ -67,69 +67,67 @@ notifications: on_failure: never # [always|never|change] default: always irc: channels: - - "chat.freenode.net#dolibarr" + - "chat.freenode.net#dolibarr" on_success: change on_failure: always use_notice: true before_install: -- | - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo + - | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: -- | - echo "Updating Composer" - rm $TRAVIS_BUILD_DIR/composer.json - rm $TRAVIS_BUILD_DIR/composer.lock - composer -V - composer self-update - composer -n init - composer -n config vendor-dir htdocs/includes - composer -n config -g vendor-dir htdocs/includes - echo - -- | - echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" - if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then - composer -n require phpunit/phpunit ^5 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then - composer -n require phpunit/phpunit ^6 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then - composer -n require phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then - composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - echo - -- | - echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" - echo $PATH - ls $TRAVIS_BUILD_DIR/vendor - ls $TRAVIS_BUILD_DIR/htdocs/includes/bin - echo + - | + echo "Updating Composer" + rm $TRAVIS_BUILD_DIR/composer.json + rm $TRAVIS_BUILD_DIR/composer.lock + composer -V + composer self-update + composer -n init + composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes + echo + - | + echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" + if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then + composer -n require phpunit/phpunit ^5 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then + composer -n require phpunit/phpunit ^6 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then + composer -n require phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + # phpunit 9 is required for php 8 + if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + echo + - | + echo "Adding path of binaries tools installed by composer to the PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin + echo before_script: - | @@ -236,7 +234,6 @@ before_script: echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo - - echo "Setting up Apache + FPM" # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf @@ -256,221 +253,219 @@ before_script: - sudo cat /etc/apache2/sites-available/000-default.conf - sudo service apache2 restart - - script: -- | - echo "Checking webserver availability by a wget -O - http://127.0.0.1" - # Ensure we stop on error with set -e - set +e - # The wget should return a page with line ' - wget -O - http://127.0.0.1 > test.html - head test.html - sudo cat /var/log/apache2/travis_error_log - set +e - echo + - | + echo "Checking webserver availability by a wget -O - http://127.0.0.1" + # Ensure we stop on error with set -e + set +e + # The wget should return a page with line ' + wget -O - http://127.0.0.1 > test.html + head test.html + sudo cat /var/log/apache2/travis_error_log + set +e + echo -- | - echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - #parallel-lint --exclude htdocs/includes --blame . - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ - --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ - --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ - --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ - --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . - fi - set +e - echo + - | + echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + #parallel-lint --exclude htdocs/includes --blame . + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + fi + set +e + echo -- | - echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; - fi - set +e - echo + - | + echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; + fi + set +e + echo -- | - export INSTALL_FORCED_FILE=htdocs/install/install.forced.php - echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" - # Ensure we catch errors - set +e - echo ' $INSTALL_FORCED_FILE - echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then - echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE - fi - if [ "$DB" = 'postgresql' ]; then - echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE - fi - echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE - #cat $INSTALL_FORCED_FILE + - | + export INSTALL_FORCED_FILE=htdocs/install/install.forced.php + echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" + # Ensure we catch errors + set +e + echo ' $INSTALL_FORCED_FILE + echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE + fi + if [ "$DB" = 'postgresql' ]; then + echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE + fi + echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE + #cat $INSTALL_FORCED_FILE -#- | -# echo "Installing Dolibarr" -# cd htdocs/install -# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log -# php step2.php set >> $TRAVIS_BUILD_DIR/install.log -# if [ "$?" -ne "0" ]; then -# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" -# cat $TRAVIS_BUILD_DIR/install.log -# exit 1 -# fi -# cd ../.. -# rm $INSTALL_FORCED_FILE -# #cat $TRAVIS_BUILD_DIR/install.log -# set +e -# echo + #- | + # echo "Installing Dolibarr" + # cd htdocs/install + # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log + # php step2.php set >> $TRAVIS_BUILD_DIR/install.log + # if [ "$?" -ne "0" ]; then + # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" + # cat $TRAVIS_BUILD_DIR/install.log + # exit 1 + # fi + # cd ../.. + # rm $INSTALL_FORCED_FILE + # #cat $TRAVIS_BUILD_DIR/install.log + # set +e + # echo -- | - echo "Setting up database to test migrations" - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then - echo "MySQL" - mysql -e 'DROP DATABASE IF EXISTS travis;' - mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' - mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' - mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - fi - if [ "$DB" = 'postgresql' ]; then - #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr - echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis - pgloader mysql://root@127.0.0.1/travis postgresql:///travis - echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis - echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis - #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis - #echo 'select * from information_schema.table_constraints;' | psql travis - #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis - fi - echo + - | + echo "Setting up database to test migrations" + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then + echo "MySQL" + mysql -e 'DROP DATABASE IF EXISTS travis;' + mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' + mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' + mysql -e 'FLUSH PRIVILEGES;' + mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + fi + if [ "$DB" = 'postgresql' ]; then + #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr + echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis + pgloader mysql://root@127.0.0.1/travis postgresql:///travis + echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis + echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis + #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis + #echo 'select * from information_schema.table_constraints;' | psql travis + #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis + fi + echo -- | - echo "Upgrading Dolibarr" - # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. - set +e - cd htdocs/install - php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log - php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log - php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log - php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log - php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log - php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log - php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log - php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log - php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log - php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log - php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log - php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log - php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log - php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log - php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log - php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log - php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log - php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log - php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log - php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log - php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log - php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log - php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log - php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log - php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log - php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log - php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log - php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log - php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log - php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log - php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log - php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log - php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log - php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log - php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log - php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log - php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log - php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log - php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log - php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log - php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log - php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log - php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log - ls -alrt $TRAVIS_BUILD_DIR/ + - | + echo "Upgrading Dolibarr" + # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. + set +e + cd htdocs/install + php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log + php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log + php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log + php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log + php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log + php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log + php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log + php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log + php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log + php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log + php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log + php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log + php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log + php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log + php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log + php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log + php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log + php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log + php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log + php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log + php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log + php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log + php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log + php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log + php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log + php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log + php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log + php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log + php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log + php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log + php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log + php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log + php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log + php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log + php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log + php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log + ls -alrt $TRAVIS_BUILD_DIR/ -- | - echo "Enabling new modules" - # Enable modules not enabled into original dump - set -e - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log - echo $? - cd - - set +e - echo - #cat /tmp/dolibarr_install.log - cat $TRAVIS_BUILD_DIR/enablemodule.log + - | + echo "Enabling new modules" + # Enable modules not enabled into original dump + set -e + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log + echo $? + cd - + set +e + echo + #cat /tmp/dolibarr_install.log + cat $TRAVIS_BUILD_DIR/enablemodule.log -- | - echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set +e - phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunitresult=$? - echo "Phpunit return code = $phpunitresult" - set +e + - | + echo "Unit testing" + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. + set -e + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + phpunitresult=$? + echo "Phpunit return code = $phpunitresult" + set +e after_script: -- | - echo "After script - Output last lines of dolibarr.log" - ls $TRAVIS_BUILD_DIR/documents - #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log - sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + - | + echo "After script - Output last lines of dolibarr.log" + ls $TRAVIS_BUILD_DIR/documents + #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log + sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log after_success: -- | - echo Success + - | + echo Success after_failure: -- | - echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files - for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` - do - echo "Debugging informations for file $ficlog" - #cat $ficlog - done - # Apache log file - echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/travis_error_log - if [ "$DEBUG" = true ]; then - # Dolibarr log file - echo "Debugging informations for file dolibarr.log (latest 50 lines)" - tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - # Database log file - echo "Debugging informations for file mysql error.log" - sudo tail -n 50 /var/log/mysql/error.log - # TODO: PostgreSQL log file - echo - fi + - | + echo Failure detected, so we show samples of log to help diagnose + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files + for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` + do + echo "Debugging informations for file $ficlog" + #cat $ficlog + done + # Apache log file + echo "Debugging informations for file apache error.log" + sudo cat /var/log/apache2/travis_error_log + if [ "$DEBUG" = true ]; then + # Dolibarr log file + echo "Debugging informations for file dolibarr.log (latest 50 lines)" + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + # Database log file + echo "Debugging informations for file mysql error.log" + sudo tail -n 50 /var/log/mysql/error.log + # TODO: PostgreSQL log file + echo + fi diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 39fd87b95a5..bd5ed8ba7ad 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -281,7 +281,7 @@ class UserTest extends PHPUnit\Framework\TestCase print __METHOD__." id=". $localobject->id ."\n"; //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); + $localobject->addrights(0, 'supplier_proposal'); $this->assertEquals($localobject->hasRight('member', ''), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); From 7f4c7c7e7b1078eb50c844d80866d12baa49a21d Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami Date: Thu, 16 Jun 2022 14:29:30 +0200 Subject: [PATCH 12/25] revert commit in travis yml file --- .travis.yml | 549 ++++++++++++++++++++++++++-------------------------- 1 file changed, 277 insertions(+), 272 deletions(-) diff --git a/.travis.yml b/.travis.yml index da3856b5254..45be1a9a6ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,30 +14,30 @@ git: # Start on every boot services: - - memcached - - mysql - - postgresql +- memcached +- mysql +- postgresql addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: "9.4" + postgresql: '9.4' apt: sources: - # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - - pgdg-xenial + # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ + - pgdg-xenial packages: - # We need a webserver to test the webservices - # Let's install Apache with. - - apache2 - # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi - # We need pgloader for import mysql database into pgsql - - pgloader + # We need a webserver to test the webservices + # Let's install Apache with. + - apache2 + # mod_php is not supported by Travis. Add fcgi. We install FPM later on. + - libapache2-mod-fastcgi + # We need pgloader for import mysql database into pgsql + - pgloader env: global: - # Set to true for very verbose output - - DEBUG=false + # Set to true for very verbose output + - DEBUG=false jobs: fast_finish: true @@ -46,19 +46,19 @@ jobs: include: - stage: PHP 5.6-7.4 if: type = push - php: "5.6" + php: '5.6' env: DB=postgresql - stage: PHP 5.6-7.4 if: type = pull_request OR type = push - php: "7.4.22" + php: '7.4.22' env: DB=mysql - stage: PHP Dev if: type = push AND branch = develop - php: nightly + php: nightly env: DB=mysql - stage: PHP Dev if: type = push AND branch = 15.0 - php: nightly + php: nightly env: DB=mysql notifications: @@ -67,67 +67,69 @@ notifications: on_failure: never # [always|never|change] default: always irc: channels: - - "chat.freenode.net#dolibarr" + - "chat.freenode.net#dolibarr" on_success: change on_failure: always use_notice: true before_install: - - | - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo +- | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: - - | - echo "Updating Composer" - rm $TRAVIS_BUILD_DIR/composer.json - rm $TRAVIS_BUILD_DIR/composer.lock - composer -V - composer self-update - composer -n init - composer -n config vendor-dir htdocs/includes - composer -n config -g vendor-dir htdocs/includes - echo +- | + echo "Updating Composer" + rm $TRAVIS_BUILD_DIR/composer.json + rm $TRAVIS_BUILD_DIR/composer.lock + composer -V + composer self-update + composer -n init + composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes + echo + +- | + echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" + if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then + composer -n require phpunit/phpunit ^5 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then + composer -n require phpunit/phpunit ^6 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then + composer -n require phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + # phpunit 9 is required for php 8 + if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + echo + +- | + echo "Adding path of binaries tools installed by composer to the PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin + echo - - | - echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" - if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then - composer -n require phpunit/phpunit ^5 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then - composer -n require phpunit/phpunit ^6 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then - composer -n require phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then - composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - echo - - | - echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" - echo $PATH - ls $TRAVIS_BUILD_DIR/vendor - ls $TRAVIS_BUILD_DIR/htdocs/includes/bin - echo before_script: - | @@ -234,6 +236,7 @@ before_script: echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo + - echo "Setting up Apache + FPM" # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf @@ -253,219 +256,221 @@ before_script: - sudo cat /etc/apache2/sites-available/000-default.conf - sudo service apache2 restart + + script: - - | - echo "Checking webserver availability by a wget -O - http://127.0.0.1" - # Ensure we stop on error with set -e - set +e - # The wget should return a page with line ' - wget -O - http://127.0.0.1 > test.html - head test.html - sudo cat /var/log/apache2/travis_error_log - set +e - echo +- | + echo "Checking webserver availability by a wget -O - http://127.0.0.1" + # Ensure we stop on error with set -e + set +e + # The wget should return a page with line ' + wget -O - http://127.0.0.1 > test.html + head test.html + sudo cat /var/log/apache2/travis_error_log + set +e + echo - - | - echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - #parallel-lint --exclude htdocs/includes --blame . - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ - --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ - --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ - --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ - --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . - fi - set +e - echo +- | + echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + #parallel-lint --exclude htdocs/includes --blame . + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + fi + set +e + echo - - | - echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; - fi - set +e - echo +- | + echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; + fi + set +e + echo - - | - export INSTALL_FORCED_FILE=htdocs/install/install.forced.php - echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" - # Ensure we catch errors - set +e - echo ' $INSTALL_FORCED_FILE - echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then - echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE - fi - if [ "$DB" = 'postgresql' ]; then - echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE - fi - echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE - #cat $INSTALL_FORCED_FILE +- | + export INSTALL_FORCED_FILE=htdocs/install/install.forced.php + echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" + # Ensure we catch errors + set +e + echo ' $INSTALL_FORCED_FILE + echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE + fi + if [ "$DB" = 'postgresql' ]; then + echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE + fi + echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE + #cat $INSTALL_FORCED_FILE - #- | - # echo "Installing Dolibarr" - # cd htdocs/install - # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log - # php step2.php set >> $TRAVIS_BUILD_DIR/install.log - # if [ "$?" -ne "0" ]; then - # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" - # cat $TRAVIS_BUILD_DIR/install.log - # exit 1 - # fi - # cd ../.. - # rm $INSTALL_FORCED_FILE - # #cat $TRAVIS_BUILD_DIR/install.log - # set +e - # echo +#- | +# echo "Installing Dolibarr" +# cd htdocs/install +# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log +# php step2.php set >> $TRAVIS_BUILD_DIR/install.log +# if [ "$?" -ne "0" ]; then +# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" +# cat $TRAVIS_BUILD_DIR/install.log +# exit 1 +# fi +# cd ../.. +# rm $INSTALL_FORCED_FILE +# #cat $TRAVIS_BUILD_DIR/install.log +# set +e +# echo - - | - echo "Setting up database to test migrations" - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then - echo "MySQL" - mysql -e 'DROP DATABASE IF EXISTS travis;' - mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' - mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' - mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - fi - if [ "$DB" = 'postgresql' ]; then - #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr - echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis - pgloader mysql://root@127.0.0.1/travis postgresql:///travis - echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis - echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis - #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis - #echo 'select * from information_schema.table_constraints;' | psql travis - #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis - fi - echo +- | + echo "Setting up database to test migrations" + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then + echo "MySQL" + mysql -e 'DROP DATABASE IF EXISTS travis;' + mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' + mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' + mysql -e 'FLUSH PRIVILEGES;' + mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + fi + if [ "$DB" = 'postgresql' ]; then + #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr + echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis + pgloader mysql://root@127.0.0.1/travis postgresql:///travis + echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis + echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis + #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis + #echo 'select * from information_schema.table_constraints;' | psql travis + #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis + fi + echo - - | - echo "Upgrading Dolibarr" - # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. - set +e - cd htdocs/install - php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log - php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log - php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log - php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log - php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log - php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log - php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log - php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log - php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log - php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log - php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log - php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log - php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log - php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log - php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log - php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log - php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log - php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log - php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log - php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log - php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log - php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log - php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log - php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log - php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log - php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log - php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log - php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log - php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log - php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log - php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log - php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log - php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log - php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log - php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log - php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log - php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log - php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log - php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log - php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log - php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log - php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log - php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log - ls -alrt $TRAVIS_BUILD_DIR/ +- | + echo "Upgrading Dolibarr" + # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. + set +e + cd htdocs/install + php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log + php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log + php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log + php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log + php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log + php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log + php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log + php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log + php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log + php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log + php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log + php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log + php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log + php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log + php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log + php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log + php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log + php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log + php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log + php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log + php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log + php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log + php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log + php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log + php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log + php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log + php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log + php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log + php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log + php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log + php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log + php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log + php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log + php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log + php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log + php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log + ls -alrt $TRAVIS_BUILD_DIR/ - - | - echo "Enabling new modules" - # Enable modules not enabled into original dump - set -e - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log - echo $? - cd - - set +e - echo - #cat /tmp/dolibarr_install.log - cat $TRAVIS_BUILD_DIR/enablemodule.log +- | + echo "Enabling new modules" + # Enable modules not enabled into original dump + set -e + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log + echo $? + cd - + set +e + echo + #cat /tmp/dolibarr_install.log + cat $TRAVIS_BUILD_DIR/enablemodule.log - - | - echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e - phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunitresult=$? - echo "Phpunit return code = $phpunitresult" - set +e +- | + echo "Unit testing" + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. + set -e + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + phpunitresult=$? + echo "Phpunit return code = $phpunitresult" + set +e after_script: - - | - echo "After script - Output last lines of dolibarr.log" - ls $TRAVIS_BUILD_DIR/documents - #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log - sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log +- | + echo "After script - Output last lines of dolibarr.log" + ls $TRAVIS_BUILD_DIR/documents + #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log + sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log after_success: - - | - echo Success +- | + echo Success after_failure: - - | - echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files - for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` - do - echo "Debugging informations for file $ficlog" - #cat $ficlog - done - # Apache log file - echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/travis_error_log - if [ "$DEBUG" = true ]; then - # Dolibarr log file - echo "Debugging informations for file dolibarr.log (latest 50 lines)" - tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - # Database log file - echo "Debugging informations for file mysql error.log" - sudo tail -n 50 /var/log/mysql/error.log - # TODO: PostgreSQL log file - echo - fi +- | + echo Failure detected, so we show samples of log to help diagnose + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files + for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` + do + echo "Debugging informations for file $ficlog" + #cat $ficlog + done + # Apache log file + echo "Debugging informations for file apache error.log" + sudo cat /var/log/apache2/travis_error_log + if [ "$DEBUG" = true ]; then + # Dolibarr log file + echo "Debugging informations for file dolibarr.log (latest 50 lines)" + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + # Database log file + echo "Debugging informations for file mysql error.log" + sudo tail -n 50 /var/log/mysql/error.log + # TODO: PostgreSQL log file + echo + fi From bc1449f1c277307df9f973da5415f63a82ea624d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jun 2022 20:51:58 +0200 Subject: [PATCH 13/25] Fix sepa generation (no special char _) --- .../class/bonprelevement.class.php | 106 ++++++++++-------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index fcf13fe8c0e..8cfdcf7e02b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -64,6 +64,7 @@ class BonPrelevement extends CommonObject public $emetteur_numero_compte; public $emetteur_code_banque; public $emetteur_number_key; + public $sepa_xml_pti_in_ctti; public $emetteur_iban; public $emetteur_bic; @@ -77,6 +78,8 @@ class BonPrelevement extends CommonObject public $statut; // 0-Wait, 1-Trans, 2-Done public $labelStatus = array(); + public $factures = array(); + public $invoice_in_error = array(); public $thirdparty_in_error = array(); @@ -107,6 +110,7 @@ class BonPrelevement extends CommonObject $this->emetteur_numero_compte = ""; $this->emetteur_code_banque = ""; $this->emetteur_number_key = ""; + $this->sepa_xml_pti_in_ctti = false; $this->emetteur_iban = ""; $this->emetteur_bic = ""; @@ -392,10 +396,10 @@ class BonPrelevement extends CommonObject $amounts[$fac->id] = $facs[$i][1]; $amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1]; - $totalpaye = $fac->getSommePaiement(); + $totalpaid = $fac->getSommePaiement(); $totalcreditnotes = $fac->getSumCreditNotesUsed(); $totaldeposits = $fac->getSumDepositsUsed(); - $alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits; + $alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits; // @TODO Move this after creation of payment if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) { @@ -911,6 +915,7 @@ class BonPrelevement extends CommonObject $this->db->begin(); $now = dol_now(); + $ref = ''; /* * Process order generation @@ -1044,10 +1049,11 @@ class BonPrelevement extends CommonObject } $account = new Account($this->db); if ($account->fetch($id) > 0) { - $this->emetteur_code_banque = $account->code_banque; + $this->emetteur_code_banque = $account->code_banque; $this->emetteur_code_guichet = $account->code_guichet; $this->emetteur_numero_compte = $account->number; - $this->emetteur_number_key = $account->cle_rib; + $this->emetteur_number_key = $account->cle_rib; + $this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti; $this->emetteur_iban = $account->iban; $this->emetteur_bic = $account->bic; @@ -1063,8 +1069,8 @@ class BonPrelevement extends CommonObject // This also set the property $this->total with amount that is included into file $result = $this->generate($format, $executiondate, $type); if ($result < 0) { - /*var_dump($this->error); - var_dump($this->invoice_in_error); */ + //var_dump($this->error); + //var_dump($this->invoice_in_error); $error++; } } @@ -1240,13 +1246,6 @@ class BonPrelevement extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - - /* - $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -1266,7 +1265,7 @@ class BonPrelevement extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('banktransferdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -1489,7 +1488,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$i.''.$CrLf); fputs($this->file, ' '.$this->total.''.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf); + fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -1605,7 +1604,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$i.''.$CrLf); fputs($this->file, ' '.$this->total.''.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf); + fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -1834,7 +1833,7 @@ class BonPrelevement extends CommonObject $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); if ($type != 'bank-transfer') { - // SEPA Paiement Information of buyer for Direct debit + // SEPA Paiement Information of buyer for Direct Debit $XML_DEBITOR = ''; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -1855,16 +1854,16 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; - $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ''))).''.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$row_country_code.''.$CrLf; $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); if (trim($addressline1)) { - $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if (trim($addressline2)) { - $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -1887,6 +1886,24 @@ class BonPrelevement extends CommonObject // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) $XML_CREDITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_CREDITOR .= ' '.$CrLf; + if (!empty($this->sepa_xml_pti_in_ctti)) { + $XML_CREDITOR .= ' ' . $CrLf; + + // Can be 'NORM' for normal or 'HIGH' for high priority level + if (!empty($conf->global->PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY)) { + $instrprty = 'HIGH'; + } else { + $instrprty = 'NORM'; + } + $XML_CREDITOR .= ' '.$instrprty.'' . $CrLf; + $XML_CREDITOR .= ' ' . $CrLf; + $XML_CREDITOR .= ' SEPA' . $CrLf; + $XML_CREDITOR .= ' ' . $CrLf; + $XML_CREDITOR .= ' ' . $CrLf; + $XML_CREDITOR .= ' CORE' . $CrLf; + $XML_CREDITOR .= ' ' . $CrLf; + $XML_CREDITOR .= ' ' . $CrLf; + } $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.round($row_somme, 2).''.$CrLf; $XML_CREDITOR .= ' '.$CrLf; @@ -1912,10 +1929,10 @@ class BonPrelevement extends CommonObject $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); if (trim($addressline1)) { - $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if (trim($addressline2)) { - $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; @@ -2037,6 +2054,7 @@ class BonPrelevement extends CommonObject $this->emetteur_code_guichet = $account->code_guichet; $this->emetteur_numero_compte = $account->number; $this->emetteur_number_key = $account->cle_rib; + $this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti; $this->emetteur_iban = $account->iban; $this->emetteur_bic = $account->bic; @@ -2060,7 +2078,7 @@ class BonPrelevement extends CommonObject $RefBon = $obj->ref; if ($type != 'bank-transfer') { - // SEPA Paiement Information of my company for Direct debit + // SEPA Paiement Information of my company for Direct Debit $XML_SEPA_INFO = ''; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).''.$CrLf; @@ -2078,16 +2096,16 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$dateTime_ETAD.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); if ($addressline1) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if ($addressline2) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -2105,8 +2123,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV @@ -2131,29 +2149,29 @@ class BonPrelevement extends CommonObject //$XML_SEPA_INFO .= ' False'.$CrLf; $XML_SEPA_INFO .= ' '.$nombre.''.$CrLf; $XML_SEPA_INFO .= ' '.$total.''.$CrLf; - /* - $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' SEPA'.$CrLf; - $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' TRF'.$CrLf; - $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' SECU'.$CrLf; - $XML_SEPA_INFO .= ' '.$CrLf; - */ + if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. + $XML_SEPA_INFO .= ' ' . $CrLf; + $XML_SEPA_INFO .= ' ' . $CrLf; + $XML_SEPA_INFO .= ' SEPA' . $CrLf; + $XML_SEPA_INFO .= ' ' . $CrLf; + $XML_SEPA_INFO .= ' ' . $CrLf; + $XML_SEPA_INFO .= ' CORE' . $CrLf; + $XML_SEPA_INFO .= ' ' . $CrLf; + $XML_SEPA_INFO .= ' ' . $format . '' . $CrLf; + $XML_SEPA_INFO .= ' ' . $CrLf; + } $XML_SEPA_INFO .= ' '.dol_print_date($dateTime_ETAD, 'dayrfc').''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); if ($addressline1) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if ($addressline2) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -2171,8 +2189,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV From d370571963497c988bb3ab89c2716cffd71b6298 Mon Sep 17 00:00:00 2001 From: GregM Date: Mon, 20 Jun 2022 14:59:13 +0200 Subject: [PATCH 14/25] FIX class center linkedObjectblock order date --- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 2a6140aaeed..9c6ed818957 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; echo ''.$objectlink->getNomUrl(1).''; echo ''.$objectlink->ref_client.''; - echo ''.dol_print_date($objectlink->date, 'day').''; + echo ''.dol_print_date($objectlink->date, 'day').''; echo ''; if ($user->rights->commande->lire) { $total = $total + $objectlink->total_ht; From 8b06d68cc0151b580755b63f851dab04b91f8c04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Jun 2022 10:06:33 +0200 Subject: [PATCH 15/25] Clean package --- build/makepack-dolibarr.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 906601d94d4..2cce46146c4 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -499,8 +499,9 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.nova*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.pgsql`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mssql/README`; From 156ddb989649700448e608779417067c5b2ef01e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 13:24:15 +0200 Subject: [PATCH 16/25] FIX: fiche inter url link into Commerce index --- htdocs/comm/index.php | 51 +++++++++++++++++++--- htdocs/fichinter/class/fichinter.class.php | 1 - 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index aad02f2bd07..3b22c018eba 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -39,6 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; +if (!empty($conf->ficheinter->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +} // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager = new HookManager($db); @@ -100,6 +103,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $supplierorderstatic = new CommandeFournisseur($db); } +if (!empty($conf->ficheinter->enabled)) { + $fichinterstatic = new Fichinter($db); +} + llxHeader("", $langs->trans("CommercialArea")); print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial'); @@ -508,7 +515,12 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU * Draft interventionals */ if (!empty($conf->ficheinter->enabled)) { - $sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid"; + $sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut"; + $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; + $sql .= ", s.code_client, s.code_compta, s.client"; + $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; + $sql .= ", s.logo, s.email, s.entity"; + $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { @@ -524,22 +536,47 @@ if (!empty($conf->ficheinter->enabled)) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } + $resql = $db->query($sql); if ($resql) { + + $num = $db->num_rows($resql); + $nbofloop = min($num, $maxofloop); + print '
'; print ''; print ''; print ''; - $langs->load("fichinter"); - $num = $db->num_rows($resql); + if ($num) { $i = 0; - while ($i < $num) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); + + $fichinterstatic->id=$obj->rowid; + $fichinterstatic->ref=$obj->ref; + $fichinterstatic->statut=$obj->fk_statut; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->name_alias = $obj->name_alias; + $companystatic->code_client = $obj->code_client; + $companystatic->code_compta = $obj->code_compta; + $companystatic->client = $obj->client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + $companystatic->fournisseur = $obj->fournisseur; + $companystatic->logo = $obj->logo; + $companystatic->email = $obj->email; + $companystatic->entity = $obj->entity; + $companystatic->canvas = $obj->canvas; print ''; - print '"; - print ''; + print '"; + print ''; $i++; } } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4bbf4e0327b..97812ca6e63 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -805,7 +805,6 @@ class Fichinter extends CommonObject $linkstart = ''; $linkend = ''; - $result .= $linkstart; if ($withpicto) { $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); From 10c0d8381dd49fd7c61161c95c9fee229f70bad6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 13:25:06 +0200 Subject: [PATCH 17/25] FIX: fiche inter url link into Commerce index --- htdocs/fichinter/class/fichinter.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 97812ca6e63..4bbf4e0327b 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -805,6 +805,7 @@ class Fichinter extends CommonObject $linkstart = ''; $linkend = ''; + $result .= $linkstart; if ($withpicto) { $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); From df585c21eec8bf9b9b9db141388bb49d7c2aea71 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Jun 2022 11:31:47 +0000 Subject: [PATCH 18/25] Fixing style errors. --- htdocs/comm/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 3b22c018eba..fd820b2de6a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -539,7 +539,6 @@ if (!empty($conf->ficheinter->enabled)) { $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $nbofloop = min($num, $maxofloop); From abdfc90eaedfb80e747a20552c3e922df7cacb93 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 13:43:07 +0200 Subject: [PATCH 19/25] FIX: Fiche inter graph by status on ficheinter Index page --- htdocs/fichinter/index.php | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 0f0fc0acc99..1e3242e4b7e 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -89,7 +89,6 @@ $sql .= " GROUP BY f.fk_statut"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i = 0; $total = 0; $totalinprocess = 0; @@ -97,38 +96,30 @@ if ($resql) { $vals = array(); $bool = false; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) - while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) { - //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) - { - $bool = (!empty($row[2]) ?true:false); - if (!isset($vals[$row[1].$bool])) { - $vals[$row[1].$bool] = 0; - } - $vals[$row[1].$bool] += $row[0]; - $totalinprocess += $row[0]; + if ($num>0) { + while ($row = $db->fetch_row($resql)) { + var_dump($row); + $bool = (!empty($row[2]) ? true : false); + + if (!isset($vals[$row[1] . $bool])) { + $vals[$row[1] . $bool] = 0; } + $vals[$row[1] . $bool] += $row[0]; + $totalinprocess += $row[0]; + $total += $row[0]; } - $i++; } $db->free($resql); - include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; print '
'; print '
'.$langs->trans("DraftFichinter").'
'; - print "rowid."\">".img_object($langs->trans("ShowFichinter"), "intervention").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).'
'; + print $fichinterstatic->getNomUrl(1); + print "'; + print $companystatic->getNomUrl(1, 'customer'); + print '
'; print ''."\n"; - $listofstatus = array(0, 1, 3); - $bool = false; + $listofstatus = array(Fichinter::STATUS_DRAFT, Fichinter::STATUS_VALIDATED, Fichinter::STATUS_BILLED, Fichinter::STATUS_CLOSED); + foreach ($listofstatus as $status) { - $dataseries[] = array($fichinterstatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool]) ? (int) $vals[$status.$bool] : 0)); - if ($status == 3 && !$bool) { - $bool = true; - } else { - $bool = false; - } + $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); if ($status == Fichinter::STATUS_DRAFT) { $colorseries[$status] = '-'.$badgeStatus0; @@ -143,6 +134,7 @@ if ($resql) { $colorseries[$status] = $badgeStatus6; } } + var_dump($dataseries); if ($conf->use_javascript_ajax) { print '
'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'
'; From c5101f4bd79fdfbbc6ab508d511f6720ca3ca879 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 13:45:06 +0200 Subject: [PATCH 20/25] FIX: Fiche inter graph by status on ficheinter Index page --- htdocs/fichinter/index.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 1e3242e4b7e..d4940ccb806 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -98,13 +98,11 @@ if ($resql) { // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) if ($num>0) { while ($row = $db->fetch_row($resql)) { - var_dump($row); - $bool = (!empty($row[2]) ? true : false); - if (!isset($vals[$row[1] . $bool])) { - $vals[$row[1] . $bool] = 0; + if (!isset($vals[$row[1]])) { + $vals[$row[1]] = 0; } - $vals[$row[1] . $bool] += $row[0]; + $vals[$row[1]] += $row[0]; $totalinprocess += $row[0]; $total += $row[0]; @@ -134,7 +132,7 @@ if ($resql) { $colorseries[$status] = $badgeStatus6; } } - var_dump($dataseries); + if ($conf->use_javascript_ajax) { print '
'; From e908118db8774d9b5cd65dadba5258ef048690ff Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Jun 2022 11:52:58 +0000 Subject: [PATCH 21/25] Fixing style errors. --- htdocs/fichinter/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index d4940ccb806..0b079e3f22d 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -98,7 +98,6 @@ if ($resql) { // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) if ($num>0) { while ($row = $db->fetch_row($resql)) { - if (!isset($vals[$row[1]])) { $vals[$row[1]] = 0; } From 9d20e602d1cbc56b5af5fe521b5692f7486b998a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 14:28:33 +0200 Subject: [PATCH 22/25] fix: remove warning GETPOST --- 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 1cdcfcdc54c..ffc88c157ff 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -682,7 +682,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null // - posted value not empty, or // - if posted value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not). - if ($out != '') { // $out = '0' or 'abc', it is a search criteria to keep + if ($out != '' && isset($user)) {// $out = '0' or 'abc', it is a search criteria to keep $user->lastsearch_values_tmp[$relativepathstring][$paramname] = $out; } } From 98ee53c4b1d2fde6f4239bf2e2be969f8fa733be Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 22 Jun 2022 15:13:13 +0200 Subject: [PATCH 23/25] fix: massaction delete on actioncomm list do not call delete with good paramters --- htdocs/core/actions_massactions.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 5e803ae3cdf..b98ce37d8f1 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1324,6 +1324,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if (in_array($objecttmp->element, array('societe', 'member'))) { $result = $objecttmp->delete($objecttmp->id, $user, 1); + } elseif (in_array($objecttmp->element, array('action'))) { + $result = $objecttmp->delete(); } else { $result = $objecttmp->delete($user); } From 8075a40bd96738727abe2cf0739fb1d3c6eda474 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jun 2022 18:12:36 +0200 Subject: [PATCH 24/25] FIX #21323 --- htdocs/core/modules/action/rapport.pdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 8b80492685d..0659c39d394 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -125,7 +125,7 @@ class CommActionRapport $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); $dir = $conf->agenda->dir_temp."/"; - $file = $dir."actions-".$this->month."-".$this->year.".pdf"; + $file = $dir."actions-".sprintf("%02d", $this->month)."-".sprintf("%04d", $this->year).".pdf"; if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { From d409a534d749bb733e38c80330c852a281b80102 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 23 Jun 2022 10:20:26 +0200 Subject: [PATCH 25/25] Ok better --- htdocs/fichinter/index.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index d4940ccb806..f40932c7faf 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -114,7 +114,8 @@ if ($resql) { print '
'; print ''; print ''."\n"; - $listofstatus = array(Fichinter::STATUS_DRAFT, Fichinter::STATUS_VALIDATED, Fichinter::STATUS_BILLED, Fichinter::STATUS_CLOSED); + $listofstatus = array(Fichinter::STATUS_DRAFT, Fichinter::STATUS_VALIDATED); + if (!empty($conf->global->FICHINTER_CLASSIFY_BILLED)) $listofstatus[] = Fichinter::STATUS_BILLED; foreach ($listofstatus as $status) { $dataseries[] = array($fichinterstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); @@ -128,9 +129,6 @@ if ($resql) { if ($status == Fichinter::STATUS_BILLED) { $colorseries[$status] = $badgeStatus4; } - if ($status == Fichinter::STATUS_CLOSED) { - $colorseries[$status] = $badgeStatus6; - } } if ($conf->use_javascript_ajax) { @@ -149,21 +147,15 @@ if ($resql) { print ''; } - $bool = false; foreach ($listofstatus as $status) { if (!$conf->use_javascript_ajax) { print ''; print ''; - print ''; print "\n"; - if ($status == 3 && !$bool) { - $bool = true; - } else { - $bool = false; - } } } //if ($totalinprocess != $total)
'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'
'.$fichinterstatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; - print $fichinterstatic->LibStatut($status, $bool, 3); + print ''.(isset($vals[$status]) ? $vals[$status] : 0).' '; + print $fichinterstatic->LibStatut($status, 3); print ''; print '