Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Regis Houssin 2012-03-20 14:42:53 +01:00
commit 507e9af5cb
4 changed files with 12 additions and 7 deletions

View File

@ -125,6 +125,7 @@ class Categorie
* @return int -1 : erreur SQL * @return int -1 : erreur SQL
* -2 : nouvel ID inconnu * -2 : nouvel ID inconnu
* -3 : categorie invalide * -3 : categorie invalide
* -4 : category already exists
*/ */
function create($user='') function create($user='')
{ {
@ -141,7 +142,7 @@ class Categorie
{ {
$this->error=$langs->trans("ImpossibleAddCat"); $this->error=$langs->trans("ImpossibleAddCat");
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
return -1; return -4;
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,";
@ -176,7 +177,7 @@ class Categorie
if($this->add_fille() < 0) if($this->add_fille() < 0)
{ {
$this->error=$langs->trans("ImpossibleAssociateCategory"); $this->error=$langs->trans("ImpossibleAssociateCategory");
return -1; return -3;
} }
} }

View File

@ -2111,7 +2111,7 @@ class Commande extends CommonObject
* @param double $pu Prix unitaire * @param double $pu Prix unitaire
* @param double $qty Quantity * @param double $qty Quantity
* @param double $remise_percent Pourcentage de remise de la ligne * @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 $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate * @param double $txlocaltax2 Local tax 2 rate
* @param string $price_base_type HT or TTC * @param string $price_base_type HT or TTC

View File

@ -1011,8 +1011,8 @@ class Ldap
* Converts a little-endian hex-number to one, that 'hexdec' can convert * Converts a little-endian hex-number to one, that 'hexdec' can convert
* Required by Active Directory * Required by Active Directory
* *
* @param string $hex * @param string $hex Hex value
* @return string little endian * @return string Little endian
*/ */
function littleEndian($hex) function littleEndian($hex)
{ {

View File

@ -129,12 +129,16 @@ class CategorieTest extends PHPUnit_Framework_TestCase
$localobject=new Categorie($this->savdb); $localobject=new Categorie($this->savdb);
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
$result=$localobject->create($user);
// We create category
$result=$localobject->create($user);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; 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; return $result;