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.

Error in planning: ...
 
Notifications
Clear all

Error in planning: Undefined variable: projectKey

4 Posts
2 Users
0 Reactions
1,909 Views
(@tequeter)
Posts: 2
New Member
Topic starter
 
[#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!


 
Posted : 16 Jan 2020 18H19
babynus
(@babynus)
Posts: 14966
Main Contributor 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;

 
Posted : 19 Jan 2020 14H57
(@tequeter)
Posts: 2
New Member
Topic starter
 

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 :/


 
Posted : 31 Jan 2020 20H32
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

You're right, code can be simlplified.


 
Posted : 04 Feb 2020 15H51
Share:

Scroll to Top