From 892a8c1ce42dc48d86334ad6f8daa34bdeb12ef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 May 2009 01:48:31 +0000 Subject: [PATCH] Fix: make fix on predefined invoice feature. --- htdocs/compta/facture.php | 13 ++++++++----- htdocs/compta/facture/facture-rec.class.php | 1 + htdocs/compta/facture/fiche-rec.php | 4 ++-- htdocs/facture.class.php | 8 ++++---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a7171d3d996..b64509373bc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -483,7 +483,7 @@ if ($_REQUEST['action'] == 'confirm_converttoreduc' && $_REQUEST['confirm'] == ' /* - * Insert invoice + * Insert new invoice in database */ if ($_POST['action'] == 'add' && $user->rights->facture->creer) { @@ -533,7 +533,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer) } } - // Facture avoir + // Credit note invoice if ($_POST['type'] == 2) { if (! $_POST['fac_avoir'] > 0) @@ -1453,7 +1453,7 @@ if ($_GET['action'] == 'create') { if ($_GET['propalid'] == 0 && $_GET['commandeid'] == 0 && $_GET['contratid'] == 0) { - $sql = 'SELECT r.rowid, r.titre, r.amount FROM '.MAIN_DB_PREFIX.'facture_rec as r'; + $sql = 'SELECT r.rowid, r.titre, r.total_ttc FROM '.MAIN_DB_PREFIX.'facture_rec as r'; $sql.= ' WHERE r.fk_soc = '.$soc->id; $resql=$db->query($sql); if ($resql) @@ -1463,12 +1463,15 @@ if ($_GET['action'] == 'create') if ($num > 0) { - print ''.$langs->trans('CreateFromRepeatableInvoice').''; print ''; while ($i < $num) { $objp = $db->fetch_object($resql); - print ''; + print ''; $i++; } print ''; diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index 31ad6dc5da1..ce37bd9f77c 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -327,6 +327,7 @@ class FactureRec extends Facture $this->lignes[$i] = $faclig; $i++; } + $this->db->free($result); return 1; } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 7b0625e7f09..8eb179d4af7 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -543,11 +543,11 @@ else { if ($objp->fk_statut == 0) { - print 'brouillon'; + print ''.$langs->trans("Draft").''; } else { - print 'impay�e'; + print ''.$langs->trans("Validated").''; } } else diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 93133e15518..00b0ce7242a 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -158,7 +158,7 @@ class Facture extends CommonObject if ($this->fac_rec > 0) { require_once(DOL_DOCUMENT_ROOT.'/compta/facture/facture-rec.class.php'); - $_facrec = new FactureRec($this->db, $this->fac_rec); + $_facrec = new FactureRec($this->db); $result=$_facrec->fetch($this->fac_rec); $this->projetid = $_facrec->projetid; @@ -277,7 +277,7 @@ class Facture extends CommonObject } /* - * Produits de la facture récurrente + * Insert lines of predefined invoices */ if (! $error && $this->fac_rec > 0) { @@ -298,8 +298,8 @@ class Facture extends CommonObject $tva_tx, $_facrec->lignes[$i]->produit_id, $_facrec->lignes[$i]->remise_percent, - '','',0,0,'','HT', - $_facref->lignes[$i]->product_type + '','',0,0,'','HT',0, + $_facrec->lignes[$i]->product_type ); if ( $result_insert < 0)