ProjeQtOr free project management software - Project expenses : 0 cost is considered NULL - ProjeQtOr
 

Project expenses : 0 cost is considered NULL

More
04 Jui 2020 15:34 #1 by fsouliers
Hello,

today, something fantastic happened : we forecasted an expense (with planned value etc ...) for some components and we should have paid for it ... but the manufacturer gave it to us, as demonstration/testing samples (wooohooo \o/ )

So I wanted to fill the real expense cost : 0€ ... but Projeqtor sees it as a null value.
This is annoying because it’s not null, it is precisely 0. The expense isn’t cancelled and has been properly filled (null necessarily stands for « this data still has no value »).
I savagely modified the database (setting a 0 value and the realDate) : the gui properly updates, but when I click «save», it brings back the null value (and updates the DB with null).

Please Connexion or Create an account to join the conversation.

More
04 Jui 2020 18:13 #2 by babynus
Yes,
It is due to PHP 7.2 compatibility, since in PHP 7.2 :
Before PHP 7.2
1 + null = 1
Since PHP 7.2
1 + null => RAISE ERROR

So all our consolidations failed and we had to replace all null numeric values with zero.
That why now null and zero is the same for numeric values.
I'm afraid we won't be able to change this.

I suggest you just don't enter a real date : there was no bill, so no bill date, so no expense real date.
And possibly move the expense to a specific stauts, closed but not cancelled.

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
12 Jui 2020 15:58 #3 by fsouliers
many thanks for your answer.
For my better understanding, can you tell me how to start looking for it in the code ?

to be perfectly honest, I would like to understand why a null coalescing operator could not solve the issue, is it to maintain same code with several versions of PHP ? another reason ?
... I am not a PHP developper, so I am just trying to understand.

Please Connexion or Create an account to join the conversation.

More
18 Jui 2020 16:22 - 18 Jui 2020 16:23 #4 by babynus

For my better understanding, can you tell me how to start looking for it in the code ?

everywhere...
ad every operation with object fields (additions, substractions,multiplications or others)

I would like to understand why a null coalescing operator could not solve the issue

Of course a coalescing operator could solve the issue,
but whould require to change al the code, with major regression risks.
So solution was applied at the persistence framework to replace null witj zero for numeric, without any other impact and no risk of regression.

Babynus
Administrator of ProjeQtOr web site
Last edit: 18 Jui 2020 16:23 by babynus.

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.025 seconds