diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index bc8e7dbbc69..2be2436d0dc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -259,6 +259,7 @@ if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user-> $fac->fetch($_GET['facid']); $result = $fac->set_payed($user); } +// Classe à "payée partiellement" if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement) { $fac = new Facture($db); @@ -274,6 +275,41 @@ if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' $mesg='
| '; @@ -1887,7 +1916,7 @@ else // Facturé print ' | |||||
| '.$langs->trans("Billed").' : | '.price($fac->total_ttc).' | '.$langs->trans('Currency'.$conf->monnaie).' | |||
| '; @@ -1895,16 +1924,16 @@ else print ' | '.price($fac->total_ttc - $totalpaye).' | '.$langs->trans('Currency'.$conf->monnaie).' | |||
| '; print $html->textwithhelp($langs->trans("Abandoned").':',$langs->trans("HelpAbandonBadCustomer"),-1); print ' | '.price($fac->total_ttc - $totalpaye).' | '.$langs->trans('Currency'.$conf->monnaie).' | |||
| '; print $html->textwithhelp($langs->trans("Abandoned").':',$langs->trans("HelpAbandonOther"),-1); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 649a4fe5c45..1b5cc0b3737 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -66,7 +66,10 @@ class Facture extends CommonObject var $total; var $note; var $note_public; - //! 0=brouillon, 1=validée, 2=classée payée partiellement ou complètement, 3=classée abandonnée + //! 0=brouillon, + //! 1=validée, + //! 2=classée payée partiellement (close_code='discount_vat','bad_customer') ou complètement (close_code=null), + //! 3=classée abandonnée (close_code='abandon') var $statut; //! 1 si facture payée COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant) var $paye; @@ -124,7 +127,7 @@ class Facture extends CommonObject \param user Object utilisateur qui crée \return int <0 si ko, >0 si ok */ - function Create($user) + function create($user) { global $langs,$conf,$mysoc; @@ -388,7 +391,7 @@ class Facture extends CommonObject \param societe_id id de societe \return int >0 si ok, <0 si ko */ - function Fetch($rowid, $societe_id=0) + function fetch($rowid, $societe_id=0) { dolibarr_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$societe_id, LOG_DEBUG); @@ -2257,7 +2260,7 @@ class Facture extends CommonObject /** \brief Renvoi liste des factures remplacables - Statut validée + aucun paiement + non payée + pas deja remplacée + Statut validée ou abandonnée pour raison autre + non payée + aucun paiement + pas deja remplacée \param socid Id societe \return array Tableau des factures ('id'=>id, 'ref'=>ref, 'statut'=>status) */ @@ -2272,7 +2275,7 @@ class Facture extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON f.rowid = ff.fk_facture_source"; - $sql.= " WHERE f.fk_statut = 1"; + $sql.= " WHERE (f.fk_statut = 1 OR (f.fk_statut = 3 AND f.close_code = 'abandon'))"; $sql.= " AND f.paye = 0"; // Pas classée payée complètement $sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait $sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 613da1f37ba..e942b7c0086 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1609,8 +1609,8 @@ class Form print ' | |||||
| '.$input['label'].' | '; else print ''; - print ' | '; - print ' | '; + print ' | '; + print ' | '; print $selval; print ' |