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
816db0e8
Commit
816db0e8
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Add protection against duplicate moduel with similar names
parent
7b2a7180
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/langs/en_US/modulebuilder.lang
+2
-1
2 additions, 1 deletion
htdocs/langs/en_US/modulebuilder.lang
htdocs/modulebuilder/index.php
+20
-2
20 additions, 2 deletions
htdocs/modulebuilder/index.php
with
22 additions
and
3 deletions
htdocs/langs/en_US/modulebuilder.lang
+
2
−
1
View file @
816db0e8
...
...
@@ -51,4 +51,5 @@ WidgetFile=Widget file
ReadmeFile=Readme file
ChangeLog=ChangeLog file
SqlFile=Sql file
SqlFileKey=Sql file for keys
\ No newline at end of file
SqlFileKey=Sql file for keys
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
\ No newline at end of file
This diff is collapsed.
Click to expand it.
htdocs/modulebuilder/index.php
+
20
−
2
View file @
816db0e8
...
...
@@ -160,11 +160,29 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
setEventMessages
(
$langs
->
trans
(
"SpaceOrSpecialCharAreNotAllowed"
),
null
,
'errors'
);
}
$srcdir
=
DOL_DOCUMENT_ROOT
.
'/modulebuilder/template'
;
$destdir
=
$dirins
.
'/'
.
strtolower
(
$module
);
// Scan dir class to find if an object with same name already exists.
if
(
!
$error
)
{
$srcdir
=
DOL_DOCUMENT_ROOT
.
'/modulebuilder/template'
;
$destdir
=
$dirins
.
'/'
.
strtolower
(
$module
);
$dirlist
=
dol_dir_list
(
$destdir
.
'/class'
,
'files'
,
0
,
'\.txt$'
);
$alreadyfound
=
false
;
foreach
(
$dirlist
as
$key
=>
$val
)
{
$filefound
=
preg_replace
(
'/\.txt$/'
,
''
,
$val
[
'name'
]);
if
(
strtolower
(
$objectname
)
==
strtolower
(
$filefound
)
&&
$objectname
!=
$filefound
)
{
$alreadyfound
=
true
;
$error
++
;
setEventMessages
(
$langs
->
trans
(
"AnObjectAlreadyExistWithThisNameAndDiffCase"
),
null
,
'errors'
);
break
;
}
}
}
if
(
!
$error
)
{
// Delete some files
$filetogenerate
=
array
(
'myobject_card.php'
=>
strtolower
(
$objectname
)
.
'_card.php'
,
...
...
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