Fix prelevement right management and action buttons

This commit is contained in:
Maxime Kohlhaas 2021-12-28 18:17:57 +01:00
parent 2237c09d64
commit 1e848f0ebb
2 changed files with 8 additions and 5 deletions

View File

@ -302,20 +302,22 @@ if ($id > 0 || $ref) {
print '<br>';
}
// Actions
if ($action != 'settransmitted' && $action != 'setcredited') {
print "\n".'<div class="tabsAction">'."\n";
if (empty($object->date_trans) && $user->rights->prelevement->bons->send) {
print '<a class="butAction" href="card.php?action=settransmitted&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToStatusSent").'</a>';
if (empty($object->date_trans)) {
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
else print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
}
if (!empty($object->date_trans) && $object->date_credit == 0) {
print '<a class="butAction" href="card.php?action=setcredited&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ClassCredited").'</a>';
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit);
else print dolGetButtonAction($langs->trans("ClassCredited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit);
}
print '<a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
else print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
print '</div>';
}

View File

@ -48,6 +48,7 @@ ThirdPartyBankCode=Third-party bank code
NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode <strong>%s</strong>.
WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries.
ClassCredited=Classify credited
ClassDebited=Classify debited
ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account?
TransData=Transmission date
TransMetod=Transmission method