2
0
forked from Wavyzz/dolibarr

NEW Add date of birth on user card.

NEW Show expected worked hours on the timesheet form.
This commit is contained in:
Laurent Destailleur
2017-10-06 12:08:01 +02:00
parent 7871498724
commit 06b18a740e
11 changed files with 56 additions and 15 deletions

View File

@@ -324,11 +324,11 @@ if ($action == 'create')
// Ref // Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12"></td></tr>'; print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12" autofocus></td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<td><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label", 'alpha').'"></td></tr>'; print '<td><input size="30" type="text" class="flat" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
// Type // Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
@@ -349,7 +349,7 @@ if ($action == 'create')
// Status // Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';
print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos));
print '</td></tr>'; print '</td></tr>';
// Country // Country

View File

@@ -3830,7 +3830,7 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
* @param float $amount Amount to format * @param float $amount Amount to format
* @param integer $form Type of format, HTML or not (not by default) * @param integer $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output * @param Translate $outlangs Object langs for output
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before inserted into database or after a computation, so this parameter should be useless. * @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL) * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
* @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force) * @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
* @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency) * @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency)

View File

@@ -41,6 +41,8 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
-- For 7.0 -- For 7.0
ALTER TABLE llx_user ADD COLUMN birth date;
-- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY; -- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY;
ALTER TABLE llx_holiday_users ADD UNIQUE INDEX uk_holiday_users(fk_user, fk_type, nb_holiday); ALTER TABLE llx_holiday_users ADD UNIQUE INDEX uk_holiday_users(fk_user, fk_type, nb_holiday);

View File

@@ -47,6 +47,7 @@ create table llx_user
town varchar(50), -- town town varchar(50), -- town
fk_state integer DEFAULT 0, -- fk_state integer DEFAULT 0, --
fk_country integer DEFAULT 0, -- fk_country integer DEFAULT 0, --
birth date, -- birthday
job varchar(128), job varchar(128),
skype varchar(255), skype varchar(255),
office_phone varchar(20), office_phone varchar(20),

View File

@@ -80,4 +80,5 @@ PermissionsDefDesc=Define here the new permissions provided by your module (once
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code). HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed. TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
SeeIDsInUse=See IDs in use in your installation SeeIDsInUse=See IDs in use in your installation
SeeReservedIDsRangeHere=See range of reserved IDs SeeReservedIDsRangeHere=See range of reserved IDs
ToolkitForDevelopers=Toolkit for Dolibarr developers

View File

@@ -96,7 +96,8 @@ HierarchicView=Hierarchical view
UseTypeFieldToChange=Use field Type to change UseTypeFieldToChange=Use field Type to change
OpenIDURL=OpenID URL OpenIDURL=OpenID URL
LoginUsingOpenID=Use OpenID to login LoginUsingOpenID=Use OpenID to login
WeeklyHours=Weekly hours WeeklyHours=Hours worked (per week)
ExpectedWorkedHours=Expected worked hours per week
ColorUser=Color of the user ColorUser=Color of the user
DisabledInMonoUserMode=Disabled in maintenance mode DisabledInMonoUserMode=Disabled in maintenance mode
UserAccountancyCode=User accounting code UserAccountancyCode=User accounting code

View File

@@ -501,7 +501,10 @@ if (count($tasksarray) > 0)
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) $colspan++; if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) $colspan++;
print '<tr class="liste_total"> print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'">'.$langs->trans("Total").'</td> <td class="liste_total" colspan="'.$colspan.'">';
print $langs->trans("Total");
//print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
print '</td>
<td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td> <td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total"></td> <td class="liste_total"></td>
<td class="liste_total"></td> <td class="liste_total"></td>

View File

@@ -514,7 +514,10 @@ if (count($tasksarray) > 0)
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++; if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
print '<tr class="liste_total"> print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'">'.$langs->trans("Total").'</td> <td class="liste_total" colspan="'.$colspan.'">';
print $langs->trans("Total");
print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
print '</td>
<td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td> <td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total hide1" align="center"><div id="totalDay[1]">&nbsp;</div></td> <td class="liste_total hide1" align="center"><div id="totalDay[1]">&nbsp;</div></td>
<td class="liste_total hide2" align="center"><div id="totalDay[2]">&nbsp;</div></td> <td class="liste_total hide2" align="center"><div id="totalDay[2]">&nbsp;</div></td>

View File

@@ -511,12 +511,12 @@ if ($action == 'create' && $user->rights->projet->creer)
// Ref // Ref
$suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref); $suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref);
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.$suggestedref.'">'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.dol_escape_htmltag($suggestedref).'">';
print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.GETPOST("title",'none').'"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title",'none')).'" autofocus></td></tr>';
// Thirdparty // Thirdparty
if ($conf->societe->enabled) if ($conf->societe->enabled)
@@ -576,20 +576,20 @@ if ($action == 'create' && $user->rights->projet->creer)
// Opportunity probability // Opportunity probability
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>'; print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(GETPOST('opp_percent')!=''?GETPOST('opp_percent'):'').'"><span class="hideonsmartphone"> %</span>'; print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.dol_escape_htmltag(GETPOST('opp_percent')!=''?GETPOST('opp_percent'):'').'"><span class="hideonsmartphone"> %</span>';
print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.(GETPOST('opp_percent')!=''?'0':'1').'">'; print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOST('opp_percent')!=''?'0':'1').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Opportunity amount // Opportunity amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>'; print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOST('opp_amount')!=''?GETPOST('opp_amount'):'').'"></td>'; print '<td><input size="5" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOST('opp_amount')!=''?GETPOST('opp_amount'):'').'"></td>';
print '</tr>'; print '</tr>';
} }
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td>'; print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input size="5" type="text" name="budget_amount" value="'.(GETPOST('budget_amount')!=''?GETPOST('budget_amount'):'').'"></td>'; print '<td><input size="5" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOST('budget_amount')!=''?GETPOST('budget_amount'):'').'"></td>';
print '</tr>'; print '</tr>';
// Description // Description

View File

@@ -197,6 +197,8 @@ if (empty($reshook)) {
$object->login = GETPOST("login", 'alpha'); $object->login = GETPOST("login", 'alpha');
$object->api_key = GETPOST("api_key", 'alpha'); $object->api_key = GETPOST("api_key", 'alpha');
$object->gender = GETPOST("gender", 'alpha'); $object->gender = GETPOST("gender", 'alpha');
$birth = dol_mktime(0, 0, 0, GETPOST('birthmonth'), GETPOST('birthday'), GETPOST('birthyear'));
$object->birth = $birth;
$object->admin = GETPOST("admin", 'alpha'); $object->admin = GETPOST("admin", 'alpha');
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
@@ -337,6 +339,8 @@ if (empty($reshook)) {
$object->firstname = GETPOST("firstname", 'alpha'); $object->firstname = GETPOST("firstname", 'alpha');
$object->login = GETPOST("login", 'alpha'); $object->login = GETPOST("login", 'alpha');
$object->gender = GETPOST("gender", 'alpha'); $object->gender = GETPOST("gender", 'alpha');
$birth = dol_mktime(0, 0, 0, GETPOST('birthmonth'), GETPOST('birthday'), GETPOST('birthyear'));
$object->birth = $birth;
$object->pass = GETPOST("password"); $object->pass = GETPOST("password");
$object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key;
if (! empty($user->admin)) $object->admin = GETPOST("admin"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request if (! empty($user->admin)) $object->admin = GETPOST("admin"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request
@@ -791,6 +795,13 @@ if ($action == 'create' || $action == 'adduserldap')
print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1);
print '</td></tr>'; print '</td></tr>';
// Date employment
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
print '<td>';
echo $form->select_date(GETPOST('birth'),'birth',0,0,1,'createuser',1,0,1);
print '</td>';
print "</tr>\n";
// Login // Login
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>'; print '<td>';
@@ -1366,6 +1377,13 @@ else
if ($object->gender) print $langs->trans("Gender".$object->gender); if ($object->gender) print $langs->trans("Gender".$object->gender);
print '</td></tr>'; print '</td></tr>';
// Date of birth
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
print '<td>';
print dol_print_date($object->birth, 'day');
print '</td>';
print "</tr>\n";
// API key // API key
if(! empty($conf->api->enabled) && $user->admin) { if(! empty($conf->api->enabled) && $user->admin) {
print '<tr><td>'.$langs->trans("ApiKey").'</td>'; print '<tr><td>'.$langs->trans("ApiKey").'</td>';
@@ -2004,6 +2022,13 @@ else
print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1); print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1);
print '</td></tr>'; print '</td></tr>';
// Date birth
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
print '<td>';
echo $form->select_date(GETPOST('birth')?GETPOST('birth'):$object->birth,'birth',0,0,1,'updateuser',1,0,1);
print '</td>';
print "</tr>\n";
// Login // Login
print "<tr>".'<td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>'; print "<tr>".'<td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>'; print '<td>';

View File

@@ -47,6 +47,7 @@ class User extends CommonObject
public $search_sid; public $search_sid;
public $employee; public $employee;
public $gender; public $gender;
public $birth;
public $email; public $email;
public $skype; public $skype;
public $job; public $job;
@@ -179,7 +180,7 @@ class User extends CommonObject
$login=trim($login); $login=trim($login);
// Get user // Get user
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,"; $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
$sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; $sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,";
$sql.= " u.admin, u.login, u.note,"; $sql.= " u.admin, u.login, u.note,";
$sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,";
@@ -260,6 +261,7 @@ class User extends CommonObject
$this->login = $obj->login; $this->login = $obj->login;
$this->gender = $obj->gender; $this->gender = $obj->gender;
$this->birth = $this->db->jdate($obj->birth);
$this->pass_indatabase = $obj->pass; $this->pass_indatabase = $obj->pass;
$this->pass_indatabase_crypted = $obj->pass_crypted; $this->pass_indatabase_crypted = $obj->pass_crypted;
$this->pass = $obj->pass; $this->pass = $obj->pass;
@@ -1341,6 +1343,7 @@ class User extends CommonObject
$this->employee = $this->employee?$this->employee:0; $this->employee = $this->employee?$this->employee:0;
$this->login = trim($this->login); $this->login = trim($this->login);
$this->gender = trim($this->gender); $this->gender = trim($this->gender);
$this->birth = trim($this->birth);
$this->pass = trim($this->pass); $this->pass = trim($this->pass);
$this->api_key = trim($this->api_key); $this->api_key = trim($this->api_key);
$this->address = $this->address?trim($this->address):trim($this->address); $this->address = $this->address?trim($this->address):trim($this->address);
@@ -1389,6 +1392,7 @@ class User extends CommonObject
$sql.= ", login = '".$this->db->escape($this->login)."'"; $sql.= ", login = '".$this->db->escape($this->login)."'";
$sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); $sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$sql.= ", birth=".(strval($this->birth)!='' ? "'".$this->db->idate($this->birth)."'" : 'null');
if (! empty($user->admin)) $sql.= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user if (! empty($user->admin)) $sql.= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user
$sql.= ", address = '".$this->db->escape($this->address)."'"; $sql.= ", address = '".$this->db->escape($this->address)."'";
$sql.= ", zip = '".$this->db->escape($this->zip)."'"; $sql.= ", zip = '".$this->db->escape($this->zip)."'";
@@ -1470,6 +1474,7 @@ class User extends CommonObject
$adh->lastname=$this->lastname; $adh->lastname=$this->lastname;
$adh->login=$this->login; $adh->login=$this->login;
$adh->gender=$this->gender; $adh->gender=$this->gender;
$adh->birth=$this->birth;
$adh->pass=$this->pass; $adh->pass=$this->pass;