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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
5709179c
Commit
5709179c
authored
11 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Box was not added on correct side
parent
0e13ded6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/admin/boxes.php
+20
-21
20 additions, 21 deletions
htdocs/admin/boxes.php
with
20 additions
and
21 deletions
htdocs/admin/boxes.php
+
20
−
21
View file @
5709179c
...
...
@@ -57,7 +57,7 @@ if ($action == 'add')
$db
->
begin
();
// Initialize distinctfkuser with all already existing values of fk_user (user that use a personalized view of boxes for pos)
// Initialize distinct
fkuser with all already existing values of fk_user (user that use a personalized view of boxes for
page "
pos
"
)
$distinctfkuser
=
array
();
if
(
!
$error
)
{
...
...
@@ -85,33 +85,31 @@ if ($action == 'add')
}
}
$distinctfkuser
[
'0'
]
=
'0'
;
// Add entry for fk_user = 0. We must use string as key and val
foreach
(
$distinctfkuser
as
$fk_user
)
{
if
(
!
$error
&&
$fk_user
!=
0
)
// We will add fk_user = 0 later.
if
(
!
$error
&&
$fk_user
!=
''
)
{
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"boxes ("
;
$sql
.
=
"box_id, position, box_order, fk_user, entity"
;
$sql
.
=
") values ("
;
$sql
.
=
GETPOST
(
"boxid"
,
"int"
)
.
", "
.
GETPOST
(
"pos"
,
"alpha"
)
.
", 'A01', "
.
$fk_user
.
", "
.
$conf
->
entity
;
$sql
.
=
")"
;
$nbboxonleft
=
$nbboxonright
=
0
;
$sql
=
"SELECT box_order FROM "
.
MAIN_DB_PREFIX
.
"boxes WHERE position = "
.
GETPOST
(
"pos"
,
"alpha"
)
.
" AND fk_user = "
.
$fk_user
.
" AND entity = "
.
$conf
->
entity
;
dol_syslog
(
"boxes.php activate box sql="
.
$sql
);
$resql
=
$db
->
query
(
$sql
);
if
(
!
$resql
)
if
(
$resql
)
{
$errmesg
=
$db
->
lasterror
();
$error
++
;
}
while
(
$obj
=
$db
->
fetch_object
(
$resql
))
{
$boxorder
=
$obj
->
box_order
;
if
(
preg_match
(
'/A/'
,
$boxorder
))
$nbboxonleft
++
;
if
(
preg_match
(
'/B/'
,
$boxorder
))
$nbboxonright
++
;
}
}
else
dol_print_error
(
$db
);
// If value 0 was not included, we add it.
if
(
!
$error
)
{
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"boxes ("
;
$sql
.
=
"box_id, position, box_order, fk_user, entity"
;
$sql
.
=
") values ("
;
$sql
.
=
GETPOST
(
"boxid"
,
"int"
)
.
", "
.
GETPOST
(
"pos"
,
"alpha"
)
.
", '
A01', 0
, "
.
$conf
->
entity
;
$sql
.
=
GETPOST
(
"boxid"
,
"int"
)
.
", "
.
GETPOST
(
"pos"
,
"alpha"
)
.
", '
"
.
((
$nbboxonleft
>
$nbboxonright
)
?
'B01'
:
'A01'
)
.
"', "
.
$fk_user
.
"
, "
.
$conf
->
entity
;
$sql
.
=
")"
;
dol_syslog
(
"boxes.php activate box sql="
.
$sql
);
...
...
@@ -122,6 +120,7 @@ if ($action == 'add')
$error
++
;
}
}
}
if
(
!
$error
)
{
...
...
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