public function submit_disable_ot() { // If there was an error, respond with 404 status if (!Request::ajax() || !Auth::check()) { return Response::json(array('success' => false), 200); } $data["user"] = Session::get('user'); if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) { $data["inside_url"] = Config::get('app.inside_url'); $ot_busqueda = OrdenesTrabajoBusquedaInformacion::find(Input::get('idot_busqueda_info')); $ot_busqueda->idestado_ot = 25; $ot_busqueda->save(); $message = "Se ha cancelado la OTM."; $type_message = "bg-success"; return Response::json(array('success' => true, 'url' => $data["inside_url"], 'message' => $message, 'type_message' => $type_message), 200); } else { return Response::json(array('success' => false), 200); } }
public function submit_ot() { if (!Request::ajax() || !Auth::check()) { return Response::json(array('success' => false), 200); } $id = Auth::id(); $data["inside_url"] = Config::get('app.inside_url'); $data["user"] = Session::get('user'); if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) { // Check if the current user is the "System Admin" $idsot = Input::get('idsot'); $sot = SolicitudBusquedaInformacion::find($idsot); $idsolicitante = Input::get('idsolicitante'); $fecha_programacion = $sot->fecha_solicitud; $sot->idestado = 15; $sot->save(); $ot = new OrdenesTrabajoBusquedaInformacion(); $abreviatura = "BI"; // Algoritmo para añadir numeros correlativos $string = $this->getCorrelativeReportNumberOt(); $ot->fecha_programacion = $fecha_programacion; $ot->idarea = $sot->idarea; $ot->idestado_ot = 9; $ot->ot_tipo_abreviatura = $abreviatura; $ot->ot_correlativo = $string; $ot->id_usuarioelaborador = $data["user"]->id; //el solicitante de la ot es el encargado de la sot $ot->id_usuariosolicitante = $sot->id; $ot->id_usuarioencargado = $sot->id_usuarioencargado; $ot->idsolicitud_busqueda_info = $idsot; $ot->save(); return Response::json(array('success' => true), 200); } else { return Response::json(array('success' => false), 200); } }