From fd86e90df22c5f61bdbca95ef27e156ad62287fb Mon Sep 17 00:00:00 2001 From: John Date: Thu, 22 Mar 2018 11:19:39 +0100 Subject: [PATCH] Add create creadit note btn --- htdocs/compta/facture/card.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e6ca4650150..61b63315295 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4416,7 +4416,7 @@ else if ($id > 0 || ! empty($ref)) print '
' . $langs->trans("ChangeIntoRepeatableInvoice") . '
'; } } - + // Create a credit note if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer) { @@ -4425,6 +4425,25 @@ else if ($id > 0 || ! empty($ref)) print '
' . $langs->trans("CreateCreditNote") . '
'; } } + + + // For situation invoice with excess received + if ($object->statut == Facture::STATUS_VALIDATED + && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0 + && $user->rights->facture->creer + && !$objectidnext + && $object->is_last_in_cycle() + ) + { + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate))) + { + print '
' . $langs->trans("CreateCreditNote") . '
'; + } else { + print '
' . $langs->trans("CreateCreditNote") . '
'; + } + } + // Create next situation invoice if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {