mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-30 05:11:27 +01:00
Merge pull request #169 from atm-adrien/NEW/12.0_new_payments_on_salaries_devadrien
FIX : pencil to update employee field on card view
This commit is contained in:
@@ -59,6 +59,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");
|
||||
@@ -98,6 +99,18 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == '
|
||||
$result = $object->set_paid($user);
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -626,11 +639,30 @@ if ($id)
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$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))
|
||||
|
||||
Reference in New Issue
Block a user