darkroast
Member
I have a form which has two plugins. The first one generates a number and updates a field element. It does this by taking the rowid, adding a constant to it, then updates the database field with that number. (I know that's the hard way, but using a calc field wasn't working right for some reason). Here's the PHP code for that:
It's set to fire onBeforeCalculations, and it works perfectly - when the record is saved, the number is generated and saved.
However... the second plugin for that form is an email plugin. It's supposed to send an email which includes that caseNumber field. Problem is, it works some of the time, but not always. Could this be because of the timing of firing those plugins? As I say, the PHP plugin fires onBeforeCalculations; is it possible that the email plugin fires BEFORE that?
In the plugins tab on the form, I have the PHP plugin first, then the email plugin, then two redirect plugins (one for new, one for edit). Does the order make a difference?
Thanks for the help!
PHP:
$object = new stdClass();
$object->id = {rowid};
$object->caseNumber = 1400000 + {rowid};
$result = JFactory::getDbo()->updateObject('hs_cases', $object, 'id');
It's set to fire onBeforeCalculations, and it works perfectly - when the record is saved, the number is generated and saved.
However... the second plugin for that form is an email plugin. It's supposed to send an email which includes that caseNumber field. Problem is, it works some of the time, but not always. Could this be because of the timing of firing those plugins? As I say, the PHP plugin fires onBeforeCalculations; is it possible that the email plugin fires BEFORE that?
In the plugins tab on the form, I have the PHP plugin first, then the email plugin, then two redirect plugins (one for new, one for edit). Does the order make a difference?
Thanks for the help!