NEW: Can show Paid button if invoice or supplier invoice has no payments with global INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS and SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS
This commit is contained in:
parent
960319fd8a
commit
d91c24233c
@ -4091,10 +4091,10 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation du classement paye
|
// Confirmation du classement paye
|
||||||
if ($action == 'paid' && $resteapayer <= 0) {
|
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $resteapayer == $object->total_ttc))) {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
|
||||||
}
|
}
|
||||||
if ($action == 'paid' && $resteapayer > 0) {
|
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) || $resteapayer != $object->total_ttc)) {
|
||||||
$close = array();
|
$close = array();
|
||||||
// Code
|
// Code
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -5450,14 +5450,17 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classify paid
|
// Classify paid
|
||||||
if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
|
||||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
|
($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $object->total_ttc == $resteapayer))) ||
|
||||||
|
($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
|
||||||
|
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $object->total_ttc == $resteapayer)))
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
||||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) {
|
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
||||||
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
||||||
// If one payment or one credit note was linked to this invoice
|
// If one payment or one credit note was linked to this invoice
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
||||||
|
|||||||
@ -2563,11 +2563,11 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation set paid
|
// Confirmation set paid
|
||||||
if ($action == 'paid' && $resteapayer <= 0) {
|
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $resteapayer == $object->total_ttc))) {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'paid' && $resteapayer > 0) {
|
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) || $resteapayer != $object->total_ttc)) {
|
||||||
$close = array();
|
$close = array();
|
||||||
// Code
|
// Code
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -3496,14 +3496,17 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classify paid
|
// Classify paid
|
||||||
if (($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (
|
||||||
|| ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && empty($discount->id))
|
($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $object->total_ttc == $resteapayer))) ||
|
||||||
|
($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
|
||||||
|
($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) && $object->total_ttc == $resteapayer)))
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
||||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0) {
|
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_FORCE_PAID_WHEN_NO_PAIEMENTS) || $object->total_ttc != $resteapayer)) {
|
||||||
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
||||||
// If one payment or one credit note was linked to this invoice
|
// If one payment or one credit note was linked to this invoice
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user