diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index dde8d32a49f..4ed3a3ad801 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -812,11 +812,11 @@ else $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num_lignes = $db->num_rows(); $i = 0; $total = 0; echo '
| Description | '; @@ -828,7 +828,7 @@ else print "
| id&action=delete\">Supprimer | "; - } - // Valider - if ($fac->statut == 0 && $fac->total_ht > 0) + if ($user->societe_id == 0 && $_GET["action"] <> 'valid') + { + print "id&action=valid\">Valider | "; - } - else - { - print '- | '; + print "id&action=valid\">Valider"; } } - else { + else + { // Générer - if ($fac->statut == 1 && ($fac->paye == 0 || $user->admin)) - { - if ($user->rights->facture->creer) + if ($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer) { - if ($fac->paye == 0) { - print "id&action=pdf\">Générer la facture | "; - } - else { - print "id&action=pdf\">Regénérer la facture | "; - } - } - else - { - print '- | '; + if ($fac->paye == 0) + { + print "id&action=pdf\">Générer la facture"; + } + else + { + print "id&action=pdf\">Regénérer la facture"; + } } } - else - { - print '- | '; - } - } - // Envoyer - if ($fac->statut == 1 && abs($resteapayer) > 0 && $user->rights->facture->envoyer) + // Supprimer + if ($fac->statut == 0 && $user->rights->facture->supprimer) { - print "id&action=presend\">Envoyer | "; - } - else - { - print "- | "; + print "id&action=delete\">Supprimer"; } - // Envoyer une relance + // Envoyer + if ($fac->statut == 1 && abs($resteapayer) > 0 && $user->rights->facture->envoyer) + { + print "id&action=presend\">Envoyer"; + } + + // Envoyer une relance if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->envoyer) { - print "id&action=prerelance\">Envoyer une relance | "; - } - else - { - print '- | '; + print "id&action=prerelance\">Envoyer une relance"; } - // Emettre paiement + // Emettre paiement if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->paiement) { - print ''; - print 'Emettre un paiement | '; + print 'Emettre un paiement'; } - else + + // Classer 'payé' + if ($fac->statut == 1 && abs($resteapayer) == 0 + && $fac->paye == 0 && $user->rights->facture->paiement) { - print '- | '; + print "id&action=payed\">Classer 'Payée'"; } - - // Classer 'payé' - if ($fac->statut == 1 && abs($resteapayer) == 0 && $fac->paye == 0) - { - if ($user->rights->facture->paiement) - { - print "id&action=payed\">Classer 'Payée' | "; - } - else - { - print '- | '; - } - } + - // Récurrente + // Récurrente if (! defined("FACTURE_DISABLE_RECUR")) // Possibilité de désactiver les factures récurrentes { if ($fac->statut > 0) { - print 'Récurrente | '; - } - else - { - print '- | '; + print 'Récurrente'; } } - - print "
\n"; @@ -1057,7 +1025,6 @@ else print "
| Date | Action |