SVN Alba r6176 - in prosistem/alba/trunk/alba/apps/principal/modules/alumno: actions config templates
Author: hsanchez Date: 2009-05-11 18:04:03 -0300 (Mon, 11 May 2009) New Revision: 6176 Added: prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/_legajo.php Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/alumno/config/generator.yml prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php Log: Toma el legajo automatico y actualiza Ticket: #291 Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php 2009-05-11 20:50:49 UTC (rev 6175) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/actions/actions.class.php 2009-05-11 21:04:03 UTC (rev 6176) @@ -89,21 +89,23 @@ } + protected function addSortCriteria ($c) { if ($sort_column = $this->getUser()->getAttribute('sort', 'apellido', 'sf_admin/alumno/sort')) { $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column); if ($this->getUser()->getAttribute('type', 'asc', 'sf_admin/alumno/sort') == 'asc') { $c->addAscendingOrderByColumn($sort_column); - } - else { + } else { $c->addDescendingOrderByColumn($sort_column); } } } + public function executeEdit ($request) { $this->alumno = $this->getAlumnoOrCreate(); + //Datos de la cuenta $datosCuenta = ""; if($this->getRequestParameter("fk_cuenta_id")) { $datosCuenta = CuentaPeer::retrieveByPk($this->getRequestParameter("fk_cuenta_id")); @@ -113,15 +115,28 @@ } $this->datosCuenta = $datosCuenta; + //Prefijo y número de legajo + //@TODO obtener el establecimiento de la session + $estable = EstablecimientoPeer::retrieveByPk(1); + + $this->prefijo = $this->alumno->getLegajoPrefijo(); + $this->nrolegajo = $this->alumno->getLegajoNumero(); + + if ($this->prefijo == "") + $this->prefijo = $estable->getLegajoPrefijo(); + + if ($this->nrolegajo == "") + $this->nrolegajo = $estable->getLegajoSiguiente(); + + //Fecha de nacimiento $today = getdate(); $fecha_nac = $this->alumno->getFechaNacimiento("Y"); - if($fecha_nac!="") + if($fecha_nac != "") $this->edad = $today['year'] - $fecha_nac; else $this->edad = ""; - if ($this->getRequest()->getMethod() == sfRequest::POST) - { + if ($this->getRequest()->getMethod() == sfRequest::POST) { $this->alumno = $this->getAlumnoOrCreate(); $this->updateAlumnoFromRequest(); @@ -132,29 +147,31 @@ list($d, $m, $y) = $this->getContext()->getI18N()->getDateForCulture($fecha_nacimiento, $user_culture); $this->alumno->setFechaNacimiento("$y-$m-$d"); } + $this->saveAlumno($this->alumno); + //Actualizo el nro siguiente. + $nrosiguiente = $this->alumno->getLegajoNumero() +1; + $estable->setLegajoSiguiente($nrosiguiente); + $estable->Save(); + $this->getUser()->setFlash('notice', 'Your modifications have been saved'); - if ($this->getRequestParameter('save_and_add')) - { + if ($this->getRequestParameter('save_and_add')) { return $this->redirect('alumno/create?fk_cuenta_id=' . $this->alumno->getFkCuentaId()); - } - else - { + } else { return $this->redirect('alumno/edit?id='.$this->alumno->getId()); } - } - else - { + } else { // add javascripts $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype'); $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir').'/js/collapse'); - if ($this->getRequestParameter('fk_cuenta_id')) - $this->alumno->setFkCuentaId($this->getRequestParameter('fk_cuenta_id')); - + if ($this->getRequestParameter('fk_cuenta_id')) { + $this->alumno->setFkCuentaId($this->getRequestParameter('fk_cuenta_id')); + } } } + public function executeAddfoto(sfWebRequest $request) { $alumno = AlumnoPeer::retrieveByPk($request->getParameter('id')); Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/config/generator.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/config/generator.yml 2009-05-11 20:50:49 UTC (rev 6175) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/config/generator.yml 2009-05-11 21:04:03 UTC (rev 6176) @@ -35,7 +35,7 @@ list: title: " " - display: [ =apellido, apellido_materno, nombre, nro_documento, sexo, telefono, email, activo ] + display: [ _legajo, =apellido, apellido_materno, nombre, nro_documento, sexo, telefono, email, activo ] filters: [ _nombre_apellido, _division, nro_documento ] object_actions: _edit: - Added: prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/_legajo.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/_legajo.php (rev 0) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/_legajo.php 2009-05-11 21:04:03 UTC (rev 6176) @@ -0,0 +1,3 @@ +<?php + echo $alumno->getLegajoPrefijo() ."/" .$alumno->getLegajoNumero(); +?> Modified: prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php 2009-05-11 20:50:49 UTC (rev 6175) +++ prosistem/alba/trunk/alba/apps/principal/modules/alumno/templates/editSuccess.php 2009-05-11 21:04:03 UTC (rev 6176) @@ -41,25 +41,20 @@ <div class="form-row"> <?php echo label_for('alumno[legajo_prefijo]', __('Legajo:'), 'class="required" ') ?> <div class="content<?php if ($sf_request->hasError('alumno{legajo_prefijo}')|| $sf_request->hasError('alumno{legajo_numero}')): ?> form-error<?php endif; ?>"> + <?php if ($sf_request->hasError('alumno{legajo_prefijo}')): ?> - <?php echo form_error('alumno{legajo_prefijo}', array('class' => 'form-error-msg')) ?> + <?php echo form_error('alumno{legajo_prefijo}', array('class' => 'form-error-msg')) ?> <?php endif; ?> + <?php if ($sf_request->hasError('alumno{legajo_numero}')): ?> <?php echo form_error('alumno{legajo_numero}', array('class' => 'form-error-msg')) ?> <?php endif; ?> - <?php echo object_input_tag($alumno, 'getLegajoPrefijo', array ( - 'size' => 10, - 'control_name' => 'alumno[legajo_prefijo]', - )) ?> - <?php echo object_input_tag($alumno, 'getLegajoNumero', array ( - 'size' => 10, - 'control_name' => 'alumno[legajo_numero]', - )) ?> + <?php echo input_tag('alumno[legajo_prefijo]', (isset($prefijo)?$prefijo:"")) ?> + <?php echo input_tag('alumno[legajo_numero]', (isset($nrolegajo)?$nrolegajo:"")) ?> </div> </div> - <!-- Fin Legajo --> <div class="form-row"> @@ -170,7 +165,7 @@ 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png', 'control_name' => 'alumno[fecha_nacimiento]', )) ?> - Edad: <input type="text" value="<?php echo $edad?>" disabled="true" size="4"> + Edad: <input type="text" value="<?php echo (isset($edad)?$edad:"")?>" disabled="true" size="4"> </div> </div>
participants (1)
-
commits@pressenter.com.ar