Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
2e63393b
Commit
2e63393b
authored
7 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: wrong values if array used to force entity 0
parent
7e1d282b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/core/modules/DolibarrModules.class.php
+71
-71
71 additions, 71 deletions
htdocs/core/modules/DolibarrModules.class.php
with
71 additions
and
71 deletions
htdocs/core/modules/DolibarrModules.class.php
+
71
−
71
View file @
2e63393b
...
@@ -48,22 +48,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -48,22 +48,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var string Publisher name
* @var string Publisher name
*/
*/
public
$editor_name
;
public
$editor_name
;
/**
/**
* @var string URL of module at publisher site
* @var string URL of module at publisher site
*/
*/
public
$editor_web
;
public
$editor_web
;
/**
/**
* @var string Family
* @var string Family
*/
*/
public
$family
;
public
$family
;
/**
/**
* @var int module_position
* @var int module_position
*/
*/
public
$module_position
=
500
;
public
$module_position
=
500
;
/**
/**
* @var string Module name
* @var string Module name
*/
*/
...
@@ -171,7 +171,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -171,7 +171,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var string Module description (long text)
* @var string Module description (long text)
*/
*/
public
$descriptionlong
;
public
$descriptionlong
;
/**
/**
* @var string[] Module language files
* @var string[] Module language files
*/
*/
...
@@ -211,7 +211,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -211,7 +211,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var bool Module is enabled globally (Multicompany support)
* @var bool Module is enabled globally (Multicompany support)
*/
*/
public
$core_enabled
;
public
$core_enabled
;
/**
/**
* @var string Relative path to module style sheet
* @var string Relative path to module style sheet
* @deprecated
* @deprecated
...
@@ -219,8 +219,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -219,8 +219,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/
*/
public
$style_sheet
=
''
;
public
$style_sheet
=
''
;
/**
/**
* Constructor. Define names, constants, directories, boxes, permissions
* Constructor. Define names, constants, directories, boxes, permissions
*
*
...
@@ -468,9 +468,9 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -468,9 +468,9 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
{
global
$langs
;
global
$langs
;
$langs
->
load
(
"admin"
);
$langs
->
load
(
"admin"
);
if
(
empty
(
$this
->
descriptionlong
))
return
''
;
if
(
empty
(
$this
->
descriptionlong
))
return
''
;
// If module description translation does not exist using its unique id, we can use its name to find translation
// If module description translation does not exist using its unique id, we can use its name to find translation
if
(
is_array
(
$this
->
langfiles
))
if
(
is_array
(
$this
->
langfiles
))
{
{
...
@@ -481,7 +481,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -481,7 +481,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
}
}
return
$langs
->
trans
(
$this
->
descriptionlong
);
return
$langs
->
trans
(
$this
->
descriptionlong
);
}
}
/**
/**
* Gives the publisher name
* Gives the publisher name
*
*
...
@@ -491,7 +491,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -491,7 +491,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
{
return
$this
->
editor_name
;
return
$this
->
editor_name
;
}
}
/**
/**
* Gives the publisher url
* Gives the publisher url
*
*
...
@@ -501,7 +501,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -501,7 +501,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
{
return
$this
->
editor_url
;
return
$this
->
editor_url
;
}
}
/**
/**
* Gives module version (translated if param $translated is on)
* Gives module version (translated if param $translated is on)
* For 'experimental' modules, gives 'experimental' translation
* For 'experimental' modules, gives 'experimental' translation
...
@@ -705,7 +705,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -705,7 +705,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files
[]
=
$file
;
$files
[]
=
$file
;
}
}
sort
(
$files
);
sort
(
$files
);
foreach
(
$files
as
$file
)
foreach
(
$files
as
$file
)
{
{
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'llx_'
&&
substr
(
$file
,
0
,
4
)
!=
'data'
)
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'llx_'
&&
substr
(
$file
,
0
,
4
)
!=
'data'
)
{
{
...
@@ -723,7 +723,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -723,7 +723,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files
[]
=
$file
;
$files
[]
=
$file
;
}
}
sort
(
$files
);
sort
(
$files
);
foreach
(
$files
as
$file
)
foreach
(
$files
as
$file
)
{
{
if
(
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'llx_'
&&
substr
(
$file
,
0
,
4
)
!=
'data'
)
if
(
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'llx_'
&&
substr
(
$file
,
0
,
4
)
!=
'data'
)
{
{
...
@@ -741,7 +741,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -741,7 +741,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files
[]
=
$file
;
$files
[]
=
$file
;
}
}
sort
(
$files
);
sort
(
$files
);
foreach
(
$files
as
$file
)
foreach
(
$files
as
$file
)
{
{
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'data'
)
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
4
)
==
'data'
)
{
{
...
@@ -759,7 +759,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -759,7 +759,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files
[]
=
$file
;
$files
[]
=
$file
;
}
}
sort
(
$files
);
sort
(
$files
);
foreach
(
$files
as
$file
)
foreach
(
$files
as
$file
)
{
{
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
6
)
==
'update'
)
if
(
preg_match
(
'/\.sql$/i'
,
$file
)
&&
!
preg_match
(
'/\.key\.sql$/i'
,
$file
)
&&
substr
(
$file
,
0
,
6
)
==
'update'
)
{
{
...
@@ -899,19 +899,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -899,19 +899,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
//$titre = $this->boxes[$key][0];
//$titre = $this->boxes[$key][0];
$file
=
$this
->
boxes
[
$key
][
'file'
];
$file
=
$this
->
boxes
[
$key
][
'file'
];
//$note = $this->boxes[$key][2];
//$note = $this->boxes[$key][2];
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
// For the moment, we manage this with hard coded exception
// For the moment, we manage this with hard coded exception
//print "Remove box ".$file.'<br>';
//print "Remove box ".$file.'<br>';
if
(
$file
==
'box_graph_product_distribution.php'
)
if
(
$file
==
'box_graph_product_distribution.php'
)
{
{
if
(
!
empty
(
$conf
->
produit
->
enabled
)
||
!
empty
(
$conf
->
service
->
enabled
))
if
(
!
empty
(
$conf
->
produit
->
enabled
)
||
!
empty
(
$conf
->
service
->
enabled
))
{
{
dol_syslog
(
"We discard disabling of module "
.
$file
.
" because another module still active require it."
);
dol_syslog
(
"We discard disabling of module "
.
$file
.
" because another module still active require it."
);
continue
;
continue
;
}
}
}
}
if
(
empty
(
$file
))
$file
=
isset
(
$this
->
boxes
[
$key
][
1
])
?
$this
->
boxes
[
$key
][
1
]
:
''
;
// For backward compatibility
if
(
empty
(
$file
))
$file
=
isset
(
$this
->
boxes
[
$key
][
1
])
?
$this
->
boxes
[
$key
][
1
]
:
''
;
// For backward compatibility
if
(
$this
->
db
->
type
==
'sqlite3'
)
{
if
(
$this
->
db
->
type
==
'sqlite3'
)
{
...
@@ -986,7 +986,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -986,7 +986,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$status
=
isset
(
$this
->
cronjobs
[
$key
][
'status'
])
?
$this
->
cronjobs
[
$key
][
'status'
]
:
''
;
$status
=
isset
(
$this
->
cronjobs
[
$key
][
'status'
])
?
$this
->
cronjobs
[
$key
][
'status'
]
:
''
;
$priority
=
isset
(
$this
->
cronjobs
[
$key
][
'priority'
])
?
$this
->
cronjobs
[
$key
][
'priority'
]
:
''
;
$priority
=
isset
(
$this
->
cronjobs
[
$key
][
'priority'
])
?
$this
->
cronjobs
[
$key
][
'priority'
]
:
''
;
$test
=
isset
(
$this
->
cronjobs
[
$key
][
'test'
])
?
$this
->
cronjobs
[
$key
][
'test'
]
:
''
;
// Line must be visible
$test
=
isset
(
$this
->
cronjobs
[
$key
][
'test'
])
?
$this
->
cronjobs
[
$key
][
'test'
]
:
''
;
// Line must be visible
// Search if boxes def already present
// Search if boxes def already present
$sql
=
"SELECT count(*) as nb FROM "
.
MAIN_DB_PREFIX
.
"cronjob"
;
$sql
=
"SELECT count(*) as nb FROM "
.
MAIN_DB_PREFIX
.
"cronjob"
;
$sql
.
=
" WHERE module_name = '"
.
$this
->
db
->
escape
(
$this
->
rights_class
)
.
"'"
;
$sql
.
=
" WHERE module_name = '"
.
$this
->
db
->
escape
(
$this
->
rights_class
)
.
"'"
;
...
@@ -1124,55 +1124,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
...
@@ -1124,55 +1124,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
*
*
* @return int Error count (0 if ok)
* @return int Error count (0 if ok)
*/
*/
function
insert_tabs
()
function
insert_tabs
()
{
{
global
$conf
;
global
$conf
;
$err
=
0
;
$err
=
0
;
if
(
!
empty
(
$this
->
tabs
))
if
(
!
empty
(
$this
->
tabs
))
{
{
$i
=
0
;
$i
=
0
;
foreach
(
$this
->
tabs
as
$key
=>
$value
)
foreach
(
$this
->
tabs
as
$key
=>
$value
)
{
{
if
(
is_array
(
$value
)
&&
count
(
$value
)
==
0
)
continue
;
// Discard empty arrays
if
(
is_array
(
$value
)
&&
count
(
$value
)
==
0
)
continue
;
// Discard empty arrays
$entity
=
$conf
->
entity
;
$entity
=
$conf
->
entity
;
$newvalue
=
$value
;
$newvalue
=
$value
;
if
(
is_array
(
$value
))
if
(
is_array
(
$value
))
{
{
$newvalue
=
$value
[
'data'
];
$newvalue
=
$value
[
'data'
];
if
(
isset
(
$value
[
'entity'
]))
$entity
=
$value
[
'entity'
];
if
(
isset
(
$value
[
'entity'
]))
$entity
=
$value
[
'entity'
];
}
}
if
(
$newvalue
)
if
(
$newvalue
)
{
{
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"const ("
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"const ("
;
$sql
.
=
"name"
;
$sql
.
=
"name"
;
$sql
.
=
", type"
;
$sql
.
=
", type"
;
$sql
.
=
", value"
;
$sql
.
=
", value"
;
$sql
.
=
", note"
;
$sql
.
=
", note"
;
$sql
.
=
", visible"
;
$sql
.
=
", visible"
;
$sql
.
=
", entity"
;
$sql
.
=
", entity"
;
$sql
.
=
")"
;
$sql
.
=
")"
;
$sql
.
=
" VALUES ("
;
$sql
.
=
" VALUES ("
;
$sql
.
=
$this
->
db
->
encrypt
(
$this
->
const_name
.
"_TABS_"
.
$i
,
1
);
$sql
.
=
$this
->
db
->
encrypt
(
$this
->
const_name
.
"_TABS_"
.
$i
,
1
);
$sql
.
=
", 'chaine'"
;
$sql
.
=
", 'chaine'"
;
$sql
.
=
", "
.
$this
->
db
->
encrypt
(
$value
,
1
);
$sql
.
=
", "
.
$this
->
db
->
encrypt
(
$
new
value
,
1
);
$sql
.
=
", null"
;
$sql
.
=
", null"
;
$sql
.
=
", '0'"
;
$sql
.
=
", '0'"
;
$sql
.
=
", "
.
$
conf
->
entity
;
$sql
.
=
", "
.
$entity
;
$sql
.
=
")"
;
$sql
.
=
")"
;
dol_syslog
(
get_class
(
$this
)
.
"::insert_tabs"
,
LOG_DEBUG
);
dol_syslog
(
get_class
(
$this
)
.
"::insert_tabs"
,
LOG_DEBUG
);
$this
->
db
->
query
(
$sql
);
$this
->
db
->
query
(
$sql
);
}
}
$i
++
;
$i
++
;
}
}
}
}
return
$err
;
return
$err
;
}
}
/**
/**
* Adds constants
* Adds constants
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment