itflow-org / itflow

Free and open-source web application for MSPs. Unifies IT documentation, ticketing, invoicing.
https://itflow.org
GNU General Public License v3.0
535 stars 139 forks source link

Domain expiration dates #888

Closed wrongecho closed 6 months ago

wrongecho commented 6 months ago
wrongecho commented 6 months ago

Test these changes at: https://dnsexpirynullfix888.pr-review.itflow.org
(automatic message)

sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
26.9% Duplication on New Code

See analysis details on SonarCloud

NickyM commented 6 months ago

Pardon me for not having too much insight into either PHP or ITFlow, but shouldnt there be an ALTER TABLE statement somewhere? And changes to database initializaiton?

wrongecho commented 6 months ago

@NickyM I thought the same, but it turns out we actually already allow NULL for the domain expiry field!

https://github.com/itflow-org/itflow/blob/31184f0db19eeaade58086abab478e2b3b959bf3/db.sql#L504

I think the issue was the code previously was trying to add it as a variable which was then enclosed in quotes in the SQL statement, so it was treated as a string rather than an actual null.

NickyM commented 6 months ago

Just realised that the error message that I got yesterday, surelay states 'NULL' and not NULL for the error. :)

[Thu Feb 22 08:47:47.736482 2024] [php:error] [pid 2047] [client 172.29.0.1:48080] PHP Fatal error: Uncaught mysqli_sql_exception: Incorrect date value: 'NULL' for column itflow.domains.domain_expire at row 1 in /var/www/html/post/domain.php:40\nStack trace:\n#0 /var/www/html/post/domain.php(40): mysqli_query()\n#1 /var/www/html/post.php(38): require_once('...')\n#2 {main}\n thrown in /var/www/html/post/domain.php on line 40, referer: [removed]

The domain adding/editing works fine for me then.

johnnyq commented 6 months ago

@wrongecho @NickyM Things are working fine for me too. I feel confident to reel in.

wrongecho commented 6 months ago

@NickyM

Just realised that the error message that I got yesterday, surelay states 'NULL' and not NULL for the error. :)

It's truly amazing how tiny, insignificant errors can make or break big features haha! Thanks again for your help on this - has been a thorn in my side since it was first added! :)