From f0dcd8ad511cb82ec42abb87472d14c6f350ce10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Apr 2011 10:48:57 +0000 Subject: [PATCH] Doxygen --- dev/skeletons/skeleton_class.class.php | 134 ++++++++++++------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index a214195a393..aa37ed93c06 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -44,35 +44,35 @@ class Skeleton_class // extends CommonObject var $errors=array(); //!< To return several error codes (or messages) //var $element='skeleton'; //!< Id that identify managed objects //var $table_element='skeleton'; //!< Name of table without prefix where object is stored - + var $id; var $prop1; var $prop2; //... - + /** - * \brief Constructor - * \param DB Database handler + * Constructor + * @param DB Database handler */ - function Skeleton_class($DB) + function Skeleton_class($DB) { $this->db = $DB; return 1; } - + /** - * \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 object into 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 */ function create($user, $notrigger=0) { global $conf, $langs; $error=0; - + // Clean parameters if (isset($this->prop1)) $this->prop1=trim($this->prop1); if (isset($this->prop2)) $this->prop2=trim($this->prop2); @@ -80,7 +80,7 @@ class Skeleton_class // extends CommonObject // Check parameters // Put here code to add control on parameters values - + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."mytable("; $sql.= " field1,"; @@ -93,20 +93,20 @@ class Skeleton_class // extends CommonObject $sql.= ")"; $this->db->begin(); - + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - + if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mytable"); - + if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. - + //// Call triggers //include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); //$interface=new Interfaces($this->db); @@ -123,7 +123,7 @@ class Skeleton_class // extends CommonObject { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); - } + } $this->db->rollback(); return -1*$error; } @@ -134,11 +134,11 @@ class Skeleton_class // 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 id id object + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -150,7 +150,7 @@ class Skeleton_class // extends CommonObject //... $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; $sql.= " WHERE t.rowid = ".$id; - + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -158,14 +158,14 @@ class Skeleton_class // extends CommonObject if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; $this->prop1 = $obj->field1; $this->prop2 = $obj->field2; //... } $this->db->free($resql); - + return 1; } else @@ -175,19 +175,19 @@ class Skeleton_class // extends CommonObject return -1; } } - + /** - * \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 object into 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) { global $conf, $langs; $error=0; - + // Clean parameters if (isset($this->prop1)) $this->prop1=trim($this->prop1); if (isset($this->prop2)) $this->prop2=trim($this->prop2); @@ -204,18 +204,18 @@ class Skeleton_class // extends CommonObject $sql.= " WHERE rowid=".$this->id; $this->db->begin(); - + dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - + if (! $error) { if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. - + //// Call triggers //include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); //$interface=new Interfaces($this->db); @@ -224,7 +224,7 @@ class Skeleton_class // extends CommonObject //// End call triggers } } - + // Commit or rollback if ($error) { @@ -232,7 +232,7 @@ class Skeleton_class // extends CommonObject { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); - } + } $this->db->rollback(); return -1*$error; } @@ -240,46 +240,46 @@ class Skeleton_class // extends CommonObject { $this->db->commit(); return 1; - } + } } - - + + /** - * \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 that delete + * @param notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK */ function delete($user, $notrigger=0) { global $conf, $langs; $error=0; - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable"; $sql.= " WHERE rowid=".$this->id; - + $this->db->begin(); - + dol_syslog(get_class($this)."::delete sql=".$sql); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - + if (! $error) { if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. - + //// Call triggers //include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); //$interface=new Interfaces($this->db); //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } + } } - + // Commit or rollback if ($error) { @@ -287,7 +287,7 @@ class Skeleton_class // extends CommonObject { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); - } + } $this->db->rollback(); return -1*$error; } @@ -299,18 +299,18 @@ class Skeleton_class // 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 fromid Id of object to clone + * @return int New id of clone */ function createFromClone($fromid) { global $user,$langs; - + $error=0; - + $object=new Skeleton_class($this->db); $this->db->begin(); @@ -322,24 +322,24 @@ class Skeleton_class // extends CommonObject // Clear fields // ... - + // Create clone $result=$object->create($user); // Other options - if ($result < 0) + if ($result < 0) { $this->error=$object->error; $error++; } - + if (! $error) { - - - + + + } - + // End if (! $error) { @@ -353,10 +353,10 @@ class Skeleton_class // extends CommonObject } } - + /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialisz object with example values + * Id must be 0 if object instance is a specimen. */ function initAsSpecimen() {