From 23a15dcf266e1e4326641100f6a842cca6f87d3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Mar 2006 21:49:07 +0000 Subject: [PATCH] New: Ajout onglet info sur fiche facture fournisseur --- htdocs/facture.class.php | 2 +- htdocs/fourn/facture/fiche.php | 19 ++++-- htdocs/fourn/facture/info.php | 76 ++++++++++++++++++++++ htdocs/fourn/fournisseur.facture.class.php | 42 ++++++++++++ 4 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 htdocs/fourn/facture/info.php diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 05d8491c290..f5f493d22b1 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Marc Barilley / Ocebo diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index ce496200414..4497be16766 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * @@ -24,7 +24,7 @@ /** \file htdocs/fourn/facture/fiche.php - \ingroup facture + \ingroup facture, fournisseur \brief Page des la fiche facture fournisseur \version $Revision$ */ @@ -82,7 +82,7 @@ if($_GET['action'] == 'deletepaiement') if ($_POST['action'] == 'modif_libelle') { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set libelle = \''.$form_libelle.'\' WHERE rowid = '.$_GET['facid']; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set libelle = \''.addslashes($form_libelle).'\' WHERE rowid = '.$_GET['facid']; $result = $db->query( $sql); } @@ -93,8 +93,8 @@ if ($_POST['action'] == 'update') $date_echeance = $db->idate(mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear'])); $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set '; - $sql .= " facnumber='".trim($_POST['facnumber'])."'"; - $sql .= ", libelle='".trim($_POST['libelle'])."'"; + $sql .= " facnumber='".addslashes(trim($_POST['facnumber']))."'"; + $sql .= ", libelle='".addslashes(trim($_POST['libelle']))."'"; $sql .= ", note='".$_POST['note']."'"; $sql .= ", datef = '$datefacture'"; $sql .= ", date_lim_reglement = '$date_echeance'"; @@ -318,6 +318,7 @@ else $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$fac->socidp; $addons[0][1] = $societe->nom; } + llxHeader('','', $addons); if ($mesg) { print '
'.$mesg.'
'; } @@ -325,7 +326,7 @@ else if ($_GET['action'] == 'edit') { - print_titre($langs->trans('Bill').': '.$fac->ref); + print_titre($langs->trans('SupplierInvoice')); print '
'; print ''; @@ -440,7 +441,11 @@ else $hselected = $h; $h++; - $titre=$langs->trans('SupplierBill').': '.$fac->ref; + $head[$h][0] = 'info.php?facid='.$fac->id; + $head[$h][1] = $langs->trans('Info'); + $h++; + + $titre=$langs->trans('SupplierInvoice'); dolibarr_fiche_head($head, $hselected, $titre); diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php new file mode 100644 index 00000000000..379e38411fb --- /dev/null +++ b/htdocs/fourn/facture/info.php @@ -0,0 +1,76 @@ + + * Copyright (C) 2004-2006 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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/info.php + \ingroup facture, fournisseur + \brief Page des informations d'une facture fournisseur + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); + +$langs->load("bills"); + +llxHeader(); + + +/* + * Visualisation de la fiche + * + */ + +$fac = new FactureFournisseur($db); +$fac->fetch($_GET["facid"]); +$fac->info($_GET["facid"]); +$soc = new Societe($db, $fac->socidp); +$soc->fetch($fac->socidp); + +$h=0; + +$head[$h][0] = 'fiche.php?facid='.$fac->id; +$head[$h][1] = $langs->trans('Card'); +$h++; + +$head[$h][0] = 'info.php?facid='.$fac->id; +$head[$h][1] = $langs->trans('Info'); +$hselected = $h; +$h++; + +dolibarr_fiche_head($head, $hselected, $langs->trans("SupplierInvoice")); + + +print '
'; +dolibarr_print_object_info($fac); +print '
'; + +print ''; + +// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent +print '
'; +print '
'; + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 48aa4fe560b..61edf8cb145 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -466,6 +466,48 @@ class FactureFournisseur } + /** + * \brief Charge les informations d'ordre info dans l'objet facture + * \param id Id de la facture a charger + */ + function info($id) + { + $sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec'; + $sql .= ', fk_user_author, fk_user_valid'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c'; + $sql .= ' WHERE c.rowid = '.$id; + + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db, $obj->fk_user_author); + $cuser->fetch(); + $this->user_creation = $cuser; + } + if ($obj->fk_user_valid) + { + $vuser = new User($this->db, $obj->fk_user_valid); + $vuser->fetch(); + $this->user_validation = $vuser; + } + $this->date_creation = $obj->datec; + //$this->date_validation = $obj->datev; \todo La date de validation n'est pas encore gérée + } + $this->db->free($result); + } + else + { + dolibarr_print_error($this->db); + } + } + + /** * \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée) * \return string Libellé