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

@ -70,7 +70,7 @@ switch ($action)
$obj_facturation->montant_rendu ( $encaisse - $total );
} else {
$obj_facturation->paiement_le ($_POST['txtDatePaiement']);
}
@ -139,18 +139,16 @@ switch ($action)
$user->fetch($_SESSION['uid']);
$user->getrights();
$invoice=new Facture($db,$conf_fksoc);
$invoice=new Facture($db);
// Recuperation de la liste des articles du panier
$res=$db->query ('
SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc
$res=$db->query ('SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc
FROM '.MAIN_DB_PREFIX.'pos_tmp
WHERE 1');
$ret=array(); $i=0;
while ( $tab = $db->fetch_array($res) )
while ($tab = $db->fetch_array($res))
{
foreach ( $tab as $cle => $valeur )
foreach ($tab as $cle => $valeur)
{
$ret[$i][$cle] = $valeur;
}
@ -249,7 +247,7 @@ switch ($action)
$paiement_id = $payment->create($user);
if ($paiement_id > 0)
{
/*if ( $obj_facturation->mode_reglement() == 'ESP' )
{
$bankaccountid=$conf_fkaccount_cash;
@ -272,7 +270,7 @@ switch ($action)
$error++;
}
}
if (! $error)
{
if ($invoice->total_ttc == $obj_facturation->prix_total_ttc()
@ -282,7 +280,7 @@ switch ($action)
$result=$invoice->set_paid($user);
//print 'eeeee';exit;
}
}
}
else

View File

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

View File

@ -109,18 +109,14 @@ class Facture extends CommonObject
var $errno = 0;
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
* \param socid id societe ('' par defaut)
* \param facid id facture ('' par defaut)
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Facture($DB, $socid='', $facid='')
function Facture($DB)
{
$this->db = $DB;
$this->id = $facid;
$this->socid = $socid;
$this->amount = 0;
$this->remise = 0;
$this->remise_percent = 0;
@ -135,6 +131,7 @@ class Facture extends CommonObject
/**
* Create invoice in database
* Note: this->ref can be set or empty. If empty, we will use "(PROV)"
*
* @param user Object user that create
* @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
@ -456,6 +453,7 @@ class Facture extends CommonObject
/**
* Create a new invoice in database from current invoice
*
* @param user Object user that ask creation
* @param invertdetail Reverse sign of amounts for lines
* @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
*
* @param fromid Id of object to clone
* @param invertdetail Reverse sign of amounts for lines
* @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
*
* @param object Object source
* @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)
*
* @param withpicto Add picto into link
* @param option Where point the link
* @param max Maxlength of ref
@ -719,6 +720,7 @@ class Facture extends CommonObject
/**
* Get object and lines from database
*
* @param rowid Id of object to load
* @param ref 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
*
* @return int 1 if OK, < 0 if KO
*/
function fetch_lines()
@ -932,10 +935,11 @@ class Facture extends CommonObject
/**
* \brief Update database
* \param user User that modify
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, >0 if OK
* Update database
*
* @param user User that modify
* @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
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
* \param idremise Id de la remise fixe
* \return int >0 si ok, <0 si ko
* 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
*/
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)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
@ -1160,8 +1170,9 @@ class Facture extends CommonObject
/**
* Delete invoice
* @param rowid Id of invoice to delete
* @return int <0 if KO, >0 if OK
*
* @param int $rowid Id of invoice to delete
* @return int <0 if KO, >0 if OK
*/
function delete($rowid=0)
{

View File

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

View File

@ -1,5 +1,5 @@
<?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
* it under the terms of the GNU General Public License as published by
@ -22,11 +22,6 @@
* \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
@ -56,8 +51,9 @@ class PaymentTerm // extends CommonObject
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function PaymentTerm($DB)
{
@ -67,10 +63,11 @@ class PaymentTerm // extends CommonObject
/**
* \brief Create in database
* \param user User that create
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, Id of created object if OK
* Create in database
*
* @param User $user User that create
* @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)
{
@ -166,9 +163,10 @@ class PaymentTerm // extends CommonObject
/**
* \brief Load object in memory from database
* \param id id object
* \return int <0 if KO, >0 if OK
* Load object in memory from database
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
@ -225,6 +223,7 @@ class PaymentTerm // extends CommonObject
/**
* Return id of default payment term
*
* @return int <0 if KO, >0 if OK
*/
function getDefaultId()
@ -260,10 +259,11 @@ class PaymentTerm // extends CommonObject
/**
* \brief Update database
* \param user User that modify
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, >0 if OK
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
@ -343,10 +343,11 @@ class PaymentTerm // extends CommonObject
/**
* \brief Delete object in database
* \param user User that delete
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, >0 if OK
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
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
* \param fromid Id of object to clone
* \return int New id of clone
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
function createFromClone($fromid)
{
@ -453,8 +455,10 @@ class PaymentTerm // extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* Initialise object with example values
* id must be 0 if object instance is a specimen
*
* @return void
*/
function initAsSpecimen()
{
@ -468,8 +472,6 @@ class PaymentTerm // extends CommonObject
$this->fdm='';
$this->nbjour='';
$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.
* This should allow rgrep search.
* This should allow rgrep search
*
* @param db Objet base de donnee
* @param facid Id de la facture a creer
* @param message Message
@ -251,7 +252,7 @@ function facture_meta_create($db, $facid, $message="")
{
global $langs,$conf;
$fac = new Facture($db,"",$facid);
$fac = new Facture($db);
$fac->fetch($facid);
$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
*
* @param db objet base de donnee
* @param facid id de la facture a creer
*/
@ -306,7 +308,7 @@ function facture_delete_preview($db, $facid)
global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$fac = new Facture($db,"",$facid);
$fac = new Facture($db);
$fac->fetch($facid);
if ($conf->facture->dir_output)