Fix: Uniformize code and PHPUnit tests
This commit is contained in:
parent
b40c0a5d86
commit
a429a930d0
@ -35,7 +35,8 @@ class Account extends CommonObject
|
|||||||
public $element='bank_account';
|
public $element='bank_account';
|
||||||
public $table_element='bank_account';
|
public $table_element='bank_account';
|
||||||
|
|
||||||
var $rowid;
|
var $rowid; // deprecated
|
||||||
|
var $id;
|
||||||
var $ref;
|
var $ref;
|
||||||
var $label;
|
var $label;
|
||||||
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
||||||
@ -630,8 +631,8 @@ class Account extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->id = $obj->rowid; // deprecated
|
$this->id = $obj->rowid;
|
||||||
$this->rowid = $obj->rowid;
|
$this->rowid = $obj->rowid; // deprecated
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->type = $obj->courant;
|
$this->type = $obj->courant;
|
||||||
@ -702,7 +703,7 @@ class Account extends CommonObject
|
|||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog("Account::delete sql=".$sql);
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -989,6 +990,18 @@ class Account extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load miscellaneous information for tab "Info"
|
||||||
|
*
|
||||||
|
* @param int $id Id of object to load
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function info($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise an instance with random values.
|
* Initialise an instance with random values.
|
||||||
* Used to build previews or test instances.
|
* Used to build previews or test instances.
|
||||||
@ -1347,38 +1360,38 @@ class AccountLine extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Increase value date of a rowid
|
* Increase value date of a rowid
|
||||||
*
|
*
|
||||||
* @param int $rowid Id of line to change
|
* @param int $id Id of line to change
|
||||||
* @return int >0 if OK, 0 if KO
|
* @return int >0 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function datev_next($rowid)
|
function datev_next($id)
|
||||||
{
|
{
|
||||||
return $this->datev_change($rowid,1);
|
return $this->datev_change($id,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease value date of a rowid
|
* Decrease value date of a rowid
|
||||||
*
|
*
|
||||||
* @param int $rowid Id of line to change
|
* @param int $id Id of line to change
|
||||||
* @return int >0 if OK, 0 if KO
|
* @return int >0 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function datev_previous($rowid)
|
function datev_previous($id)
|
||||||
{
|
{
|
||||||
return $this->datev_change($rowid,-1);
|
return $this->datev_change($id,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charge les informations d'ordre info dans l'objet
|
* Load miscellaneous information for tab "Info"
|
||||||
*
|
*
|
||||||
* @param int $rowid Id of object
|
* @param int $id Id of object to load
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function info($rowid)
|
function info($id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT b.rowid, b.datec,';
|
$sql = 'SELECT b.rowid, b.datec,';
|
||||||
$sql.= ' b.fk_user_author, b.fk_user_rappro';
|
$sql.= ' b.fk_user_author, b.fk_user_rappro';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
||||||
$sql.= ' WHERE b.rowid = '.$rowid;
|
$sql.= ' WHERE b.rowid = '.$id;
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -2453,9 +2453,9 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charge les informations de l'onglet info dans l'objet facture
|
* Load miscellaneous information for tab "Info"
|
||||||
*
|
*
|
||||||
* @param int $id Id de la facture a charger
|
* @param int $id Id of object to load
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function info($id)
|
function info($id)
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testContratCreate
|
* testBankAccountCreate
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -140,12 +140,12 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testContratFetch
|
* testBankAccountFetch
|
||||||
*
|
*
|
||||||
* @param int $id Id of contract
|
* @param int $id Id of contract
|
||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
* @depends testContratCreate
|
* @depends testBankAccountCreate
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
*/
|
*/
|
||||||
public function testBankAccountFetch($id)
|
public function testBankAccountFetch($id)
|
||||||
@ -166,12 +166,12 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBankAccountFetch
|
* testBankAccountOther
|
||||||
*
|
*
|
||||||
* @param Object $localobject Object contract
|
* @param Object $localobject Object contract
|
||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
* @depends testBankAccountOther
|
* @depends testBankAccountFetch
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
*/
|
*/
|
||||||
public function testBankAccountOther($localobject)
|
public function testBankAccountOther($localobject)
|
||||||
@ -188,8 +188,8 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$localobject->info($localobject->id);
|
$localobject->info($localobject->id);
|
||||||
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
//print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||||
$this->assertNotEquals($localobject->date_creation, '');
|
//$this->assertNotEquals($localobject->date_creation, '');
|
||||||
|
|
||||||
return $localobject->id;
|
return $localobject->id;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user