ProjeQtOr free project management software - Error in planning: Undefined variable: projectKey - ProjeQtOr
 

Error in planning: Undefined variable: projectKey

More
16 Jan 2020 16:19 #1 by tequeter
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!

Please Connexion or Create an account to join the conversation.

More
19 Jan 2020 12:57 #2 by babynus
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;

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
31 Jan 2020 18:32 #3 by tequeter
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 :/

Please Connexion or Create an account to join the conversation.

More
04 Fév 2020 13:51 #4 by babynus
You're right, code can be simlplified.

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.026 seconds