New: Ajout onglet info sur fiche facture fournisseur

This commit is contained in:
Laurent Destailleur 2006-03-14 21:49:07 +00:00
parent 8e3ce6ee81
commit 23a15dcf26
4 changed files with 131 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr>
*
@ -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 '<br>'.$mesg.'<br>'; }
@ -325,7 +326,7 @@ else
if ($_GET['action'] == 'edit')
{
print_titre($langs->trans('Bill').': '.$fac->ref);
print_titre($langs->trans('SupplierInvoice'));
print '<form name="update" action="fiche.php?facid='.$fac->id.'" method="post">';
print '<input type="hidden" name="action" value="update">';
@ -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);

View File

@ -0,0 +1,76 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 '<table width="100%"><tr><td>';
dolibarr_print_object_info($fac);
print '</td></tr></table>';
print '</div>';
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
print '<div class="tabsAction">';
print '</div>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -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é