Fix phpcs

This commit is contained in:
Laurent Destailleur 2021-03-04 17:57:08 +01:00
parent 59f205596e
commit b5def91b46
5 changed files with 73 additions and 83 deletions

View File

@ -190,6 +190,8 @@ class ConferenceOrBooth extends ActionComm
/** /**
* Set Percentage from status * Set Percentage from status
*
* @return void
*/ */
public function setPercentageFromStatus() public function setPercentageFromStatus()
{ {

View File

@ -195,7 +195,6 @@ if ($action == 'add' && empty($cancel)) {
} }
if (!$error) { if (!$error) {
$ret = $object->create($user); $ret = $object->create($user);
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (!empty($auto_create_paiement) && !$error) { if (!empty($auto_create_paiement) && !$error) {
@ -257,18 +256,15 @@ if ($action == 'confirm_delete') {
$db->begin(); $db->begin();
$ret = $object->delete($user); $ret = $object->delete($user);
if ($ret > 0) if ($ret > 0) {
{
$db->commit(); $db->commit();
header("Location: ".DOL_URL_ROOT.'/salaries/list.php'); header("Location: ".DOL_URL_ROOT.'/salaries/list.php');
exit; exit;
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} } else {
else {
setEventMessages($langs->trans('DisabledBecausePayments'), null, 'errors'); setEventMessages($langs->trans('DisabledBecausePayments'), null, 'errors');
} }
} }
@ -280,8 +276,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->salaries->write)
if (empty($amount)) { if (empty($amount)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'edit'; $action = 'edit';
} } elseif (!is_numeric($amount)) {
elseif (!is_numeric($amount)) {
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create'; $action = 'create';
} else { } else {
@ -307,15 +302,13 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries-
$object->fetch($id); $object->fetch($id);
if ($object->id > 0) if ($object->id > 0) {
{
$object->paye = 0; $object->paye = 0;
$object->id = $object->ref = null; $object->id = $object->ref = null;
if (GETPOST('clone_label', 'alphanohtml')) { if (GETPOST('clone_label', 'alphanohtml')) {
$object->label = GETPOST('clone_label', 'alphanohtml'); $object->label = GETPOST('clone_label', 'alphanohtml');
} } else {
else {
$object->label = $langs->trans("CopyOf").' '.$object->label; $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 ($newdatestart) $object->datesp = $newdatestart;
if ($newdateend) $object->dateep = $newdateend; if ($newdateend) $object->dateep = $newdateend;
//if ($object->check()) {
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0) {
{
$db->commit(); $db->commit();
$db->close(); $db->close();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit; exit;
} } else {
else {
$id = $originalId; $id = $originalId;
$db->rollback(); $db->rollback();
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
//} } else {
}
else {
$db->rollback(); $db->rollback();
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
} }
@ -712,8 +700,9 @@ if ($id) {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; 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&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editbankaccount') { if ($action == 'editbankaccount') {
@ -892,8 +881,7 @@ if ($id) {
if (!empty($user->rights->salaries->delete) && empty($totalpaye)) { 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>'; 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>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
} }
} }

View File

@ -453,10 +453,10 @@ print '</tr>'."\n";
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); 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("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("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("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); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
@ -645,7 +645,6 @@ print '</div>'."\n";
print '</form>'."\n"; print '</form>'."\n";
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -60,18 +60,18 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
if (!(GETPOST("paiementtype", 'int') > 0)) { if (!(GETPOST("paiementtype", 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++; $error++;
$action = 'create'; $action = 'create';
} }
if ($datepaye == '') { if ($datepaye == '') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++; $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) { if (!$error) {
$paymentid = 0; $paymentid = 0;
@ -84,52 +84,52 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
} }
} }
if (count($amounts) <= 0) { if (count($amounts) <= 0) {
$error++; $error++;
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors'); setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
$action = 'create'; $action = 'create';
} }
if (!$error) { if (!$error) {
$db->begin(); $db->begin();
// Create a line of payments // Create a line of payments
$paiement = new PaymentSalary($db); $paiement = new PaymentSalary($db);
$paiement->chid = $chid; $paiement->chid = $chid;
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant $paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); $paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'none'); $paiement->note = GETPOST("note", 'none');
$paiement->note_private = GETPOST("note", 'none'); $paiement->note_private = GETPOST("note", 'none');
if (!$error) { if (!$error) {
$paymentid = $paiement->create($user, (GETPOST('closepaidsalary') == 'on' ? 1 : 0)); $paymentid = $paiement->create($user, (GETPOST('closepaidsalary') == 'on' ? 1 : 0));
if ($paymentid < 0) { if ($paymentid < 0) {
$error++; $error++;
setEventMessages($paiement->error, null, 'errors'); setEventMessages($paiement->error, null, 'errors');
$action = 'create'; $action = 'create';
} }
} }
if (!$error) { if (!$error) {
$result = $paiement->addPaymentToBank($user, 'payment_salary', '(SalaryPayment)', GETPOST('accountid', 'int'), '', ''); $result = $paiement->addPaymentToBank($user, 'payment_salary', '(SalaryPayment)', GETPOST('accountid', 'int'), '', '');
if (!($result > 0)) { if (!($result > 0)) {
$error++; $error++;
setEventMessages($paiement->error, null, 'errors'); setEventMessages($paiement->error, null, 'errors');
$action = 'create'; $action = 'create';
} }
} }
if (!$error) { if (!$error) {
$db->commit(); $db->commit();
$loc = DOL_URL_ROOT.'/salaries/card.php?id='.$chid; $loc = DOL_URL_ROOT.'/salaries/card.php?id='.$chid;
header('Location: '.$loc); header('Location: '.$loc);
exit; exit;
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
} }
} }
@ -147,8 +147,8 @@ $form = new Form($db);
if ($action == 'create') { if ($action == 'create') {
$salary = new Salary($db); $salary = new Salary($db);
$salary->fetch($chid); $salary->fetch($chid);
$salary->accountid = $salary->fk_account ? $salary->fk_account : $salary->accountid; $salary->accountid = $salary->fk_account ? $salary->fk_account : $salary->accountid;
$salary->paiementtype = $salary->mode_reglement_id ? $salary->mode_reglement_id : $salary->paiementtype; $salary->paiementtype = $salary->mode_reglement_id ? $salary->mode_reglement_id : $salary->paiementtype;
$total = $salary->amount; $total = $salary->amount;
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
@ -231,7 +231,7 @@ if ($action == 'create') {
dol_fiche_end(); dol_fiche_end();
/* /*
* Autres charges impayees * Autres charges impayees
*/ */
$num = 1; $num = 1;
$i = 0; $i = 0;

View File

@ -61,9 +61,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries-
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
$db->commit(); $db->commit();
header("Location: ".DOL_URL_ROOT."/salaries/payments.php"); header("Location: ".DOL_URL_ROOT."/salaries/payments.php");
exit; exit;
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$db->rollback(); $db->rollback();
@ -90,7 +90,8 @@ $head[$h][1] = $langs->trans("SalaryPayment");
$hselected = $h; $hselected = $h;
$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"); $head[$h][1] = $langs->trans("Info");
$h++; $h++;
*/ */