Qual: Uniformize code

Doxygen
This commit is contained in:
Laurent Destailleur 2012-01-19 09:53:27 +01:00
parent 8eb1da9aaa
commit 08e33f20dc
10 changed files with 128 additions and 182 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com> * Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2006-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -54,12 +54,12 @@ class Categorie
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
* @param int $id Id of category to fetch during init * @param int $id Id of category to fetch during init
*/ */
function Categorie($DB, $id=-1) function Categorie($db, $id=-1)
{ {
$this->db = $DB; $this->db = $db;
$this->id = $id; $this->id = $id;
if ($id != -1) $this->fetch($this->id); if ($id != -1) $this->fetch($this->id);
@ -132,7 +132,7 @@ class Categorie
$langs->load('categories'); $langs->load('categories');
$error=0; $error=0;
// Clean parameters // Clean parameters
if (empty($this->visible)) $this->visible=0; if (empty($this->visible)) $this->visible=0;
$this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0; $this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0;
@ -214,7 +214,7 @@ class Categorie
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->label=trim($this->label); $this->label=trim($this->label);
$this->description=trim($this->description); $this->description=trim($this->description);

View File

@ -104,47 +104,6 @@ class Fournisseur extends Societe
} }
} }
/**
* Create the order from an existing
*
* @param User $user Creator user
* @param int $idc Id source
* @param int $comclientid Id thirdparty
*/
function updateFromCommandeClient($user, $idc, $comclientid)
{
$comm = new CommandeFournisseur($this->db);
$comm->socid = $this->id;
$comm->updateFromCommandeClient($user, $idc, $comclientid);
}
/**
* Create the order with draft status
* @param User $user Creator user
* @return int <0 if ko, id of order if ok
*/
function create_commande($user)
{
dol_syslog("Fournisseur::Create_Commande");
$comm = new CommandeFournisseur($this->db);
$comm->socid = $this->id;
if ($comm->create($user) > 0)
{
$this->single_open_commande = $comm->id;
return $comm->id;
}
else
{
$this->error=$comm->error;
dol_syslog("Fournisseur::Create_Commande Failed ".$this->error, LOG_ERR);
return -1;
}
}
/** /**
* Load statistics indicators * Load statistics indicators
* *

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
@ -70,12 +70,14 @@ class CommandeFournisseur extends Commande
var $mode_reglement_code; var $mode_reglement_code;
/** Constructeur /**
* @param DoliDB $DB Handler d'acces aux bases de donnees * Constructor
*
* @param DoliDB $db Handler d'acces aux bases de donnees
*/ */
function CommandeFournisseur($DB) function CommandeFournisseur($db)
{ {
$this->db = $DB; $this->db = $db;
$this->products = array(); $this->products = array();
$this->lines = array(); $this->lines = array();
@ -239,6 +241,7 @@ class CommandeFournisseur extends Commande
/** /**
* Add a line in log table * Add a line in log table
*
* @param User $user User making action * @param User $user User making action
* @param int $statut Status of order * @param int $statut Status of order
* @param date $datelog Date of change * @param date $datelog Date of change
@ -460,8 +463,9 @@ class CommandeFournisseur extends Commande
/** /**
* Return label of the status of object * Return label of the status of object
* @param mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label *
* @return string Label * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label
* @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {
@ -470,10 +474,10 @@ class CommandeFournisseur extends Commande
/** /**
* Return label of a status * Return label of a status
* *
* @param int $statut Id statut * @param int $statut Id statut
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)
{ {
@ -568,7 +572,7 @@ class CommandeFournisseur extends Commande
/** /**
* Renvoie la reference de commande suivante non utilisee en fonction du modele * Renvoie la reference de commande suivante non utilisee en fonction du modele
* de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON * de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON
* *
* @param Societe $soc objet societe * @param Societe $soc objet societe
* @return string reference libre pour la facture * @return string reference libre pour la facture
*/ */
@ -703,7 +707,7 @@ class CommandeFournisseur extends Commande
/** /**
* Refuse an order * Refuse an order
* *
* @param User $user User making action * @param User $user User making action
* @return int 0 if Ok, <0 if Ko * @return int 0 if Ok, <0 if Ko
*/ */
@ -712,7 +716,7 @@ class CommandeFournisseur extends Commande
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
dol_syslog("CommandeFournisseur::Refuse"); dol_syslog("CommandeFournisseur::Refuse");
$result = 0; $result = 0;
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
@ -760,7 +764,7 @@ class CommandeFournisseur extends Commande
global $langs,$conf; global $langs,$conf;
$error=0; $error=0;
//dol_syslog("CommandeFournisseur::Cancel"); //dol_syslog("CommandeFournisseur::Cancel");
$result = 0; $result = 0;
if ($user->rights->fournisseur->commande->commander) if ($user->rights->fournisseur->commande->commander)
@ -814,6 +818,7 @@ class CommandeFournisseur extends Commande
/** /**
* Send a supplier order to supplier * Send a supplier order to supplier
*
* @param User $user User making change * @param User $user User making change
* @param date $date Date * @param date $date Date
* @param int $methode Method * @param int $methode Method
@ -850,6 +855,7 @@ class CommandeFournisseur extends Commande
/** /**
* Create order with draft status * Create order with draft status
*
* @param User $user User making creation * @param User $user User making creation
* @return int <0 if KO, Id of supplier order if OK * @return int <0 if KO, Id of supplier order if OK
*/ */
@ -858,7 +864,7 @@ class CommandeFournisseur extends Commande
global $langs,$conf; global $langs,$conf;
$this->db->begin(); $this->db->begin();
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -888,15 +894,15 @@ class CommandeFournisseur extends Commande
//$sql.= ", ".$this->mode_reglement_id; //$sql.= ", ".$this->mode_reglement_id;
$sql.= ")"; $sql.= ")";
dol_syslog("CommandeFournisseur::Create sql=".$sql); dol_syslog(get_class($this)."::create sql=".$sql);
if ( $this->db->query($sql) ) if ($this->db->query($sql))
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur");
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " SET ref='(PROV".$this->id.")'"; $sql.= " SET ref='(PROV".$this->id.")'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("CommandeFournisseur::Create sql=".$sql); dol_syslog(get_class($this)."::create sql=".$sql);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// On logue creation pour historique // On logue creation pour historique
@ -915,7 +921,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create: Failed -2 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -923,7 +929,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create: Failed -1 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -945,6 +951,7 @@ class CommandeFournisseur extends Commande
* @param string $price_base_type HT or TTC * @param string $price_base_type HT or TTC
* @param double $pu_ttc Unit price TTC * @param double $pu_ttc Unit price TTC
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $info_bits More information
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0)
@ -1255,7 +1262,7 @@ class CommandeFournisseur extends Commande
/** /**
* Get list of order methods * Get list of order methods
* *
* @return 0 if Ok, <0 if Ko * @return 0 if Ok, <0 if Ko
*/ */
function get_methodes_commande() function get_methodes_commande()
@ -1288,7 +1295,7 @@ class CommandeFournisseur extends Commande
/** /**
* Change les conditions de reglement de la commande * Change les conditions de reglement de la commande
* *
* @param int $cond_reglement_id Id de la nouvelle condition de reglement * @param int $cond_reglement_id Id de la nouvelle condition de reglement
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
*/ */
@ -1322,7 +1329,7 @@ class CommandeFournisseur extends Commande
/** /**
* Change le mode de reglement * Change le mode de reglement
* *
* @param int $mode_reglement_id Id du nouveau mode * @param int $mode_reglement_id Id du nouveau mode
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
@ -1356,11 +1363,12 @@ class CommandeFournisseur extends Commande
/** /**
* Set a delivery in database for this supplier order * Set a delivery in database for this supplier order
* *
* @param User $user User that input data * @param User $user User that input data
* @param date $date Date of reception * @param date $date Date of reception
* @param string $type Type of receipt * @param string $type Type of receipt
* @param string $comment Comment * @param string $comment Comment
* @return int <0 if KO, >0 if OK
*/ */
function Livraison($user, $date, $type, $comment) function Livraison($user, $date, $type, $comment)
{ {
@ -1416,10 +1424,12 @@ class CommandeFournisseur extends Commande
} }
/** /**
* Cree la commande depuis une propale existante * Update a supplier order from a customer order
* @param User $user Utilisateur qui cree *
* @param int $idc Id de la propale qui sert de modele * @param User $user User that create
* @param int $comclientid Id thirdparty * @param int $idc Id of supplier order to update
* @param int $comclientid Id of customer order to use as template
* @return int <0 if KO, >0 if OK
*/ */
function updateFromCommandeClient($user, $idc, $comclientid) function updateFromCommandeClient($user, $idc, $comclientid)
{ {
@ -1446,7 +1456,7 @@ class CommandeFournisseur extends Commande
$sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'"; $sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'";
$sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent; $sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent;
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."');"; $sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."');";
if ( $this->db->query( $sql) ) if ($this->db->query($sql))
{ {
$this->update_price(); $this->update_price();
} }
@ -1479,7 +1489,7 @@ class CommandeFournisseur extends Commande
$sql.= " note_public ='".$this->db->escape($note_public)."'"; $sql.= " note_public ='".$this->db->escape($note_public)."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("CommandeFournisseur::UpdateNote sql=".$sql); dol_syslog(get_class($this)."::UpdateNote sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -1488,54 +1498,16 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseur::UpdateNote ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::UpdateNote ".$this->error, LOG_ERR);
$result = -1; $result = -1;
} }
return $result ; return $result ;
} }
/**
* Get list of user that can approve an order
*/
function ReadApprobators()
{
global $conf;
$this->approbs = array();
$sql = "SELECT u.name, u.firstname, u.email";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " , ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= " WHERE u.rowid = ur.fk_user";
$sql.= " AND u.entity = ".$conf->entity;
$sql.= " AND ur.fk_id = 184";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $this->db->fetch_row($resql);
$this->approbs[$i] = $row;
$i++;
}
$this->db->free($resql);
}
else
{
dol_syslog("ReadApprobators Erreur", LOG_ERR);
}
}
/** /**
* Tag order with a particular status * Tag order with a particular status
* *
* @param User $user Object user that change status * @param User $user Object user that change status
* @param int $status New status * @param int $status New status
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -1584,15 +1556,15 @@ class CommandeFournisseur extends Commande
* @param double $pu Prix unitaire * @param double $pu Prix unitaire
* @param double $qty Quantity * @param double $qty Quantity
* @param double $remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param double $tva_tx Taux TVA * @param double $txtva Taux TVA
* @param double $localtax1 Localtax1 tax * @param double $txlocaltax1 Localtax1 tax
* @param double $localtax2 Localtax2 tax * @param double $txlocaltax2 Localtax2 tax
* @param double $price_base_type Type of price base * @param double $price_base_type Type of price base
* @param int $info_bits Miscellanous informations * @param int $info_bits Miscellanous informations
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @return int < 0 if error, > 0 if ok * @return int < 0 if error, > 0 if ok
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0)
{ {
dol_syslog("CommandeFournisseur::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type"); dol_syslog("CommandeFournisseur::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -1859,17 +1831,18 @@ class CommandeFournisseurLigne extends OrderLine
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function CommandeFournisseurLigne($DB) function CommandeFournisseurLigne($db)
{ {
$this->db= $DB; $this->db= $db;
} }
/** /**
* Load line order * Load line order
* *
* @param int $rowid id line order * @param int $rowid Id line order
* @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) function fetch($rowid)
{ {
@ -1919,7 +1892,7 @@ class CommandeFournisseurLigne extends OrderLine
/** /**
* Mise a jour de l'objet ligne de commande en base * Mise a jour de l'objet ligne de commande en base
* *
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function update_total() function update_total()

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
@ -691,7 +691,7 @@ class FactureFournisseur extends Facture
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse, * Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte. * ou quand une facture annulee et reouverte.
* *
* @param User $user Object user that change status * @param User $user Object user that change status
* @return int <0 si ok, >0 si ok * @return int <0 si ok, >0 si ok
*/ */
@ -909,8 +909,8 @@ class FactureFournisseur extends Facture
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue).
*
* @param string $desc Description de la ligne * @param string $desc Description de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note) * @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
* @param double $txtva Taux de tva force, sinon -1 * @param double $txtva Taux de tva force, sinon -1
@ -922,13 +922,13 @@ class FactureFournisseur extends Facture
* @param date $date_start Date de debut de validite du service * @param date $date_start Date de debut de validite du service
* @param date $date_end Date de fin de validite du service * @param date $date_end Date de fin de validite du service
* @param string $ventil Code de ventilation comptable * @param string $ventil Code de ventilation comptable
* @param int $ºinfo_bits Bits de type de lines * @param int $info_bits Bits de type de lines
* @param string $price_base_type HT ou TTC * @param string $price_base_type HT ou TTC
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line * @param int $rang Position of line
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function addline($desc, $pu, $txtva, $txlocaltax1=0, $txlocaltax2=0, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1) function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1)
{ {
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG); dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -988,6 +988,7 @@ class FactureFournisseur extends Facture
/** /**
* Update a line detail into database * Update a line detail into database
*
* @param int $id Id of line invoice * @param int $id Id of line invoice
* @param string $label Description of line * @param string $label Description of line
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
@ -1083,7 +1084,9 @@ class FactureFournisseur extends Facture
/** /**
* Delete a detail line from database * Delete a detail line from database
* @param int $rowid id of line to delete *
* @param int $rowid Id of line to delete
* @return void
*/ */
function deleteline($rowid) function deleteline($rowid)
{ {
@ -1103,7 +1106,9 @@ class FactureFournisseur extends Facture
/** /**
* Charge les informations d'ordre info dans l'objet facture * Charge les informations d'ordre info dans l'objet facture
* @param int $id Id de la facture a charger *
* @param int $id Id de la facture a charger
* @return void
*/ */
function info($id) function info($id)
{ {
@ -1146,7 +1151,8 @@ class FactureFournisseur extends Facture
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* @param User $user Objet user *
* @param User $user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_board($user) function load_board($user)
@ -1188,10 +1194,10 @@ class FactureFournisseur extends Facture
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Renvoie nom clicable (avec eventuellement le picto)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param string $option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @param int $max Max length of shown ref * @param int $max Max length of shown ref
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='',$max=0) function getNomUrl($withpicto=0,$option='',$max=0)
{ {

View File

@ -58,17 +58,18 @@ class PaiementFourn extends Paiement
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function PaiementFourn($DB) function PaiementFourn($db)
{ {
$this->db = $DB ; $this->db = $db;
} }
/** /**
* Load payment object * Load payment object
* @param int $id id paiement to get *
* @return int <0 if ko, >0 if ok * @param int $id Id if payment to get
* @return int <0 if ko, >0 if ok
*/ */
function fetch($id) function fetch($id)
{ {
@ -238,7 +239,7 @@ class PaiementFourn extends Paiement
* Supprime un paiement ainsi que les lignes qu'il a genere dans comptes * Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
* Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse * Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
* Si le paiement porte sur au moins une facture a "payee", on refuse * Si le paiement porte sur au moins une facture a "payee", on refuse
* *
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete() function delete()
@ -320,8 +321,10 @@ class PaiementFourn extends Paiement
} }
/** /**
* Information sur l'objet * Information on object
* @param int $id id du paiement dont il faut afficher les infos *
* @param int $id Id du paiement dont il faut afficher les infos
* @return void
*/ */
function info($id) function info($id)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
@ -161,18 +161,18 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty); $localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
$result=$object->addline( $result=$object->addline(
$desc, $desc,
$pu, $pu,
$qty, $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$productsupplier->id, $productsupplier->id,
$_POST['idprodfournprice'], $_POST['idprodfournprice'],
$productsupplier->fourn_ref, $productsupplier->fourn_ref,
$remise_percent, $remise_percent,
'HT', 'HT',
$type $type
); );
} }
if ($idprod == -1) if ($idprod == -1)
@ -566,27 +566,32 @@ if ($action=='remove_file')
} }
} }
/* /*
* Create an order * Create an order
*/ */
if ($action == 'create') if ($action == 'create')
{ {
$error=0;
$fourn = new Fournisseur($db); $fourn = new Fournisseur($db);
$result=$fourn->fetch($socid); $result=$fourn->fetch($socid);
$object->socid = $fourn->id;
$db->begin(); $db->begin();
$orderid=$fourn->create_commande($user); $orderid=$object->create($user);
if (! $orderid > 0)
if ($orderid > 0)
{ {
$idc = $fourn->single_open_commande; $error++;
$mesg=$object->error;
}
if (! $error)
{
if ($comclientid != '') if ($comclientid != '')
{ {
$fourn->updateFromCommandeClient($user,$idc,$comclientid); $object->updateFromCommandeClient($user, $orderid, $comclientid);
} }
$id=$orderid; $id=$orderid;
@ -596,7 +601,6 @@ if ($action == 'create')
else else
{ {
$db->rollback(); $db->rollback();
$mesg=$fourn->error;
} }
} }
@ -733,7 +737,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
if ($error) if ($error)

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 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
@ -130,7 +131,7 @@ if ($_GET["id"])
foreach ($cats as $cat) foreach ($cats as $cat)
{ {
$ways = $cat->print_all_ways (); $ways = $cat->print_all_ways();
foreach ($ways as $way) foreach ($ways as $way)
{ {
$i = !$i; $i = !$i;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 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
@ -99,7 +99,7 @@ $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.type";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p "; $sql .= " FROM ".MAIN_DB_PREFIX."product as p ";
$sql .= " WHERE p.fk_product_type <> 1"; $sql .= " WHERE p.fk_product_type <> 1";
$sql .= " ORDER BY p.datec DESC "; $sql .= " ORDER BY p.datec DESC ";
$sql .= $db->plimit(15 ,0); $sql .= $db->plimit(15, 0);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
@ -132,7 +132,7 @@ if ($fourn_id > 0)
$sql .= " AND ppf.fk_soc = ".$fourn_id; $sql .= " AND ppf.fk_soc = ".$fourn_id;
} }
$sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= " ORDER BY ".$sortfield." ".$sortorder;
$sql .= $db->plimit($limit + 1 ,$offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("fourn/product/liste: sql=".$sql); dol_syslog("fourn/product/liste: sql=".$sql);
@ -164,7 +164,7 @@ if ($resql)
if (isset($catid)) if (isset($catid))
{ {
print "<div id='ways'>"; print "<div id='ways'>";
$c = new Categorie ($db, $catid); $c = new Categorie($db, $catid);
$ways = $c->print_all_ways(' &gt; ','fourn/product/liste.php'); $ways = $c->print_all_ways(' &gt; ','fourn/product/liste.php');
print " &gt; ".$ways[0]."<br>\n"; print " &gt; ".$ways[0]."<br>\n";
print "</div><br>"; print "</div><br>";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 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
@ -162,7 +162,7 @@ if ($_GET["id"])
print '<br>'.$langs->trans("File").': '.dol_trunc($filename,16); print '<br>'.$langs->trans("File").': '.dol_trunc($filename,16);
if ($user->rights->produit->creer || $user->rights->service->creer) if ($user->rights->produit->creer || $user->rights->service->creer)
{ {
print '<br>'.'<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$filename).'">'.img_delete().'</a>'; print '<br><a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$filename).'">'.img_delete().'</a>';
} }
if ($nbbyrow) print '</td>'; if ($nbbyrow) print '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>'; if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';