} else { header("Location: index.php"); exit; } } else { if ($action == 'update' && $user->rights->loan->write) { if (!$cancel) { $result = $object->fetch($id); if ($object->fetch($id)) { $object->label = GETPOST("label"); $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); $object->nbterm = GETPOST("nbterm"); $object->rate = GETPOST("rate"); } $result = $object->update($user); if ($result > 0) { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } else { setEventMessage($object->error, 'errors'); } } else { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } } } /* * View */