diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 09a2abf329a..ef771b8a9a4 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -37,27 +37,67 @@ class ActionComm extends CommonObject
public $table_rowid = 'id';
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;
+ /**
+ * 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_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_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 $label;
+ /**
+ * @var string
+ * @deprecated Use $label
+ */
+ public $libelle;
+
var $datec; // Date creation record (datec)
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 $usermodid; // Id user that modified action
var $datep; // Date action start (datep)
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 $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 $location; // Location
@@ -68,14 +108,41 @@ class ActionComm extends CommonObject
var $userassigned = array(); // Array of user ids
var $userownerid; // Id of user owner
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 $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
var $fk_element; // Id of record
@@ -95,8 +162,6 @@ class ActionComm extends CommonObject
*/
function __construct($db)
{
- global $langs;
-
$this->db = $db;
$this->societe = new stdClass(); // deprecated
@@ -239,7 +304,6 @@ class ActionComm extends CommonObject
{
if (! is_array($val)) // For backward compatibility when val=id
{
- $tmpid=$val;
$val=array('id'=>$val);
}
@@ -421,9 +485,7 @@ class ActionComm extends CommonObject
*/
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.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id;
$resql2=$this->db->query($sql);
@@ -885,7 +947,7 @@ class ActionComm extends CommonObject
* @param int $overwritepicto 1=Overwrite picto
* @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;
@@ -1145,7 +1207,7 @@ class ActionComm extends CommonObject
*/
function initAsSpecimen()
{
- global $user,$langs,$conf,$user;
+ global $user;
$now=dol_now();
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 77dfea739e1..56465d45fdb 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -99,10 +99,10 @@ class CActionComm
/**
* 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 $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
*/
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 91e5dd9f1d2..d9d17a0ea71 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -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);
// 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))
{
$nummytasks++; $cssclass='family_mytasks';
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index b8c913df271..8fd26b52b7f 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -313,7 +313,7 @@ if ($resql)
$actionstatic->id=$obj->id;
$actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label;
- $actionstatic->libelle=$obj->label;
+ $actionstatic->label=$obj->label;
print $actionstatic->getNomUrl(1,28);
print '';
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 831a019d04e..3df77549609 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -804,7 +804,7 @@ $db->close();
* @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header
* @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
*/
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)
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 74e29fcd3b2..450a462c751 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -909,7 +909,7 @@ if ($id > 0)
// Addresses list
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))
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 4129b561ed1..427b2201d52 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -434,7 +434,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- print "
| contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref." | ";
+ print "
| contratid."\">".img_object($langs->trans("ShowContract","contract"), 'contract')." ".$obj->ref." | ";
print '';
$companystatic->id=$objp->rowid;
$companystatic->name=$objp->name;
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 75f2399017b..ff129a557e8 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -118,8 +118,7 @@ if ($action == 'add')
if (GETPOST('clearlist'))
{
// Chargement de la classe
- $classname = "MailingTargets";
- $obj = new $classname($db);
+ $obj = new MailingTargets($db);
$obj->clear_target($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
@@ -135,8 +134,7 @@ if ($action == 'delete')
{
if (!empty($id))
{
- $classname = "MailingTargets";
- $obj = new $classname($db);
+ $obj = new MailingTargets($db);
$obj->update_nb($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 15ce2ccd330..ca4c51c3f4c 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -296,15 +296,15 @@ class Propal extends CommonObject
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*
* @param string $desc Description de la ligne
- * @param double $pu_ht Prix unitaire
- * @param double $qty Quantite
- * @param double $txtva Taux de tva
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu_ht Prix unitaire
+ * @param float $qty Quantite
+ * @param float $txtva Taux de tva
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @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 double $pu_ttc Prix unitaire TTC
+ * @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes
* @param int $type Type of line (product, service)
* @param int $rang Position of line
@@ -320,7 +320,7 @@ class Propal extends CommonObject
*
* @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;
@@ -477,14 +477,14 @@ class Propal extends CommonObject
* Update a proposal line
*
* @param int $rowid Id de la ligne
- * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
- * @param double $qty Quantity
- * @param double $remise_percent Remise effectuee sur le produit
- * @param double $txtva Taux de TVA
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu Prix unitaire (HT ou TTC selon price_base_type)
+ * @param float $qty Quantity
+ * @param float $remise_percent Remise effectuee sur le produit
+ * @param float $txtva Taux de TVA
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @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 $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).
@@ -498,9 +498,9 @@ class Propal extends CommonObject
* @param array $array_option extrafields array
* @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");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@@ -1866,8 +1866,6 @@ class Propal extends CommonObject
*/
function set_draft($user)
{
- global $conf,$langs;
-
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id;
diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php
index dc8501c37ba..97256c840b1 100644
--- a/htdocs/comm/propal/class/propalestats.class.php
+++ b/htdocs/comm/propal/class/propalestats.class.php
@@ -193,8 +193,6 @@ class PropaleStats extends Stats
*/
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.= " 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";
diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php
index 19e56fe2cff..59f284408b8 100644
--- a/htdocs/comm/prospect/class/prospect.class.php
+++ b/htdocs/comm/prospect/class/prospect.class.php
@@ -41,8 +41,6 @@ class Prospect extends Societe
*/
function __construct($db)
{
- global $config;
-
$this->db = $db;
return 0;
@@ -56,7 +54,7 @@ class Prospect extends Societe
*/
function load_state_board()
{
- global $conf, $user;
+ global $user;
$this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE";
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index 79f952fe7fd..99bfcb3a072 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -534,7 +534,7 @@ if ($socid > 0)
}
else
{
- print dol_print_error($db);
+ dol_print_error($db);
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index c02df68db2c..dd9018f5669 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -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.
* Sinon la TVA proposee par defaut=0. Fin de regle.
* @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)
{
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 8c0038f785f..9e4c72d8299 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -32,10 +32,10 @@
/**
* 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
*/
-function societe_prepare_head($object)
+function societe_prepare_head(Societe $object)
{
global $db, $langs, $conf, $user;
$h = 0;
@@ -545,7 +545,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @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
* @return void
*/
@@ -809,7 +809,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @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
* @return void
*/
diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php
index 239f36721ee..7ca2aba9db2 100644
--- a/htdocs/core/lib/emailing.lib.php
+++ b/htdocs/core/lib/emailing.lib.php
@@ -24,10 +24,10 @@
/**
* 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
*/
-function emailing_prepare_head($object)
+function emailing_prepare_head(Mailing $object)
{
global $user, $langs, $conf;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 2952ffd0b39..6c3de564197 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -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
* provide it to the function calcul_price_total.
*
- * @param float $vatrate VAT Rate
- * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
- * @param int $buyer Company object
- * @param int $seller Company object
- * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
+ * @param float $vatrate VAT Rate
+ * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
+ * @param Societe $buyer Company object
+ * @param Societe $seller Company object
+ * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
*/
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
{
diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php
index 7b36423cb61..632e4aea5b6 100644
--- a/htdocs/societe/class/address.class.php
+++ b/htdocs/societe/class/address.class.php
@@ -47,6 +47,11 @@ class Address
var $fax;
var $note;
+ /**
+ * Adresses liees a la societe
+ * @var array
+ */
+ public $lines;
/**
* Constructor
@@ -391,7 +396,7 @@ class Address
*
* @param int $id id de la societe a supprimer
* @param int $socid id third party
- * @return void
+ * @return <0 KO >0 OK
*/
function delete($id,$socid)
{
@@ -403,10 +408,11 @@ class Address
$result = $this->db->query($sql);
- if (!$result)
- {
- print $this->db->error() . ' ' . $sql;
+ if (!$result) {
+ return -1;
}
+
+ return 1;
}
/**
|