PHPDoc and misc fixes for several folders

This commit is contained in:
Marcos García de La Fuente 2015-02-10 11:38:13 +01:00
parent ca939bf8a5
commit 023175b9f1
17 changed files with 129 additions and 69 deletions

View File

@ -37,27 +37,67 @@ class ActionComm extends CommonObject
public $table_rowid = 'id'; public $table_rowid = 'id';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* Id of the event
* @var int
*/
var $id; var $id;
/**
* Id of the event. Use $id as possible
* @var int
*/
public $ref;
var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
var $label; var $label;
/**
* @var string
* @deprecated Use $label
*/
public $libelle;
var $datec; // Date creation record (datec) var $datec; // Date creation record (datec)
var $datem; // Date modification record (tms) var $datem; // Date modification record (tms)
var $author; // Object user that create action //deprecated
var $usermod; // Object user that modified action // deprecated /**
* Object user that create action
* @var User
* @deprecated
*/
var $author;
/**
* Object user that modified action
* @var User
* @deprecated
*/
var $usermod;
var $authorid; // Id user that create action var $authorid; // Id user that create action
var $usermodid; // Id user that modified action var $usermodid; // Id user that modified action
var $datep; // Date action start (datep) var $datep; // Date action start (datep)
var $datef; // Date action end (datep2) var $datef; // Date action end (datep2)
var $durationp = -1; // -1=Unkown duration // deprecated
/**
* @var int -1=Unkown duration
* @deprecated
*/
var $durationp = -1;
var $fulldayevent = 0; // 1=Event on full day var $fulldayevent = 0; // 1=Event on full day
var $punctual = 1; // Milestone // deprecated. Milestone is already event with end date = start date
/**
* Milestone
* @var int
* @deprecated Milestone is already event with end date = start date
*/
var $punctual = 1;
var $percentage; // Percentage var $percentage; // Percentage
var $location; // Location var $location; // Location
@ -68,14 +108,41 @@ class ActionComm extends CommonObject
var $userassigned = array(); // Array of user ids var $userassigned = array(); // Array of user ids
var $userownerid; // Id of user owner var $userownerid; // Id of user owner
var $userdoneid; // Id of user done var $userdoneid; // Id of user done
var $usertodo; // Object user of owner // deprecated
var $userdone; // Object user that did action // deprecated /**
* Object user of owner
* @var User
* @deprecated
*/
var $usertodo;
/**
* Object user that did action
* @var User
* @deprecated
*/
var $userdone;
var $socid; var $socid;
var $contactid; var $contactid;
var $societe; // Company linked to action (optional)
var $contact; // Contact linked to action (optional) /**
var $fk_project; // Id of project (optional) * Company linked to action (optional)
* @var Societe|null
*/
var $societe;
/**
* Contact linked to action (optional)
* @var Contact|null
*/
var $contact;
/**
* Id of project (optional)
* @var int
*/
var $fk_project;
// Properties for links to other objects // Properties for links to other objects
var $fk_element; // Id of record var $fk_element; // Id of record
@ -95,8 +162,6 @@ class ActionComm extends CommonObject
*/ */
function __construct($db) function __construct($db)
{ {
global $langs;
$this->db = $db; $this->db = $db;
$this->societe = new stdClass(); // deprecated $this->societe = new stdClass(); // deprecated
@ -239,7 +304,6 @@ class ActionComm extends CommonObject
{ {
if (! is_array($val)) // For backward compatibility when val=id if (! is_array($val)) // For backward compatibility when val=id
{ {
$tmpid=$val;
$val=array('id'=>$val); $val=array('id'=>$val);
} }
@ -421,9 +485,7 @@ class ActionComm extends CommonObject
*/ */
function fetch_userassigned() function fetch_userassigned()
{ {
global $langs; $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql.="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources";
$sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id;
$resql2=$this->db->query($sql); $resql2=$this->db->query($sql);
@ -885,7 +947,7 @@ class ActionComm extends CommonObject
* @param int $overwritepicto 1=Overwrite picto * @param int $overwritepicto 1=Overwrite picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='') function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0)
{ {
global $conf,$langs; global $conf,$langs;
@ -1145,7 +1207,7 @@ class ActionComm extends CommonObject
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
global $user,$langs,$conf,$user; global $user;
$now=dol_now(); $now=dol_now();

View File

@ -99,10 +99,10 @@ class CActionComm
/** /**
* Return list of event types: array(id=>label) or array(code=>label) * Return list of event types: array(id=>label) or array(code=>label)
* *
* @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code' * @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude * @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not * @param int $onlyautoornot Group list by auto events or not
* @return mixed Array of all event types if OK, <0 if KO * @return mixed Array of all event types if OK, <0 if KO
*/ */
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0) function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)

View File

@ -1144,7 +1144,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event // Define $color (Hex string like '0088FF') and $cssclass of event
$color=-1; $cssclass=''; $colorindex=-1; $color=-1; $colorindex=-1;
if (in_array($user->id, $keysofuserassigned)) if (in_array($user->id, $keysofuserassigned))
{ {
$nummytasks++; $cssclass='family_mytasks'; $nummytasks++; $cssclass='family_mytasks';

View File

@ -313,7 +313,7 @@ if ($resql)
$actionstatic->id=$obj->id; $actionstatic->id=$obj->id;
$actionstatic->type_code=$obj->type_code; $actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label; $actionstatic->type_label=$obj->type_label;
$actionstatic->libelle=$obj->label; $actionstatic->label=$obj->label;
print $actionstatic->getNomUrl(1,28); print $actionstatic->getNomUrl(1,28);
print '</td>'; print '</td>';

View File

@ -804,7 +804,7 @@ $db->close();
* @param int $minheight Minimum height for each event. 60px by default. * @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header * @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type * @param array $colorsbytype Array with colors by type
* @param string $var true or false for alternat style on tr/td * @param bool $var true or false for alternat style on tr/td
* @return void * @return void
*/ */
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false)

View File

@ -909,7 +909,7 @@ if ($id > 0)
// Addresses list // Addresses list
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB)) if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
{ {
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
} }
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))

View File

@ -434,7 +434,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print "<tr ".$bc[$var]."><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."</a></td>"; print "<tr ".$bc[$var]."><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), 'contract')." ".$obj->ref."</a></td>";
print '<td>'; print '<td>';
$companystatic->id=$objp->rowid; $companystatic->id=$objp->rowid;
$companystatic->name=$objp->name; $companystatic->name=$objp->name;

View File

@ -118,8 +118,7 @@ if ($action == 'add')
if (GETPOST('clearlist')) if (GETPOST('clearlist'))
{ {
// Chargement de la classe // Chargement de la classe
$classname = "MailingTargets"; $obj = new MailingTargets($db);
$obj = new $classname($db);
$obj->clear_target($id); $obj->clear_target($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
@ -135,8 +134,7 @@ if ($action == 'delete')
{ {
if (!empty($id)) if (!empty($id))
{ {
$classname = "MailingTargets"; $obj = new MailingTargets($db);
$obj = new $classname($db);
$obj->update_nb($id); $obj->update_nb($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);

View File

@ -296,15 +296,15 @@ class Propal extends CommonObject
* 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_ht Prix unitaire * @param float $pu_ht Prix unitaire
* @param double $qty Quantite * @param float $qty Quantite
* @param double $txtva Taux de tva * @param float $txtva Taux de tva
* @param double $txlocaltax1 Local tax 1 rate * @param float $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate * @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id du produit/service predefini * @param int $fk_product Id du produit/service predefini
* @param double $remise_percent Pourcentage de remise de la ligne * @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC * @param string $price_base_type HT or TTC
* @param double $pu_ttc Prix unitaire TTC * @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $type Type of line (product, service) * @param int $type Type of line (product, service)
* @param int $rang Position of line * @param int $rang Position of line
@ -320,7 +320,7 @@ class Propal extends CommonObject
* *
* @see add_product * @see add_product
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
{ {
global $mysoc; global $mysoc;
@ -477,14 +477,14 @@ class Propal extends CommonObject
* Update a proposal line * Update a proposal line
* *
* @param int $rowid Id de la ligne * @param int $rowid Id de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type) * @param float $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param double $qty Quantity * @param float $qty Quantity
* @param double $remise_percent Remise effectuee sur le produit * @param float $remise_percent Remise effectuee sur le produit
* @param double $txtva Taux de TVA * @param float $txtva Taux de TVA
* @param double $txlocaltax1 Local tax 1 rate * @param float $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate * @param float $txlocaltax2 Local tax 2 rate
* @param string $desc Description * @param string $desc Description
* @param double $price_base_type HT ou TTC * @param string $price_base_type HT ou TTC
* @param int $info_bits Miscellaneous informations * @param int $info_bits Miscellaneous informations
* @param int $special_code Special code (also used by externals modules!) * @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
@ -498,9 +498,9 @@ class Propal extends CommonObject
* @param array $array_option extrafields array * @param array $array_option extrafields array
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0) function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0)
{ {
global $conf,$user,$langs, $mysoc; global $mysoc;
dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits"); dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -1866,8 +1866,6 @@ class Propal extends CommonObject
*/ */
function set_draft($user) function set_draft($user)
{ {
global $conf,$langs;
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;

View File

@ -193,8 +193,6 @@ class PropaleStats extends Stats
*/ */
function getAllByProduct($year) function getAllByProduct($year)
{ {
global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";

View File

@ -41,8 +41,6 @@ class Prospect extends Societe
*/ */
function __construct($db) function __construct($db)
{ {
global $config;
$this->db = $db; $this->db = $db;
return 0; return 0;
@ -56,7 +54,7 @@ class Prospect extends Societe
*/ */
function load_state_board() function load_state_board()
{ {
global $conf, $user; global $user;
$this->nb=array("customers" => 0,"prospects" => 0); $this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE"; $clause = "WHERE";

View File

@ -534,7 +534,7 @@ if ($socid > 0)
} }
else else
{ {
print dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -3667,7 +3667,7 @@ class Form
* Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle.
* Sinon la TVA proposee par defaut=0. Fin de regle. * Sinon la TVA proposee par defaut=0. Fin de regle.
* @param bool $options_only Return options only (for ajax treatment) * @param bool $options_only Return options only (for ajax treatment)
* @return void * @return string
*/ */
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false) function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false)
{ {

View File

@ -32,10 +32,10 @@
/** /**
* Return array of tabs to used on pages for third parties cards. * Return array of tabs to used on pages for third parties cards.
* *
* @param Object $object Object company shown * @param Societe $object Object company shown
* @return array Array of tabs * @return array Array of tabs
*/ */
function societe_prepare_head($object) function societe_prepare_head(Societe $object)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
$h = 0; $h = 0;
@ -545,7 +545,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Object $object Third party object * @param Societe $object Third party object
* @param string $backtopage Url to go once contact is created * @param string $backtopage Url to go once contact is created
* @return void * @return void
*/ */
@ -809,7 +809,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Object $object Third party object * @param Societe $object Third party object
* @param string $backtopage Url to go once address is created * @param string $backtopage Url to go once address is created
* @return void * @return void
*/ */

View File

@ -24,10 +24,10 @@
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param Object $object Object related to tabs * @param Mailing $object Object related to tabs
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
function emailing_prepare_head($object) function emailing_prepare_head(Mailing $object)
{ {
global $user, $langs, $conf; global $user, $langs, $conf;

View File

@ -3188,11 +3188,11 @@ function get_localtax_by_third($local)
* Instead this function must be called when adding a line to get (array of localtax and type) and * Instead this function must be called when adding a line to get (array of localtax and type) and
* provide it to the function calcul_price_total. * provide it to the function calcul_price_total.
* *
* @param float $vatrate VAT Rate * @param float $vatrate VAT Rate
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param int $buyer Company object * @param Societe $buyer Company object
* @param int $seller Company object * @param Societe $seller Company object
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
*/ */
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
{ {

View File

@ -47,6 +47,11 @@ class Address
var $fax; var $fax;
var $note; var $note;
/**
* Adresses liees a la societe
* @var array
*/
public $lines;
/** /**
* Constructor * Constructor
@ -391,7 +396,7 @@ class Address
* *
* @param int $id id de la societe a supprimer * @param int $id id de la societe a supprimer
* @param int $socid id third party * @param int $socid id third party
* @return void * @return <0 KO >0 OK
*/ */
function delete($id,$socid) function delete($id,$socid)
{ {
@ -403,10 +408,11 @@ class Address
$result = $this->db->query($sql); $result = $this->db->query($sql);
if (!$result) if (!$result) {
{ return -1;
print $this->db->error() . '<br>' . $sql;
} }
return 1;
} }
/** /**