Problem passing a date to a record using $addLink and an email template

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 27, 2017   (RSS)

By Dave - October 27, 2017

Hi Jerry, 

Passing in field values via the url isn't an official feature, and might trigger "indirect links" warnings (unless you turn that off).  But the reason it's not working is because it's not supported on date fields.  Try this patch: 

In /lib/menus/default/edit_functions.php search for: get date value

And replace this:

// get date value(s)
$dateValue  = @$record[$fieldSchema['name']] ? $record[$fieldSchema['name']] : $defaultDateTime;

With this: 

// get date value(s)
$fieldname = $fieldSchema['name'];
if     (isset($record[$fieldname]))   { $dateValue = $record[$fieldname]; }
elseif (isset($_REQUEST[$fieldname])) { $dateValue = $_REQUEST[ $fieldname ]; }
else                                  { $dateValue = $defaultDateTime; }

Let me know if that works for you and I'll add it to the next release.

Dave Edis - Senior Developer
interactivetools.com

Afternoon Dave,

Thanks for this.

I'm passing the values:

http://mysite.com/cmsAdmin/admin.php?menu=my_table&action=add&event_date=2018-06-16 (and other field parameters)

and your suggestion does work, but it throws the following errors:

Notice: Undefined offset: 1 in /home3/ellescho/public_html/jazzonjstreet/cmsAdmin/lib/menus/default/edit_functions.php on line 351 Notice: Undefined offset: 2 in /home3/ellescho/public_html/jazzonjstreet/cmsAdmin/lib/menus/default/edit_functions.php on line 353 Notice: Undefined offset: 1 in /home3/ellescho/public_html/jazzonjstreet/cmsAdmin/lib/menus/default/edit_functions.php on line 353

and it does throw an 'indirect link' warning as well, but I can live with that one.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - October 27, 2017

Can you try adding @ in front of the list(): 

    @list($date,$time)       = explode(' ', $dateValue); // expecting: YYYY-MM-DD HH:MM:SS
    @list($year,$month,$day) = explode('-', $date);      // expecting: YYYY-MM-DD
    @list($hour24,$min,$sec) = explode(':', $time);      // expecting: HH:MM:SS

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

Indeed that fixes the errors.

You've done it yet again, Dave.

Thanks a bunch,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php