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
8025b258
Commit
8025b258
authored
16 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Qual: Simplify code for menu handlers
parent
e19a8e91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/admin/menus/edit.php
+10
-35
10 additions, 35 deletions
htdocs/admin/menus/edit.php
htdocs/langs/en_US/admin.lang
+2
-0
2 additions, 0 deletions
htdocs/langs/en_US/admin.lang
htdocs/langs/fr_FR/admin.lang
+2
-0
2 additions, 0 deletions
htdocs/langs/fr_FR/admin.lang
with
14 additions
and
35 deletions
htdocs/admin/menus/edit.php
+
10
−
35
View file @
8025b258
...
@@ -185,7 +185,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_const')
...
@@ -185,7 +185,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_const')
if
(
$_POST
[
'type'
]
==
'prede'
)
if
(
$_POST
[
'type'
]
==
'prede'
)
{
{
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_const(fk_menu, fk_constraint
, user
) VALUES("
.
$_POST
[
'menuId'
]
.
","
.
$_POST
[
'constraint'
]
.
"
,"
.
$_POST
[
'user'
]
.
"
)"
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_const(fk_menu, fk_constraint) VALUES("
.
$_POST
[
'menuId'
]
.
","
.
$_POST
[
'constraint'
]
.
")"
;
}
}
else
else
{
{
...
@@ -198,7 +198,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_const')
...
@@ -198,7 +198,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_const')
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_constraint(rowid,action) VALUES("
.
$constraint
.
",'"
.
$_POST
[
'constraint'
]
.
"')"
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_constraint(rowid,action) VALUES("
.
$constraint
.
",'"
.
$_POST
[
'constraint'
]
.
"')"
;
$db
->
query
(
$sql
);
$db
->
query
(
$sql
);
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_const(fk_menu, fk_constraint
, user
) VALUES("
.
$_POST
[
'menuId'
]
.
","
.
$constraint
.
"
,"
.
$_POST
[
'user'
]
.
"
)"
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"menu_const(fk_menu, fk_constraint) VALUES("
.
$_POST
[
'menuId'
]
.
","
.
$constraint
.
")"
;
}
}
$db
->
query
(
$sql
);
$db
->
query
(
$sql
);
...
@@ -457,11 +457,12 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
...
@@ -457,11 +457,12 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
/*
/*
* Lignes de contraintes
* Lignes de contraintes
*/
*/
$sql
=
'SELECT c.rowid, c.action
, mc.user
'
;
$sql
=
'SELECT c.rowid, c.action'
;
$sql
.
=
'FROM '
.
MAIN_DB_PREFIX
.
'menu_constraint as c, '
.
MAIN_DB_PREFIX
.
'menu_const as mc
'
;
$sql
.
=
'
FROM '
.
MAIN_DB_PREFIX
.
'menu_constraint as c, '
.
MAIN_DB_PREFIX
.
'menu_const as mc'
;
$sql
.
=
'WHERE c.rowid = mc.fk_constraint
'
;
$sql
.
=
'
WHERE c.rowid = mc.fk_constraint'
;
$sql
.
=
'AND mc.fk_menu = '
.
$_GET
[
'menuId'
];
$sql
.
=
'
AND mc.fk_menu = '
.
$_GET
[
'menuId'
];
dolibarr_syslog
(
"Edit: sql="
.
$sql
,
LOG_DEBUG
);
$resql
=
$db
->
query
(
$sql
);
$resql
=
$db
->
query
(
$sql
);
if
(
$resql
)
if
(
$resql
)
{
{
...
@@ -472,8 +473,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
...
@@ -472,8 +473,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
if
(
$num
)
if
(
$num
)
{
{
print
'<tr class="liste_titre">'
;
print
'<tr class="liste_titre">'
;
print
'<td>'
.
$langs
->
trans
(
'Constraint'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'ConstraintsToShowOrNotEntry'
)
.
' ('
.
$langs
->
trans
(
"AllMustBeOk"
)
.
')</td>'
;
print
'<td>'
.
$langs
->
trans
(
'User'
)
.
'</td>'
;
print
'<td width="16"> </td>'
;
print
'<td width="16"> </td>'
;
print
"</tr>
\n
"
;
print
"</tr>
\n
"
;
}
}
...
@@ -487,26 +487,13 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
...
@@ -487,26 +487,13 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
$var
=
!
$var
;
$var
=
!
$var
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
.
$objc
->
action
.
'</td>'
;
print
'<td>'
.
$objc
->
action
.
'</td>'
;
print
'<td>'
;
switch
(
$objc
->
user
)
{
case
0
:
print
'Interne'
;
break
;
case
1
:
print
'Externe'
;
break
;
case
2
:
print
'Tous'
;
break
;
}
print
'</td>'
;
print
'<td align="center"><a href="edit.php?action=del_const&menuId='
.
$_GET
[
'menuId'
]
.
'&constId='
.
$objc
->
rowid
.
'">'
.
img_delete
()
.
'</a></td>'
;
print
'<td align="center"><a href="edit.php?action=del_const&menuId='
.
$_GET
[
'menuId'
]
.
'&constId='
.
$objc
->
rowid
.
'">'
.
img_delete
()
.
'</a></td>'
;
$i
++
;
$i
++
;
}
}
print
'<tr class="liste_titre">'
;
print
'<tr class="liste_titre">'
;
print
'<td>'
.
$langs
->
trans
(
'Constraints'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'ConstraintsToShowOrNotEntry'
)
.
'</td>'
;
print
'<td width="250">'
.
$langs
->
trans
(
'User'
)
.
'</td>'
;
print
'<td width="16"> </td>'
;
print
'<td width="16"> </td>'
;
print
"</tr>
\n
"
;
print
"</tr>
\n
"
;
...
@@ -519,13 +506,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
...
@@ -519,13 +506,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
$var
=
true
;
$var
=
true
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
' <td><textarea cols="70" name="constraint" rows="1"></textarea></td>'
;
print
' <td><textarea cols="70" name="constraint" rows="1"></textarea></td>'
;
print
'<td>'
;
print
' <td align="center"><input type="submit" class="button" value="'
.
$langs
->
trans
(
"Add"
)
.
'"></td>'
;
print
'<select name="user">'
;
print
'<option value="0"'
.
(
$menu
->
user
==
0
?
' selected="true"'
:
''
)
.
'>'
.
$langs
->
trans
(
'Internal'
)
.
'</option>'
;
print
'<option value="1"'
.
(
$menu
->
user
==
1
?
' selected="true"'
:
''
)
.
'>'
.
$langs
->
trans
(
'External'
)
.
'</option>'
;
print
'<option value="2"'
.
(
$menu
->
user
==
2
?
' selected="true"'
:
''
)
.
'>Tous</option>'
;
print
'</td>'
;
print
'<td align="center"><input type="submit" class="button" value="'
.
$langs
->
trans
(
"Add"
)
.
'"></td>'
;
print
'</tr>'
;
print
'</tr>'
;
print
'</form>'
;
print
'</form>'
;
...
@@ -553,12 +534,6 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
...
@@ -553,12 +534,6 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
print
'</select>'
;
print
'</select>'
;
print
'</td>'
;
print
'<td>'
;
print
'<select name="user">'
;
print
'<option value="0"'
.
(
$menu
->
user
==
0
?
' selected="true"'
:
''
)
.
'>'
.
$langs
->
trans
(
'Internal'
)
.
'</option>'
;
print
'<option value="1"'
.
(
$menu
->
user
==
1
?
' selected="true"'
:
''
)
.
'>'
.
$langs
->
trans
(
'External'
)
.
'</option>'
;
print
'<option value="2"'
.
(
$menu
->
user
==
2
?
' selected="true"'
:
''
)
.
'>Tous</option>'
;
print
'</td>'
;
print
'</td>'
;
print
'<td align="center"><input type="submit" class="button" value="'
.
$langs
->
trans
(
"Add"
)
.
'"></td>'
;
print
'<td align="center"><input type="submit" class="button" value="'
.
$langs
->
trans
(
"Add"
)
.
'"></td>'
;
print
'</tr>'
;
print
'</tr>'
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/langs/en_US/admin.lang
+
2
−
0
View file @
8025b258
...
@@ -470,6 +470,8 @@ TableLineFormat=Line format
...
@@ -470,6 +470,8 @@ TableLineFormat=Line format
NbOfRecord=Nb of records
NbOfRecord=Nb of records
Constraints=Constraints
Constraints=Constraints
ConstraintsType=Constraint's type
ConstraintsType=Constraint's type
ConstraintsToShowOrNotEntry=Constraint to show or not the menu entry
AllMustBeOk=All must be checked
Host=Server
Host=Server
DriverType=Driver type
DriverType=Driver type
SummarySystem=System information summary
SummarySystem=System information summary
...
...
This diff is collapsed.
Click to expand it.
htdocs/langs/fr_FR/admin.lang
+
2
−
0
View file @
8025b258
...
@@ -468,6 +468,8 @@ TableLineFormat=Format lignes
...
@@ -468,6 +468,8 @@ TableLineFormat=Format lignes
NbOfRecord=Nb d'enr.
NbOfRecord=Nb d'enr.
Constraints=Contraintes
Constraints=Contraintes
ConstraintsType=Type de contrainte
ConstraintsType=Type de contrainte
ConstraintsToShowOrNotEntry=Contrainte pour afficher ou non le menu
AllMustBeOk=Toutes doivent etre respectées
Host=Serveur
Host=Serveur
DriverType=Type du driver
DriverType=Type du driver
SummarySystem=Résumé des informations systèmes Dolibarr
SummarySystem=Résumé des informations systèmes Dolibarr
...
...
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