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
b36e40ee
Commit
b36e40ee
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix feature to break by email
parent
7fbf76ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/projet/class/project.class.php
+1
-1
1 addition, 1 deletion
htdocs/projet/class/project.class.php
htdocs/projet/element.php
+41
-30
41 additions, 30 deletions
htdocs/projet/element.php
with
42 additions
and
31 deletions
htdocs/projet/class/project.class.php
+
1
−
1
View file @
b36e40ee
...
...
@@ -398,7 +398,7 @@ class Project extends CommonObject
* @param string $datefieldname name of table associated of the type
* @param string $dates Start date (at 00:00:00)
* @param string $datee End date (at 23:00:00)
* @return mixed
L
ist of o
rder
s linked to project, < 0 or string if error
* @return mixed
Array l
ist of o
bject id
s linked to project, < 0 or string if error
*/
function
get_element_list
(
$type
,
$tablename
,
$datefieldname
=
''
,
$dates
=
''
,
$datee
=
''
)
{
...
...
This diff is collapsed.
Click to expand it.
htdocs/projet/element.php
+
41
−
30
View file @
b36e40ee
...
...
@@ -272,6 +272,8 @@ foreach ($listofreferent as $key => $value)
if
(
$qualified
)
{
$element
=
new
$classname
(
$db
);
if
(
!
$showdatefilter
)
{
print
'<form action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$projectid
.
'" method="post">'
;
...
...
@@ -336,6 +338,9 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_third
=
0
;
$total_ttc_by_third
=
0
;
$saved_third_id
=
0
;
$breakline
=
''
;
if
(
canApplySubtotalOn
(
$tablename
))
{
// Appel du mon code de tri :
$elementarray
=
sortElementsByClientName
(
$elementarray
);
...
...
@@ -344,11 +349,22 @@ foreach ($listofreferent as $key => $value)
$num
=
count
(
$elementarray
);
for
(
$i
=
0
;
$i
<
$num
;
$i
++
)
{
$element
=
new
$classname
(
$db
);
$element
->
fetch
(
$elementarray
[
$i
]);
$element
->
fetch_thirdparty
();
//print $classname;
if
(
$breakline
&&
$saved_third_id
!=
$element
->
thirdparty
->
id
)
{
print
$breakline
;
$var
=
true
;
$saved_third_id
=
$element
->
thirdparty
->
id
;
$breakline
=
''
;
$total_ht_by_third
=
0
;
$total_ttc_by_third
=
0
;
}
$qualifiedfortotal
=
true
;
if
(
$key
==
'invoice'
)
{
...
...
@@ -417,34 +433,26 @@ foreach ($listofreferent as $key => $value)
$total_ttc_by_third
+=
$element
->
total_ttc
;
}
// Autre partie de mon code :
if
(
canApplySubtotalOn
(
$tablename
))
{
$next_third_id
=
(
isset
(
$elementarray
[
$i
+
1
]))
?
$elementarray
[
$i
+
1
]
:
''
;
$third_id
=
$element
->
thirdparty
->
id
;
if
(
$third_id
!=
$next_third_id
)
{
print
'<tr class="liste_total">'
;
print
'<td colspan="2">'
;
print
'</td>'
;
print
'<td>'
;
print
'</td>'
;
print
'<td class="right">'
;
print
$langs
->
trans
(
'SubTotal'
)
.
' : '
;
if
(
is_object
(
$element
->
thirdparty
))
print
$element
->
thirdparty
->
getNomUrl
(
0
,
''
,
48
);
print
'</td>'
;
print
'<td align="right">'
.
price
(
$total_ht
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$total_ttc
)
.
'</td>'
;
print
'<td></td>'
;
print
'</tr>'
;
$total_ht_by_third
=
0
;
$total_ttc_by_third
=
0
;
$var
=
true
;
}
$breakline
=
'<tr class="liste_total">'
;
$breakline
.
=
'<td colspan="2">'
;
$breakline
.
=
'</td>'
;
$breakline
.
=
'<td>'
;
$breakline
.
=
'</td>'
;
$breakline
.
=
'<td class="right">'
;
$breakline
.
=
$langs
->
trans
(
'SubTotal'
)
.
' : '
;
if
(
is_object
(
$element
->
thirdparty
))
$breakline
.
=
$element
->
thirdparty
->
getNomUrl
(
0
,
''
,
48
);
$breakline
.
=
'</td>'
;
$breakline
.
=
'<td align="right">'
.
price
(
$total_ht_by_third
)
.
'</td>'
;
$breakline
.
=
'<td align="right">'
.
price
(
$total_ttc_by_third
)
.
'</td>'
;
$breakline
.
=
'<td></td>'
;
$breakline
.
=
'</tr>'
;
}
}
if
(
$breakline
)
print
$breakline
;
print
'<tr class="liste_total"><td colspan="4">'
.
$langs
->
trans
(
"Number"
)
.
': '
.
$i
.
'</td>'
;
if
(
empty
(
$value
[
'disableamount'
]))
print
'<td align="right" width="100">'
.
$langs
->
trans
(
"TotalHT"
)
.
' : '
.
price
(
$total_ht
)
.
'</td>'
;
else
print
'<td></td>'
;
...
...
@@ -524,6 +532,8 @@ foreach ($listofreferent as $key => $value)
$margin
=
$value
[
'margin'
];
if
(
isset
(
$margin
))
{
$element
=
new
$classname
(
$db
);
$elementarray
=
$project
->
get_element_list
(
$key
,
$tablename
);
if
(
count
(
$elementarray
)
>
0
&&
is_array
(
$elementarray
))
{
...
...
@@ -533,7 +543,6 @@ foreach ($listofreferent as $key => $value)
$num
=
count
(
$elementarray
);
for
(
$i
=
0
;
$i
<
$num
;
$i
++
)
{
$element
=
new
$classname
(
$db
);
$element
->
fetch
(
$elementarray
[
$i
]);
$element
->
fetch_thirdparty
();
//print $classname;
...
...
@@ -607,23 +616,25 @@ function sortElementsByClientName($elementarray)
$element
=
new
$classname
(
$db
);
$clientname
=
array
();
foreach
(
$elementarray
as
$key
=>
$id
)
foreach
(
$elementarray
as
$key
=>
$id
)
// id = id of object
{
if
(
empty
(
$clientname
[
$id
]))
{
$element
->
id
=
$id
;
$element
->
fetch
(
$id
)
;
$element
->
fetch_thirdparty
();
$clientname
[
$id
]
=
$element
->
thirdparty
->
name
;
}
}
asort
(
$clientname
);
//var_dump($clientname);
asort
(
$clientname
);
// sort on name
$elementarray
=
array
();
foreach
(
$clientname
as
$id
=>
$name
)
{
foreach
(
$clientname
as
$id
=>
$name
)
{
$elementarray
[]
=
$id
;
}
return
$elementarray
;
}
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