Permalink
Browse files

Added three check before value storing to prevent query error.

  • Loading branch information...
1 parent 27d6303 commit a7e43b213ef5f3d320e45a7d1bf64cade34228ed @gpongelli committed Apr 12, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 administrator/components/com_contact/tables/contact.php
@@ -83,6 +83,25 @@ public function store($updateNulls = false)
$this->created_by = $user->get('id');
}
}
+
+ // Set publish_up to null date if not set
+ if (!$this->publish_up)
+ {
+ $this->publish_up = $this->_db->getNullDate();
+ }
+
+ // Set publish_down to null date if not set
+ if (!$this->publish_down)
+ {
+ $this->publish_down = $this->_db->getNullDate();
+ }
+
+ // Set xreference to empty string if not set
+ if (!$this->xreference)
+ {
+ $this->xreference = '';
+ }
+
// Verify that the alias is unique
$table = JTable::getInstance('Contact', 'ContactTable');
if ($table->load(array('alias'=>$this->alias, 'catid'=>$this->catid)) && ($table->id != $this->id || $this->id==0)) {

0 comments on commit a7e43b2

Please sign in to comment.