Fix button create template must be visible only if amount is != 0

This commit is contained in:
Laurent Destailleur 2016-02-11 10:39:01 +01:00
parent 1d5bd7208e
commit 518080468e

View File

@ -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 '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
// Previous situation(s) deduction(s)
for ($i = 0; $i < count($prevsits); $i++) {
for ($i = 0; $i < $cprevsits; $i++) {
print '<tr><td>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
@ -3714,10 +3717,10 @@ else if ($id > 0 || ! empty($ref))
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&amp;action=clone&amp;object=invoice">' . $langs->trans("ToClone") . '</a></div>';
}
// 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 '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&amp;action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
}
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=create&amp;type=5&amp;origin=facture&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '" >' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';