diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 12dadebdd27..7f604659625 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -125,6 +125,7 @@ class Categorie * @return int -1 : erreur SQL * -2 : nouvel ID inconnu * -3 : categorie invalide + * -4 : category already exists */ function create($user='') { @@ -141,7 +142,7 @@ class Categorie { $this->error=$langs->trans("ImpossibleAddCat"); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); - return -1; + return -4; } $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,"; @@ -176,7 +177,7 @@ class Categorie if($this->add_fille() < 0) { $this->error=$langs->trans("ImpossibleAssociateCategory"); - return -1; + return -3; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0f80894cb2b..8c4a8b6f06e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2111,7 +2111,7 @@ class Commande extends CommonObject * @param double $pu Prix unitaire * @param double $qty Quantity * @param double $remise_percent Pourcentage de remise de la ligne - * @param double $tva_tx Taux TVA + * @param double $txtva Taux TVA * @param double $txlocaltax1 Local tax 1 rate * @param double $txlocaltax2 Local tax 2 rate * @param string $price_base_type HT or TTC diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 3598497a3a9..8ed2d0cbbb6 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1011,8 +1011,8 @@ class Ldap * Converts a little-endian hex-number to one, that 'hexdec' can convert * Required by Active Directory * - * @param string $hex - * @return string little endian + * @param string $hex Hex value + * @return string Little endian */ function littleEndian($hex) { diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 24693fdac20..f87a2c29d44 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -129,12 +129,16 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject=new Categorie($this->savdb); $localobject->initAsSpecimen(); - $result=$localobject->create($user); + // We create category + $result=$localobject->create($user); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; - // TODO Add test on error when creating duplicate + // We try to create same category again + $result=$localobject->create($user); + $this->assertLessThan($result, -4); + print __METHOD__." result=".$result."\n"; return $result;