Fix phpcs
This commit is contained in:
parent
59f205596e
commit
b5def91b46
@ -190,6 +190,8 @@ class ConferenceOrBooth extends ActionComm
|
||||
|
||||
/**
|
||||
* Set Percentage from status
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPercentageFromStatus()
|
||||
{
|
||||
|
||||
@ -195,7 +195,6 @@ if ($action == 'add' && empty($cancel)) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
$ret = $object->create($user);
|
||||
if ($ret < 0) $error++;
|
||||
if (!empty($auto_create_paiement) && !$error) {
|
||||
@ -257,18 +256,15 @@ if ($action == 'confirm_delete') {
|
||||
$db->begin();
|
||||
|
||||
$ret = $object->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT.'/salaries/list.php');
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setEventMessages($langs->trans('DisabledBecausePayments'), null, 'errors');
|
||||
}
|
||||
}
|
||||
@ -280,8 +276,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->salaries->write)
|
||||
if (empty($amount)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (!is_numeric($amount)) {
|
||||
} elseif (!is_numeric($amount)) {
|
||||
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
} else {
|
||||
@ -307,15 +302,13 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries-
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$object->paye = 0;
|
||||
$object->id = $object->ref = null;
|
||||
|
||||
if (GETPOST('clone_label', 'alphanohtml')) {
|
||||
$object->label = GETPOST('clone_label', 'alphanohtml');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$object->label = $langs->trans("CopyOf").' '.$object->label;
|
||||
}
|
||||
|
||||
@ -325,25 +318,20 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries-
|
||||
if ($newdatestart) $object->datesp = $newdatestart;
|
||||
if ($newdateend) $object->dateep = $newdateend;
|
||||
|
||||
//if ($object->check()) {
|
||||
$id = $object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($id > 0) {
|
||||
$db->commit();
|
||||
$db->close();
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$id = $originalId;
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
@ -712,8 +700,9 @@ if ($id) {
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->salaries->write)
|
||||
if ($action != 'editbankaccount' && $user->rights->salaries->write) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
@ -892,8 +881,7 @@ if ($id) {
|
||||
|
||||
if (!empty($user->rights->salaries->delete) && empty($totalpaye)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,10 +453,10 @@ print '</tr>'."\n";
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
@ -645,7 +645,6 @@ print '</div>'."\n";
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -60,18 +60,18 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
if (!(GETPOST("paiementtype", 'int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$action = 'create';
|
||||
}
|
||||
if ($datepaye == '') {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
$action = 'create';
|
||||
}
|
||||
if (!empty($conf->banque->enabled) && !(GETPOST("accountid", 'int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
if (!empty($conf->banque->enabled) && !(GETPOST("accountid", 'int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = 0;
|
||||
@ -84,52 +84,52 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
}
|
||||
}
|
||||
|
||||
if (count($amounts) <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
if (count($amounts) <= 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
// Create a line of payments
|
||||
$paiement = new PaymentSalary($db);
|
||||
$paiement->chid = $chid;
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Tableau de montant
|
||||
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
|
||||
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
|
||||
$paiement->note = GETPOST("note", 'none');
|
||||
$paiement->note_private = GETPOST("note", 'none');
|
||||
// Create a line of payments
|
||||
$paiement = new PaymentSalary($db);
|
||||
$paiement->chid = $chid;
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Tableau de montant
|
||||
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
|
||||
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
|
||||
$paiement->note = GETPOST("note", 'none');
|
||||
$paiement->note_private = GETPOST("note", 'none');
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidsalary') == 'on' ? 1 : 0));
|
||||
if ($paymentid < 0) {
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidsalary') == 'on' ? 1 : 0));
|
||||
if ($paymentid < 0) {
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_salary', '(SalaryPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_salary', '(SalaryPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/salaries/card.php?id='.$chid;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/salaries/card.php?id='.$chid;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ $form = new Form($db);
|
||||
if ($action == 'create') {
|
||||
$salary = new Salary($db);
|
||||
$salary->fetch($chid);
|
||||
$salary->accountid = $salary->fk_account ? $salary->fk_account : $salary->accountid;
|
||||
$salary->paiementtype = $salary->mode_reglement_id ? $salary->mode_reglement_id : $salary->paiementtype;
|
||||
$salary->accountid = $salary->fk_account ? $salary->fk_account : $salary->accountid;
|
||||
$salary->paiementtype = $salary->mode_reglement_id ? $salary->mode_reglement_id : $salary->paiementtype;
|
||||
|
||||
$total = $salary->amount;
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
@ -231,7 +231,7 @@ if ($action == 'create') {
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Autres charges impayees
|
||||
* Autres charges impayees
|
||||
*/
|
||||
$num = 1;
|
||||
$i = 0;
|
||||
|
||||
@ -61,9 +61,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries-
|
||||
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT."/salaries/payments.php");
|
||||
exit;
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT."/salaries/payments.php");
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
@ -90,7 +90,8 @@ $head[$h][1] = $langs->trans("SalaryPayment");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$id;
|
||||
/*
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user