diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index eb3f969890b..090a82cbaa2 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3313,7 +3313,9 @@ else if ($id > 0 || ! empty($ref)) print ' '; print $prevsits[0]->situation_counter; - for ($i = 1; $i < count($prevsits); $i++) { + $cprevsits = count($prevsits); + + for ($i = 1; $i < $cprevsits; $i++) { print ' + '; print $prevsits[$i]->situation_counter; } @@ -3334,7 +3336,7 @@ else if ($id > 0 || ! empty($ref)) print '' . $langs->trans('Currency' . $conf->currency) . ''; // Previous situation(s) deduction(s) - for ($i = 0; $i < count($prevsits); $i++) { + for ($i = 0; $i < $cprevsits; $i++) { print ''; print ''; print $langs->trans('SituationDeduction'); @@ -3629,6 +3631,7 @@ else if ($id > 0 || ! empty($ref)) } } + // deprecated. Useless because now we can use templates if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility { if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) { @@ -3684,7 +3687,7 @@ else if ($id > 0 || ! empty($ref)) // Classify paid if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)) - || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id)) + || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id)) ) { print '
'.$langs->trans('ClassifyPaid').'
'; @@ -3714,10 +3717,10 @@ else if ($id > 0 || ! empty($ref)) print '
' . $langs->trans("ToClone") . '
'; } - // Clone as predefined + // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $user->rights->facture->creer) { - if (! $objectidnext) + if (! $objectidnext && count($object->lines) > 0) { print '
' . $langs->trans("ChangeIntoRepeatableInvoice") . '
'; } @@ -3732,7 +3735,7 @@ else if ($id > 0 || ! empty($ref)) } } - //Create next situation invoice + // Create next situation invoice if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) { if ($object->is_last_in_cycle() && $object->situation_final != 1) { print '
' . $langs->trans('CreateNextSituationInvoice') . '
';