buenas gracias por todas las ayudas q me han dado y bueno siguen surgiendo dudas y problemas, que por mis excasos 1 mes con yii me cuesta muchisimo pero poco a poco espero aprender mas.
Tengo el sigueinte codigo
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Ajuste;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Ajuste']))
{
/*Retorno todos los valores*/
$model->attributes=$_POST['Ajuste'];
/*Cambio el cobrador por AJUSTE*/
$model->cobrador="AJUSTE";
/*Determino el tipo de ajuste*/
$tipoajuste=$_POST['Ajuste']['recibo'];
/*Obtengo el modular via string no es la mejor manera pero bueno*/
$modular=$tipoajuste{1};
/*modifico el monto dependiendo el modular*/
$model->monto=$modular.$_POST['Ajuste']['monto'];
switch ($tipoajuste) {
case "(+) RETIRADA TOTAL":
case "(+) INCOBRABLE":
#echo "BORRO";
Mervendida::model()->deleteAll("cuenta = ".$_POST['Ajuste']['cuenta']);
break;
}
if($model->save()) {
#echo "RESULTO: ".$modular.$_POST['Ajuste']['monto'];
$this->redirect(array('admin'));
}
}
$this->render('create',array(
'model'=>$model,
));
}
El problema esta es que no se porque me esta haciendo doble post me crea dos registros y no uno en la tabla.
gracias y espero que alguien me pueda dar una mano