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
b92980c6
Commit
b92980c6
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix statistics on products
parent
811b0d9a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/langs/en_US/products.lang
+5
-3
5 additions, 3 deletions
htdocs/langs/en_US/products.lang
htdocs/product/index.php
+23
-15
23 additions, 15 deletions
htdocs/product/index.php
with
28 additions
and
18 deletions
htdocs/langs/en_US/products.lang
+
5
−
3
View file @
b92980c6
...
...
@@ -25,11 +25,13 @@ ProductAccountancySellCode=Accountancy code (sale)
ProductOrService=Product or Service
ProductsAndServices=Products and Services
ProductsOrServices=Products or Services
ProductsOnSell=Product for sale or for purchase
ProductsOnSaleOnly=Products for sale only
ProductsOnPurchaseOnly=Product for purchase only
ProductsNotOnSell=Product not for sale and not for purchase
ProductsOnSellAndOnBuy=Products for sale and for purchase
ServicesOnSell=Services for sale or for purchase
ServicesNotOnSell=Services not for sale
ServicesOnSaleOnly=Services for sale only
ServicesOnPurchaseOnly=Services for purchase only
ServicesNotOnSell=Services not for sale and not for purchase
ServicesOnSellAndOnBuy=Services for sale and for purchase
LastModifiedProductsAndServices=Latest %s modified products/services
LastRecordedProducts=Latest %s recorded products
...
...
This diff is collapsed.
Click to expand it.
htdocs/product/index.php
+
23
−
15
View file @
b92980c6
...
...
@@ -84,7 +84,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
$listofsearchfields
[
'search_product'
]
=
array
(
'text'
=>
'ProductOrService'
);
}
if
(
count
(
$listofsearchfields
))
{
print
'<form method="post" action="'
.
DOL_URL_ROOT
.
'/core/search.php">'
;
...
...
@@ -100,7 +100,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
print
'</tr>'
;
$i
++
;
}
print
'</table>'
;
print
'</table>'
;
print
'</form>'
;
print
'<br>'
;
}
...
...
@@ -111,7 +111,8 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
* Number of products and/or services
*/
$prodser
=
array
();
$prodser
[
0
][
0
]
=
$prodser
[
0
][
1
]
=
$prodser
[
1
][
0
]
=
$prodser
[
1
][
1
]
=
0
;
$prodser
[
0
][
0
]
=
$prodser
[
0
][
1
]
=
$prodser
[
0
][
2
]
=
$prodser
[
0
][
3
]
=
0
;
$prodser
[
1
][
0
]
=
$prodser
[
1
][
1
]
=
$prodser
[
1
][
2
]
=
$prodser
[
1
][
3
]
=
0
;
$sql
=
"SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"product as p"
;
...
...
@@ -120,9 +121,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result
=
$db
->
query
(
$sql
);
while
(
$objp
=
$db
->
fetch_object
(
$result
))
{
$status
=
2
;
if
(
!
$objp
->
tosell
&&
!
$objp
->
tobuy
)
$status
=
0
;
// To sell OR to buy
if
((
!
$objp
->
tosell
&&
$objp
->
tobuy
)
||
(
$objp
->
tosell
&&
!
$objp
->
tobuy
))
$status
=
1
;
$status
=
3
;
if
(
!
$objp
->
tosell
&&
!
$objp
->
tobuy
)
$status
=
0
;
// Not on sale, not on purchase
if
(
$objp
->
tosell
&&
!
$objp
->
tobuy
)
$status
=
1
;
// On sale only
if
(
!
$objp
->
tosell
&&
$objp
->
tobuy
)
$status
=
2
;
// On purchase only
$prodser
[
$objp
->
fk_product_type
][
$status
]
=
$objp
->
total
;
}
...
...
@@ -134,10 +136,13 @@ if (! empty($conf->product->enabled))
$statProducts
.
=
'<td><a href="list.php?type=0&tosell=0&tobuy=0">'
.
$langs
->
trans
(
"ProductsNotOnSell"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
0
])
.
'</td>'
;
$statProducts
.
=
"</tr>"
;
$statProducts
.
=
'<tr class="oddeven">'
;
$statProducts
.
=
'<td><a href="list.php?type=0">'
.
$langs
->
trans
(
"ProductsOnSell"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
1
])
.
'</td>'
;
$statProducts
.
=
'<td><a href="list.php?type=0">'
.
$langs
->
trans
(
"ProductsOnSaleOnly"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
1
])
.
'</td>'
;
$statProducts
.
=
"</tr>"
;
$statProducts
.
=
'<tr class="oddeven">'
;
$statProducts
.
=
'<td><a href="list.php?type=0">'
.
$langs
->
trans
(
"ProductsOnPurchaseOnly"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
2
])
.
'</td>'
;
$statProducts
.
=
"</tr>"
;
$statProducts
.
=
'<tr class="oddeven">'
;
$statProducts
.
=
'<td><a href="list.php?type=0&tosell=1&tobuy=1">'
.
$langs
->
trans
(
"ProductsOnSellAndOnBuy"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
2
])
.
'</td>'
;
$statProducts
.
=
'<td><a href="list.php?type=0&tosell=1&tobuy=1">'
.
$langs
->
trans
(
"ProductsOnSellAndOnBuy"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
0
][
3
])
.
'</td>'
;
$statProducts
.
=
"</tr>"
;
}
...
...
@@ -147,10 +152,13 @@ if (! empty($conf->service->enabled))
$statServices
.
=
'<td><a href="list.php?type=1&tosell=0&tobuy=0">'
.
$langs
->
trans
(
"ServicesNotOnSell"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
0
])
.
'</td>'
;
$statServices
.
=
"</tr>"
;
$statServices
.
=
'<tr class="oddeven">'
;
$statServices
.
=
'<td><a href="list.php?type=1">'
.
$langs
->
trans
(
"ServicesOnSell"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
1
])
.
'</td>'
;
$statServices
.
=
'<td><a href="list.php?type=1">'
.
$langs
->
trans
(
"ServicesOnSaleOnly"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
1
])
.
'</td>'
;
$statServices
.
=
"</tr>"
;
$statServices
.
=
'<tr class="oddeven">'
;
$statServices
.
=
'<td><a href="list.php?type=1">'
.
$langs
->
trans
(
"ServicesOnPurchaseOnly"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
2
])
.
'</td>'
;
$statServices
.
=
"</tr>"
;
$statServices
.
=
'<tr class="oddeven">'
;
$statServices
.
=
'<td><a href="list.php?type=1&tosell=1&tobuy=1">'
.
$langs
->
trans
(
"ServicesOnSellAndOnBuy"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
2
])
.
'</td>'
;
$statServices
.
=
'<td><a href="list.php?type=1&tosell=1&tobuy=1">'
.
$langs
->
trans
(
"ServicesOnSellAndOnBuy"
)
.
'</a></td><td align="right">'
.
round
(
$prodser
[
1
][
3
])
.
'</td>'
;
$statServices
.
=
"</tr>"
;
}
...
...
@@ -220,7 +228,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
while
(
$i
<
$num
)
{
$obj
=
$db
->
fetch_object
(
$result
);
print
'<tr $bc[$var]><td>'
.
$obj
->
label
.
'</td><td>'
.
$obj
->
nb
.
'</td></tr>'
;
$total
+=
$obj
->
nb
;
$i
++
;
...
...
@@ -292,7 +300,7 @@ if ($result)
}
}
print
'<tr class="oddeven">'
;
print
'<td class="nowrap">'
;
$product_static
->
id
=
$objp
->
rowid
;
...
...
@@ -419,7 +427,7 @@ function activitytrim($product_type)
$i
=
0
;
$var
=
true
;
while
(
$i
<
$num
)
{
$objp
=
$db
->
fetch_object
(
$result
);
...
...
@@ -427,7 +435,7 @@ function activitytrim($product_type)
{
if
(
$trim1
+
$trim2
+
$trim3
+
$trim4
>
0
)
{
print
'<tr class="oddeven"><td align=left>'
.
$tmpyear
.
'</td>'
;
print
'<td align=right>'
.
price
(
$trim1
)
.
'</td>'
;
print
'<td align=right>'
.
price
(
$trim2
)
.
'</td>'
;
...
...
@@ -461,7 +469,7 @@ function activitytrim($product_type)
}
if
(
$trim1
+
$trim2
+
$trim3
+
$trim4
>
0
)
{
print
'<tr class="oddeven"><td align=left>'
.
$tmpyear
.
'</td>'
;
print
'<td align=right>'
.
price
(
$trim1
)
.
'</td>'
;
print
'<td align=right>'
.
price
(
$trim2
)
.
'</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