Qual: Uniformize code

Doxygen
This commit is contained in:
Laurent Destailleur 2011-09-08 20:02:57 +00:00
parent e458569caf
commit 549b7a655b
6 changed files with 89 additions and 73 deletions

View File

@ -139,12 +139,10 @@ switch ($action)
$user->fetch($_SESSION['uid']); $user->fetch($_SESSION['uid']);
$user->getrights(); $user->getrights();
$invoice=new Facture($db,$conf_fksoc); $invoice=new Facture($db);
// Recuperation de la liste des articles du panier // Recuperation de la liste des articles du panier
$res=$db->query (' $res=$db->query ('SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc
SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc
FROM '.MAIN_DB_PREFIX.'pos_tmp FROM '.MAIN_DB_PREFIX.'pos_tmp
WHERE 1'); WHERE 1');
$ret=array(); $i=0; $ret=array(); $i=0;

View File

@ -68,7 +68,9 @@ class FactureRec extends Facture
/** /**
* \brief Initialisation de la classe * Constructor
*
* @param DoliDB $DB Database handler
*/ */
function FactureRec($DB) function FactureRec($DB)
{ {
@ -77,8 +79,9 @@ class FactureRec extends Facture
/** /**
* Create a predefined invoice * Create a predefined invoice
* @param user *
* @param facid Id of source invoice * @param User $user
* @param int $facid Id of source invoice
* @return int <0 if KO, id of invoice if OK * @return int <0 if KO, id of invoice if OK
*/ */
function create($user,$facid) function create($user,$facid)

View File

@ -109,18 +109,14 @@ class Facture extends CommonObject
var $errno = 0; var $errno = 0;
/** /**
* \brief Constructeur de la classe * Constructor
* \param DB handler acces base de donnees *
* \param socid id societe ('' par defaut) * @param DoliDB $DB Database handler
* \param facid id facture ('' par defaut)
*/ */
function Facture($DB, $socid='', $facid='') function Facture($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->id = $facid;
$this->socid = $socid;
$this->amount = 0; $this->amount = 0;
$this->remise = 0; $this->remise = 0;
$this->remise_percent = 0; $this->remise_percent = 0;
@ -135,6 +131,7 @@ class Facture extends CommonObject
/** /**
* Create invoice in database * Create invoice in database
* Note: this->ref can be set or empty. If empty, we will use "(PROV)" * Note: this->ref can be set or empty. If empty, we will use "(PROV)"
*
* @param user Object user that create * @param user Object user that create
* @param notrigger 1=Does not execute triggers, 0 otherwise * @param notrigger 1=Does not execute triggers, 0 otherwise
* @param forceduedate 1=Do not recalculate due date from payment condition but force it with value * @param forceduedate 1=Do not recalculate due date from payment condition but force it with value
@ -456,6 +453,7 @@ class Facture extends CommonObject
/** /**
* Create a new invoice in database from current invoice * Create a new invoice in database from current invoice
*
* @param user Object user that ask creation * @param user Object user that ask creation
* @param invertdetail Reverse sign of amounts for lines * @param invertdetail Reverse sign of amounts for lines
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -513,6 +511,7 @@ class Facture extends CommonObject
/** /**
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
*
* @param fromid Id of object to clone * @param fromid Id of object to clone
* @param invertdetail Reverse sign of amounts for lines * @param invertdetail Reverse sign of amounts for lines
* @return int New id of clone * @return int New id of clone
@ -600,6 +599,7 @@ class Facture extends CommonObject
/** /**
* Load an object from an order and create a new invoice into database * Load an object from an order and create a new invoice into database
*
* @param object Object source * @param object Object source
* @return int <0 if KO, 0 if nothing done, 1 if OK * @return int <0 if KO, 0 if nothing done, 1 if OK
*/ */
@ -681,6 +681,7 @@ class Facture extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
*
* @param withpicto Add picto into link * @param withpicto Add picto into link
* @param option Where point the link * @param option Where point the link
* @param max Maxlength of ref * @param max Maxlength of ref
@ -719,6 +720,7 @@ class Facture extends CommonObject
/** /**
* Get object and lines from database * Get object and lines from database
*
* @param rowid Id of object to load * @param rowid Id of object to load
* @param ref Reference of invoice * @param ref Reference of invoice
* @param ref_ext External reference of invoice * @param ref_ext External reference of invoice
@ -854,6 +856,7 @@ class Facture extends CommonObject
/** /**
* Recupere les lignes de factures dans this->lines * Recupere les lignes de factures dans this->lines
*
* @return int 1 if OK, < 0 if KO * @return int 1 if OK, < 0 if KO
*/ */
function fetch_lines() function fetch_lines()
@ -932,10 +935,11 @@ class Facture extends CommonObject
/** /**
* \brief Update database * Update database
* \param user User that modify *
* \param notrigger 0=launch triggers after, 1=disable triggers * @param user User that modify
* \return int <0 if KO, >0 if OK * @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
{ {
@ -1053,9 +1057,10 @@ class Facture extends CommonObject
/** /**
* \brief Ajout en base d'une ligne remise fixe en ligne de facture * Ajout en base d'une ligne remise fixe en ligne de facture
* \param idremise Id de la remise fixe *
* \return int >0 si ok, <0 si ko * @param idremise Id de la remise fixe
* @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -1137,7 +1142,12 @@ class Facture extends CommonObject
} }
} }
/**
* Set customer ref
*
* @param string $ref_client Customer ref
* @return int <0 if KO, >0 if OK
*/
function set_ref_client($ref_client) function set_ref_client($ref_client)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
@ -1160,7 +1170,8 @@ class Facture extends CommonObject
/** /**
* Delete invoice * Delete invoice
* @param rowid Id of invoice to delete *
* @param int $rowid Id of invoice to delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($rowid=0) function delete($rowid=0)

View File

@ -47,10 +47,10 @@ class FactureStats extends Stats
/** /**
* Constructor * Constructor
* *
* @param $DB Database handler * @param DoliDB $DB Database handler
* @param $socid Id third party * @param int $socid Id third party
* @param $mode Option * @param string $mode Option
* @param $userid Id user for filter * @param int $userid Id user for filter
* @return FactureStats * @return FactureStats
*/ */
function FactureStats($DB, $socid=0, $mode, $userid=0) function FactureStats($DB, $socid=0, $mode, $userid=0)

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,11 +22,6 @@
* \author Put author name here * \author Put author name here
*/ */
// Put here all includes required by your class file
//require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
/** /**
* \class PaymentTerm * \class PaymentTerm
@ -56,8 +51,9 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Constructor * Constructor
* \param DB Database handler *
* @param DoliDB $DB Database handler
*/ */
function PaymentTerm($DB) function PaymentTerm($DB)
{ {
@ -67,10 +63,11 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Create in database * Create in database
* \param user User that create *
* \param notrigger 0=launch triggers after, 1=disable triggers * @param User $user User that create
* \return int <0 if KO, Id of created object if OK * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
@ -166,9 +163,10 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Load object in memory from database * Load object in memory from database
* \param id id object *
* \return int <0 if KO, >0 if OK * @param int $id Id object
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id) function fetch($id)
{ {
@ -225,6 +223,7 @@ class PaymentTerm // extends CommonObject
/** /**
* Return id of default payment term * Return id of default payment term
*
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getDefaultId() function getDefaultId()
@ -260,10 +259,11 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Update database * Update database
* \param user User that modify *
* \param notrigger 0=launch triggers after, 1=disable triggers * @param User $user User that modify
* \return int <0 if KO, >0 if OK * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
{ {
@ -343,10 +343,11 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Delete object in database * Delete object in database
* \param user User that delete *
* \param notrigger 0=launch triggers after, 1=disable triggers * @param User $user User that delete
* \return int <0 if KO, >0 if OK * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
@ -399,9 +400,10 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* \param fromid Id of object to clone *
* \return int New id of clone * @param int $fromid Id of object to clone
* @return int New id of clone
*/ */
function createFromClone($fromid) function createFromClone($fromid)
{ {
@ -453,8 +455,10 @@ class PaymentTerm // extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise object with example values
* \remarks id must be 0 if object instance is a specimen. * id must be 0 if object instance is a specimen
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
@ -468,8 +472,6 @@ class PaymentTerm // extends CommonObject
$this->fdm=''; $this->fdm='';
$this->nbjour=''; $this->nbjour='';
$this->decalage=''; $this->decalage='';
} }
} }

View File

@ -242,7 +242,8 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide
/** /**
* Create a meta file with document file into same directory. * Create a meta file with document file into same directory.
* This should allow rgrep search. * This should allow rgrep search
*
* @param db Objet base de donnee * @param db Objet base de donnee
* @param facid Id de la facture a creer * @param facid Id de la facture a creer
* @param message Message * @param message Message
@ -251,7 +252,7 @@ function facture_meta_create($db, $facid, $message="")
{ {
global $langs,$conf; global $langs,$conf;
$fac = new Facture($db,"",$facid); $fac = new Facture($db);
$fac->fetch($facid); $fac->fetch($facid);
$fac->fetch_thirdparty(); $fac->fetch_thirdparty();
@ -298,6 +299,7 @@ function facture_meta_create($db, $facid, $message="")
/** /**
* Supprime l'image de previsualitation, pour le cas de regeneration de facture * Supprime l'image de previsualitation, pour le cas de regeneration de facture
*
* @param db objet base de donnee * @param db objet base de donnee
* @param facid id de la facture a creer * @param facid id de la facture a creer
*/ */
@ -306,7 +308,7 @@ function facture_delete_preview($db, $facid)
global $langs,$conf; global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$fac = new Facture($db,"",$facid); $fac = new Facture($db);
$fac->fetch($facid); $fac->fetch($facid);
if ($conf->facture->dir_output) if ($conf->facture->dir_output)