mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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();
|
||||
|
||||
// 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
|
||||
if (! $error)
|
||||
{
|
||||
|
|
@ -639,6 +622,7 @@ class Product extends CommonObject
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1018,13 +1002,13 @@ class Product extends CommonObject
|
|||
|
||||
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
|
||||
if (! $id && ! $ref && ! $ref_ext)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1023,7 @@ class Product extends CommonObject
|
|||
else if ($ref) $sql.= " WHERE ref = '".$this->db->escape($ref)."'";
|
||||
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);
|
||||
if ( $resql )
|
||||
{
|
||||
|
|
@ -2371,7 +2355,7 @@ class Product extends CommonObject
|
|||
/**
|
||||
* 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()
|
||||
{
|
||||
|
|
@ -2381,7 +2365,7 @@ class Product extends CommonObject
|
|||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock";
|
||||
$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);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -2403,7 +2387,7 @@ class Product extends CommonObject
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ class ProductTest extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
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.
|
||||
|
||||
print __METHOD__."\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user