Fix: Pb of object with wrong type.

This commit is contained in:
Laurent Destailleur 2014-11-15 18:24:38 +01:00
parent 741adc79b2
commit 445f696d28
28 changed files with 94 additions and 61 deletions

View File

@ -180,9 +180,44 @@ tools:
- 'htdocs/includes/*'
paths: { }
# Coding-Style / Bug Detection
js_hint: false
php_changetracking:
enabled: false
bug_patterns:
- '\bfix(?:es|ed)?\b'
feature_patterns:
- '\badd(?:s|ed)?\b'
- '\bimplement(?:s|ed)?\b'
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# Coding-Style / Bug Detection
js_hint:
enabled: false
use_native_config: true
extensions:
- js
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
config: { }
path_configs: { }
checks:
php:
code_rating: true
duplication: true
before_commands: { }
after_commands: { }

View File

@ -182,7 +182,7 @@ class Skeleton_Class extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -107,7 +107,7 @@ class Categorie extends CommonObject
$this->type = $res['type'];
$this->entity = $res['entity'];
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals($this->id,null);
$this->db->free($resql);
@ -202,7 +202,7 @@ class Categorie extends CommonObject
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookModuleNamedao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,'create'); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@ -294,7 +294,7 @@ class Categorie extends CommonObject
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
$parameters=array();
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,'update'); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@ -441,7 +441,7 @@ class Categorie extends CommonObject
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
}
}
}
@ -799,7 +799,7 @@ class Categorie extends CommonObject
*/
function get_full_arbo($type,$markafterid=0)
{
global $langs;
global $conf, $langs;
$this->cats = array();
@ -809,11 +809,9 @@ class Categorie extends CommonObject
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
if (! empty($conf->global->MAIN_MULTILANGS))
$sql.= ", t.label as label_trans, t.description as description_trans";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (! empty($conf->global->MAIN_MULTILANGS))
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql.= " WHERE c.entity IN (".getEntity('category',1).")";
$sql.= " AND c.type = ".$type;

View File

@ -2118,7 +2118,7 @@ class Propal extends CommonObject
if (! $error)
{
dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG);
dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG);
$this->db->commit();
return 1;
}

View File

@ -1145,7 +1145,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user=0)
function delete($user=null)
{
$nbko=0;
@ -1194,7 +1194,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete_urls($user=0)
function delete_urls($user=null)
{
$nbko=0;

View File

@ -172,7 +172,7 @@ class BankCateg // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -1040,7 +1040,7 @@ class Facture extends CommonInvoice
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -261,7 +261,7 @@ class PaymentTerm // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -127,7 +127,7 @@ class Localtax extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;

View File

@ -73,7 +73,7 @@ class PaymentSalary extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
@ -144,7 +144,7 @@ class PaymentSalary extends CommonObject
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
function fetch($id, $user=null)
{
global $langs;
$sql = "SELECT";

View File

@ -220,7 +220,7 @@ class PaymentSocialContribution extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -143,7 +143,7 @@ class Tva extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
@ -205,7 +205,7 @@ class Tva extends CommonObject
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
function fetch($id, $user=null)
{
global $langs;
$sql = "SELECT";

View File

@ -220,7 +220,7 @@ class Contact extends CommonObject
* @param string $action Current action for hookmanager
* @return int <0 if KO, >0 if OK
*/
function update($id, $user=0, $notrigger=0, $action='update')
function update($id, $user=null, $notrigger=0, $action='update')
{
global $conf, $langs, $hookmanager;
@ -427,7 +427,7 @@ class Contact extends CommonObject
* @param User $user User asking to change alert or birthday
* @return int <0 if KO, >=0 if OK
*/
function update_perso($id, $user=0)
function update_perso($id, $user=null)
{
$error=0;
$result=false;
@ -492,7 +492,7 @@ class Contact extends CommonObject
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
* @return int -1 if KO, 0 if OK but not found, 1 if OK
*/
function fetch($id, $user=0)
function fetch($id, $user=null)
{
global $langs;

View File

@ -989,7 +989,7 @@ class Contrat extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -191,7 +191,7 @@ class Ccountry // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -198,7 +198,7 @@ class Ctypent // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -154,7 +154,7 @@ class Events // extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
@ -191,7 +191,7 @@ class Events // extends CommonObject
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
function fetch($id, $user=null)
{
global $langs;

View File

@ -74,7 +74,7 @@ class Menubase
* @param User $user User that create
* @return int <0 if KO, Id of record if OK
*/
function create($user=0)
function create($user=null)
{
global $conf, $langs;
@ -185,7 +185,7 @@ class Menubase
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
@ -250,7 +250,7 @@ class Menubase
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user=0)
function fetch($id, $user=null)
{
global $langs;

View File

@ -501,7 +501,7 @@ class Cronjob extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;

View File

@ -184,7 +184,7 @@ class EcmDirectory // extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;

View File

@ -800,7 +800,7 @@ class Expedition extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -539,7 +539,7 @@ class FactureFournisseur extends CommonInvoice
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -470,7 +470,7 @@ class Holiday extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -254,7 +254,7 @@ class Opensurveysondage extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -196,7 +196,7 @@ class Productbatch extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -261,7 +261,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -205,7 +205,7 @@ class Resource extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;
@ -695,7 +695,7 @@ class Resource extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update_element_resource($user=0, $notrigger=0)
function update_element_resource($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -232,7 +232,7 @@ class Address
* @param User $user Objet de l'utilisateur
* @return int >0 si ok, <0 si ko
*/
function fetch_lines($socid, $user=0)
function fetch_lines($socid, $user=null)
{
global $langs, $conf;
@ -325,7 +325,7 @@ class Address
* @param User $user Objet de l'utilisateur
* @return int >0 si ok, <0 si ko
*/
function fetch_address($id, $user=0)
function fetch_address($id, $user=null)
{
global $langs;
global $conf;