Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRP Calculation (MRP.php) not working (v4.15.2) #269

Open
andrewcouling opened this issue Dec 2, 2024 · 9 comments
Open

MRP Calculation (MRP.php) not working (v4.15.2) #269

andrewcouling opened this issue Dec 2, 2024 · 9 comments
Labels
Fix being discussed A fix is being discussed (add comment with link to Discussion)

Comments

@andrewcouling
Copy link
Collaborator

webERP version: v.4.15.2
PHP version: 7.4
DBMS: MariaDB version 10.2.29
Script: MRP.php

Symptom:
Since updating to 4.15.2, the MRP calculation script doesn't seem to run correctly. After I click the Run MRP button, the script runs for a very short time, then outputs the following:

image

I've compared the v4.15.2 code to the script version which worked well in our previous 4.14.1 installation, and the only changes are the removal of $db parameters.

The demo site also appears to have issues, but the behavior is different. The script appears to make more progress, generating a bunch of info messages, but there are also many SQL error messages.

@andrewcouling
Copy link
Collaborator Author

I have tried running the latest MRP.php from the master branch in my 4.15.2 installation. I get the following error message on page load:

Database Error 1054 : Unknown column 'Tables_in_weberp' in 'where clause'

@aingelc12ell
Copy link
Contributor

Hello @andrewcouling !

Try this quick fix and confirm before we push for a commit:
#line 547
$SQL = "SHOW TABLES LIKE 'mrpparameters'";

Please send your feedback

@andrewcouling
Copy link
Collaborator Author

Thanks for your help on this @aingelc12ell .

I have grabbed the latest code from master and have swapped the code which you suggest.

The calculation seems to complete, although its possible there was no problem with this before to change. Once the calculation is completed, I still receive only one message box instead of the 20 (approx) which I expect to see.

image

This is what i see after running MRP calculation on my legacy 4.14.1 installation:

mrp99

I expect that the absence of these message boxes relates to the latest code running in my 4.15.2 installation, as the problem doesn't seem to exist on the demo site. Any ideas what might be causing this?

I have verified that the output of the MRP calculation in 4.15.2 (with latest MRP.php) is equivalent to that running in my legacy 4.14.1 (which has been reliably stable), by comparing the number of components in the MRP shortages report - they are both identical.

I am not yet running the latest code from master, so can't verify that your suggested code change fixes the SQL error messages experienced on the demo site (I don't see these errors when running 4.15.2). Can someone volunteer to do this please?

@aingelc12ell
Copy link
Contributor

Based on your reported error, (just my opinion), the SQL syntax could be causing the problem, depending on the DB version you may be using.

For the devs:
From line 547 to 553, the checking of the table can be ignored and proceed to just query the content of the table, the condition on line 554 can be changed to check the existence of the records.

@timschofield
Copy link
Owner

Hi, I have successfully run MRP on my system here.
MRP
The only changes I made were some default dates (I have just committed them), as I am using the strictest level for sql-mode and that prohibits zero dates.
@andrewcouling does your web server log reveal any errors?

Tim

@andrewcouling
Copy link
Collaborator Author

I have grabbed that latest code again.
As before, initially i get the sql warning:

Database Error 1054 : Unknown column 'Tables_in_weberp' in 'where clause'

The script runs after I swap line 547 for the following, as suggested by @aingelc12ell .

$SQL = "SHOW TABLES LIKE 'mrpparameters'";

When running the calculation, the behaviour is exactly the same as before; only one message box.

I'm not getting error logs on the webserver.

@andrewcouling andrewcouling added the Fix being discussed A fix is being discussed (add comment with link to Discussion) label Dec 9, 2024
@timschofield
Copy link
Owner

timschofield commented Dec 10, 2024 via email

@andrewcouling
Copy link
Collaborator Author

would I be right in saying that you are running mariadb?

Yes, I'm running MariaDB version 10.2.29.

The 4.14.1 code continues to perform correctly and as expected on the same web server, but there have been many commits to MRP.php since this release.

@andrewcouling
Copy link
Collaborator Author

@timschofield , I'm now seeing an error log when running MRP calculation, which appears to relate to messages and the fwrite function in footer.php:

erp-sandbox.handloomholdings.com [Wed Dec 11 19:28:57 2024] [error] [client 212.56.99.66:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, null given in /home/sites/3a/2/2b806fa8d9/public_html/erp-sandbox/includes/footer.php:36\nStack trace:\n#0 /home/sites/3a/2/2b806fa8d9/public_html/erp-sandbox/includes/footer.php(36): fwrite(NULL, '2024-12-11 07-1...')\n#1 /home/sites/3a/2/2b806fa8d9/public_html/erp-sandbox/MRP.php(941): include('/home/sites/3a/...')\n#2 {main}\n thrown in /home/sites/3a/2/2b806fa8d9/public_html/erp-sandbox/includes/footer.php on line 36'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix being discussed A fix is being discussed (add comment with link to Discussion)
Projects
None yet
Development

No branches or pull requests

3 participants