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!
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;
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 :/
You're right, code can be simlplified.