[Alba-desarrollo] SVN Alba r5064 - in prosistem/alba/trunk/alba:
apps/principal/modules/horarioescolar/actions config data/sql
lib/model/map lib/model/om
commits en pressenter.com.ar
commits en pressenter.com.ar
Mie Sep 5 20:44:37 CEST 2007
Author: josx
Date: 2007-09-05 15:44:35 -0300 (Wed, 05 Sep 2007)
New Revision: 5064
Modified:
prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php
prosistem/alba/trunk/alba/config/schema.yml
prosistem/alba/trunk/alba/data/sql/lib.model.schema.sql
prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php
prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php
Log:
Se cambio el esquema para soportar horarioescolar sin evento (para que puedan ser cargados si quieren en partes) y ademas el codigo necesario para evitar cargar el evento
Modified: prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php 2007-09-05 17:41:37 UTC (rev 5063)
+++ prosistem/alba/trunk/alba/apps/principal/modules/horarioescolar/actions/actions.class.php 2007-09-05 18:44:35 UTC (rev 5064)
@@ -40,10 +40,15 @@
$this->horarioescolar = $this->getHorarioescolarOrCreate();
$this->evento = $evento_generico->getEventoOrCreate($this->horarioescolar->getFkEventoId());
if ($this->getRequest()->getMethod() == sfRequest::POST) {
- $this->evento = $evento_generico->updateEventoFromRequest($this->evento, $this->getRequestParameter('evento'), $this->getUser()->getCulture());
- $this->evento->save();
- $this->forward404Unless($this->evento);
- $this->updateHorarioescolarFromRequest($this->evento->getId());
+ $evento = $this->getRequestParameter('evento');
+ if($evento['fecha_inicio'] AND $evento['fecha_fin']) {
+ $this->evento = $evento_generico->updateEventoFromRequest($this->evento, $this->getRequestParameter('evento'), $this->getUser()->getCulture());
+ $this->evento->save();
+ $this->forward404Unless($this->evento);
+ $this->updateHorarioescolarFromRequest($this->evento->getId());
+ } else {
+ $this->updateHorarioescolarFromRequest($this->evento->getId());
+ }
$this->saveHorarioescolar($this->horarioescolar);
$this->setFlash('notice', 'Your modifications have been saved');
if ($this->getRequestParameter('save_and_add')) {
@@ -59,7 +64,7 @@
}
-
+
protected function updateHorarioescolarFromRequest($fk_evento_id = '') {
$horarioescolar = $this->getRequestParameter('horarioescolar');
@@ -162,10 +167,6 @@
$this->labels = $this->getLabels();
return sfView::SUCCESS;
}
-
-
-
-
-
+
}
?>
Modified: prosistem/alba/trunk/alba/config/schema.yml
===================================================================
--- prosistem/alba/trunk/alba/config/schema.yml 2007-09-05 17:41:37 UTC (rev 5063)
+++ prosistem/alba/trunk/alba/config/schema.yml 2007-09-05 18:44:35 UTC (rev 5064)
@@ -1660,8 +1660,7 @@
required: false
fk_evento_id:
type: INTEGER
- required: true
- default: 0
+ required: false
foreignTable: evento
foreignReference: id
onDelete: cascade
Modified: prosistem/alba/trunk/alba/data/sql/lib.model.schema.sql
===================================================================
--- prosistem/alba/trunk/alba/data/sql/lib.model.schema.sql 2007-09-05 17:41:37 UTC (rev 5063)
+++ prosistem/alba/trunk/alba/data/sql/lib.model.schema.sql 2007-09-05 18:44:35 UTC (rev 5064)
@@ -1293,7 +1293,7 @@
`id` INTEGER(11) NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(128) NOT NULL,
`descripcion` VARCHAR(255),
- `fk_evento_id` INTEGER default 0 NOT NULL,
+ `fk_evento_id` INTEGER,
`fk_establecimiento_id` INTEGER default 0 NOT NULL,
`fk_turno_id` INTEGER default 0 NOT NULL,
`fk_horarioescolartipo_id` INTEGER default 0 NOT NULL,
Modified: prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php 2007-09-05 17:41:37 UTC (rev 5063)
+++ prosistem/alba/trunk/alba/lib/model/map/HorarioescolarMapBuilder.php 2007-09-05 18:44:35 UTC (rev 5064)
@@ -38,7 +38,7 @@
$tMap->addColumn('DESCRIPCION', 'Descripcion', 'string', CreoleTypes::VARCHAR, false, 255);
- $tMap->addForeignKey('FK_EVENTO_ID', 'FkEventoId', 'int', CreoleTypes::INTEGER, 'evento', 'ID', true, null);
+ $tMap->addForeignKey('FK_EVENTO_ID', 'FkEventoId', 'int', CreoleTypes::INTEGER, 'evento', 'ID', false, null);
$tMap->addForeignKey('FK_ESTABLECIMIENTO_ID', 'FkEstablecimientoId', 'int', CreoleTypes::INTEGER, 'establecimiento', 'ID', true, null);
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php 2007-09-05 17:41:37 UTC (rev 5063)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseHorarioescolar.php 2007-09-05 18:44:35 UTC (rev 5064)
@@ -21,7 +21,7 @@
- protected $fk_evento_id = 0;
+ protected $fk_evento_id;
@@ -152,7 +152,7 @@
$v = (int) $v;
}
- if ($this->fk_evento_id !== $v || $v === 0) {
+ if ($this->fk_evento_id !== $v) {
$this->fk_evento_id = $v;
$this->modifiedColumns[] = HorarioescolarPeer::FK_EVENTO_ID;
}
@@ -596,7 +596,7 @@
if ($v === null) {
- $this->setFkEventoId('0');
+ $this->setFkEventoId(NULL);
} else {
$this->setFkEventoId($v->getId());
}
Más información sobre la lista de distribución Alba-desarrollo