Fix: Change status of order to cancel

This commit is contained in:
Laurent Destailleur 2010-05-17 12:48:55 +00:00
parent f83954daef
commit eeb8fb09ba
2 changed files with 32 additions and 16 deletions

View File

@ -551,24 +551,21 @@ class Commande extends CommonObject
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice); $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
}
if (! $error) if (! $error)
{ {
$this->statut=-1; $this->statut=-1;
$this->db->commit(); $this->db->commit();
return $result; return 1;
} }
else else
{ {
$this->error=$mouvP->error; $this->error=$mouvP->error;
$this->db->rollback(); $this->db->rollback();
return $result; return -1;
} }
} }
$this->db->commit();
return 1;
}
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();

View File

@ -183,13 +183,32 @@ class CommandeTest extends PHPUnit_Framework_TestCase
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
return $localobject->id; return $localobject;
} }
/** /**
* @depends testCommandeValid * @depends testCommandeValid
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
public function testCommandeCancel($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$result=$localobject->cancel($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
/**
* @depends testCommandeCancel
* The depends says test is run only if previous is ok
*/
public function testCommandeDelete($id) public function testCommandeDelete($id)
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;