Date index for Jan 2004


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: email notifierfor new/finished projects



Hello list!
Hi Ivo!

Thank you for your reply! I adapted the code as follows:

function postUpdate($rec)
{
  $oldRecord = $rec["atkorgrec"];
  $newRecord = $rec;

  $customerAttr = $this->m_attribList["customer"];
  $newCustomer = $customerAttr->value2db($newRecord);
  $oldCustomer = $customerAttr->value2db($oldRecord);

  if ($newCustomer!=$oldCustomer){
    // do something
  }
}

Unfortunately, it does only work for all fields!

For example: If I edit a project which has 'none'-values for 'customer',
'contact' and 'coordinator' and save it without change, 'customer' and
'contact' are indicated as 'changed' whereas 'coordinator' is not.

I am not sure, whether it makes a difference or not, but 'customer' and
'contact' are Integer values, 'coordinator' is a String. 'customer' and
'coordinator' may be 'Null', 'contact' has to have a value.

Is there a different approach to solve this problem?

Thank you for your help!
Regards,
Nele.

---
>> There is another way of checking if a value is empty, and for
>> 'equalling' those values.
>>
>> Example:
>>
>> function postUpdate($rec)
>> {
>>   $old = $rec["atkorgrec"];
>>   $new = $rec;
>>
>>   $coordinatorAttrib = $this->m_attribList["coordinator"];
>>
>>   if ($coordinatorAttrib->isEmpty($old))
>>   {
>>     // This will work for all 0, NULL, "" or invalid entries.
>>   }
>>
>>   $rawvalue    = $coordinatorAttrib->value2db($new);
>>   $oldrawvalue = $coordinatorAttrib->value2db($old);
>>   if ($rawvalue!=$oldrawvalue)
>>   {
>>     // value2db converts internal values to db compatible values. In
>>     // both cases, the same value should arise from that. Depending
>>     // on which version of ATK you are using, it's either 0 or NULL
>>     // , but equal in both cases.
>>
>>   }
>>
>> }

>> By the way, mails you send contain  ^^^^ ^^^^ weird chars.
It looks awful! Thanks for the hint. I changed the mailclient.


http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV