public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST')) {
             $id = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::ID, true));
             $fecha = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::FECHA, true));
             $empleado = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true));
             salidaBodegaTableClass::validateUpdate($fecha, $empleado);
             $ids = array(salidaBodegaTableClass::ID => $id);
             $data = array(salidaBodegaTableClass::FECHA => $fecha, salidaBodegaTableClass::EMPLEADO => $empleado);
             salidaBodegaTableClass::update($ids, $data);
             session::getInstance()->setSuccess(i18n::__('succesUpdateS', null, 'bodega'));
             log::register('update', salidaBodegaTableClass::getNameTable());
             routing::getInstance()->redirect('bodega', 'indexSalida');
         } else {
             log::register(i18n::__('update'), salidaBodegaTableClass::getNameTable(), i18n::__('errorUpdateBitacora'));
             session::getInstance()->setError(i18n::__('errorUpdate'));
             routing::getInstance()->redirect('bodega', 'indexSalida');
         }
         //close if
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public static function validateUpdate($fecha, $empleado)
 {
     $flag = false;
     $dateNow = date("Y-m-d", strtotime("now"));
     if (empty($fecha) or !isset($fecha) or $fecha == '') {
         session::getInstance()->setError(i18n::__(10055, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::FECHA, true), true);
     }
     if ($fecha > $dateNow) {
         session::getInstance()->setError(i18n::__(10010, null, 'errors', array('%fecha%' => $fecha)));
         $flag = true;
         session::getInstance()->setFlash(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::FECHA, true), true);
     }
     if (empty($empleado) or !isset($empleado) or $empleado == '') {
         session::getInstance()->setError(i18n::__(10099, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true), true);
     }
     if (!is_numeric($empleado)) {
         session::getInstance()->setError(i18n::__(10100, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true), true);
     }
     if ($empleado < 0) {
         session::getInstance()->setError(i18n::__(10101, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('bodega', 'updateSalida');
     }
 }
 public function execute()
 {
     try {
         $fecha = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::FECHA, true));
         $empleado = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true));
         salidaBodegaTableClass::validateCreate($fecha, $empleado);
         $data = array(salidaBodegaTableClass::EMPLEADO => $empleado, salidaBodegaTableClass::FECHA => $fecha, salidaBodegaTableClass::ESTADO => true);
         salidaBodegaTableClass::insert($data);
         session::getInstance()->setSuccess(i18n::__('succesCreate1', null, 'bodega'));
         log::register(i18n::__('create'), salidaBodegaTableClass::getNameTable());
         routing::getInstance()->redirect('bodega', 'indexSalida');
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) {
             $id = request::getInstance()->getPost(salidaBodegaTableClass::getNameField(salidaBodegaTableClass::ID, true));
             $ids = array(salidaBodegaTableClass::ID => $id);
             $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa');
             salidaBodegaTableClass::stateToToggle($ids);
             session::getInstance()->setSuccess(i18n::__('succesDelete1', null, 'bodega'));
             //                log::register(i18n::__('delete'), detalleVacunacionTableClass::getNameTable());
             $this->defineView('delete', 'salidaBodega', session::getInstance()->getFormatOutput());
         } else {
             routing::getInstance()->redirect('bodega', 'indexEntrada');
         }
         //close if
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
                                <a href="#close" title="Close" class="close">X</a>
                                <div class="modal-body">
                                    <?php 
    echo i18n::__('confirmInhabil');
    ?>
                                </div>
                                <div class="modal-footer">
                                    <a href="#close2" title="Close" class="close2 btn btn-default fa fa-times-circle-o close2"> <?php 
    echo i18n::__('cancel');
    ?>
</a>
                                    <button type="button" class="btn btn-primary fa fa-ban" onclick="eliminar(<?php 
    echo $key->{$id};
    ?>
, '<?php 
    echo salidaBodegaTableClass::getNameField(salidaBodegaTableClass::ID, true);
    ?>
', '<?php 
    echo routing::getInstance()->getUrlWeb('bodega', 'deleteSalida');
    ?>
')"> <?php 
    echo i18n::__('inhabil');
    ?>
</button>
                                </div>
                            </div>
                        </div>

                        <!-- WINDOWS MODAL DETAILS -->
                        <div id="myModalInserDetails<?php 
    echo $key->{$id};
Exemplo n.º 6
0
echo salidaBodegaTableClass::getNameField(salidaBodegaTableClass::FECHA, true);
?>
">
              </th>   

            </tr>
            <tr>
              <th>  
                <?php 
echo i18n::__('empleado', NULL, 'empleado');
?>
:
              </th>
              <th> 
                <select name="<?php 
echo salidaBodegaTableClass::getNameField(salidaBodegaTableClass::EMPLEADO, true);
?>
">
                  <option value="">...</option>
                  <?php 
foreach ($objEmpleado as $key) {
    ?>
                    <option value="<?php 
    echo $key->{$id};
    ?>
"> <?php 
    echo $key->{$nombreEmpleado};
    ?>
</option>
                  <?php 
}