diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 09a2abf329a65a9159da5590a97bd0fc8aa1873c..ef771b8a9a47488f8c939c574b2a2a4a766ad2da 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 77dfea739e123dd6560efe8dd750a70760399320..56465d45fdb63525821646e09d210926f397a374 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 91e5dd9f1d21691f415b709ec2fa1a5abede7961..d9d17a0ea712e645327376a9386b9af3856f47c6 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 b8c913df271f1f436bbc7e4689f881aee690cef1..8fd26b52b7f82ec6b6c8aaf4fb5a0c8ad5186a4a 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 '</td>'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 831a019d04ef45e1b3838ddefa72707ae503810b..3df775496098d2e2271d50c4eecbeb30e388b90e 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 74e29fcd3b21ab495222488a16ada50cb4e52021..450a462c751e27136665522af6d6105c894a6d70 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 4129b561ed1abfd82afac9d520c4d18f754fabd2..427b2201d521a2da5934c67fe6b28ea9ec785bf7 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 "<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>'; $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 75f2399017bb0b3a4b099c66c531320095840ed3..ff129a557e88f60dde91c7ad3061ba87427697e9 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 15ce2ccd33022473c0cc4be0519b65c16c421204..ca4c51c3f4c44386ee45828a8b24cf1b891beee7 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 dc8501c37baa379f3b979d18ca5dfea559e852ff..97256c840b147c6139ec177ff0009f59d1086c04 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 19e56fe2cffb54b6701fa9cf9fd7d086270c219b..59f284408b84d9a9e839e43cef94f02f9f2139f6 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 79f952fe7fdec7f31a3322655a8978b51c598a33..99bfcb3a072e7f125d55098d8021c5653e9151c9 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 c02df68db2c92d1793896e5771b055825d12ac19..dd9018f5669caeff2665d319a5bde21806f47fc0 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 8c0038f785fc67e7916f81306fb9bae3421687ca..9e4c72d829972ddfc16369cb4a2bfa2eb2cd8a0c 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 239f36721ee0a808f4dda2e8d2859e3bf421518e..7ca2aba9db2702248d41ac4e70308ce9741f0668 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 2952ffd0b39cdfdff9ff2930cfe179c4368b72d2..6c3de5641979e9c66ea0cfc64c5576cb7b45ba66 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 7b36423cb6116da68f07c60bf4dfb881ca212472..632e4aea5b6bb125c3a1fbe6e9c40ce54dbf2526 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() . '<br>' . $sql; + if (!$result) { + return -1; } + + return 1; } /**