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
302ab8b7
Commit
302ab8b7
authored
15 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: uniformize code
parent
0f45a3c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/product.class.php
+10
-10
10 additions, 10 deletions
htdocs/product.class.php
with
10 additions
and
10 deletions
htdocs/product.class.php
+
10
−
10
View file @
302ab8b7
...
...
@@ -1961,7 +1961,7 @@ class Product extends CommonObject
* \brief Return all parent products
* \return array prod
*/
function
get
_pere
()
function
get
Parent
()
{
$sql
=
"SELECT p.label as label,p.rowid,pa.fk_product_pere as id"
;
...
...
@@ -1991,13 +1991,13 @@ class Product extends CommonObject
* \brief Return childs
* \return array prod
*/
function
get
_fils_a
rbo
(
$
id
_p
e
re
)
function
get
ChildsA
rbo
(
$
fk
_p
a
re
nt
)
{
$sql
=
"SELECT p.rowid, p.label as label, pa.qty as qty, pa.fk_product_fils as id"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"product as p"
;
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"product_association as pa"
;
$sql
.
=
" WHERE p.rowid = pa.fk_product_fils"
;
$sql
.
=
" AND pa.fk_product_pere = "
.
$
id
_p
e
re
;
$sql
.
=
" AND pa.fk_product_pere = "
.
$
fk
_p
a
re
nt
;
$res
=
$this
->
db
->
query
(
$sql
);
if
(
$res
)
...
...
@@ -2006,7 +2006,7 @@ class Product extends CommonObject
while
(
$rec
=
$this
->
db
->
fetch_array
(
$res
))
{
$prods
[
addslashes
(
$rec
[
'label'
])]
=
array
(
0
=>
$rec
[
'id'
],
1
=>
$rec
[
'qty'
]);
foreach
(
$this
->
get
_fils_a
rbo
(
$rec
[
'id'
])
as
$kf
=>
$vf
)
foreach
(
$this
->
get
ChildsA
rbo
(
$rec
[
'id'
])
as
$kf
=>
$vf
)
$prods
[
addslashes
(
$rec
[
'label'
])][
$kf
]
=
$vf
;
}
return
$prods
;
...
...
@@ -2025,18 +2025,18 @@ class Product extends CommonObject
*/
function
get_sousproduits_arbo
()
{
$p
e
re
s
=
$this
->
get
_pere
();
foreach
(
$p
e
re
s
as
$k
=>
$v
)
$p
a
re
nt
=
$this
->
get
Parent
();
foreach
(
$p
a
re
nt
as
$k
ey
=>
$v
alue
)
{
foreach
(
$this
->
get
_fils_a
rbo
(
$v
[
0
])
as
$k
f
=>
$v
f
)
foreach
(
$this
->
get
ChildsA
rbo
(
$v
alue
[
0
])
as
$k
eyChild
=>
$v
alueChild
)
{
$p
e
re
s
[
$k
][
$k
f
]
=
$vf
;
$p
a
re
nt
[
$k
ey
][
$k
eyChild
]
=
$valueChild
;
}
}
// concatenation
foreach
(
$p
e
re
s
as
$k
=>
$v
)
foreach
(
$p
a
re
nt
as
$k
ey
=>
$v
alue
)
{
$this
->
sousprods
[
$k
]
=
$v
;
$this
->
sousprods
[
$k
ey
]
=
$value
;
}
}
...
...
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