diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 661a727268f..65d9d5da9b1 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -76,7 +76,7 @@ if ($reshook < 0) { } if (empty($reshook)) { // Classify paid - if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_paid' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setPaid($user); if ($result > 0) { @@ -87,7 +87,7 @@ if (empty($reshook)) { } // Delete loan - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->delete($user); if ($result > 0) { @@ -100,12 +100,12 @@ if (empty($reshook)) { } // Add loan - if ($action == 'add' && $user->rights->loan->write) { + if ($action == 'add' && $user->hasRight('loan', 'write')) { if (!$cancel) { $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); $capital = price2num(GETPOST('capital')); - $rate = price2num(GETPOST('rate')); + $rate = price2num(GETPOST('rate')); if (!$capital) { $error++; $action = 'create'; @@ -168,23 +168,23 @@ if (empty($reshook)) { header("Location: list.php"); exit(); } - } elseif ($action == 'update' && $user->rights->loan->write) { + } elseif ($action == 'update' && $user->hasRight('loan', 'write')) { // Update record if (!$cancel) { $result = $object->fetch($id); $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); - $capital = price2num(GETPOST('capital')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $capital = price2num(GETPOST('capital')); if (!$capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); $action = 'edit'; } else { $object->datestart = $datestart; - $object->dateend = $dateend; - $object->capital = $capital; - $object->nbterm = GETPOST("nbterm", 'int'); + $object->dateend = $dateend; + $object->capital = $capital; + $object->nbterm = GETPOST("nbterm", 'int'); $object->rate = price2num(GETPOST("rate", 'alpha')); $object->insurance_amount = price2num(GETPOST('insurance_amount', 'int')); @@ -225,7 +225,7 @@ if (empty($reshook)) { } // Link to a project - if ($action == 'classin' && $user->rights->loan->write) { + if ($action == 'classin' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setProject($projectid); if ($result < 0) { @@ -233,7 +233,7 @@ if (empty($reshook)) { } } - if ($action == 'setlabel' && $user->rights->loan->write) { + if ($action == 'setlabel' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY'); if ($result < 0) { @@ -426,13 +426,13 @@ if ($id > 0) { $morehtmlref = '