$db->commit(); header("Location: index.php"); exit; } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } } $action = 'create'; } if ($action == 'delete') { $result = $object->fetch($id); if ($object->rappro == 0) { $db->begin(); $ret = $object->delete($user); if ($ret > 0) { if ($object->fk_bank) { $accountline = new AccountLine($db); $result = $accountline->fetch($object->fk_bank); if ($result > 0) { $result = $accountline->delete($user); } // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } if ($result >= 0) { $db->commit(); header("Location: " . DOL_URL_ROOT . '/compta/salaries/index.php'); exit; } else { $object->error = $accountline->error;
$db->commit(); header("Location: index.php"); exit; } else { $db->rollback(); setEventMessage($sal->error, 'errors'); $action = "create"; } } $action = 'create'; } if ($action == 'delete') { $result = $sal->fetch($id); if ($sal->rappro == 0) { $db->begin(); $ret = $sal->delete($user); if ($ret > 0) { if ($sal->fk_bank) { $accountline = new AccountLine($db); $result = $accountline->fetch($sal->fk_bank); if ($result > 0) { $result = $accountline->delete($user); } // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } if ($result >= 0) { $db->commit(); header("Location: " . DOL_URL_ROOT . '/compta/salaries/index.php'); exit; } else { $sal->error = $accountline->error;