From be7da6f52c3ae92af6b3599fa93530e0dcddc446 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Mar 2012 16:44:45 +0100 Subject: [PATCH] Fix: avoid warning in php strict mode --- htdocs/compta/bank/class/account.class.php | 10 ++++------ htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 2 +- htdocs/core/modules/societe/mod_codeclient_monkey.php | 7 +++---- htdocs/core/modules/societe/modules_societe.class.php | 2 +- htdocs/societe/class/companybankaccount.class.php | 6 +++--- htdocs/user/class/user.class.php | 7 +++++++ 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 9158f11148b..a828a22a5aa 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -91,7 +91,7 @@ class Account extends CommonObject * * @param DoliDB $db Database handler */ - function Account($db) + function __construct($db) { global $langs; @@ -344,10 +344,9 @@ class Account extends CommonObject /** * Create bank account into database * - * @param User $user Object user making action * @return int < 0 if KO, > 0 if OK */ - function create($user='') + function create() { global $langs,$conf; @@ -597,14 +596,13 @@ class Account extends CommonObject * * @param int $id Id of bank account to get * @param string $ref Ref of bank account to get - * @param string $ref_ext External ref of bank account to get * @return int <0 if KO, >0 if OK */ - function fetch($id,$ref='',$ref_ext='') + function fetch($id,$ref='') { global $conf; - if (empty($id) && empty($ref) && empty($ref_ext)) + if (empty($id) && empty($ref)) { $this->error="ErrorBadParameters"; return -1; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e7e1682bc31..77b71df8083 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2011 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * Copyright (c) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index a1471ed6f70..aaa28a2917c 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -296,7 +296,7 @@ class modSociete extends DolibarrModules ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789'); + $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789'); // Import list of contact and attributes $r++; diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 8c0024e4632..9c5033158b9 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -135,10 +135,9 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode return -1; } - //$date=time(); - $date=gmmktime(); - $yymm = strftime("%y%m",$date); - $num = sprintf("%04s",$max+1); + $date = dol_now(); + $yymm = strftime("%y%m",$date); + $num = sprintf("%04s",$max+1); dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num); return $prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 83f21e98320..1420d8b53e9 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -42,7 +42,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator * @param string $maxfilenamelength Max length of value to show * @return array List of templates */ - function liste_modeles($db,$maxfilenamelength=0) + static function liste_modeles($db,$maxfilenamelength=0) { global $conf; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index d9a76064256..2e4802ddc9b 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -49,11 +49,11 @@ class CompanyBankAccount extends Account /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function CompanyBankAccount($DB) + function __construct($db) { - $this->db = $DB; + $this->db = $db; $this->socid = 0; $this->clos = 0; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0120cac0419..be0b676e12e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -108,6 +108,11 @@ class User extends CommonObject $this->all_permissions_are_loaded = 0; $this->admin=0; + + $this->rights = (object) array(); + $this->rights->user = (object) array(); + $this->rights->user->user = (object) array(); + $this->rights->user->self = (object) array(); } /** @@ -522,6 +527,8 @@ class User extends CommonObject if ($perms) { + if (! is_object($this->rights->$module)) $this->rights->$module = (object) array(); + if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); if ($subperms) { if (! isset($this->rights->$module) ||