Forum

Error in planning: ...
 
Notifications
Retirer tout

Error in planning: Undefined variable: projectKey

4 Posts
2 Utilisateurs
0 Reactions
1,899 Vu
(@tequeter)
Posts: 2
New Member
Début du sujet
 
[#6449]

Hello,

We're encountering the following error every time we try to refresh the plan:

2020-01-16 15:36:14.665 ** ERROR ** [V8.3.1] ERROR **
2020-01-16 15:36:14.666 ** ERROR ** [V8.3.1] on file '/srv/www/projets/projeqtor/model/PlannedWork.php' at line (978)
2020-01-16 15:36:14.666 ** ERROR ***** [V8.3.1] cause = Undefined variable: projectKey

I have no idea how to recreate the problem from an empty database :/

I've tried adding some debug to figure out which activity and resource were involved, but the results were weird (the resource was never affected to that activity).

I've worked around it by changing the line from:

if (isset($ress[$projectKeyTest]) and ( ! isset($ress[$projectKey]) or Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) ) continue;

to

if (isset($ress[$projectKeyTest]) and ( !isset($projectKey) or ! isset($ress[$projectKey]) or Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) ) continue;

It seems to work, at least I have not seen obvious errors in the plan results, but that planning code is too complex for me to be sure of anything.

I'll gladly debug some more if you can provide me some pointers.

Thanks!


 
Posté : 16/01/2020 6:19 pm
(@babynus)
Posts: 14952
Membre Admin
 

Hi,
Thanks for posting the issue and proposing a fix.
In fact fix is more easy.
Just replace

if (isset($ress[$projectKeyTest]) and ( ! isset($ress[$projectKey]) or Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) ) continue;

with

if (isset($ress[$projectKeyTest]) and ( ! isset($ress[$projectKeyTest]) or Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) ) continue;

 
Posté : 19/01/2020 2:57 pm
(@tequeter)
Posts: 2
New Member
Début du sujet
 

Err, if I read the new version well,

if (isset($ress[$projectKeyTest]) and ( ! isset($ress[$projectKeyTest]) or Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) ) continue;

is: A and ( !A or B )
ie. A and B.

In other words, either further simplify to:

if (isset($ress[$projectKeyTest]) and Resource::findAffectationRate($ress[$projectKeyTest]['rate'],$currentDate)<=0) continue;

Or that piece of code was really meant to do something with both $projectKey and $projectKeyTest (but I have no idea).

Sorry to come back to this thread so late, BTW :/


 
Posté : 31/01/2020 8:32 pm
(@babynus)
Posts: 14952
Membre Admin
 

You're right, code can be simlplified.


 
Posté : 04/02/2020 3:51 pm
Share:
Retour en haut