SVN Alba r5142 - prosistem/alba/trunk/alba/apps/principal/modules/locacion/actions
Author: hsanchez Date: 2007-09-24 17:06:57 -0300 (Mon, 24 Sep 2007) New Revision: 5142 Modified: prosistem/alba/trunk/alba/apps/principal/modules/locacion/actions/actions.class.php Log: Corrigiendo codigo Modified: prosistem/alba/trunk/alba/apps/principal/modules/locacion/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/locacion/actions/actions.class.php 2007-09-24 19:40:42 UTC (rev 5141) +++ prosistem/alba/trunk/alba/apps/principal/modules/locacion/actions/actions.class.php 2007-09-24 20:06:57 UTC (rev 5142) @@ -1,5 +1,4 @@ <?php - /** * This file is part of Alba. * @@ -37,7 +36,6 @@ public function saveLocacion($locacion) { $id = $locacion->getId(); - new sfUser(); // nasty hack to load propel $con = Propel::getConnection(); try { @@ -46,15 +44,10 @@ if ($locacion->getPrincipal()) { -// $c1 = new Criteria(); -// $c1->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); -// $c1->addJoin(LocacionPeer::ID, RelEstablecimientoLocacionPeer::FK_LOCACION_ID); -// $c2 = new Criteria(); -// $c2->add(LocacionPeer::PRINCIPAL,false); -// BasePeer::doUpdate($c1,$c2,$con); - // Aparentemente propel no soporta aun joins dentro del update - $s = "UPDATE rel_establecimiento_locacion,locacion SET locacion.principal = 0 WHERE locacion.id = rel_establecimiento_locacion.fk_locacion_id AND rel_establecimiento_locacion.fk_establecimiento_id = ".$this->getUser()->getAttribute('fk_establecimiento_id'); + $s = "UPDATE rel_establecimiento_locacion,locacion SET locacion.principal = 0 "; + $s += "WHERE locacion.id = rel_establecimiento_locacion.fk_locacion_id AND "; + $s += "rel_establecimiento_locacion.fk_establecimiento_id = ".$this->getUser()->getAttribute('fk_establecimiento_id'); $stmt = $con->createStatement(); $alumnos = $stmt->executeQuery($s); @@ -67,15 +60,12 @@ $relEstablecimientoLocacion ->setFkLocacionId($locacion->getId()); $relEstablecimientoLocacion ->save(); } - $con->commit(); - } catch (Exception $e) { $con->rollback(); throw $e; } - } protected function deleteLocacion($locacion) { @@ -86,14 +76,11 @@ $relEstablecimientoLocacion = RelEstablecimientoLocacionPeer::doDelete($criteria); } - public function executeVerEstablecimiento() { $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id'); $this->redirect( 'establecimiento?action=editLocacion&id='.$establecimiento_id); } - - public function executeCambiarPais() { $this->pais_id = $this->getRequestParameter('pais_id'); $this->provincia_id = $this->getRequestParameter('provincia_id'); @@ -101,6 +88,5 @@ $c->add(ProvinciaPeer::FK_PAIS_ID, $this->pais_id); $this->provincias = ProvinciaPeer::getEnOrden($c); } - } ?>
participants (1)
-
commits@pressenter.com.ar