예제 #1
0
 protected function private_core()
 {
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     $this->fabricante = FALSE;
     if (isset($_REQUEST['cod'])) {
         $fab = new fabricante();
         $this->fabricante = $fab->get($_REQUEST['cod']);
     }
     if ($this->fabricante) {
         $this->page->title = $this->fabricante->codfabricante;
         if (isset($_POST['cod'])) {
             $this->fabricante->nombre = $_POST['nombre'];
             if ($this->fabricante->save()) {
                 $this->new_message("Datos modificados correctamente");
             } else {
                 $this->new_error_msg("Imposible modificar los datos.");
             }
         }
         $this->offset = 0;
         if (isset($_GET['offset'])) {
             $this->offset = intval($_GET['offset']);
         }
         $this->articulos = $this->fabricante->get_articulos($this->offset);
     } else {
         $this->new_error_msg("Fabricante no encontrado.");
     }
 }
예제 #2
0
 protected function private_core()
 {
     $this->share_extensions();
     $this->fabricante = new fabricante();
     if (isset($_POST['ncodfabricante'])) {
         $fab = $this->fabricante->get($_POST['ncodfabricante']);
         if ($fab) {
             $this->new_error_msg('El fabricante <a href="' . $fab->url() . '">' . $fab->codfabricante . '</a> ya existe.');
         } else {
             $fab = new fabricante();
             $fab->codfabricante = $_POST['ncodfabricante'];
             $fab->nombre = $_POST['nnombre'];
             if ($fab->save()) {
                 Header('location: ' . $fab->url());
             } else {
                 $this->new_error_msg("¡Imposible guardar el fabricante!");
             }
         }
     } else {
         if (isset($_GET['delete'])) {
             $fab = $this->fabricante->get($_GET['delete']);
             if ($fab) {
                 if ($fab->delete()) {
                     $this->new_message("Fabricante " . $_GET['delete'] . " eliminado correctamente");
                 } else {
                     $this->new_error_msg("¡Imposible eliminar el fabricante " . $_GET['delete'] . "!");
                 }
             } else {
                 $this->new_error_msg("Fabricante " . $_GET['delete'] . " no encontrado.");
             }
         }
     }
     $this->resultados = $this->fabricante->search($this->query);
 }
예제 #3
0
 /**
  * Devuelve el fabricante del artículo.
  * @return fabricante
  */
 public function get_fabricante()
 {
     $fab = new fabricante();
     return $fab->get($this->codfabricante);
 }
예제 #4
0
 /**
  * Devuelve el fabricante del artículo.
  * @return fabricante
  */
 public function get_fabricante()
 {
     if (is_null($this->codfabricante)) {
         return FALSE;
     } else {
         $fab = new \fabricante();
         return $fab->get($this->codfabricante);
     }
 }