From 8b2f1eee130a419a19a7f83d149891b11b09a6cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Aug 2012 21:59:45 +0200 Subject: [PATCH 1/3] Fix: W3C --- htdocs/compta/facture/impayees.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 24bf6de375e..01bcf3599d2 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -313,7 +313,7 @@ if ($resql) $var=!$var; - print ""; + print ""; $classname = "impayee"; print ''; @@ -380,6 +380,7 @@ if ($resql) print ''.price($total_paid).''; print ' '; print ' '; + print ' '; print "\n"; } From 92624d650f80f029a562afc6456548a85a003ea8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Aug 2012 23:59:13 +0200 Subject: [PATCH 2/3] Fix into categorie functions --- htdocs/categories/class/categorie.class.php | 19 ++++++++----------- test/phpunit/CategorieTest.php | 12 ++++++++++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 99686eed40d..5485cb31db6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -889,17 +889,14 @@ class Categorie } else // mother_id undefined (so it's root) { - /* We have to select any rowid from llx_categorie which which category's type and label - * are equals to those of the calling category, AND which doesn't exist in categorie association - * as children (rowid != fk_categorie_fille) - */ - $sql = "SELECT c.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c "; - $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; - $sql.= " ON c.rowid!=ca.fk_categorie_fille"; - $sql.= " WHERE c.type=".$this->type; - $sql.= " AND c.label='".$this->db->escape($this->label)."'"; - $sql.= " AND c.entity IN (".getEntity('category',1).")"; + /* We have to select any rowid from llx_categorie that is not at root level + */ + $sql = "SELECT c.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c "; + $sql.= " WHERE c.type=".$this->type; + $sql.= " AND c.label='".$this->db->escape($this->label)."'"; + $sql.= " AND c.entity IN (".getEntity('category',1).")"; + $sql.= " AND c.rowid NOT IN (SELECT ca.fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association as ca)"; } dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index caa02a30538..5ceab0f40cd 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -131,7 +131,14 @@ class CategorieTest extends PHPUnit_Framework_TestCase // We create a category $localobject=new Categorie($this->savdb); $localobject->initAsSpecimen(); - $resultFirstCreate=$localobject->create($user); + + // Check it does not exist (return 0) + $resultCheck=$localobject->already_exists(); + print __METHOD__." resultCheck=".$resultCheck."\n"; + $this->assertEquals(0, $resultCheck); + + // Create + $resultFirstCreate=$localobject->create($user); print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; $this->assertGreaterThan(0, $resultFirstCreate); @@ -139,8 +146,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject2=new Categorie($this->savdb); $localobject2->initAsSpecimen(); + // Check it does exist (return 1) $resultCheck=$localobject2->already_exists(); - print __METHOD__." resultCheck=".$resultCheck."\n"; + print __METHOD__." resultCheck=".$resultCheck."\n"; $this->assertGreaterThan(0, $resultCheck); $resultSecondCreate=$localobject2->create($user); From 4f5432160d8ad24083dfd8534b12be875edd0f04 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 Aug 2012 09:13:50 +0200 Subject: [PATCH 3/3] Fix: remove draft status if invoice is validated --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4d7ef16713d..af79c0967f9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1726,6 +1726,7 @@ class Facture extends CommonObject $this->ref = $num; $this->facnumber=$num; $this->statut=1; + $this->brouillon=0; $this->date_validation=$now; }