Accountancy code on user object in prevision of the complete accountancy module

This commit is contained in:
Maxime Kohlhaas
2013-06-25 11:14:00 +02:00
parent 109d1a71cb
commit b22b604d02
4 changed files with 30 additions and 2 deletions

View File

@@ -66,4 +66,4 @@ ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_ob
DROP table llx_adherent_options;
DROP table llx_adherent_options_label;
ALTER TABLE `llx_user` ADD `accountancy_code` VARCHAR( 24 ) NULL;

View File

@@ -62,5 +62,6 @@ create table llx_user
statut tinyint DEFAULT 1,
photo varchar(255), -- filename or url of photo
lang varchar(6),
color varchar(6)
color varchar(6),
accountancy_code varchar(24) NULL
)ENGINE=innodb;

View File

@@ -96,6 +96,8 @@ class User extends CommonObject
var $users; // To store all tree of users hierarchy
var $parentof; // To store an array of all parents for all ids.
var $accountancy_code; // Accountancy code in prevision of the complete accountancy module
/**
@@ -149,6 +151,7 @@ class User extends CommonObject
$sql.= " u.datepreviouslogin as datep,";
$sql.= " u.photo as photo,";
$sql.= " u.openid as openid,";
$sql.= " u.accountancy_code,";
$sql.= " u.ref_int, u.ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
@@ -209,6 +212,7 @@ class User extends CommonObject
$this->openid = $obj->openid;
$this->lang = $obj->lang;
$this->entity = $obj->entity;
$this->accountancy_code = $obj->accountancy_code;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
@@ -1114,6 +1118,7 @@ class User extends CommonObject
$this->address = empty($this->address)?'':$this->address;
$this->zip = empty($this->zip)?'':$this->zip;
$this->town = empty($this->town)?'':$this->town;
$this->accountancy_code = trim($this->accountancy_code);
// Check parameters
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
@@ -1142,6 +1147,7 @@ class User extends CommonObject
$sql.= ", email = '".$this->db->escape($this->email)."'";
$sql.= ", job = '".$this->db->escape($this->job)."'";
$sql.= ", signature = '".$this->db->escape($this->signature)."'";
$sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'";
$sql.= ", note = '".$this->db->escape($this->note)."'";
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");

View File

@@ -188,6 +188,7 @@ if ($action == 'add' && $canadduser)
$object->email = GETPOST("email");
$object->job = GETPOST("job");
$object->signature = GETPOST("signature");
$object->accountancy_code = GETPOST("accountancy_code");
$object->note = GETPOST("note");
$object->ldap_sid = GETPOST("ldap_sid");
@@ -324,6 +325,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$object->email = GETPOST("email");
$object->job = GETPOST("job");
$object->signature = GETPOST("signature");
$object->accountancy_code = GETPOST("accountancy_code");
$object->openid = GETPOST("openid");
$object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0;
@@ -1192,6 +1194,10 @@ else
}
print '</td>';
print "</tr>\n";
// Accountancy code
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td>'.$object->accountancy_code.'</td>';
// Status
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
@@ -1821,6 +1827,21 @@ else
}
print '</td>';
print "</tr>\n";
// Accountancy code
print "<tr>";
print '<td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
if ($caneditfield)
{
print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
}
else
{
print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">';
print $object->accountancy_code;
}
print '</td>';
// Status
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';