public function create()
 {
     $id = parent::create();
     if ($id > 0) {
         $this->crearTarifas();
     }
     return $id;
 }
示例#2
0
 /**
  * Pongo el precio medio de compra igual al precio de costo y
  * Aplico las reglas de ordenacion si está vigente
  * 
  * @return integer El id del ultimo articulo creado
  */
 public function create()
 {
     $this->Pmc = $this->Pvd;
     if (trim($this->CodigoEAN == '')) {
         $this->CodigoEAN = $this->Codigo;
     }
     if (trim($this->Subtitulo == '')) {
         $this->Subtitulo = $this->Descripcion;
     }
     if (trim($this->Resumen == '')) {
         $this->Resumen = $this->Descripcion;
     }
     if (trim($this->Etiqueta == '')) {
         $this->Etiqueta = substr($this->Descripcion, 0, 29);
     }
     $id = parent::create();
     if ($id and $this->Vigente == '1') {
         $reglas = new Escaparates();
         $reglas->aplicaReglasArticulo($id);
         unset($reglas);
     }
     return $id;
 }