• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Conditional email - date plugin

jo-ka

Member
Hello.

I' have a conditional email form plugin, which sends an email everytime one of the form fields is updated with new values. Something like this and is working for all elements except date element.

So, this works:

upload_2019-7-6_1-10-59.png

But if the element is a date element, the email is sent everytime, even though the value is not changed. The mail body then has no value for the date, but the email is sent anyway.

So, for the date plugin, I have this condition:

upload_2019-7-6_1-13-54.png

I've tried with and without _raw for both fields but with no avail.

Also, the value on the database does'nt change at all, as the time value is allways set like 00:00:00.

The element is set for Local Time as the site is only used locally.

upload_2019-7-6_1-17-18.png

What can possibly be wrong?
 
Check with var_dump(...);exit; what you really get.
I think for the date element (and also dbjoins etc) $origData is an array.
 
Yes, it's an array in deed.
So how shall I use it here?

Tried like this, but the result is the same:

PHP:
$origData[0]["fab_juizes___data_exame_medico"];

If I use it like this, nothing happens:

PHP:
$origData[0]->["fab_juizes___data_exame_medico"];
 
$origData[...][0]
But for comparing it must be exactly the same date/time format so maybe you have to do additionally some string handling.

Gesendet von meinem SM-G930F mit Tapatalk
 
So, I've made this change:
PHP:
return '{fab_juizes___data_exame_medico}' != $origData["fab_juizes___data_exame_medico"][0];
but sitll no luck.

Where can I put the
PHP:
var_dump(...);exit;
code, so I can check what's beeing compared?
 
Before the return do
var_dump('{fab_juizes___data_exame_medico}',$origData["fab_juizes___data_exame_medico"][0]);exit;
 
Hmm, I can't replicate this. Also odd that your main form placeholder is empty as well.

Can you just do ...

var_dump($origData);exit;

... and lets see the whole array.

-- hugh
 
OK, I've ended up doing this:
PHP:
//first validade if the form element is empty or null
$aux='{fab_juizes___data_exame_medico_raw}' == "" ? "0000-00-00 00:00:00" : '{fab_juizes___data_exame_medico_raw}';

//then, send the email only if the new value and original value are different
return $aux != $origData["fab_juizes___data_exame_medico"];

Working as wished.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top