diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index cf302c7e206..04337bf8a72 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4478,7 +4478,26 @@ else if ($id > 0 || ! empty($ref))
print '
' . $langs->trans("CreateCreditNote") . '
';
}
}
-
+
+ // remove situation from cycle
+ if ($object->statut == Facture::STATUS_VALIDATED
+ && $user->rights->facture->creer
+ && !$objectidnext
+ && $object->is_last_in_cycle()
+ && ((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)))
+ )
+ {
+ if(($object->total_ttc - $totalcreditnotes) == 0 && false)
+ {
+ print '';
+ }
+ else
+ {
+ print '';
+ }
+
+ }
// Create next situation invoice
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 48a2a9d0535..7bab9fd7ac1 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -341,6 +341,8 @@ ListOfPreviousSituationInvoices=List of previous situation invoices
ListOfNextSituationInvoices=List of next situation invoices
ListOfSituationInvoices=List of situation invoices
CurrentSituationTotal=Total current situation
+DisabledBecauseNotEnouthCreditNote=To remove a situation invoice from cycle, this invoice's credit note total must cover this invoice total
+RemoveSituationFromCycle=Remove this invoice from cycle
FrequencyPer_d=Every %s days
FrequencyPer_m=Every %s months
FrequencyPer_y=Every %s years