diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3d43d6b00f2..56c3839dcb6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -780,7 +780,7 @@ class Propal extends CommonObject */ function create($user, $notrigger=0) { - global $langs,$conf,$mysoc,$hookmanager; + global $conf,$hookmanager; $error=0; $now=dol_now(); @@ -1080,7 +1080,7 @@ class Propal extends CommonObject */ function createFromClone($socid=0) { - global $db, $user,$langs,$conf,$hookmanager; + global $user,$conf,$hookmanager; dol_include_once('/projet/class/project.class.php'); @@ -1214,7 +1214,6 @@ class Propal extends CommonObject */ function fetch($rowid,$ref='') { - global $conf; $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; @@ -1508,7 +1507,7 @@ class Propal extends CommonObject { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - global $conf,$langs; + global $conf; $error=0; $now=dol_now(); @@ -1868,7 +1867,6 @@ class Propal extends CommonObject */ function reopen($user, $statut, $note='', $notrigger=0) { - global $langs,$conf; $this->statut = $statut; $error=0; @@ -1979,7 +1977,7 @@ class Propal extends CommonObject $outputlangs->setDefaultLang($newlang); } //$ret=$object->fetch($id); // Reload to get new records - $this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + $this->generateDocument($modelpdf, $outputlangs); } // Call trigger @@ -2082,7 +2080,7 @@ class Propal extends CommonObject */ function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') { - global $conf,$user; + global $user; $ga = array(); @@ -2247,7 +2245,7 @@ class Propal extends CommonObject */ function delete($user, $notrigger=0) { - global $conf,$langs; + global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; @@ -2610,7 +2608,7 @@ class Propal extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf; + global $langs; // Charge tableau des produits prodids $prodids = array(); @@ -2696,7 +2694,7 @@ class Propal extends CommonObject */ function load_state_board() { - global $conf, $user; + global $user; $this->nb=array(); $clause = "WHERE"; @@ -2741,7 +2739,7 @@ class Propal extends CommonObject */ function getNextNumRef($soc) { - global $conf, $db, $langs; + global $conf,$langs; $langs->load("propal"); if (! empty($conf->global->PROPALE_ADDON)) @@ -2942,7 +2940,7 @@ class Propal extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf,$langs; $langs->load("propale"); @@ -3196,7 +3194,7 @@ class PropaleLigne extends CommonObjectLine */ function insert($notrigger=0) { - global $conf,$langs,$user; + global $conf,$user; $error=0; @@ -3332,7 +3330,7 @@ class PropaleLigne extends CommonObjectLine */ function delete() { - global $conf,$langs,$user; + global $conf,$user; $error=0; $this->db->begin(); @@ -3383,7 +3381,7 @@ class PropaleLigne extends CommonObjectLine */ function update($notrigger=0) { - global $conf,$langs,$user; + global $conf,$user; $error=0; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a0babc4d972..a22e937da87 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -204,7 +204,7 @@ class Commande extends CommonOrder */ function getNextNumRef($soc) { - global $db, $langs, $conf; + global $langs, $conf; $langs->load("order"); if (! empty($conf->global->COMMANDE_ADDON)) @@ -239,7 +239,7 @@ class Commande extends CommonOrder } else { - dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); + dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } } @@ -500,7 +500,6 @@ class Commande extends CommonOrder */ function set_reopen($user) { - global $conf,$langs; $error=0; if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) @@ -560,7 +559,7 @@ class Commande extends CommonOrder */ function cloture($user) { - global $conf, $langs; + global $conf; $error=0; @@ -697,7 +696,7 @@ class Commande extends CommonOrder */ function create($user, $notrigger=0) { - global $conf,$langs,$mysoc,$hookmanager; + global $conf,$langs; $error=0; // Clean parameters @@ -971,7 +970,7 @@ class Commande extends CommonOrder */ function createFromClone($socid=0) { - global $conf,$user,$langs,$hookmanager; + global $user,$hookmanager; $error=0; @@ -1061,7 +1060,7 @@ class Commande extends CommonOrder */ function createFromProposal($object) { - global $db, $conf,$user,$langs,$hookmanager; + global $conf,$user,$hookmanager; dol_include_once('/core/class/extrafields.class.php'); @@ -1134,7 +1133,7 @@ class Commande extends CommonOrder // get extrafields from original line $object->fetch_optionals($object->id); - $e = new ExtraFields($db); + $e = new ExtraFields($this->db); $element_extrafields = $e->fetch_name_optionals_label($this->element); foreach($object->array_options as $options_key => $value) { @@ -1495,7 +1494,6 @@ class Commande extends CommonOrder */ function fetch($id, $ref='', $ref_ext='', $ref_int='') { - global $conf; // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; @@ -1851,10 +1849,9 @@ class Commande extends CommonOrder * Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order * * @param int $filtre_statut Filter on status - * @param int $fk_product Filter on a product * @return int <0 if KO, Nb of lines found if OK */ - function loadExpeditions($filtre_statut=-1, $fk_product=0) + function loadExpeditions($filtre_statut=-1) { $this->expeditions = array(); @@ -1983,7 +1980,6 @@ class Commande extends CommonOrder */ function deleteline($lineid) { - global $user; if ($this->statut == self::STATUS_DRAFT) { @@ -2262,7 +2258,7 @@ class Commande extends CommonOrder */ function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') { - global $conf,$user; + global $user; $ga = array(); @@ -2430,7 +2426,7 @@ class Commande extends CommonOrder */ function classifyBilled(User $user) { - global $conf, $user, $langs; + global $user; $error = 0; $this->db->begin(); @@ -2698,7 +2694,6 @@ class Commande extends CommonOrder */ function update($user=null, $notrigger=0) { - global $conf, $langs; $error=0; // Clean parameters @@ -3205,7 +3200,7 @@ class Commande extends CommonOrder */ function initAsSpecimen() { - global $user,$langs,$conf; + global $langs; dol_syslog(get_class($this)."::initAsSpecimen"); @@ -3287,7 +3282,7 @@ class Commande extends CommonOrder */ function load_state_board() { - global $conf, $user; + global $user; $this->nb=array(); $clause = "WHERE"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8fee9cc5758..bea200f2656 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador @@ -734,7 +734,7 @@ class Facture extends CommonInvoice */ function createFromClone($socid=0) { - global $conf,$user,$langs,$hookmanager; + global $user,$hookmanager; $error=0; @@ -849,7 +849,7 @@ class Facture extends CommonInvoice */ function createFromOrder($object) { - global $conf,$user,$langs,$hookmanager; + global $user,$hookmanager; $error=0; @@ -1289,7 +1289,6 @@ class Facture extends CommonInvoice */ function update($user=null, $notrigger=0) { - global $conf, $langs; $error=0; // Clean parameters @@ -1682,7 +1681,6 @@ class Facture extends CommonInvoice */ function set_paid($user,$close_code='',$close_note='') { - global $conf,$langs; $error=0; if ($this->paye != 1) @@ -1740,7 +1738,6 @@ class Facture extends CommonInvoice */ function set_unpaid($user) { - global $conf,$langs; $error=0; $this->db->begin(); @@ -1790,9 +1787,6 @@ class Facture extends CommonInvoice */ function set_canceled($user,$close_code='',$close_note='') { - global $conf,$langs; - - $error=0; dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); @@ -2463,6 +2457,7 @@ class Facture extends CommonInvoice */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) { + global $conf,$user; // Deprecation warning if ($label) { dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); @@ -2667,7 +2662,7 @@ class Facture extends CommonInvoice */ function update_percent($line, $percent) { - global $mysoc; + global $mysoc,$user; include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); @@ -2693,7 +2688,6 @@ class Facture extends CommonInvoice */ function deleteline($rowid) { - global $langs, $conf; dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); @@ -2931,7 +2925,7 @@ class Facture extends CommonInvoice */ function getNextNumRef($soc,$mode='next') { - global $conf, $db, $langs; + global $conf, $langs; $langs->load("bills"); // Clean parameters (if not defined or using deprecated value) @@ -2993,7 +2987,7 @@ class Facture extends CommonInvoice * set up mask. */ if ($mode != 'last' && !$numref) { - dol_print_error($db,"Facture::getNextNumRef ".$obj->error); + dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); return ""; } @@ -3307,7 +3301,6 @@ class Facture extends CommonInvoice */ function demande_prelevement($fuser, $amount=0) { - global $langs; $error=0; @@ -3527,7 +3520,7 @@ class Facture extends CommonInvoice */ function initAsSpecimen($option='') { - global $user,$langs,$conf; + global $langs; $now=dol_now(); $arraynow=dol_getdate($now); @@ -3712,7 +3705,7 @@ class Facture extends CommonInvoice */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf,$langs; $langs->load("bills"); @@ -3812,7 +3805,6 @@ class Facture extends CommonInvoice */ function setFinal() { - global $conf, $langs, $user; $this->db->begin(); @@ -4276,7 +4268,7 @@ class FactureLigne extends CommonInvoiceLine */ function update($user='',$notrigger=0) { - global $user,$langs,$conf; + global $user,$conf; $error=0; @@ -4402,9 +4394,7 @@ class FactureLigne extends CommonInvoiceLine */ function delete() { - global $conf,$langs,$user; - - $error=0; + global $user; $this->db->begin(); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 18b3d4d7ebc..35ef726be20 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2011-2015 Juanjo Menent + * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García @@ -90,6 +90,7 @@ class Expedition extends CommonObject var $date_creation; var $date_valid; + var $meths; var $listmeths; // List of carriers /** @@ -119,7 +120,7 @@ class Expedition extends CommonObject */ function getNextNumRef($soc) { - global $db, $langs, $conf; + global $langs, $conf; $langs->load("sendings"); if (!empty($conf->global->EXPEDITION_ADDON_NUMBER)) @@ -156,7 +157,7 @@ class Expedition extends CommonObject } else { - dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); + dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } } @@ -176,7 +177,7 @@ class Expedition extends CommonObject */ function create($user, $notrigger=0) { - global $conf, $langs, $hookmanager; + global $conf, $hookmanager; $now=dol_now(); @@ -978,7 +979,7 @@ class Expedition extends CommonObject */ function update($user=null, $notrigger=0) { - global $conf, $langs; + global $conf; $error=0; // Clean parameters @@ -1532,7 +1533,7 @@ class Expedition extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf; + global $langs; $now=dol_now(); @@ -1644,7 +1645,7 @@ class Expedition extends CommonObject function fetch_delivery_methods() { global $langs; - $meths = array(); + $this->meths = array(); $sql = "SELECT em.rowid, em.code, em.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; @@ -1799,7 +1800,6 @@ class Expedition extends CommonObject */ function setClosed() { - global $conf; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; @@ -1825,7 +1825,6 @@ class Expedition extends CommonObject */ function set_billed() { - global $conf; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; @@ -1851,7 +1850,6 @@ class Expedition extends CommonObject */ function reOpen() { - global $conf; $sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; @@ -1882,7 +1880,7 @@ class Expedition extends CommonObject */ public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf,$langs; $langs->load("sendings");