Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Imputation Line - g...
 
Notifications
Clear all

Imputation Line - getLines

6 Posts
2 Users
0 Reactions
2,190 Views
(@antonio-grr)
Posts: 84
Active Member
Topic starter
 
[#4051]

Hi.
I hope you can help me to understand the following fragment of code from method getLines in Imputation line.

// fetch all work stored in database for this assignment
foreach ( $workList as $work ) {
if (($work->idAssignment and $work->idAssignment == $elt->idAssignment and !$work->idWorkElement and !isset($elt->_idWorkElement)) or
(!$work->idAssignment and $work->refType == $elt->refType and $work->refId == $elt->refId) or
($work->idAssignment and $work->idAssignment == $elt->idAssignment and $work->idWorkElement and isset($elt->_idWorkElement) and $elt->_idWorkElement == $work->idWorkElement)) {
$workDate=$work->workDate;
$offset=dayDiffDates($startDate, $workDate) + 1;
if (isset($elt->arrayWork [$offset])) {
$elt->arrayWork [$offset]->work+=$work->work;
} else {
$elt->arrayWork [$offset]=$work;
}
}
}

It seems that you collect in the same work object the amount of work from work table having
a) a given assignment and no _idWorkElement
b) no assignment , a given reference
c) a given assignment and a given idWorkElement

Now, I'm to create a) just as a real work referred to an activity, b) as the real work for a ticket, but I'm not able to create c) .
How can I ?
Furthermore, how can I create two or more lines in work table that will be added in the same imputation line ( as in the previous fragment of code ) ?
Conditions appear incompatible, but if not, what will happen at save ?
Thank you for your help


 
Posted : 31 Jan 2017 14H27
(@babynus)
Posts: 14952
Member Admin
 

Real work in never linekd directly to the activity but to the assignment.
For Tickets, :link is through WorkElement, that may be linked to Activity if PlanningActivity is set on Ticket.

Each line in Real Work allocation is dedicated to corresponding Assignment or WorkElement (in this last case it is read only)


 
Posted : 31 Jan 2017 16H51
(@antonio-grr)
Posts: 84
Active Member
Topic starter
 

Thank you for your explanation.
Now I'm able to create a work line with assignment and idWorkElement.
But at the moment I could believe that the condition to add to different amount of work as in the code line
$elt->arrayWork [$offset]->work+=$work->work;
will never happen.
It's true ?


 
Posted : 31 Jan 2017 17H57
(@babynus)
Posts: 14952
Member Admin
 

But at the moment I could believe that the condition to add to different amount of work as in the code line
$elt->arrayWork [$offset]->work+=$work->work;
will never happen.
It's true ?

I don't understand the question.

Could you explain ?


 
Posted : 01 Feb 2017 1H38
(@antonio-grr)
Posts: 84
Active Member
Topic starter
 

Ok, I try to explain.
In the code you test isset($elt->arrayWork [$offset])
If true you add the new work amount to the previously stored.
I cannot understand how this condition can happen : you should find two lines in db having the same date and matching one of the three conditions above.
Is this possible ?


 
Posted : 01 Feb 2017 11H20
(@babynus)
Posts: 14952
Member Admin
 

It is a security trick to be sure to display all data.
But you're right it should not happen.


 
Posted : 01 Feb 2017 12H20
Share:

Scroll to Top