time element placeholder returns incorrect format

p38

Active Member
I am trying to create calc elements using time elements.

A time is stored in the database correctly via the time element, ie '10:46:00'

Now when I use a place holder eg: {timesheet___launchtime}, it returns '10,46', so my calcs fail.

I also tried {timesheet___launchtime_raw} but same thing.

Paul
 
was this a JS fix?

I just updated from GIT and problem still there, after ctrlF5, was jjust wondering if a cache problem and FF?

Paul
 
no it was a php fix - the link to the github commit should show you which files were edited, namely plugins/fabrik_element/calc/calc.php
Could you check if your calc.php file has the new method

Code:
 protected function setStoreDatabaseFormat(&$data)
 
yes, the new method is there, but I am still getting a '10,46' in the placeholder value.

Paul.
 
hm can you point me at the page please? There must be something different between your set up and what I'm testing.
 
It's true that I've noticed discrepancy between the value returned by $data and the one returned by a placeholder.
For example, 18:00 is returned as '1800' by $data while it is '18,00' with a placeholder.

I solved this problem using
PHP:
$time = preg_replace( '/,/','', '{tablename___elementname}');

when using placeholders.
 
Weird, I can't replicate this here either. But I've looked at your site and confirmed that you are still seeing the "old" behavior.

Are you absolutely 100% positive you have updated ALL your code to latest github? I just can't see how that would not be fixed if you are running the fix Rob applied.

If you have definitely done that, then I think your only option is to use a workaround like ....

PHP:
$launch_time = '{timesheet___launchtime}';
matches = array();
if (preg_match('/(\d+)\,(\d+)/', $launch_time, $matches)) {
    $launch_time = $matches[1] . ':' . $matches[2] . ':00';
}

... and then assume that your $launch_time will be in xx:yy:00 format.

-- hugh
 
I have updated twice from Git since Rob fixed. Both times the problem still the same with time returned as 13,46

jfquestiaux also encountered this problem, so I doubt it is applicable only to my site.

If you can point me to the file and code where this was fixed, I will check on my side.

I did see the workaround suggested, but would rather look at fixing the problem instead of doing a workaround, as I have a lot of time calcs in my system and I know I will pick up support problems later which I want to alleviate,

thanks

Paul.
 
The issue is that your calcs are using the _raw version, which is still in an array format when the form is submitted. Either use the none raw placeholder or access the $data array and manipulate the array and its values as required.
I altered element id 126 to use the non-raw value - it seems to behave correctly
 
friendly bump, please can someone attend to this.

Paul


I realize you have Pro support, but there is a limit to what we can do. We are helping you support at least 5 different sites, and you account for about 1/3rd of our Pro support load at the moment. We try and fix your issues as fast as we can, but sometimes you may have to live with a workaround for a while, rather than an immediate fix.

I'm hoping Rob's response fixes your issue, although I'd be a little confused if it does, as your OP says you already tried that.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top