Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual: Uniformize code #73

Merged
merged 2 commits into from
Dec 19, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Qual: Uniformize code
  • Loading branch information
simnandez committed Dec 19, 2011
commit 136fba88adebdac1610a24934f00aa032a5b7c01
28 changes: 16 additions & 12 deletions htdocs/fourn/class/fournisseur.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
Expand Down Expand Up @@ -101,11 +102,13 @@ function NbProduct()
}
}

/**
* \brief Cree la commande au statut brouillon
* \param user Utilisateur qui cree
* \return int <0 si ko, id de la commande creee si ok
*/
/**
* 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);
Expand All @@ -115,9 +118,10 @@ function updateFromCommandeClient($user, $idc, $comclientid)
}

/**
* \brief Cree la commande au statut brouillon
* \param user Utilisateur qui cree
* \return int <0 si ko, id de la commande creee si ok
* 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)
{
Expand Down Expand Up @@ -183,9 +187,9 @@ function load_state_board()
/**
* Create a supplier category
*
* @param user User asking creation
* @param name Nom categorie
* @return int <0 if KO, 0 if OK
* @param User $user User asking creation
* @param string $name Category name
* @return int <0 if KO, 0 if OK
*/
function CreateCategory($user, $name)
{
Expand All @@ -209,7 +213,7 @@ function CreateCategory($user, $name)
}

/**
* Retourne la liste des fournisseurs
* Return the suppliers list
*
* @return array Array of suppliers
*/
Expand Down
162 changes: 89 additions & 73 deletions htdocs/fourn/class/fournisseur.commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CommandeFournisseur extends Commande


/** Constructeur
* @param DB Handler d'acces aux bases de donnees
* @param DoliDB $DB Handler d'acces aux bases de donnees
*/
function CommandeFournisseur($DB)
{
Expand Down Expand Up @@ -239,11 +239,11 @@ function fetch($id,$ref='')

/**
* Add a line in log table
* @param user User making action
* @param statut Status of order
* @param datelog Date of change
* @param comment Comment
* @return int <0 if KO, >0 if OK
* @param User $user User making action
* @param int $statut Status of order
* @param date $datelog Date of change
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
*/
function log($user, $statut, $datelog, $comment='')
{
Expand All @@ -269,7 +269,7 @@ function log($user, $statut, $datelog, $comment='')
/**
* Validate an order
*
* @param User $user Utilisateur qui valide
* @param User $user Validator User
* @return int <0 if KO, >0 if OK
*/
function valid($user)
Expand Down Expand Up @@ -470,9 +470,10 @@ function getLibStatut($mode=0)

/**
* Return label of a status
* @param statut Id statut
* @param 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
*
* @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
* @return string Label of status
*/
function LibStatut($statut,$mode=0)
{
Expand Down Expand Up @@ -540,9 +541,10 @@ function LibStatut($statut,$mode=0)

/**
* Renvoie nom clicable (avec eventuellement le picto)
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param option Sur quoi pointe le lien
* @return string Chaine avec URL
*
* @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
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0,$option='')
{
Expand All @@ -566,7 +568,8 @@ function getNomUrl($withpicto=0,$option='')
/**
* Renvoie la reference de commande suivante non utilisee en fonction du modele
* de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON
* @param soc objet societe
*
* @param Societe $soc objet societe
* @return string reference libre pour la facture
*/
function getNextNumRef($soc)
Expand Down Expand Up @@ -700,7 +703,9 @@ function approve($user, $idwarehouse=0)

/**
* Refuse an order
* @param user User making action
*
* @param User $user User making action
* @return int 0 if Ok, <0 if Ko
*/
function refuse($user)
{
Expand Down Expand Up @@ -746,7 +751,9 @@ function refuse($user)
/**
* Cancel an approved order.
* L'annulation se fait apres l'approbation
* @param user User making action
*
* @param User $user User making action
* @return int >0 if Ok, <0 if Ko
*/
function Cancel($user)
{
Expand Down Expand Up @@ -807,10 +814,10 @@ function Cancel($user)

/**
* Send a supplier order to supplier
* @param user User making change
* @param date Date
* @param methode Method
* @param comment Comment
* @param User $user User making change
* @param date $date Date
* @param int $methode Method
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
*/
function commande($user, $date, $methode, $comment='')
Expand Down Expand Up @@ -843,8 +850,8 @@ function commande($user, $date, $methode, $comment='')

/**
* Create order with draft status
* @param user User making creation
* @return int <0 if KO, Id of supplier order if OK
* @param User $user User making creation
* @return int <0 if KO, Id of supplier order if OK
*/
function create($user)
{
Expand Down Expand Up @@ -925,20 +932,20 @@ function create($user)
/**
* Add order line
*
* @param desc Description
* @param pu_ht Unit price
* @param qty Quantity
* @param txtva Taux tva
* @param txlocaltax1 Localtax1 tax
* @param txlocaltax2 Localtax2 tax
* @param fk_product Id produit
* @param fk_prod_fourn_price Id supplier price
* @param fourn_ref Supplier reference
* @param remise_percent Remise
* @param price_base_type HT or TTC
* @param pu_ttc Unit price TTC
* @param type Type of line (0=product, 1=service)
* @return int <=0 if KO, >0 if OK
* @param string $desc Description
* @param double $pu_ht Unit price
* @param double $qty Quantity
* @param double $txtva Taux tva
* @param double $txlocaltax1 Localtax1 tax
* @param double $txlocaltax2 Localtax2 tax
* @param int $fk_product Id produit
* @param int $fk_prod_fourn_price Id supplier price
* @param string $fourn_ref Supplier reference
* @param double $remise_percent Remise
* @param string $price_base_type HT or TTC
* @param double $pu_ttc Unit price TTC
* @param int $type Type of line (0=product, 1=service)
* @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)
{
Expand Down Expand Up @@ -1087,13 +1094,13 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f
/**
* Add a product into a stock warehouse.
*
* @param $user User object making change
* @param $product Id of product to dispatch
* @param $qty Qty to dispatch
* @param $entrepot Id of warehouse to add product
* @param $price Price for PMP value calculation
* @param $comment Comment for stock movement
* @return int <0 if KO, >0 if OK
* @param User $user User object making change
* @param int $product Id of product to dispatch
* @param double $qty Qty to dispatch
* @param int $entrepot Id of warehouse to add product
* @param double $price Price for PMP value calculation
* @param string $comment Comment for stock movement
* @return int <0 if KO, >0 if OK
*/
function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='')
{
Expand Down Expand Up @@ -1164,6 +1171,7 @@ function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment=''
* Delete line
*
* @param int $idligne Id of line to delete
* @return 0 if Ok, <0 ik Ko
*/
function deleteline($idligne)
{
Expand Down Expand Up @@ -1246,7 +1254,9 @@ function delete($user='')
}

/**
* Return list of order methods
* Get list of order methods
*
* @return 0 if Ok, <0 if Ko
*/
function get_methodes_commande()
{
Expand Down Expand Up @@ -1278,8 +1288,9 @@ function get_methodes_commande()

/**
* Change les conditions de reglement de la commande
* @param cond_reglement_id Id de la nouvelle condition de reglement
* @return int >0 si ok, <0 si ko
*
* @param int $cond_reglement_id Id de la nouvelle condition de reglement
* @return int >0 si ok, <0 si ko
*/
function cond_reglement($cond_reglement_id)
{
Expand Down Expand Up @@ -1311,8 +1322,9 @@ function cond_reglement($cond_reglement_id)

/**
* Change le mode de reglement
* @param mode_reglement_id Id du nouveau mode
* @return int >0 if OK, <0 if KO
*
* @param int $mode_reglement_id Id du nouveau mode
* @return int >0 if OK, <0 if KO
*/
function mode_reglement($mode_reglement_id)
{
Expand Down Expand Up @@ -1344,10 +1356,11 @@ function mode_reglement($mode_reglement_id)

/**
* Set a delivery in database for this supplier order
* @param user User that input data
* @param date Date of reception
* @param type Type of receipt
* @param comment Comment
*
* @param User $user User that input data
* @param date $date Date of reception
* @param string $type Type of receipt
* @param string $comment Comment
*/
function Livraison($user, $date, $type, $comment)
{
Expand Down Expand Up @@ -1404,9 +1417,9 @@ function Livraison($user, $date, $type, $comment)

/**
* Cree la commande depuis une propale existante
* @param user Utilisateur qui cree
* @param idc Id de la propale qui sert de modele
* @param comclientid Id thirdparty
* @param User $user Utilisateur qui cree
* @param int $idc Id de la propale qui sert de modele
* @param int $comclientid Id thirdparty
*/
function updateFromCommandeClient($user, $idc, $comclientid)
{
Expand Down Expand Up @@ -1450,6 +1463,7 @@ function updateFromCommandeClient($user, $idc, $comclientid)
* @param string $note Private note
* @param string $note_public Public note
* @return int <0 if KO, >=0 if OK
*
* TODO Use instead update_note_public and update_note
*/
function UpdateNote($user, $note, $note_public)
Expand Down Expand Up @@ -1521,9 +1535,10 @@ function ReadApprobators()

/**
* Tag order with a particular status
* @param user Object user that change status
* @param status New status
* @return int <0 if KO, >0 if OK
*
* @param User $user Object user that change status
* @param int $status New status
* @return int <0 if KO, >0 if OK
*/
function setStatus($user,$status)
{
Expand Down Expand Up @@ -1564,18 +1579,18 @@ function setStatus($user,$status)
/**
* Update line
*
* @param rowid Id de la ligne de facture
* @param desc Description de la ligne
* @param pu Prix unitaire
* @param qty Quantity
* @param remise_percent Pourcentage de remise de la ligne
* @param tva_tx Taux TVA
* @param localtax1 Localtax1 tax
* @param localtax2 Localtax2 tax
* @param price_base_type Type of price base
* @param info_bits Miscellanous informations
* @param type Type of line (0=product, 1=service)
* @return int < 0 if error, > 0 if ok
* @param int $rowid Id de la ligne de facture
* @param string $desc Description de la ligne
* @param double $pu Prix unitaire
* @param double $qty Quantity
* @param double $remise_percent Pourcentage de remise de la ligne
* @param double $tva_tx Taux TVA
* @param double $localtax1 Localtax1 tax
* @param double $localtax2 Localtax2 tax
* @param double $price_base_type Type of price base
* @param int $info_bits Miscellanous informations
* @param int $type Type of line (0=product, 1=service)
* @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)
{
Expand Down Expand Up @@ -1765,10 +1780,10 @@ function initAsSpecimen()
}

/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param user Objet user
* @return int <0 if KO, >0 if OK
* @param User $user Objet user
* @return int <0 if KO, >0 if OK
*/
function load_board($user)
{
Expand Down Expand Up @@ -1904,6 +1919,7 @@ function fetch($rowid)

/**
* Mise a jour de l'objet ligne de commande en base
*
* @return int <0 si ko, >0 si ok
*/
function update_total()
Expand Down
Loading