Commits

christiansalazar committed a54b769

EYuiFormDb update command now return true allowing updates.

Comments (0)

Files changed (2)

 			// all fields pass validation, now massive saving for each field:
 			// notify begintrans
 			$transaction_handler = $this->model->eyuiform_transaction('begin');
+			
 			foreach($post as $fieldentry){
+				Yii::log(__METHOD__."\nsaving field:\n".$fieldentry['id'],"info");
 				if(($field = $this->findFieldByName(trim($fieldentry['id']))) != null){
 				$field->setValue(trim($fieldentry['val']));
 				if(!$this->model->eyuiform_saveFieldValue(
 					$this->id,$field->id,$field->getName(),$field->getValue())){
 						// abort saving
+						Yii::log(__METHOD__."\nsaving field ABORT.\n","info");
 						$this->model->eyuiform_transaction('rollback',$transaction_handler);
 						return array(
 							'result'=>false,
 						break;
 					}
 			}}
+			Yii::log(__METHOD__."\nsaving field end.\n","info");
 			// notify commit
 			$this->model->eyuiform_transaction('commit',$transaction_handler);
 			return array(
 			->where($whereCondition,$params)->queryRow();
 		if($row!==false){
 			// it exists, so update it.
-			return $this->getDb()->createCommand()
+			Yii::log(__METHOD__."\nupdating field: {$fullFieldName}","info");
+			$ok = $this->getDb()->createCommand()
 				->update($this->getTablename(), array('field_value'=>CHtml::encode($fieldValue)), 
 				$whereCondition, $params);
+			Yii::log(__METHOD__."\nupdate field result: {$ok}","info");
+			return true;
 		}
 		else{
 			// it doesnt exists, so insert it.
+			Yii::log(__METHOD__."\ninsert field: {$fullFieldName}","info");
 			return $this->getDb()->createCommand()
 				->insert($this->getTablename(), array(
 					'model_id'=>$this->_instanceid,