Started using Account TYPE and STATUS constants

This commit is contained in:
Marcos García de La Fuente 2016-03-02 11:04:52 +01:00
parent fd3b4f6080
commit dcde7773a3
4 changed files with 19 additions and 12 deletions

View File

@ -302,7 +302,7 @@ if ($action == 'create')
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
// Country
@ -643,7 +643,7 @@ else
print '<br>';
if ($account->type == 0 || $account->type == 1)
if ($account->type == Account::TYPE_SAVINGS || $account->type == Account::TYPE_CURRENT)
{
print '<table class="border" width="100%">';
@ -861,7 +861,7 @@ else
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
// Country

View File

@ -139,7 +139,19 @@ class Account extends CommonObject
public $state_code;
public $state;
public $type_lib=array();
/**
* Variable containing all account types with their respective translated label.
* Defined in __construct
* @var array
*/
public $type_lib = array();
/**
* Variable containing all account statuses with their respective translated label.
* Defined in __construct
* @var array
*/
public $status = array();
/**
* Accountancy code
@ -205,7 +217,6 @@ class Account extends CommonObject
$this->db = $db;
$this->clos = 0;
$this->solde = 0;
$this->type_lib = array(
@ -1230,7 +1241,7 @@ class Account extends CommonObject
$this->label = 'My Bank account';
$this->bank = 'MyBank';
$this->courant = 1;
$this->clos = 0;
$this->clos = Account::STATUS_OPEN;
$this->code_banque = '123';
$this->code_guichet = '456';
$this->number = 'ABC12345';

View File

@ -46,16 +46,14 @@ class CompanyBankAccount extends Account
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
$this->socid = 0;
$this->clos = 0;
$this->solde = 0;
$this->error_number = 0;
$this->default_rib = 0;
return 1;
}

View File

@ -44,15 +44,13 @@ class UserBankAccount extends Account
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
$this->socid = 0;
$this->clos = 0;
$this->solde = 0;
$this->error_number = 0;
return 1;
}