Hello everyone and thanks for reading. I have implemented a logic hook to prevent fields being NULL.
Ok you may be confused by this, i will explain. The implimentation of sugar works across multiple databases so to make thisgs simpler I matched the sugar table with a table from another database by use od MySQL Views. It all works very well with all issues ironed out except one.
On the donor database many fields cannot be set to null. The reason is that the donor table is used by many other websites and applications, which will break if these fields are set to null.
I have got round the insert problems when trying to insert null onto the view linking to this table with the following code.
<?php
class ContactNullFields
{
function updateContactFields(&$bean, $event, $arguments)
{
if ($bean->department===NULL);
unset($bean->department);
}
}
?>
This code works brilliantly on insert, but when you try to update the field 'department' the update does not happen.
Any ideas as to why this code is making the update fail as when the data that will be inserted will not be NULL.
Regards
John


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks