Clean code

This commit is contained in:
Laurent Destailleur 2015-03-17 00:35:17 +01:00
parent 6f7b07548c
commit 435be30047
3 changed files with 10 additions and 6 deletions

View File

@ -777,15 +777,16 @@ class Commande extends CommonOrder
}
// update ref
if (empty($this->ref))
{
$this->ref = '(PROV'.$this->id.')';
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->ref."' WHERE rowid=".$this->id;
$initialref='(PROV'.$this->id.')';
if (! empty($this->ref)) $initialref=$this->ref;
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
if ($this->id)
{
$this->ref = $initialref;
// Add object linked
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
{
@ -803,7 +804,7 @@ class Commande extends CommonOrder
{
// On recupere les differents contact interne et externe
$prop = new Propal($this->db);
$prop->fetch($origin_id);
$prop->fetch($origin_id);
// We get ids of sales representatives of proposal
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');

View File

@ -77,6 +77,8 @@ class CommandeTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->commande->enabled)) { print __METHOD__." module customer order must be enabled.\n"; die(); }
print __METHOD__."\n";
}

View File

@ -76,6 +76,7 @@ class FactureTest extends PHPUnit_Framework_TestCase
{
global $conf,$user,$langs,$db;
if (empty($conf->facture->enabled)) { print __METHOD__." module customer invoice must be enabled.\n"; die(); }
if (! empty($conf->ecotaxdeee->enabled)) { print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.