[Alba-desarrollo] SVN Alba r4191 - in prosistem/alba/trunk/alba/apps/principal/modules/responsable: actions config templates validate

commits en pressenter.com.ar commits en pressenter.com.ar
Mie Feb 14 21:12:24 CET 2007


Author: ftoledo
Date: 2007-02-14 17:12:17 -0300 (Wed, 14 Feb 2007)
New Revision: 4191

Added:
   prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/_edit_actions.php
   prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php
Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/responsable/config/generator.yml
   prosistem/alba/trunk/alba/apps/principal/modules/responsable/validate/edit.yml
Log:
EL responsable se debe administrar siempre desde la cuenta ticket #114 y no se vuelve a pedir la misma cuando se agrega o modifica

Modified: prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php	2007-02-14 19:40:28 UTC (rev 4190)
+++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/actions/actions.class.php	2007-02-14 20:12:17 UTC (rev 4191)
@@ -35,13 +35,6 @@
         $this->vista = $this->getRequestParameter('vista');
     }
          
-    function executeIrCuenta(){
-        //Obtener el id de cuenta.
-        $c = new Criteria(); 
-        $c->add(ResponsablePeer::ID, $this->getRequestParameter('id')); 
-        $Resp = ResponsablePeer::doSelectOne($c);
-        $this->redirect('cuenta/verCompleta?id='.$Resp->getFkCuentaId()); 
-    }
     protected function addSortCriteria (&$c) { 
         if ($sort_column = $this->getUser()->getAttribute('sort', 'apellido', 'sf_admin/responsable/sort')) {                                                                                                                        
             $sort_column = Propel::getDB($c->getDbName())->quoteIdentifier($sort_column);                                          
@@ -52,5 +45,98 @@
                 $c->addDescendingOrderByColumn($sort_column);                                                                        
         }
     }
-}
-?>
\ No newline at end of file
+    public function executeEdit (){                                                       
+        $this->responsable = $this->getResponsableOrCreate();                                                                    
+
+        if ($this->getRequest()->getMethod() == sfRequest::POST) {                                                                                                                        
+            $this->responsable = $this->getResponsableOrCreate(); 
+            $this->updateResponsableFromRequest();
+            $this->saveResponsable($this->responsable);
+            $this->setFlash('notice', 'Your modifications have been saved');
+            if ($this->getRequestParameter('save_and_add')) {                                                                                                                      
+                //el save_and_add debe volver al crate pero pasando la cuenta actual
+                return $this->redirect('responsable/create?fk_cuenta_id=' . $this->responsable->getFkCuentaId());                                                                        
+            }                                                                                                    
+            else {                                                                                                                      
+                return $this->redirect('responsable/edit?id='.$this->responsable->getId());
+            }
+        }                                                                                                                    
+        else {                                                                                                                        
+            // add javascripts                                                                                                     
+            $this->getResponse()->addJavascript('/sf/js/prototype/prototype');                                                     
+            $this->getResponse()->addJavascript('/sf/js/sf_admin/collapse');   
+            if ($this->getRequestParameter('fk_cuenta_id'))
+                $this->responsable->setFkCuentaId($this->getRequestParameter('fk_cuenta_id'));
+        }
+    }
+     protected function updateResponsableFromRequest()
+  {
+    $responsable = $this->getRequestParameter('responsable');
+
+    if (isset($responsable['apellido']))
+    {
+      $this->responsable->setApellido($responsable['apellido']);
+    }
+    if (isset($responsable['nombre']))
+    {
+      $this->responsable->setNombre($responsable['nombre']);
+    }
+    if (isset($responsable['sexo']))
+    {
+      $this->responsable->setSexo($responsable['sexo']);
+    }
+    if (isset($responsable['fk_tipodocumento_id']))
+    {
+      $this->responsable->setFkTipodocumentoId($responsable['fk_tipodocumento_id']);
+    }
+    if (isset($responsable['nro_documento']))
+    {
+      $this->responsable->setNroDocumento($responsable['nro_documento']);
+    }
+    if (isset($responsable['direccion']))
+    {
+      $this->responsable->setDireccion($responsable['direccion']);
+    }
+    if (isset($responsable['ciudad']))
+    {
+      $this->responsable->setCiudad($responsable['ciudad']);
+    }
+    if (isset($responsable['fk_provincia_id']))
+    {
+      $this->responsable->setFkProvinciaId($responsable['fk_provincia_id']);
+    }
+    if (isset($responsable['codigo_postal']))
+    {
+      $this->responsable->setCodigoPostal($responsable['codigo_postal']);
+    }
+    if (isset($responsable['telefono']))
+    {
+      $this->responsable->setTelefono($responsable['telefono']);
+    }
+    if (isset($responsable['telefono_movil']))
+    {
+      $this->responsable->setTelefonoMovil($responsable['telefono_movil']);
+    }
+    if (isset($responsable['email']))
+    {
+      $this->responsable->setEmail($responsable['email']);
+    }
+    if (isset($responsable['relacion']))
+    {
+      $this->responsable->setRelacion($responsable['relacion']);
+    }
+    if (isset($responsable['observacion']))
+    {
+      $this->responsable->setObservacion($responsable['observacion']);
+    }
+    if (isset($responsable['fk_cuenta_id']))
+    {
+      $this->responsable->setFkCuentaId($responsable['fk_cuenta_id']);
+    }
+        
+    $this->responsable->setAutorizacionRetiro(isset($responsable['autorizacion_retiro']) ? $responsable['autorizacion_retiro'] : 0);
+  }
+
+}  
+
+?>

Modified: prosistem/alba/trunk/alba/apps/principal/modules/responsable/config/generator.yml
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/responsable/config/generator.yml	2007-02-14 19:40:28 UTC (rev 4190)
+++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/config/generator.yml	2007-02-14 20:12:17 UTC (rev 4191)
@@ -19,7 +19,6 @@
             relacion: { name: Relación con los alumnos }
             observacion: { name: Observación, params: size=80}
             autorizacion_retiro: { name: Aut. Retiro }
-            fk_cuenta_id: { name: Cuenta }
       list:
         title: Listado de Responsables
         display: [ cuenta, =apellido, nombre, nro_documento, direccion, ciudad, _provincia, telefono, relacion, autorizacion_retiro ]
@@ -27,10 +26,8 @@
           _edit: -
           _delete: -
           irCuenta:  { name: Ir a Cuenta, action: irCuenta, icon: next.png }
-                   
-        actions:
-          _create: -
-                
+        actions: {}
+        filters: [ apellido ]        
       edit:
         title: Editar Responsable
         fields:
@@ -39,7 +36,7 @@
         display:
                 "Información general":  [apellido, nombre, _sexo, fk_tipodocumento_id, nro_documento]
                 "Donde vive": [direccion, ciudad, fk_provincia_id, codigo_postal ]
-                "Otros":  [ telefono, telefono_movil, email, relacion, observacion,  autorizacion_retiro, fk_cuenta_id]
+                "Otros":  [ telefono, telefono_movil, email, relacion, observacion,  autorizacion_retiro]
         actions:
           _delete: -
           _save: -

Added: prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/_edit_actions.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/_edit_actions.php	2007-02-14 19:40:28 UTC (rev 4190)
+++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/_edit_actions.php	2007-02-14 20:12:17 UTC (rev 4191)
@@ -0,0 +1,20 @@
+<?php
+// auto-generated by sfPropelAdmin
+// date: 2007/02/14 11:18:57
+?>
+<ul class="sf_admin_actions">
+      <li><?php echo submit_tag(__('save'), array (
+  'name' => 'save',
+  'class' => 'sf_admin_action_save',
+)) ?></li>
+    <li><?php echo submit_tag(__('save and add'), array (
+  'name' => 'save_and_add',
+  'class' => 'sf_admin_action_save_and_add',
+)) ?></li>
+    <li><?php echo button_to(__('list'), 'responsable/list?id='.$responsable->getId(), array (
+  'class' => 'sf_admin_action_list',
+)) ?></li>
+    <li><?php echo button_to(__('Ir a Cuenta'), 'cuenta/verCompleta?id='.$responsable->getFkCuentaId(), array (
+  'style' => 'background: #ffc url(next.png) no-repeat 3px 2px',
+)) ?></li>
+</ul>


Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/_edit_actions.php
___________________________________________________________________
Name: svn:keywords
   + Id Date Author Rev URL

Added: prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php	2007-02-14 19:40:28 UTC (rev 4190)
+++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php	2007-02-14 20:12:17 UTC (rev 4191)
@@ -0,0 +1,280 @@
+<?php
+// auto-generated by sfPropelAdmin
+// date: 2007/02/09 13:27:13
+?>
+<?php use_helpers('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
+
+<h1><?php 
+    echo __('Editar Responsable',array());
+    if ($responsable->getCuenta())
+        echo '(' . $responsable->getCuenta()->getNombre() .')' ;
+?></h1>
+
+<div id="sf_admin_header">
+<?php include_partial('responsable/edit_header', array('responsable' => $responsable)) ?>
+</div>
+
+<div id="sf_admin_content">
+
+<?php if ($sf_request->hasErrors()): ?>
+<div class="form-errors">
+<h2><?php echo __('There are some errors that prevent the form to validate') ?></h2>
+<ul>
+<?php foreach ($sf_request->getErrorNames() as $name): ?>
+  <li><?php echo $sf_request->getError($name) ?></li>
+<?php endforeach; ?>
+</ul>
+</div>
+<?php elseif ($sf_flash->has('notice')): ?>
+<div class="save-ok">
+<h2><?php echo __($sf_flash->get('notice')) ?></h2>
+</div>
+<?php endif; ?>
+
+<?php echo form_tag('responsable/edit', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?>
+
+<?php echo object_input_hidden_tag($responsable, 'getId') ?>
+
+<fieldset id="sf_fieldset_informaci_oacute_n_general" class="">
+<h2><?php echo __('Informaci&oacute;n general') ?></h2>
+
+<div class="form-row">
+  <?php echo label_for('responsable[apellido]', __('Apellido:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{apellido}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{apellido}')): ?>
+    <?php echo form_error('responsable{apellido}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getApellido', array (
+  'size' => 64,
+  'control_name' => 'responsable[apellido]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[nombre]', __('Nombre:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{nombre}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{nombre}')): ?>
+    <?php echo form_error('responsable{nombre}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getNombre', array (
+  'size' => 64,
+  'control_name' => 'responsable[nombre]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[sexo]', __('Sexo:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{sexo}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{sexo}')): ?>
+    <?php echo form_error('responsable{sexo}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo include_partial('sexo', array('type' => 'edit', 'responsable' => $responsable)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[fk_tipodocumento_id]', __('Tipo Documento:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{fk_tipodocumento_id}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{fk_tipodocumento_id}')): ?>
+    <?php echo form_error('responsable{fk_tipodocumento_id}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_select_tag($responsable, 'getFkTipodocumentoId', array (
+  'related_class' => 'Tipodocumento',
+  'control_name' => 'responsable[fk_tipodocumento_id]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[nro_documento]', __('Nro. Documento:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{nro_documento}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{nro_documento}')): ?>
+    <?php echo form_error('responsable{nro_documento}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getNroDocumento', array (
+  'size' => 16,
+  'control_name' => 'responsable[nro_documento]',
+)) ?>
+    </div>
+</div>
+
+</fieldset>
+<fieldset id="sf_fieldset_donde_vive" class="">
+<h2><?php echo __('Donde vive') ?></h2>
+
+<div class="form-row">
+  <?php echo label_for('responsable[direccion]', __('Direcci&oacute;n:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{direccion}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{direccion}')): ?>
+    <?php echo form_error('responsable{direccion}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getDireccion', array (
+  'size' => 64,
+  'control_name' => 'responsable[direccion]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[ciudad]', __('Ciudad:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{ciudad}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{ciudad}')): ?>
+    <?php echo form_error('responsable{ciudad}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getCiudad', array (
+  'size' => 64,
+  'control_name' => 'responsable[ciudad]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[fk_provincia_id]', __('Provincia:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{fk_provincia_id}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{fk_provincia_id}')): ?>
+    <?php echo form_error('responsable{fk_provincia_id}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_select_tag($responsable, 'getFkProvinciaId', array (
+  'related_class' => 'Provincia',
+  'control_name' => 'responsable[fk_provincia_id]',
+  'include_custom' => '>>Selecciones una Provincia<<',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[codigo_postal]', __('CP:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{codigo_postal}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{codigo_postal}')): ?>
+    <?php echo form_error('responsable{codigo_postal}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getCodigoPostal', array (
+  'size' => 20,
+  'control_name' => 'responsable[codigo_postal]',
+)) ?>
+    </div>
+</div>
+
+</fieldset>
+<fieldset id="sf_fieldset_otros" class="">
+<h2><?php echo __('Otros') ?></h2>
+
+<div class="form-row">
+  <?php echo label_for('responsable[telefono]', __('Tel&eacute;fono:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{telefono}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{telefono}')): ?>
+    <?php echo form_error('responsable{telefono}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getTelefono', array (
+  'size' => 20,
+  'control_name' => 'responsable[telefono]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[telefono_movil]', __('Tel. Movil:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{telefono_movil}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{telefono_movil}')): ?>
+    <?php echo form_error('responsable{telefono_movil}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getTelefonoMovil', array (
+  'size' => 20,
+  'control_name' => 'responsable[telefono_movil]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[email]', __('Email:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{email}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{email}')): ?>
+    <?php echo form_error('responsable{email}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getEmail', array (
+  'size' => 64,
+  'control_name' => 'responsable[email]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[relacion]', __('Relaci&oacute;n con los alumnos:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{relacion}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{relacion}')): ?>
+    <?php echo form_error('responsable{relacion}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getRelacion', array (
+  'size' => 20,
+  'control_name' => 'responsable[relacion]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[observacion]', __('Observaci&oacute;n:'), '') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{observacion}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{observacion}')): ?>
+    <?php echo form_error('responsable{observacion}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_input_tag($responsable, 'getObservacion', array (
+  'size' => 80,
+  'control_name' => 'responsable[observacion]',
+)) ?>
+    </div>
+</div>
+
+<div class="form-row">
+  <?php echo label_for('responsable[autorizacion_retiro]', __('Aut. Retiro:'), 'class="required" ') ?>
+  <div class="content<?php if ($sf_request->hasError('responsable{autorizacion_retiro}')): ?> form-error<?php endif; ?>">
+  <?php if ($sf_request->hasError('responsable{autorizacion_retiro}')): ?>
+    <?php echo form_error('responsable{autorizacion_retiro}', array('class' => 'form-error-msg')) ?>
+  <?php endif; ?>
+
+  <?php echo object_checkbox_tag($responsable, 'getAutorizacionRetiro', array (
+  'control_name' => 'responsable[autorizacion_retiro]',
+)) ?>
+    </div>
+</div>
+
+    <?php
+        echo object_input_hidden_tag($responsable,'getFkCuentaId',array('control_name' =>'responsable[fk_cuenta_id]'));
+    ?>
+
+</fieldset>
+
+<?php echo include_partial('edit_actions', array('responsable' => $responsable)) ?>
+
+</form>
+
+<ul class="sf_admin_actions">
+      <li class="float-left"><?php if ($responsable->getId()): ?>
+<?php echo button_to(__('delete'), 'responsable/delete?id='.$responsable->getId(), array (
+  'post' => true,
+  'confirm' => __('Are you sure?'),
+  'class' => 'sf_admin_action_delete',
+)) ?><?php endif; ?>
+</li>
+  </ul>
+
+</div>
+
+<div id="sf_admin_footer">
+<?php include_partial('responsable/edit_footer', array('responsable' => $responsable)) ?>
+</div>


Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/responsable/templates/editSuccess.php
___________________________________________________________________
Name: svn:keywords
   + Id Date Author Rev URL

Modified: prosistem/alba/trunk/alba/apps/principal/modules/responsable/validate/edit.yml
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/responsable/validate/edit.yml	2007-02-14 19:40:28 UTC (rev 4190)
+++ prosistem/alba/trunk/alba/apps/principal/modules/responsable/validate/edit.yml	2007-02-14 20:12:17 UTC (rev 4191)
@@ -12,6 +12,8 @@
     - "responsable{telefono_movil}"        
     - "responsable{relacion}"            
     - "responsable{autorizacion_retiro}"            
+    - "responsable{fk_cuenta_id}"            
+    - "responsable{fk_provincia_id}"            
     
 fillin:
     enabled:       on
@@ -65,8 +67,17 @@
     responsable{email}:
         required:     No
         validators: validaEmail, caracteresMaximos128
+
+    responsable{fk_cuenta_id}:
+        required:    Yes
+        required_msg: El identificador de cuenta[fk_cuenta_id] es obligatorio, debe enviarlo para poder crear un responsable
+        validators: validaFkCuentaId
+
+    responsable{fk_provincia_id}:
+        required:    Yes
+        required_msg: El campo provincia es obligatorio
+        validators: validaFkProvinciaId
         
-        
 caracteresMaximos128:
     class:  sfStringValidator
     param:
@@ -113,4 +124,17 @@
     class: sfEmailValidator
     param:
        email_error:   "No ingresaste un email correctamente ( ej: nombre en dominio.com)"
-                    
\ No newline at end of file
+
+validaFkCuentaId:
+    class: sfNumberValidator
+    param:
+        nan_error: Por favor ingrese un identificar v&aacute;lido de cuenta       
+        min: 1
+        min_error: El identificador de cuenta es inv&aacute;lido
+
+validaFkProvinciaId:
+    class: sfNumberValidator
+    param:
+        nan_error: Por favor seleccione una provincia       
+        min: 1
+        min_error: Por favor seleccione una provincia 




Más información sobre la lista de distribución Alba-desarrollo