english/administrator/components/com_aicontactsafe/models/default.php
// function to validate fields before writing them to the database
function to validate fields before writing them to the database
function to validate fields before writing them to the database
function checkBeforeWrite($postData) {
		switch(true) {
			case array_key_exists('last_task', $postData) && $postData['last_task'] == 'add':
				$datenow =& JFactory::getDate();
				$postData['date_added'] = $datenow->toMySQL();
				$postData['last_update'] = $datenow->toMySQL();
				break;
			case array_key_exists('last_task', $postData) && $postData['last_task'] == 'edit':
				$datenow =& JFactory::getDate();
				$postData['last_update'] = $datenow->toMySQL();
				break;
		}
		return $postData;
	}
function checkBeforeWrite ( $ postData ) { switch ( true ) { case array_key_exists ( 'last_task' , $ postData ) && $ postData [ 'last_task' ] == 'add' : $ datenow = & JFactory :: getDate ( ) ; $ postData [ 'date_added' ] = $ datenow -> toMySQL ( ) ; $ postData [ 'last_update' ] = $ datenow -> toMySQL ( ) ; break ; case array_key_exists ( 'last_task' , $ postData ) && $ postData [ 'last_task' ] == 'edit' : $ datenow = & JFactory :: getDate ( ) ; $ postData [ 'last_update' ] = $ datenow -> toMySQL ( ) ; break ; } return $ postData ; }
function to validate fields before writing them to the database
function to validate fields before writing them to the database
// modify the fields 'date_added' and 'last_update' if the last task was to add or edit a record