webERP Forum
User Settings - Missing Value - SOLVED - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (http://www.weberp.org/forum/forumdisplay.php?fid=8)
+--- Thread: User Settings - Missing Value - SOLVED (/showthread.php?tid=8081)



User Settings - Missing Value - SOLVED - VortecCPI - 02-08-2018

UserSettings.php

Does not show value in displayrecordsmax field in www_users table.

Attached is my crack at a fix...


RE: User Settings - Missing Value - TurboPT - 02-08-2018

Paul, unless there possibly more to this picture, I do not see the same issue without modification?

When I go to user settings, the Display Max had 50 in the field.
I changed that to 55, clicked Modify, and the www_users table reflected 55.
Then changed again to 60, clicked Modify, and the table column reflected 60.

Is there more to know?

It seems that lines 109-111 (in the existing file) is part of the (initial) handling?

=====

UPDATE:

Never mind, I think I found it. Although the value saves to the table, upon RETURN to the user's settings, then the field Display Max field shows 50 again, instead of the table value, as in my example, should have been 60... is this correct?


RE: User Settings - Missing Value - VortecCPI - 02-08-2018

Now go back to the User Settings page and you will see it always shows 50 no matter what is in the table.


RE: User Settings - Missing Value - TurboPT - 02-08-2018

Yes, found it. We must have posted at the same time! (I updated my post #2)


RE: User Settings - Missing Value - TurboPT - 02-08-2018

I believe that the change may be easier than expected.

I made this minor change, and then 60 appears as expected for me:

Change this:
PHP Code:
If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') {
    
$_POST['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax'];


...to this:
PHP Code:
If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') {
    
$_POST['DisplayRecordsMax'] = $_SESSION['DisplayRecordsMax']; // session index change

POST will never be set when first entering the script, and the 'DefaultDisplayRecordsMax' will always be 50 (or whatever that setting might have).

The 'DisplayRecordsMax' is set at UserLogin (lines 123-127), and in the UserSettings file the same field is updated after Modify at line 94.


RE: User Settings - Missing Value - TimSchofield - 02-08-2018

Paul T I remember solving this in my code a while back. Unfortunately I am not at my computer right now but if you look back at that file in my github repository you should see the solution.

Tim


RE: User Settings - Missing Value - VortecCPI - 02-08-2018

Thank you!


RE: User Settings - Missing Value - TurboPT - 02-08-2018

Yes, Tim, I had a look...

What your code has is an improvement of existing handling, but we basically have the same change.

The conditional block that I added to post 5 can be eliminated, and use the $_SESSION['DisplayRecordsMax'] directly to set the 'value' as your code has, instead of populating the POST (in the condition) and then use the POST to set the 'value'.

=====

Paul B., so the post 5 change can be ignored, as that entire condition block will be eliminated, but the new handling is:

Change line 123 from this:
PHP Code:
<td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_POST['DisplayRecordsMax'], '" /></td

...to this: (near the end)
PHP Code:
<td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_SESSION['DisplayRecordsMax'], '" /></td
I'll commit the changes in just a moment.


RE: User Settings - Missing Value - SOLVED - TimSchofield - 02-08-2018

Yes, using DisplayRecordsMax was the fix it applied that reminded me. In fact it came to light because of a post the other Paul made to this forum about the number of displayed records. Thanks for thememory prompt Smile


RE: User Settings - Missing Value - SOLVED - TurboPT - 02-08-2018

Changes committed to SVN.