/** * Hace una copia del albarán. * Genera otro albarán en base al actual. * IMPORTANTE: SE TOMAN LOS PRECIOS ACTUALES DE LOS ARTICULOS * * @return array Template y values */ public function duplicarAction() { if ($this->values['permisos']['permisosModulo']['IN']) { $datos = new AlbaranesCab($this->request['AlbaranesCab']['IDAlbaran']); $idAlbaranNuevo = $datos->duplica(); if ($idAlbaranNuevo) { $this->values['datos'] = new AlbaranesCab($idAlbaranNuevo); } else { $this->values['datos'] = new AlbaranesCab($this->request['AlbaranesCab']['IDAlbaran']); } $this->values['errores'] = $datos->getErrores(); $this->values['alertas'] = $datos->getAlertas(); unset($datos); return array('template' => $this->entity . '/edit.html.twig', 'values' => $this->values); } else { return array('template' => '_global/forbiden.html.twig'); } }