[solved (partly!)] Formbrower 0.2.3 Admin Approval

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

[solved (partly!)] Formbrower 0.2.3 Admin Approval

Post by psy »

Hi

Would really like some help with FormBrowser.

At first, when I tried to approve a form response from the FormBrowser admin panel nothing happened.  The page simply refreshed without any error messages or changes to the page content.

A bit of investigation led me to change action.admin_approve_resp.php line 14 change from:

Code: Select all

if (isset($params['apr']) && isset($params['response_id']))

to
   

Code: Select all

if (isset($params['fbrp_apr']) && isset($params['response_id']))
   

The browser now correctly updated the database and displayed "Updated" on the page but the browser list remained unchanged, ie still a red "x" and 'Approve this' next to each form response and the Date Submitted column was blank.

I had left the FormBrowser date_format field blank assuming it would default to something logical.  However, when I tried to enter the php date string (in this case 'j M Y'), an error occurred, ie:

Code: Select all

Notice: Undefined index: date_format in C:\xxxxxxxxx\modules\FormBrowser\action.admin_store_config.php on line 12
action.admin_store_config.php refers to DoAction defaultadmin, which in turns calls:

Code: Select all

        $this->smarty->assign('input_date_format',$this->CreateInputText($id, 'fbrp_date_format', $this->GetPreference('date_format','d F y'), 20, 255));
Does this mean that in the absence of a user preference, the default field content should be 'd F Y'?  If so, it's not happening - the field is blank.

I could not find the methods GetPreference or SetPreference anywhere.  I also could not find anywhere in the database to store the date_format.

I'm not even sure that these issues, ie date_format and admin approval/date submitted not displaying correctly are related - just giving some feedback in the hope that you will please help me to fix.


Thanks
psy


CMSMS 1.3.1 Havanna
FormBrowser 0.2.3
FormBuilder 0.5.3
moorezilla

Re: [solved (partly!)] Formbrower 0.2.3 Admin Approval

Post by moorezilla »

I've run into a partially similar thing in that I changed the default d F y date format in the configuration tab of formbuilder, and now the date column is blank, even if I put the default back.

I even uninstalled and removed formbrowser and put it back and the date column is still blank.

Any ideas on this one?
bryan

Re: [solved (partly!)] Formbrower 0.2.3 Admin Approval

Post by bryan »

Thanks for the info. Per your suggestion I changed action.admin_approve_resp.php line 14 from:

Code: Select all

if (isset($params['apr']) && isset($params['response_id']))
to

Code: Select all

if (isset($params['fbrp_apr']) && isset($params['response_id']))
I encountered the same problem with the date format breaking in the form. I was able to work around this issue by going into the database table cms_siteprefs and adding my date format string 'd F y' to the FormBrowser_mapi_pref_date_format field.
Worked like a charm.

CMS Made Simple 1.5.1 "San Juan"
FormBrowser 0.2.3
FormBuilder 0.5.5
RytoEX
Forum Members
Forum Members
Posts: 29
Joined: Thu Jan 07, 2010 10:32 am

Re: [solved (partly!)] Formbrower 0.2.3 Admin Approval

Post by RytoEX »

I've been clearing out Form Builder and Form Browser bugs, and I came across these (Bug #2250 and Bug #2427). I did some reading on the bugs, saw the comment on both that it was fixed, checked the SVN log, agreed that they were fixed, and then marked them Fixed and closed them.

Then, for some reason, I went to go test Admin Approval. I then changed the Date Format, and boom, suddenly nothing was approved. Yet, when I checked the database, the approval dates were clearly there. Clicking on the approval links changed nothing. I recalled in the back of my mind that there was a report or a thread about this very issue, so I searched, and dug this back up.

Then, I started digging through the code again. action.admin_approve_resp.php calls the Browser.class.php function BrowserShowList, which does a lot of stuff, and then does this check:

Code: Select all

if (! empty($vals[$i]->admin_approved) && $vals[$i]->admin_approved > 0)
{ // The response is approved, so show the approved status, and give a link allowing us to unapprove the response.
}
else
{ // The response is not approved, so show the unapproved status, and give a link allowing us to approve the response.
}
The problem is that "$vals[$i]->admin_approved > 0" part. When you have a string compared to a number, the string gets cast to a number. In this case, something like "15 January 11" (the default "d F y" Date Format) becomes the integer 15 because the string starts with "15" and then it stops the conversion at the first non-numeric character. Now, if you change your Date Format to something like "F d Y" to produce "January 15 2011", now when it's converted to a number for the "$vals[$i]->admin_approved > 0" comparison it becomes "0" because it does not start with a numeric character, so you have "0 > 0", which is FALSE. The IF statement fails, and it moves down to the ELSE block, indicating that the response is not approved, even if it is.




TL;DR: This issue has been fixed, and the next release (Form Browser 0.4) will not have this problem. Sorry about the wait. Enjoy!
Post Reply

Return to “Modules/Add-Ons”