From d9e089256e3f4af66baefdff07e372d2c3b9c352 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2016 16:16:46 +0100 Subject: [PATCH 1/4] Fix path to copyrighted files --- build/debian/copyright | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/debian/copyright b/build/debian/copyright index 73109152034..deccd8cbe52 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -159,7 +159,7 @@ Comments: Those files are not shipped in the binary package as we configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core". -Files: docs/images/* +Files: doc/images/* Copyright: Laurent Destailleur License: CC-BY-SA-3.0 You are free: @@ -176,7 +176,7 @@ License: CC-BY-SA-3.0 . For more information, see http://creativecommons.org/licenses/by-sa/3.0/ -Files: htdocs/includes/fpdi/* +Files: htdocs/includes/fpdfi/* Copyright: 2004-2011 Setasign - Jan Slabon License: GPL-2+ This program is free software; you can redistribute it From 7b15ac11797a52d89e8004a41f980200b52230b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2016 20:38:11 +0100 Subject: [PATCH 2/4] Fix bad transaction level due to code of situation invoices Conflicts: htdocs/compta/facture/class/facture.class.php --- htdocs/compta/facture/class/facture.class.php | 25 ++++++++++++------- test/phpunit/NumberingModulesTest.php | 9 ++++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f8bb53cf9ed..c66bbb6d1c2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1919,14 +1919,18 @@ class Facture extends CommonInvoice $this->brouillon=0; $this->date_validation=$now; $i = 0; - $final = True; - while ($i < count($this->lines) && $final == True) { - $final = ($this->lines[$i]->situation_percent == 100); - $i++; - } - if ($final) { - $this->setFinal(); - } + + if (!empty($conf->global->INVOICE_USE_SITUATION)) + { + $final = True; + while ($i < count($this->lines) && $final == True) { + $final = ($this->lines[$i]->situation_percent == 100); + $i++; + } + if ($final) { + $this->setFinal(); + } + } } } else @@ -3619,11 +3623,14 @@ class Facture extends CommonInvoice function setFinal() { global $conf, $langs, $user; + + $this->db->begin(); + $this->situation_final = 1; $sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; $resql = $this->db->query($sql); if ($resql) { - // FIXME: call triggers? + // FIXME: call triggers MODIFY because we modify invoice $this->db->commit(); return 1; } else { diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 904c102e0a8..0107edc1f8d 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -75,7 +75,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; } @@ -145,10 +146,10 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result2=$localobject->create($user,1); $result3=$localobject->validate($user, $result); // create invoice by forcing ref print __METHOD__." result=".$result."\n"; - $this->assertEquals('1915-0001', $result); // counter must start to 1 + $this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1 $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result, 'Test for {yyyy}-{0000}, 1st invoice'); // Can be deleted + $this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen(); @@ -156,7 +157,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $numbering=new mod_facture_mercure(); $result=$numbering->getNextValue($mysoc, $localobject2, 'last'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('1915-0001', $result); + $this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'"); $result=$numbering->getNextValue($mysoc, $localobject2); $result2=$localobject2->create($user,1); $result3=$localobject2->validate($user, $result); // create invoice by forcing ref From 2d0c823ffec39a6ba88f509e01ac9c9dca4384f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2016 20:38:11 +0100 Subject: [PATCH 3/4] Fix bad transaction level due to code of situation invoices Conflicts: htdocs/compta/facture/class/facture.class.php --- htdocs/compta/facture/class/facture.class.php | 25 ++++++++++++------- test/phpunit/NumberingModulesTest.php | 9 ++++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 628fd45f1ed..614c7d3f33a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1953,14 +1953,18 @@ class Facture extends CommonInvoice $this->brouillon=0; $this->date_validation=$now; $i = 0; - $final = True; - while ($i < count($this->lines) && $final == True) { - $final = ($this->lines[$i]->situation_percent == 100); - $i++; - } - if ($final) { - $this->setFinal(); - } + + if (!empty($conf->global->INVOICE_USE_SITUATION)) + { + $final = True; + while ($i < count($this->lines) && $final == True) { + $final = ($this->lines[$i]->situation_percent == 100); + $i++; + } + if ($final) { + $this->setFinal(); + } + } } } else @@ -3654,11 +3658,14 @@ class Facture extends CommonInvoice function setFinal() { global $conf, $langs, $user; + + $this->db->begin(); + $this->situation_final = 1; $sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; $resql = $this->db->query($sql); if ($resql) { - // FIXME: call triggers? + // FIXME: call triggers MODIFY because we modify invoice $this->db->commit(); return 1; } else { diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 904c102e0a8..0107edc1f8d 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -75,7 +75,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { global $conf,$user,$langs,$db; - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; } @@ -145,10 +146,10 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result2=$localobject->create($user,1); $result3=$localobject->validate($user, $result); // create invoice by forcing ref print __METHOD__." result=".$result."\n"; - $this->assertEquals('1915-0001', $result); // counter must start to 1 + $this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1 $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(1, $result, 'Test for {yyyy}-{0000}, 1st invoice'); // Can be deleted + $this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen(); @@ -156,7 +157,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $numbering=new mod_facture_mercure(); $result=$numbering->getNextValue($mysoc, $localobject2, 'last'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('1915-0001', $result); + $this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'"); $result=$numbering->getNextValue($mysoc, $localobject2); $result2=$localobject2->create($user,1); $result3=$localobject2->validate($user, $result); // create invoice by forcing ref From 640adcc66659337a904d3afa60462c553fef7070 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2016 21:23:30 +0100 Subject: [PATCH 4/4] Missing translation --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 27b533c3f2d..bda34ce2299 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -32,6 +32,7 @@ Language_es_MX=Spanish (Mexico) Language_es_PY=Spanish (Paraguay) Language_es_PE=Spanish (Peru) Language_es_PR=Spanish (Puerto Rico) +Language_es_VE=Spanish (Venezuela) Language_et_EE=Estonian Language_eu_ES=Basque Language_fa_IR=Persian