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 $table_element='bank_account';
|
||||
|
||||
var $rowid;
|
||||
var $rowid; // deprecated
|
||||
var $id;
|
||||
var $ref;
|
||||
var $label;
|
||||
//! 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);
|
||||
|
||||
$this->id = $obj->rowid; // deprecated
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid; // deprecated
|
||||
$this->ref = $obj->ref;
|
||||
$this->label = $obj->label;
|
||||
$this->type = $obj->courant;
|
||||
@ -702,7 +703,7 @@ class Account extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("Account::delete sql=".$sql);
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
return 1;
|
||||
@ -989,6 +990,18 @@ class Account extends CommonObject
|
||||
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.
|
||||
* Used to build previews or test instances.
|
||||
@ -1347,38 +1360,38 @@ class AccountLine extends CommonObject
|
||||
/**
|
||||
* Increase value date of a rowid
|
||||
*
|
||||
* @param int $rowid Id of line to change
|
||||
* @return int >0 if OK, 0 if KO
|
||||
* @param int $id Id of line to change
|
||||
* @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
|
||||
*
|
||||
* @param int $rowid Id of line to change
|
||||
* @return int >0 if OK, 0 if KO
|
||||
* @param int $id Id of line to change
|
||||
* @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
|
||||
* @return void
|
||||
* @param int $id Id of object to load
|
||||
* @return void
|
||||
*/
|
||||
function info($rowid)
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT b.rowid, b.datec,';
|
||||
$sql.= ' b.fk_user_author, b.fk_user_rappro';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
||||
$sql.= ' WHERE b.rowid = '.$rowid;
|
||||
$sql.= ' WHERE b.rowid = '.$id;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
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
|
||||
*/
|
||||
function info($id)
|
||||
|
||||
@ -116,7 +116,7 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* testContratCreate
|
||||
* testBankAccountCreate
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@ -140,12 +140,12 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* testContratFetch
|
||||
* testBankAccountFetch
|
||||
*
|
||||
* @param int $id Id of contract
|
||||
* @return int
|
||||
*
|
||||
* @depends testContratCreate
|
||||
* @depends testBankAccountCreate
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testBankAccountFetch($id)
|
||||
@ -166,12 +166,12 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* testBankAccountFetch
|
||||
* testBankAccountOther
|
||||
*
|
||||
* @param Object $localobject Object contract
|
||||
* @return int
|
||||
*
|
||||
* @depends testBankAccountOther
|
||||
* @depends testBankAccountFetch
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testBankAccountOther($localobject)
|
||||
@ -188,8 +188,8 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
|
||||
$localobject->info($localobject->id);
|
||||
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||
$this->assertNotEquals($localobject->date_creation, '');
|
||||
//print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||
//$this->assertNotEquals($localobject->date_creation, '');
|
||||
|
||||
return $localobject->id;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user