Date index for Jan 2004
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [achievo] Re:[achievo] email notifier for new/finished projects
Hello Sebastian!
> One way would be to insert your code into the postUpate() and postAdd() methods from class.project.inc. Or, if you want to be notified more often (e.g. whenever new time registration is added), you can do the same into class.hours.inc. You don't need to put all your code in there, just a call to a relevant function from your custom "notifier" module.
Thanks a lot for your immediate answer! I implemented my email notifier as postUpdate() function.
I activated "NF_TRACK_CHANGES" for node "project" in order to analyze, which data fields have actually changed. I compare field values and check for equality.
The problem is: My aproach fails for fields with value "none". They are represented differently in the record that is passed on to postUpdate($record), even if I leave these fields unchanged.
For example
$record["contact"]["id"]
=> string(1) "0"
represents "none"
$record["atkorgrec"]["contact"]["id"]
=> string(0) ""
represents "none"
$record["contact"]["id"]!=$record["atkorgrec"]["contact"]["id"]
=> returns true, since the strings are not equal
Can you explain why Achievo uses different strings to represent the same state?
How can I overcome this problem? I thought about using the following (not PHP syntax yet):
if (a!=b) && !( ( (a=="0")&&(b=="") )
|| ( (a=="")&&(b=="0") ) ){
// do something
// I do not want unchanged fields to be mailed
}
a represents $record["contact"]["id"]
b represents $record["atkorgrec"]["contact"]["id"]
Thank you for your help!
Regards,
Nele.