Fix: The way we tested if a ref/id already exists was wrong. Introduce a
common static method for this. Removed verifNumRef method. Fix: Add missing logs
This commit is contained in:
parent
3a29d7dac1
commit
69eaefc459
@ -673,16 +673,26 @@ class Propal extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! empty($this->ref)) // We check that ref is not already used
|
||||||
|
{
|
||||||
|
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->error='ErrorRefAlreadyExists';
|
||||||
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($this->date))
|
if (empty($this->date))
|
||||||
{
|
{
|
||||||
$this->error="Date of proposal is required";
|
$this->error="Date of proposal is required";
|
||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
if (! empty($this->ref))
|
|
||||||
{
|
|
||||||
$result=$this->verifyNumRef(); // Check ref is not yet used
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -612,6 +612,18 @@ class Commande extends CommonOrder
|
|||||||
dol_syslog(get_class($this)."::create user=".$user->id);
|
dol_syslog(get_class($this)."::create user=".$user->id);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
if (! empty($this->ref)) // We check that ref is not already used
|
||||||
|
{
|
||||||
|
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->error='ErrorRefAlreadyExists';
|
||||||
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
$result=$soc->fetch($this->socid);
|
$result=$soc->fetch($this->socid);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -3493,7 +3493,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert line in database
|
* Insert line into database
|
||||||
*
|
*
|
||||||
* @param int $notrigger 1 no triggers
|
* @param int $notrigger 1 no triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
@ -3531,7 +3531,21 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->product_type < 0) return -1;
|
if ($this->product_type < 0)
|
||||||
|
{
|
||||||
|
$this->error='ErrorProductTypeMustBe0orMore';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (! empty($this->fk_product))
|
||||||
|
{
|
||||||
|
// Check product exists
|
||||||
|
$result=Product::isExistingObject('product', $this->fk_product);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
$this->error='ErrorProductIdDoesNotExists';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,42 @@ abstract class CommonObject
|
|||||||
// No constructor as it is an abstract class
|
// No constructor as it is an abstract class
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check an object id/ref exists
|
||||||
|
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
|
||||||
|
*
|
||||||
|
* @param string $element String of element ('product', 'facture', ...)
|
||||||
|
* @param int $id Id of object
|
||||||
|
* @param string $ref Ref of object to check
|
||||||
|
* @param string $ref_ext Ref ext of object to check
|
||||||
|
* @return int <0 if KO, 0 if OK but not found, >0 if OK and exists
|
||||||
|
*/
|
||||||
|
static function isExistingObject($element, $id, $ref='', $ref_ext='')
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, ref, ref_ext";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX.$element;
|
||||||
|
if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id);
|
||||||
|
else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'";
|
||||||
|
else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'";
|
||||||
|
else {
|
||||||
|
$error='ErrorWrongParameters';
|
||||||
|
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class()."::isExistingObject sql=".$sql);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num=$db->num_rows($resql);
|
||||||
|
if ($num > 0) return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to output saved errors
|
* Method to output saved errors
|
||||||
*
|
*
|
||||||
@ -114,33 +150,6 @@ abstract class CommonObject
|
|||||||
return dol_format_address($this, $withcountry, $sep);
|
return dol_format_address($this, $withcountry, $sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if ref is used.
|
|
||||||
*
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if found
|
|
||||||
*/
|
|
||||||
function verifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$sql = "SELECT rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
|
||||||
$sql.= " WHERE ref = '".$this->ref."'";
|
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
|
||||||
dol_syslog(get_class($this)."::verifyNumRef sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
return $num;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
dol_syslog(get_class($this)."::verifyNumRef ".$this->error, LOG_ERR);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a link between element $this->element and a contact
|
* Add a link between element $this->element and a contact
|
||||||
@ -2052,7 +2061,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get special code of line
|
* Get special code of a line
|
||||||
*
|
*
|
||||||
* @param int $lineid Id of line
|
* @param int $lineid Id of line
|
||||||
* @return int Special code
|
* @return int Special code
|
||||||
@ -3088,7 +3097,8 @@ abstract class CommonObject
|
|||||||
* @param string $force_price True of not
|
* @param string $force_price True of not
|
||||||
* @return mixed Array with info
|
* @return mixed Array with info
|
||||||
*/
|
*/
|
||||||
function getMarginInfos($force_price=false) {
|
function getMarginInfos($force_price=false)
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
*
|
*
|
||||||
* @param string $url URL to call.
|
* @param string $url URL to call.
|
||||||
* @param string $postorget 'POST', 'GET', 'HEAD'
|
* @param string $postorget 'POST', 'GET', 'HEAD'
|
||||||
* @param string $param Paraemeters of URL (x=value1&y=value2)
|
* @param string $param Parameters of URL (x=value1&y=value2)
|
||||||
* @param string $followlocation 1=Follow location, 0=Do not follow
|
* @param string $followlocation 1=Follow location, 0=Do not follow
|
||||||
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
|
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
|
||||||
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||||
|
|||||||
@ -95,36 +95,28 @@ class Fichinter extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::create ref=".$this->ref);
|
dol_syslog(get_class($this)."::create ref=".$this->ref);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_numeric($this->duree)) {
|
if (! empty($this->ref)) // We check that ref is not already used
|
||||||
$this->duree = 0;
|
{
|
||||||
|
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->error='ErrorRefAlreadyExists';
|
||||||
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (! is_numeric($this->duree)) $this->duree = 0;
|
||||||
|
|
||||||
if ($this->socid <= 0)
|
if ($this->socid <= 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorBadParameterForFunc';
|
$this->error='ErrorBadParameterForFunc';
|
||||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// on verifie si la ref n'est pas utilisee
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
$result=$soc->fetch($this->socid);
|
$result=$soc->fetch($this->socid);
|
||||||
if (! empty($this->ref))
|
|
||||||
{
|
|
||||||
$result=$this->verifyNumRef(); // Check ref is not yet used
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$this->error='ErrorRefAlreadyExists';
|
|
||||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
|
|
||||||
$this->db->rollback();
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
else if ($result < 0)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
|
||||||
$this->db->rollback();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -2276,6 +2276,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
$sql.= " WHERE fk_product = ". $fromId;
|
$sql.= " WHERE fk_product = ". $fromId;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::clone_price sql='.$sql);
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
@ -2285,6 +2286,13 @@ class Product extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone links between products
|
||||||
|
*
|
||||||
|
* @param int $fromId Product id
|
||||||
|
* @param int $toId Product id
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
function clone_associations($fromId, $toId)
|
function clone_associations($fromId, $toId)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -2293,6 +2301,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " SELECT null, $toId, fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
|
$sql.= " SELECT null, $toId, fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
|
||||||
$sql.= " WHERE fk_product_pere = '".$fromId."'";
|
$sql.= " WHERE fk_product_pere = '".$fromId."'";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::clone_association sql='.$sql);
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
@ -2336,6 +2345,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||||
$sql.= " WHERE fk_product = ".$fromId;
|
$sql.= " WHERE fk_product = ".$fromId;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::clone_fournisseurs sql='.$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
@ -2894,42 +2904,6 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deplace fichier recupere sur internet (utilise pour interface avec OSC)
|
|
||||||
*
|
|
||||||
* @param string $sdir Repertoire destination finale
|
|
||||||
* @param string $file url de l'image
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function add_photo_web($sdir, $file)
|
|
||||||
{
|
|
||||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/";
|
|
||||||
$dir .= "photos/";
|
|
||||||
|
|
||||||
$dir_osencoded=dol_osencode($dir);
|
|
||||||
if (! file_exists($dir_osencoded))
|
|
||||||
{
|
|
||||||
dol_syslog("Product Create ".$dir);
|
|
||||||
dol_mkdir($dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($dir_osencoded))
|
|
||||||
{
|
|
||||||
// Cree fichier en taille vignette
|
|
||||||
// TODO A faire
|
|
||||||
|
|
||||||
// Cree fichier en taille origine
|
|
||||||
$content = @file_get_contents($file);
|
|
||||||
if( $content)
|
|
||||||
{
|
|
||||||
$nom = basename($file);
|
|
||||||
$im = fopen(dol_osencode($dir.$nom),'wb');
|
|
||||||
fwrite($im, $content);
|
|
||||||
fclose($im);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche la premiere photo du produit
|
* Affiche la premiere photo du produit
|
||||||
*
|
*
|
||||||
|
|||||||
@ -68,7 +68,6 @@ $limit = $conf->liste_limit;
|
|||||||
|
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
//$object->getCanvas($id);
|
|
||||||
$canvas=GETPOST("canvas");
|
$canvas=GETPOST("canvas");
|
||||||
$objcanvas='';
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
|
|||||||
@ -62,7 +62,6 @@ $search_sale = GETPOST("search_sale");
|
|||||||
$search_categ = GETPOST("search_categ");
|
$search_categ = GETPOST("search_categ");
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
//$object->getCanvas($id);
|
|
||||||
$canvas=GETPOST("canvas");
|
$canvas=GETPOST("canvas");
|
||||||
$objcanvas='';
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
|
|||||||
@ -337,26 +337,5 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new CommandeFournisseur($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -264,26 +264,5 @@ class CommandeTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Commande($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -115,28 +115,6 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Commande($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFetchUser
|
* testFetchUser
|
||||||
*
|
*
|
||||||
|
|||||||
@ -241,27 +241,4 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Contrat($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,24 +264,5 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/*public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -232,27 +232,5 @@ class ProjectTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Project($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -264,27 +264,5 @@ class PropalTest extends PHPUnit_Framework_TestCase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testVerifyNumRef
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testVerifyNumRef()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Propal($this->savdb);
|
|
||||||
$result=$localobject->ref='refthatdoesnotexists';
|
|
||||||
$result=$localobject->VerifyNumRef();
|
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user