Merge branch 'NEW/12.0_new_payments_on_salaries' of https://github.com/ATM-Consulting/dolibarr into FIX/salaries_card
This commit is contained in:
commit
946a1fe82d
@ -61,6 +61,7 @@ $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday",
|
||||
$datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int'));
|
||||
$dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int'));
|
||||
$label = GETPOST('label');
|
||||
$fk_user = GETPOST('userid', 'int');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
@ -107,7 +108,18 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == '
|
||||
$result = $object->set_paid($user);
|
||||
}
|
||||
|
||||
// Reopen
|
||||
if($action == 'setfk_user' && $user->rights->salaries->write) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0){
|
||||
$object->fk_user = $fk_user;
|
||||
$object->update($user);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->salaries->write) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye) {
|
||||
@ -593,10 +605,29 @@ if ($id) {
|
||||
$morehtmlref .= '</form>';
|
||||
}
|
||||
|
||||
// Employee
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->fk_user);
|
||||
$morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1);
|
||||
//Employee
|
||||
if($action != 'editfk_user') {
|
||||
$morehtmlref .= '<br />' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1);
|
||||
|
||||
if(!empty($object->fk_user)) {
|
||||
$userstatic = new User($db);
|
||||
$result = $userstatic->fetch($object->fk_user);
|
||||
if ($result > 0){
|
||||
$morehtmlref .= $userstatic->getNomUrl(1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '<br>'.$langs->trans('Employee').' : ';
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="setfk_user">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $form->select_dolusers($object->fk_user, 'userid', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
@ -674,7 +705,7 @@ if ($id) {
|
||||
print '</td></tr>';*/
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . $object->amount . '"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount, 0, $outputlangs, 1, -1, 2) . '"></td></tr>';
|
||||
} else {
|
||||
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user