Qual: Mise en facteur des methodes fetch_client et fetch_projet

This commit is contained in:
Laurent Destailleur 2006-06-23 19:40:28 +00:00
parent bc8f0fbc38
commit 8fabb7888a
9 changed files with 54 additions and 88 deletions

View File

@ -44,9 +44,12 @@ class Commande extends CommonObject
var $element='commande';
var $id ;
var $socidp; // Id client
var $client; // Objet societe client (à charger par fetch_client)
var $ref;
var $ref_client;
var $socidp;
var $contactid;
var $projet_id;
var $statut;
@ -934,18 +937,6 @@ class Commande extends CommonObject
*
*/
function fetch_client()
{
$client = new Societe($this->db);
$client->fetch($this->socidp);
$this->client = $client;
}
/**
*
*
*/
function fetch_adresse_livraison($id)
{
$idadresse = $id;

View File

@ -333,6 +333,27 @@ class CommonObject
$this->contact = $contact;
}
/*
* \brief Charge l'objet client depuis la base
*/
function fetch_client()
{
$client = new Societe($this->db);
$client->fetch($this->societe_id);
$this->client = $client;
}
/*
* \brief Charge l'objet projet depuis la base
*
*/
function fetch_projet()
{
$projet = new Project($this->db);
$projet->fetch($this->projet_id);
$this->projet = $projet;
}
}
?>

View File

@ -38,9 +38,14 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
*/
class FactureRec extends Facture
{
var $id;
var $db;
var $socidp;
var $db ;
var $element='commande';
var $id ;
var $socidp; // Id client
var $client; // Objet societe client (à charger par fetch_client)
var $number;
var $author;
var $date;
@ -239,17 +244,6 @@ class FactureRec extends Facture
}
}
/**
* Recupére l'objet client lié à la facture
*/
function fetch_client()
{
$client = new Societe($this->db);
$client->fetch($this->socidp);
$this->client = $client;
}
/**
* Valide la facture
*/

View File

@ -71,12 +71,12 @@ class Facture extends CommonObject
var $mode_reglement_id;
var $mode_reglement_code;
// Pour board
var $nbtodo;
var $nbtodolate;
// Pour board
var $nbtodo;
var $nbtodolate;
var $specimen;
var $error;
var $error;
/**
@ -468,17 +468,6 @@ class Facture extends CommonObject
}
}
/**
* \brief Recupére l'objet client lié à la facture
*
*/
function fetch_client()
{
$client = new Client($this->db);
$client->fetch($this->socidp);
$this->client = $client;
}
/**
* \brief Classe la facture dans un projet

View File

@ -330,7 +330,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
if ($conf->projet->enabled)
{
$fichinter->fetch_projet();
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'.$fichinter->projet.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'.$fichinter->projet->title.'</td></tr>';
}
// Statut

View File

@ -35,10 +35,14 @@ require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
*/
class Fichinter extends CommonObject
{
var $id;
var $db;
var $element='ficheinter';
var $id;
var $socidp;
var $socidp; // Id client
var $client; // Objet societe client (à charger par fetch_client)
var $author;
var $ref;
var $date;
@ -273,28 +277,6 @@ class Fichinter extends CommonObject
}
/*
* \brief Charge la liste des clients depuis la base
*/
function fetch_client()
{
$client = new Societe($this->db);
$client->fetch($this->societe_id);
$this->client = $client;
}
/*
* \brief Charge les infos du projet depuis la base
*
*/
function fetch_projet()
{
$projet = new Project($this->db);
$projet->fetch($this->projet_id);
$this->projet = $projet->title;
}
/**
* \brief Retourne le libellé du statut de l'intervantion
* \return string Libellé

View File

@ -269,7 +269,6 @@ function facture_delete_preview($db, $facid)
$fac = new Facture($db,"",$facid);
$fac->fetch($facid);
$fac->fetch_client();
if ($conf->facture->dir_output)
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-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
@ -18,7 +18,6 @@
*
* $Id$
* $Source$
*
*/
/**
@ -29,11 +28,11 @@
*/
/**
\class Project
\brief Classe permettant la gestion des projets
\class Project
\brief Classe permettant la gestion des projets
*/
class Project {
class Project
{
var $id;
var $db;
var $ref;

View File

@ -49,7 +49,10 @@ class Propal extends CommonObject
var $element='propal';
var $id;
var $socidp;
var $socidp; // Id client
var $client; // Objet societe client (à charger par fetch_client)
var $contactid;
var $projetidp;
var $author;
@ -349,18 +352,6 @@ class Propal extends CommonObject
}
/**
*
*
*/
function fetch_client()
{
$client = new Societe($this->db);
$client->fetch($this->socidp);
$this->client = $client;
}
/**
*
*