From 6ffa8d70b5dd9e77328c6ce5798156bdc26aebfc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Mar 2008 11:34:20 +0000 Subject: [PATCH] Number for ref and ref supplier are not the same for supplier invoices --- htdocs/fourn/facture/document.php | 11 +++++--- htdocs/fourn/facture/fiche.php | 17 ++++++++---- htdocs/fourn/facture/index.php | 31 +++++++++++++--------- htdocs/fourn/facture/note.php | 14 +++++----- htdocs/fourn/facture/paiement.php | 19 ++++++------- htdocs/fourn/fournisseur.facture.class.php | 4 ++- htdocs/fourn/paiement/fiche.php | 19 ++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 9 files changed, 71 insertions(+), 46 deletions(-) diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index aae695de519..07c14ddfe85 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -17,15 +17,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/fourn/facture/document.php \ingroup facture, fournisseur \brief Page de gestion des documents attachées à une facture fournisseur - \version $Revision$ + \version $Id$ */ require('./pre.inc.php'); @@ -146,7 +144,12 @@ if ($facid > 0) print ''; // Ref - print ''; + print ''; + print "\n"; + + // Ref supplier + print ''; + print "\n"; // Société print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index da282bacaa8..a28715fcdcc 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -193,7 +193,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) } else { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
'; + $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'
'; $_GET['action']='create'; $_GET['socid']=$_POST['socid']; } @@ -347,9 +347,9 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy') print ''; if($_GET['action'] == 'copy'){ - print ''; + print ''; }else{ - print ''; + print ''; } print ''; @@ -362,7 +362,7 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy') print ''; } - print ''; @@ -446,7 +446,10 @@ else print ''; print ''; + print $fac->ref.''; + + print ''; $rownb=9; print ''; print "\n"; + // Ref supplier + print ''; + print "\n"; + // Societe print ''; print ''; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 4009533d64e..98f2ea1f466 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/fourn/facture/index.php \ingroup fournisseur,facture \brief Lsite des factures fournisseurs - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -90,8 +87,8 @@ if ($_POST["mode"] == 'search') llxHeader(); $sql = "SELECT s.rowid as socid, s.nom, "; -$sql.= " ".$db->pdate("fac.datef")." as datef, ".$db->pdate("fac.date_lim_reglement")." as date_echeance,"; -$sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, fac.rowid as facid, fac.facnumber"; +$sql.= " fac.rowid as ref, fac.rowid as facid, fac.facnumber, ".$db->pdate("fac.datef")." as datef, ".$db->pdate("fac.date_lim_reglement")." as date_echeance,"; +$sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -113,7 +110,11 @@ if ($_GET["filtre"]) if ($_REQUEST["search_ref"]) { - $sql .= " AND fac.facnumber like '%".addslashes($_REQUEST["search_ref"])."%'"; + $sql .= " AND fac.rowid like '%".addslashes($_REQUEST["search_ref"])."%'"; + } +if ($_REQUEST["search_ref_supplier"]) + { + $sql .= " AND fac.facnumber like '%".addslashes($_REQUEST["search_ref_supplier"])."%'"; } if ($_GET["search_libelle"]) @@ -154,7 +155,8 @@ if ($resql) print '
'; print '
'.$langs->trans('Ref').''.$facture->ref.'
'.$langs->trans("Ref").''.$facture->ref.'
'.$langs->trans("RefSupplier").''.$facture->ref_supplier.'
'.$langs->trans('Company').''.$facture->fournisseur->getNomUrl(1).'
'.$langs->trans('NotePublic').'
'.$langs->trans('Ref').'
'.$langs->trans('RefSupplier').'
'.$langs->trans('Ref').'
'.$langs->trans('RefSupplier').'
'.$langs->trans('Label').'
'.$langs->trans('Date').''; + print '
'.$langs->trans('DateInvoice').''; $html->select_date('','','','','',"add"); print '
'.$langs->trans('Ref').''; - print '
'.$langs->trans('RefSupplier').''; + print ''; @@ -568,6 +571,10 @@ else print '
'.$langs->trans("Ref").''.$fac->ref.'
'.$langs->trans("RefSupplier").''.$fac->ref_supplier.'
'.$langs->trans('Company').''.$societe->getNomUrl(1).''.$langs->trans('OtherBills').'
'; print ''; - print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&socid=$socid","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),"index.php","rowid","&socid=$socid","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefSupplier"),"index.php","facnumber","&socid=$socid","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),"index.php","fac.datef","&socid=$socid","",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&socid=$socid","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&socid=$socid","","",$sortfield,$sortorder); @@ -168,7 +170,11 @@ if ($resql) print ''; print ''; + print ''; + print ''; + print ''; print ''; @@ -194,9 +200,10 @@ if ($resql) $var=!$var; print ""; - print '\n"; + print '"; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 6e45c962ea9..fc1e19bf7f4 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/fourn/facture/note.php \ingroup facture \brief Fiche de notes sur une facture fournisseur - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -108,7 +105,12 @@ if ($_GET["facid"]) print '
'; print ''; - print ' '; + print ''; + print ' '; print ''; print '
'.img_object($langs->trans("ShowBill"),"bill").' '.dolibarr_trunc($obj->facnumber,12).""; + print ''.img_object($langs->trans("ShowBill"),"bill").' '.$obj->ref.""; if (($obj->paye == 0) && ($obj->fk_statut > 0) && $obj->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print "'.dolibarr_trunc($obj->facnumber,12)."'.dolibarr_print_date($obj->datef).''.dolibarr_trunc($obj->libelle,36).''; @@ -219,7 +226,7 @@ if ($resql) { // Print total print '
'.$langs->trans("Total").''.$langs->trans("Total").''.price($total).''.price($total_ttc).' 
'; // Ref - print ''; + print ''; + print "\n"; + + // Ref supplier + print ''; + print "\n"; // Société print ''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 8ba55670bae..903ad786d5c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Éric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * @@ -18,16 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/fourn/facture/paiement.php \ingroup fournisseur,facture \brief Paiements des factures fournisseurs - \version $Revision$ + \version $Id$ */ @@ -244,7 +241,7 @@ if ($action == 'create' || $action == 'add_paiement') print ''; print ''; - print ''; + print ''; if ($conf->banque->enabled) { print '
'.$langs->trans('Ref').''.$fac->ref.'
'.$langs->trans("Ref").''.$fac->ref.'
'.$langs->trans("RefSupplier").''.$fac->ref_supplier.'
'.$langs->trans('Company').''.$fac->fournisseur->getNomUrl(1).'
'; print '
'.$langs->trans('Numero').'
Numéro du chèque / virement
'.$langs->trans('Numero').'
'.$langs->trans('Account').''; @@ -258,7 +255,7 @@ if ($action == 'create' || $action == 'add_paiement') /* * Autres factures impayées */ - $sql = 'SELECT f.rowid as facid,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df'; + $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df'; $sql .= ', sum(pf.amount) as am'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; @@ -274,9 +271,12 @@ if ($action == 'create' || $action == 'add_paiement') { $i = 0; print '
'; + print $langs->trans('Invoices').'
'; print ''; print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -291,8 +291,9 @@ if ($action == 'create' || $action == 'add_paiement') $objp = $db->fetch_object($resql); $var=!$var; print ''; - print ''; + print ''; if ($objp->df > 0 ) { print '
'.$langs->trans('Bill').''.$langs->trans('Date').''.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPayed').''.$langs->trans('RemainderToPay').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber; + print ''.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref; print ''.$objp->facnumber.''; diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 818222b5e6d..073d1f5ce9c 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -190,9 +190,11 @@ class FactureFournisseur extends Facture $obj = $this->db->fetch_object($resql); $this->id = $rowid; + $this->ref = $this->id; + $this->ref_supplier = $obj->facnumber; + $this->datep = $obj->df; $this->date_echeance = $obj->de; - $this->ref = $obj->facnumber; $this->libelle = $obj->libelle; $this->remise = $obj->remise; diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 321ee2a2d8c..a2221a05b8b 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -16,9 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** @@ -26,7 +23,7 @@ \ingroup facture, fournisseur \brief Onglet paiement d'un paiement fournisseur \remarks Fichier presque identique a compta/paiement/fiche.php - \version $Revision$ + \version $Id$ */ @@ -136,7 +133,8 @@ if ($mesg) print $mesg.'
'; print ''; -print ''; +print ''; +print ''; if ($conf->banque->enabled) { if ($paiement->bank_account) @@ -171,7 +169,7 @@ print '
'.$langs->trans('Ref').''.$paiement->id.'
'.$langs->trans('Ref').''.$paiement->id.'
'; * Liste des factures */ $allow_delete = 1 ; -$sql = 'SELECT f.facnumber, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; +$sql = 'SELECT f.rowid as ref, f.facnumber as ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; $sql .= ' AND pf.fk_paiementfourn = '.$paiement->id; @@ -182,9 +180,11 @@ if ($resql) $i = 0; $total = 0; - print '
'; + print '
'.$langs->trans("Invoices").'
'; + print '
'; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -202,8 +202,9 @@ if ($resql) $var=!$var; print ''; print '\n"; + print '\n"; print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 64af9c14c3d..4d1be37f8f4 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -237,6 +237,7 @@ FullList=Full list Statistics=Statistics Status=Status Ref=Ref. +RefSupplier=Ref. supplier CommercialProposals=Commercial proposals Comment=Comment Comments=Comments diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 43d98dded06..1d18b4f5723 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -238,6 +238,7 @@ FullList=Liste compl Statistics=Statistiques Status=État Ref=Réf. +RefSupplier=Réf. fournisseur CommercialProposals=Propositions commerciales/devis Comment=Commentaire Comments=Commentaires
'.$langs->trans('Bill').''.$langs->trans('Ref').''.$langs->trans('RefSupplier').''.$langs->trans('Status').''.$langs->trans('Company').''.$langs->trans('AmountTTC').'
'.img_object($langs->trans('ShowBill'),'bill').' '; - print $objp->facnumber; + print $objp->ref; print "'.$objp->ref_supplier."'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).''.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.''.price($objp->amount).'