Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues With Lists Using foreach($Result as $MyRow)
04-07-2017, 01:46 AM, (This post was last modified: 04-07-2017, 02:46 AM by VortecCPI.)
#1
Issues With Lists Using foreach($Result as $MyRow)
I thought this may be helpful to others who may have encountered issues with a few pages that show empty lists in 4.13.1.

I had to replace "foreach($Result as $MyRow)" with "while ($MyRow = DB_fetch_array($Result))" in the following files:

+ GLAccounts.php
+ GLCashFlowsIndirect.php
+ GLCashFlowsSetup.php
+ WWW_Users.php

For reference I am using the following:

+ ClearOS Community 6.8.0
+ webERP 4.13.1
+ MySQL 5.1.73
+ PHP 5.3.3

Outstanding work, by the way!
Reply
04-07-2017, 01:59 AM, (This post was last modified: 04-07-2017, 02:05 AM by dalescott.)
#2
RE: Issues With Lists Using foreach($Result as $MyRow)
I'm just a user, what were the symptoms? SQL errors rendered in WebERP? What did you do that resulted in the symptoms? I grabbed a screenshot with SQL errors recently when working through the contracts process, but I haven't had a chance to revisit.

Also, and I don't mean any disrespect, but why not include a patch? Was it the project's fault for not explaining how? Waiting to see if someone asks for a patch? Just curious...
And really, I am not trying to call anyone out, I'm just curious because community feedback is how a project gets better. Also, if anyone PMs me I'll post an anonymized group summary.
Forgot PM is disabled. dale@dalescott.net
http://www.dalescott.net
Reply
04-07-2017, 02:11 AM, (This post was last modified: 04-07-2017, 03:22 AM by VortecCPI.)
#3
RE: Issues With Lists Using foreach($Result as $MyRow)
The symptom is an empty list found in the pages listed above; no SQL errors.

Before:    

After:    
Reply
04-07-2017, 04:02 AM,
#4
RE: Issues With Lists Using foreach($Result as $MyRow)
The entry in WWW_Users.php has already been changed in SVN, after the release of 4.13.1.
Reply
04-07-2017, 04:39 AM,
#5
RE: Issues With Lists Using foreach($Result as $MyRow)
(04-07-2017, 04:02 AM)TurboPT Wrote: The entry in WWW_Users.php has already been changed in SVN, after the release of 4.13.1.

Ah... Thank you!
Reply
04-07-2017, 07:26 AM,
#6
RE: Issues With Lists Using foreach($Result as $MyRow)
In the two cash flows scripts there are also places where you need reset the result set to the first record using the DB_data_seek() function, as the same result set gets reused, but the while loop just takes off where the previous one left off.

Tim
Reply
04-07-2017, 07:53 AM,
#7
RE: Issues With Lists Using foreach($Result as $MyRow)
(04-07-2017, 07:26 AM)falkoner Wrote: In the two cash flows scripts there are also places where you need reset the result set to the first record using the DB_data_seek() function, as the same result set gets reused, but the while loop just takes off where the previous one left off.

Tim

Thank you Tim!
Reply
04-07-2017, 11:07 PM, (This post was last modified: 04-07-2017, 11:29 PM by falkoner.)
#8
RE: Issues With Lists Using foreach($Result as $MyRow)
I would suggest you create a patch for this change and submit it to submissions@weberp.org

I should say this patch should be against the latest SVN code from Sourceforge.

Tim
Reply
04-08-2017, 02:36 AM,
#9
RE: Issues With Lists Using foreach($Result as $MyRow)
(04-07-2017, 11:07 PM)falkoner Wrote: I would suggest you create a patch for this change and submit it to submissions@weberp.org

I should say this patch should be against the latest SVN code from Sourceforge.

Tim

While I have no issue with work related to doing this I think it is best left to the experts. Any changes should be adequately tested and verified for proper operation and I am not qualified for such work. While I am familiar with PHP and have been developing applications since 1983 I am NOT intimately familiar with webERP.

I would rather a qualified contributor/developer manage any changes to a released version of webERP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)