2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2011-08-29 22:52:04 +00:00
parent da04be88a0
commit c0c6d1bede
3 changed files with 95 additions and 72 deletions

View File

@@ -56,6 +56,7 @@ class Categorie
/** /**
* Constructor * Constructor
*
* @param DB acces base de donnees * @param DB acces base de donnees
* @param id id de la categorie * @param id id de la categorie
*/ */
@@ -69,6 +70,7 @@ class Categorie
/** /**
* Load category into memory from database * Load category into memory from database
*
* @param id id of category * @param id id of category
*/ */
function fetch($id) function fetch($id)
@@ -120,6 +122,7 @@ class Categorie
/** /**
* Add category into database * Add category into database
*
* @return int -1 : erreur SQL * @return int -1 : erreur SQL
* -2 : nouvel ID inconnu * -2 : nouvel ID inconnu
* -3 : categorie invalide * -3 : categorie invalide
@@ -199,6 +202,7 @@ class Categorie
/** /**
* Update category * Update category
*
* @return int 1 : OK * @return int 1 : OK
* -1 : SQL error * -1 : SQL error
* -2 : invalid category * -2 : invalid category
@@ -284,6 +288,7 @@ class Categorie
/** /**
* Delete a category from database * Delete a category from database
*
* @param user Object user that ask to delete * @param user Object user that ask to delete
*/ */
function delete($user) function delete($user)
@@ -392,6 +397,7 @@ class Categorie
/** /**
* Ajout d'une sous-categorie * Ajout d'une sous-categorie
*
* @param $fille objet categorie * @param $fille objet categorie
* @return int 1 : OK * @return int 1 : OK
* -2 : $fille est deja dans la famille de $this * -2 : $fille est deja dans la famille de $this
@@ -416,6 +422,7 @@ class Categorie
/** /**
* Suppression d'une sous-categorie (seulement "desassociation") * Suppression d'une sous-categorie (seulement "desassociation")
*
* @param $fille objet categorie * @param $fille objet categorie
* @return int 1 : OK * @return int 1 : OK
* -3 : categorie ($this ou $fille) invalide * -3 : categorie ($this ou $fille) invalide
@@ -442,10 +449,11 @@ class Categorie
} }
/** /**
* \brief Link an object to the category * Link an object to the category
* \param obj Object to link to category *
* \param type Type of category * @param obj Object to link to category
* \return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked * @param type Type of category
* @return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked
*/ */
function add_type($obj,$type) function add_type($obj,$type)
{ {
@@ -478,9 +486,9 @@ class Categorie
/** /**
* Suppresion d'un produit de la categorie * Suppresion d'un produit de la categorie
*
* @param $prod est un objet de type produit * @param $prod est un objet de type produit
* retour : 1 : OK * @return int 1 if OK, -1 if KO
* -1 : erreur SQL
*/ */
function del_type($obj,$type) function del_type($obj,$type)
{ {
@@ -568,7 +576,7 @@ class Categorie
/** /**
* Return category description * Return category description
* *
* @param $cate Category id * @param int $cate Category id
* @return string Description * @return string Description
*/ */
function get_desc ($cate) function get_desc ($cate)
@@ -585,7 +593,7 @@ class Categorie
/** /**
* La categorie $fille est-elle une fille de cette categorie ? * La categorie $fille est-elle une fille de cette categorie ?
* *
* @param fille Object category * @param Category $fille Object category
*/ */
function is_fille ($fille) function is_fille ($fille)
{ {
@@ -609,8 +617,9 @@ class Categorie
* label = nom de la categorie * label = nom de la categorie
* fulllabel = nom avec chemin complet de la categorie * fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id * fullpath = chemin complet compose des id
* @param type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) *
* @param markafterid Mark all categories after this leaf in category tree. * @param string $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
* @param int $markafterid Mark all categories after this leaf in category tree.
* @return array Array of categories * @return array Array of categories
*/ */
function get_full_arbo($type,$markafterid=0) function get_full_arbo($type,$markafterid=0)
@@ -714,6 +723,7 @@ class Categorie
/** /**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
*
* @param id_categ id_categ entry to update * @param id_categ id_categ entry to update
* @param protection Deep counter to avoid infinite loop * @param protection Deep counter to avoid infinite loop
*/ */
@@ -764,7 +774,7 @@ class Categorie
} }
/** /**
* \brief Affiche contenu de $this->cats * Affiche contenu de $this->cats
*/ */
function debug_cats() function debug_cats()
{ {
@@ -783,8 +793,9 @@ class Categorie
/** /**
* \brief Retourne toutes les categories * Retourne toutes les categories
* \return array Tableau d'objet Categorie *
* @return array Tableau d'objet Categorie
*/ */
function get_all_categories () function get_all_categories ()
{ {
@@ -809,8 +820,9 @@ class Categorie
} }
/** /**
* \brief Retourne le nombre total de categories * Retourne le nombre total de categories
* \return int Nombre de categories *
* @return int Nombre de categories
*/ */
function get_nb_categories () function get_nb_categories ()
{ {
@@ -831,6 +843,7 @@ class Categorie
/** /**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type * Check if no category with same label already exists for this cat's parent or root and for this cat's type
*
* @return boolean 1 if already exist, 0 otherwise, -1 if error * @return boolean 1 if already exist, 0 otherwise, -1 if error
*/ */
function already_exists() function already_exists()
@@ -884,7 +897,7 @@ class Categorie
} }
/** /**
* \brief Retourne les categories de premier niveau (qui ne sont pas filles) * Retourne les categories de premier niveau (qui ne sont pas filles)
*/ */
function get_main_categories() function get_main_categories()
{ {
@@ -1036,7 +1049,7 @@ class Categorie
} }
} }
if (sizeof ($ways) == 0) if (count($ways) == 0)
$ways[0][0] = $this; $ways[0][0] = $this;
return $ways; return $ways;
@@ -1044,6 +1057,7 @@ class Categorie
/** /**
* Return list of categories linked to element of type $type with id $typeid * Return list of categories linked to element of type $type with id $typeid
*
* @param id Id of element * @param id Id of element
* @param typeid Type id of link (0,1,2,3...) * @param typeid Type id of link (0,1,2,3...)
* @return array List of category objects * @return array List of category objects
@@ -1265,8 +1279,9 @@ class Categorie
} }
/** /**
* \brief Efface la photo de la categorie et sa vignette * Efface la photo de la categorie et sa vignette
* \param file Chemin de l'image *
* @param file Chemin de l'image
*/ */
function delete_photo($file) function delete_photo($file)
{ {
@@ -1291,8 +1306,9 @@ class Categorie
} }
/** /**
* \brief Load size of image file * Load size of image file
* \param file Path to file *
* @param file Path to file
*/ */
function get_image_size($file) function get_image_size($file)
{ {
@@ -1310,7 +1326,7 @@ class Categorie
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
dol_syslog("Categorie::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");
// Initialise parametres // Initialise parametres
$this->id=0; $this->id=0;

View File

@@ -3898,19 +3898,18 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
} }
/** /**
* Advanced sort array by second index function, which produces * Advanced sort array by second index function, which produces ascending (default)
* ascending (default) or descending output and uses optionally * or descending output and uses optionally natural case insensitive sorting (which
* natural case insensitive sorting (which can be optionally case * can be optionally case sensitive as well).
* sensitive as well).
* *
* @param array Array to sort * @param array $array Array to sort
* @param index * @param string $index Key in array to use for sorting criteria
* @param order * @param int $order Sort order
* @param natsort * @param int $natsort 1=use "natural" sort (natsort), 0=use "standard sort (asort)
* @param case_sensitive Sort is case sensitive * @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
* @return Sorted array * @return array Sorted array
*/ */
function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive) function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0)
{ {
// Clean parameters // Clean parameters
$order=strtolower($order); $order=strtolower($order);

View File

@@ -47,14 +47,17 @@ class Societe extends CommonObject
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $name; // TODO obsolete
var $nom; var $nom;
var $nom_particulier; var $nom_particulier;
var $prenom; var $prenom;
var $particulier; var $particulier;
var $address; var $address;
var $adresse; // TODO obsolete var $adresse; // TODO obsolete
var $cp; var $cp; // TODO obsolete
var $ville; var $zip;
var $ville; // TODO obsolete
var $town;
var $status; // 0=activity ceased, 1= in activity var $status; // 0=activity ceased, 1= in activity
var $state_id; var $state_id;
@@ -64,8 +67,8 @@ class Societe extends CommonObject
var $departement_code; var $departement_code;
var $departement; var $departement;
var $pays_id; var $pays_id; // TODO obsolete
var $pays_code; var $pays_code; // TODO obsolete
var $pays; // TODO obsolete var $pays; // TODO obsolete
var $country_id; var $country_id;
var $country_code; var $country_code;
@@ -143,7 +146,8 @@ class Societe extends CommonObject
var $logo_mini; var $logo_mini;
/** /**
* Constructor for class * Constructor
*
* @param DB handler acces base de donnees * @param DB handler acces base de donnees
* @param id id societe (0 par defaut) * @param id id societe (0 par defaut)
*/ */
@@ -171,6 +175,7 @@ class Societe extends CommonObject
/** /**
* Create third party in database * Create third party in database
*
* @param user Object of user that ask creation * @param user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO * @return int >= 0 if OK, < 0 if KO
*/ */
@@ -291,6 +296,7 @@ class Societe extends CommonObject
/** /**
* Check properties of third party are ok (like name, third party codes, ...) * Check properties of third party are ok (like name, third party codes, ...)
*
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function verify() function verify()
@@ -366,6 +372,7 @@ class Societe extends CommonObject
/** /**
* Update parameters of third party * Update parameters of third party
*
* @param id id societe * @param id id societe
* @param user Utilisateur qui demande la mise a jour * @param user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui * @param call_trigger 0=non, 1=oui
@@ -404,6 +411,7 @@ class Societe extends CommonObject
$this->ville=$this->town; // TODO obsolete $this->ville=$this->town; // TODO obsolete
$this->state_id=trim($this->state_id); $this->state_id=trim($this->state_id);
$this->pays_id=trim($this->pays_id); $this->pays_id=trim($this->pays_id);
$this->country_id=trim($this->country_id);
$this->tel=trim($this->tel); $this->tel=trim($this->tel);
$this->fax=trim($this->fax); $this->fax=trim($this->fax);
$this->tel = preg_replace("/\s/","",$this->tel); $this->tel = preg_replace("/\s/","",$this->tel);