From bb8ec0c8f9349afa5aa901e918fa0d8d84da73d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Aug 2014 14:26:13 +0200 Subject: [PATCH] Fix: Too many parameter --- dev/initdata/generate-facture.php | 2 +- dev/initdata/generate-propale.php | 3 +- htdocs/adherents/class/adherent.class.php | 22 +++++------ htdocs/commande/class/commande.class.php | 37 ++++++++++--------- htdocs/compta/bank/bankid_fr.php | 2 +- htdocs/compta/bank/fiche.php | 26 ++++++------- .../boxes/box_graph_propales_permonth.php | 6 +-- htdocs/core/class/translate.class.php | 8 ++-- ...interface_50_modLdap_Ldapsynchro.class.php | 8 ++-- htdocs/fourn/product/categorie.php | 4 +- htdocs/fourn/product/liste.php | 2 +- htdocs/holiday/fiche.php | 2 +- htdocs/install/upgrade2.php | 8 ++-- htdocs/main.inc.php | 16 +++++--- htdocs/margin/customerMargins.php | 2 +- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- htdocs/user/logout.php | 2 +- 17 files changed, 78 insertions(+), 74 deletions(-) diff --git a/dev/initdata/generate-facture.php b/dev/initdata/generate-facture.php index 0316671d62b..5c630454ba7 100755 --- a/dev/initdata/generate-facture.php +++ b/dev/initdata/generate-facture.php @@ -94,7 +94,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) print "Invoice ".$i." for socid ".$socid; - $facture = new Facture($db, $socids[$socid]); + $facture = new Facture($db); $facture->date = time(); $facture->cond_reglement_id = 3; $facture->mode_reglement_id = 3; diff --git a/dev/initdata/generate-propale.php b/dev/initdata/generate-propale.php index a62df516481..2efd2af2f08 100755 --- a/dev/initdata/generate-propale.php +++ b/dev/initdata/generate-propale.php @@ -122,7 +122,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $soc = new Societe($db); - $propal = new Propal($db, $socids[$socid]); + $propal = new Propal($db); $obj = $conf->global->PROPALE_ADDON; $modPropale = new $obj; @@ -130,6 +130,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $propal->ref = $numpr; $propal->contactid = $contids[$socids[$socid]][0]; + $propal->socid = $socids[$socid]; $propal->datep = time(); $propal->cond_reglement_id = 3; $propal->mode_reglement_id = 3; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 38032741330..4bee90b7a50 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -187,7 +187,7 @@ class Adherent extends CommonObject if (dol_textishtml($text,1)) $msgishtml = 1; $infos=''; - if ($this->civility_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n"; + if ($this->civility_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; $infos.= $langs->transnoentities("id").": ".$this->id."\n"; $infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; $infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; @@ -210,7 +210,7 @@ class Adherent extends CommonObject $substitutionarray=array( '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, '%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id, - '%CIVILITY%'=>$this->getCivilityLabel($msgishtml?0:1), + '%CIVILITY%'=>$this->getCivilityLabel(), '%FIRSTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%LASTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, '%FULLNAME%'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), @@ -350,7 +350,7 @@ class Adherent extends CommonObject { // Call trigger $result=$this->call_trigger('MEMBER_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -599,7 +599,7 @@ class Adherent extends CommonObject { // Call trigger $result=$this->call_trigger('MEMBER_MODIFY',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } } @@ -774,7 +774,7 @@ class Adherent extends CommonObject { // Call trigger $result=$this->call_trigger('MEMBER_DELETE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -830,7 +830,7 @@ class Adherent extends CommonObject } $this->db->begin(); - + // Mise a jour $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'"; $sql.= " WHERE rowid = ".$this->id; @@ -877,7 +877,7 @@ class Adherent extends CommonObject { // Call trigger $result=$this->call_trigger('MEMBER_NEW_PASSWORD',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers } @@ -1292,7 +1292,7 @@ class Adherent extends CommonObject // Call trigger $result=$this->call_trigger('MEMBER_SUBSCRIPTION',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -1351,7 +1351,7 @@ class Adherent extends CommonObject // Call trigger $result=$this->call_trigger('MEMBER_VALIDATE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers $this->db->commit(); @@ -1399,7 +1399,7 @@ class Adherent extends CommonObject // Call trigger $result=$this->call_trigger('MEMBER_RESILIATE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers $this->db->commit(); @@ -1530,7 +1530,7 @@ class Adherent extends CommonObject /** * Return civility label of a member * - * @return string Translated name of civility + * @return string Translated name of civility (translated with transnoentitiesnoconv) */ function getCivilityLabel() { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 71419dfc1a3..ac66f7fb048 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -139,7 +139,7 @@ class Commande extends CommonOrder { $file = $conf->global->COMMANDE_ADDON.".php"; $classname = $conf->global->COMMANDE_ADDON; - + // Include file with class foreach ($conf->file->dol_document_root as $dirroot) { @@ -262,7 +262,7 @@ class Commande extends CommonOrder // We decrement stock of product (and sub-products) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num)); if ($result < 0) - { + { $error++; $this->error=$mouvP->error; } @@ -305,7 +305,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_VALIDATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -436,7 +436,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_REOPEN',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } else @@ -495,9 +495,9 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_CLOSE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers - + if (! $error) { $this->statut=3; @@ -558,7 +558,7 @@ class Commande extends CommonOrder $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); - if ($result < 0) + if ($result < 0) { $error++; $this->error=$mouvP->error; @@ -572,7 +572,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_CANCEL',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -764,9 +764,10 @@ class Commande extends CommonOrder if ($origin == 'propal' && $origin_id) { // On recupere les differents contact interne et externe - $prop = new Propal($this->db, $this->socid, $origin_id); + $prop = new Propal($this->db); + $prop->fetch($origin_id); - // On recupere le commercial suivi propale + // We get ids of sales representatives of proposal $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); if ($this->userid) @@ -775,7 +776,7 @@ class Commande extends CommonOrder $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); } - // On recupere le contact client suivi propale + // We get ids of customer follower of proposal $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); if ($this->contactid) @@ -813,7 +814,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -908,7 +909,7 @@ class Commande extends CommonOrder // Call trigger $result=$this->call_trigger('ORDER_CLONE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -2228,7 +2229,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (! $error) @@ -2447,7 +2448,7 @@ class Commande extends CommonOrder { // Call trigger $result=$this->call_trigger('ORDER_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -3189,7 +3190,7 @@ class OrderLine extends CommonOrderLine // Call trigger $result=$this->call_trigger('LINEORDER_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (!$error) { @@ -3312,7 +3313,7 @@ class OrderLine extends CommonOrderLine { // Call trigger $result=$this->call_trigger('LINEORDER_INSERT',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -3427,7 +3428,7 @@ class OrderLine extends CommonOrderLine { // Call trigger $result=$this->call_trigger('LINEORDER_UPDATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 9bd451b8caa..0042377481e 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -88,7 +88,7 @@ if ($action == 'update' && ! $_POST["cancel"]) if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer) { // Modification - $account = new Account($db, $_GET["id"]); + $account = new Account($db); $account->delete($_GET["id"]); header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 58a26007e85..27acf7eba59 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copytight (C) 2005-2009 Regis Houssin - * Copytight (C) 2014 Alexandre Spangaro + * Copytight (C) 2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ if ($_POST["action"] == 'add') $error=0; // Create account - $account = new Account($db,0); + $account = new Account($db); $account->ref = dol_sanitizeFileName(trim($_POST["ref"])); $account->label = trim($_POST["label"]); @@ -119,7 +119,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $error=0; // Update account - $account = new Account($db, $_POST["id"]); + $account = new Account($db); $account->fetch($_POST["id"]); $account->ref = dol_string_nospecial(trim($_POST["ref"])); @@ -325,9 +325,9 @@ if ($action == 'create') print 'account_min_desired).'">'; print ''; - + print '
'; - + print ''; // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) @@ -340,11 +340,11 @@ if ($action == 'create') print ''; print ''; } - + // Accountancy journal print ''; print ''; - + print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyJournal").'
'; print '

'; @@ -458,19 +458,19 @@ else print ''.$account->comment.''; print ''; - + print '
'; print ''; // Accountancy code print ''; print ''; - + // Accountancy journal print ''; print ''; - + print '
'.$langs->trans("AccountancyCode").''.$account->account_number.'
'.$langs->trans("AccountancyJournal").''.$account->accountancy_journal.'
'; - + print ''; @@ -611,7 +611,7 @@ else $doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; - + // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { @@ -623,7 +623,7 @@ else print ''.$langs->trans("AccountancyCode").''; print 'account_number).'">'; } - + // Accountancy journal print ''.$langs->trans("AccountancyJournalCode").''; print 'accountancy_journal).'">'; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 0574531e875..974ccaed446 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -113,11 +113,10 @@ class box_graph_propales_permonth extends ModeleBoxes $nowarray=dol_getdate(dol_now(),true); if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; - $mode='customer'; $WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320'; $HEIGHT='192'; - $stats = new PropaleStats($this->db, $socid, $mode, 0); + $stats = new PropaleStats($this->db, $socid, 0); // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) @@ -126,8 +125,7 @@ class box_graph_propales_permonth extends ModeleBoxes $datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars'); $filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsnbinyear-'.$endyear.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index f86681f5c76..3657cca03f5 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -335,11 +335,12 @@ class Translate * Return translated value of key. Search in lang file, then into database. * Key must be any complete entry into lang file: CurrencyEUR, ... * If not found, return key. - * WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must - * not be called with same value than input. + * The string return is not formated (translated with transnoentitiesnoconv) + * NOTE: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), if you modify this function, + * check that getLabelFromKey is not called with same value than input. * * @param string $key Key to translate - * @return string Translated string + * @return string Translated string (translated with transnoentitiesnoconv) */ private function getTradFromKey($key) { @@ -347,7 +348,6 @@ class Translate if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly. - //print 'xx'.$key; $newstr=$key; if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) { diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index dcecdc26991..ce3af92d30b 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -165,7 +165,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -322,7 +322,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -399,7 +399,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; @@ -576,7 +576,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - $result=$ldap->delete($dn,$info,$user); + $result=$ldap->delete($dn); if ($result < 0) { $this->error="ErrorLDAP ".$ldap->error; diff --git a/htdocs/fourn/product/categorie.php b/htdocs/fourn/product/categorie.php index ad46210ed3b..b2d353046df 100644 --- a/htdocs/fourn/product/categorie.php +++ b/htdocs/fourn/product/categorie.php @@ -52,14 +52,14 @@ if ($_GET["id"]) //on veut supprimer une cat�gorie if ($_REQUEST["cat"]) { - $cat = new Categorie($db,$_REQUEST["cat"]); + $cat = new Categorie($db); $cat->del_product($product); } //on veut ajouter une cat�gorie if (isset($_REQUEST["add_cat"]) && $_REQUEST["add_cat"]>=0) { - $cat = new Categorie($db,$_REQUEST["add_cat"]); + $cat = new Categorie($db); $cat->add_product($product); } diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index ec186cd8339..c8911837a40 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -149,7 +149,7 @@ if ($resql) if (isset($catid)) { print "
"; - $c = new Categorie($db, $catid); + $c = new Categorie($db); $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); print " > ".$ways[0]."
\n"; print "

"; diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 797bce3171f..0092a6e25c9 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -1070,7 +1070,7 @@ else // Liste des utiliseurs du groupes choisi dans la config $idGroupValid = $cp->getConfCP('userGroup'); - $validator = new UserGroup($db,$idGroupValid); + $validator = new UserGroup($db); $valideur = $validator->listUsersForGroup('',1); print ''; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 3b062d4ada0..f9fa76541a5 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1412,7 +1412,7 @@ function migrate_price_propal($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $propalligne->update_total($rowid); + $propalligne->update_total(); /* On touche pas a propal mere @@ -1521,7 +1521,7 @@ function migrate_price_contrat($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc"); print ". "; - $contratligne->update_total($rowid); + $contratligne->update_total(); $i++; } @@ -1606,7 +1606,7 @@ function migrate_price_commande($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $commandeligne->update_total($rowid); + $commandeligne->update_total(); /* On touche pas a facture mere $commande = new Commande($db); @@ -1720,7 +1720,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; - $commandeligne->update_total($rowid); + $commandeligne->update_total(); /* On touche pas a facture mere $commande = new Commande($db); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 314ee3bab9b..83771d2e157 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -411,7 +411,7 @@ if (! defined('NOLOGIN')) // Call of triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST('entity','int')); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -514,10 +514,11 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$user->error; } + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,$_POST["entity"]); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -556,10 +557,11 @@ if (! defined('NOLOGIN')) $_SESSION["dol_loginmesg"]=$user->error; } + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,(isset($_POST["entity"])?$_POST["entity"]:0)); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -572,10 +574,11 @@ if (! defined('NOLOGIN')) { if (! empty($conf->global->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default (triggers are time consuming) { + // TODO We should use a hook here, not a trigger. // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_UPDATE_SESSION',$user,$user,$langs,$conf,$conf->entity); + $result=$interface->run_triggers('USER_UPDATE_SESSION',$user,$user,$langs,$conf); if ($result < 0) { $error++; } @@ -588,7 +591,7 @@ if (! defined('NOLOGIN')) // If we are here, this means authentication was successfull. if (! isset($_SESSION["dol_login"])) { - // New session for this login. + // New session for this login has started. $error=0; // Store value into session (values always stored) @@ -617,10 +620,11 @@ if (! defined('NOLOGIN')) $user->update_last_login_date(); + // TODO We should use a hook here, not a trigger // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf,GETPOST('entity','int')); + $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf); if ($result < 0) { $error++; } diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index ec1daf2634b..c0f7e41b97e 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -80,7 +80,7 @@ print ''; $client = false; if ($socid > 0) { - $soc = new Societe($db, $socid); + $soc = new Societe($db); $soc->fetch($socid); if ($soc->client) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 06e2f4a81b3..cc7a5fb1c75 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -62,7 +62,7 @@ llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Margins"),$help_ur if ($socid > 0) { - $societe = new Societe($db, $socid); + $societe = new Societe($db); $societe->fetch($socid); /* diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index ab31ae0aa6c..81434828592 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -42,7 +42,7 @@ if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuse // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); -$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf,$conf->entity); +$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf); if ($result < 0) { $error++; } // Fin appel triggers