Add a test to be sure module is on
This commit is contained in:
parent
1e8fd73810
commit
ed4a0742c8
@ -526,23 +526,6 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Delete supplier prices log
|
|
||||||
/*if (! $error)
|
|
||||||
{
|
|
||||||
$sql = 'DELETE pfpl';
|
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price_log as pfpl, '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
|
|
||||||
$sql.= ' WHERE pfpl.fk_product_fournisseur = pfp.rowid';
|
|
||||||
$sql.= ' AND pf.fk_product = '.$id;
|
|
||||||
dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG);
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->error = $this->db->lasterror();
|
|
||||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Delete supplier prices
|
// Delete supplier prices
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -639,6 +622,7 @@ class Product extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1018,13 +1002,13 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
dol_syslog("Product::fetch id=$id ref=$ref ref_ext=$ref_ext");
|
dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref." ref_ext=".$ref_ext);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $id && ! $ref && ! $ref_ext)
|
if (! $id && ! $ref && ! $ref_ext)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans('ErrorWrongParameters');
|
$this->error=$langs->trans('ErrorWrongParameters');
|
||||||
dol_print_error("Product::fetch ".$this->error, LOG_ERR);
|
dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,7 +1023,7 @@ class Product extends CommonObject
|
|||||||
else if ($ref) $sql.= " WHERE ref = '".$this->db->escape($ref)."'";
|
else if ($ref) $sql.= " WHERE ref = '".$this->db->escape($ref)."'";
|
||||||
else if ($ref_ext) $sql.= " WHERE ref_ext = '".$this->db->escape($ref_ext)."'";
|
else if ($ref_ext) $sql.= " WHERE ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||||
|
|
||||||
dol_syslog("Product::fetch sql=".$sql);
|
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
@ -2371,7 +2355,7 @@ class Product extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load information about stock of a product into stock_warehouse[] and stock_reel
|
* Load information about stock of a product into stock_warehouse[] and stock_reel
|
||||||
*
|
*
|
||||||
* @return int < 0 si erreur, > 0 si ok
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function load_stock()
|
function load_stock()
|
||||||
{
|
{
|
||||||
@ -2381,7 +2365,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock";
|
||||||
$sql.= " WHERE fk_product = '".$this->id."'";
|
$sql.= " WHERE fk_product = '".$this->id."'";
|
||||||
|
|
||||||
dol_syslog("Product::load_stock sql=".$sql);
|
dol_syslog(get_class($this)."::load_stock sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -2403,7 +2387,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,6 +77,8 @@ class ProductTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
global $conf,$user,$langs,$db;
|
global $conf,$user,$langs,$db;
|
||||||
|
|
||||||
|
if (empty($conf->produit->enabled)) { print __METHOD__." Module Product must be enabled.\n"; die(); }
|
||||||
|
|
||||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||||
|
|
||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user