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
9dd605bd
Commit
9dd605bd
authored
11 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Simplify and comment code
parent
7070ee36
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/product/admin/product.php
+27
-22
27 additions, 22 deletions
htdocs/product/admin/product.php
with
27 additions
and
22 deletions
htdocs/product/admin/product.php
+
27
−
22
View file @
9dd605bd
...
...
@@ -44,11 +44,12 @@ $value = GETPOST('value','alpha');
// Pricing Rules
$select_pricing_rules
=
array
(
'PRODUCT_PRICE_UNIQ'
=>
$langs
->
trans
(
'PriceCatalogue'
),
'PRODUIT_MULTIPRICES'
=>
$langs
->
trans
(
'MultiPricesAbility'
),
'PRODUIT_CUSTOMER_PRICES'
=>
$langs
->
trans
(
'PriceByCustomer'
)
'PRODUCT_PRICE_UNIQ'
=>
$langs
->
trans
(
'PriceCatalogue'
),
// Unique price
'PRODUIT_MULTIPRICES'
=>
$langs
->
trans
(
'MultiPricesAbility'
),
// Several prices according to a customer level
'PRODUIT_CUSTOMER_PRICES'
=>
$langs
->
trans
(
'PriceByCustomer'
)
// Different price for each customer
);
if
(
$conf
->
global
->
MAIN_FEATURES_LEVEL
==
2
)
{
if
(
$conf
->
global
->
MAIN_FEATURES_LEVEL
==
2
)
{
$select_pricing_rules
[
'PRODUIT_CUSTOMER_PRICES_BY_QTY'
]
=
$langs
->
trans
(
'PriceByQuantity'
);
$select_pricing_rules
[
'PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'
]
=
$langs
->
trans
(
'MultiPricesAbility'
)
.
'+'
.
$langs
->
trans
(
'PriceByQuantity'
);
}
...
...
@@ -103,31 +104,35 @@ if ($action == 'nbprod')
{
$res
=
dolibarr_set_const
(
$db
,
"PRODUIT_LIMIT_SIZE"
,
$value
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
else
if
(
$action
==
'
multiprix_num
'
)
else
if
(
$action
==
'
PRODUIT_MULTIPRICES_LIMIT
'
)
{
$res
=
dolibarr_set_const
(
$db
,
"PRODUIT_MULTIPRICES_LIMIT"
,
$value
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
if
(
$action
==
'pricingrule'
)
{
$princingrules
=
GETPOST
(
'princingrule'
,
'alpha'
);
foreach
(
$select_pricing_rules
as
$rule
=>
$label
)
{
if
(
$rule
==
$princingrules
)
{
if
(
$princingrules
==
'PRODUCT_PRICE_UNIQ'
)
{
foreach
(
$select_pricing_rules
as
$rule
=>
$label
)
// Loop on each possible mode
{
if
(
$rule
==
$princingrules
)
// We are on selected rule, we enable it
{
if
(
$princingrules
==
'PRODUCT_PRICE_UNIQ'
)
// For this case, we disable entries manually
{
$res
=
dolibarr_set_const
(
$db
,
'PRODUIT_MULTIPRICES'
,
0
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
$res
=
dolibarr_set_const
(
$db
,
'PRODUIT_CUSTOMER_PRICES_BY_QTY'
,
0
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
$res
=
dolibarr_set_const
(
$db
,
'PRODUIT_CUSTOMER_PRICES'
,
0
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
else
{
dolibarr_set_const
(
$db
,
'PRODUCT_PRICE_UNIQ'
,
1
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
else
{
$multirule
=
explode
(
'&'
,
$princingrules
);
if
(
is_array
(
$multirule
)
&&
count
(
$multirule
)
>
0
)
{
foreach
(
$multirule
as
$rulesselected
)
{
foreach
(
$multirule
as
$rulesselected
)
{
$res
=
dolibarr_set_const
(
$db
,
$rulesselected
,
1
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
}
else
{
$res
=
dolibarr_set_const
(
$db
,
$rule
,
1
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
}
}
else
{
else
// We clear this mode
{
if
(
strpos
(
$rule
,
'&'
)
===
false
)
{
$res
=
dolibarr_set_const
(
$db
,
$rule
,
0
,
'chaine'
,
0
,
''
,
$conf
->
entity
);
}
...
...
@@ -337,7 +342,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
$var
=!
$var
;
print
'<form method="POST" action="'
.
$_SERVER
[
'PHP_SELF'
]
.
'">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
print
'<input type="hidden" name="action" value="
multiprix_num
">'
;
print
'<input type="hidden" name="action" value="
PRODUIT_MULTIPRICES_LIMIT
">'
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
.
$langs
->
trans
(
"MultiPricesNumPrices"
)
.
'</td>'
;
print
'<td align="right"><input size="3" type="text" class="flat" name="value" value="'
.
$conf
->
global
->
PRODUIT_MULTIPRICES_LIMIT
.
'"></td>'
;
...
...
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