예제 #1
0
 protected function private_core()
 {
     $op = new autoventas_opcionesdb();
     $this->opciones = new autoventas_opcionesdb($op->load());
     if (isset($_GET["action"])) {
         switch ($_GET["action"]) {
             case 1:
                 // modificar
                 $this->opciones->url = $this->db->escape_string($_GET["url"]);
                 $this->opciones->activo = isset($_GET["activo"]) ? 1 : 0;
                 $this->opciones->cron = isset($_GET["cron"]) ? 1 : 0;
                 $this->opciones->tiempocron = (int) $_GET["tiempocron"];
                 $this->opciones->ftp_url = $this->db->escape_string($_GET["ftp_url"]);
                 $this->opciones->ftp_user = $this->db->escape_string($_GET["ftp_user"]);
                 $this->opciones->ftp_pass = $this->db->escape_string($_GET["ftp_pass"]);
                 $this->opciones->ftp_dir = $this->db->escape_string($_GET["ftp_dir"]);
                 $this->opciones->save();
                 break;
             case 2:
                 // Sincronitzar
                 $articulos = $this->recoge_articulos();
                 $familias = $this->recoge_familias();
                 $agentes = $this->recoge_agentes();
                 $series = $this->recoge_series();
                 $tarifas = $this->recoge_tarifas();
                 $formas = $this->recoge_formaspago();
                 $clientes = $this->recoge_clientes();
                 $empresa = $this->recoge_empresa();
                 $enviar["articulos"] = $articulos;
                 $enviar["familias"] = $familias;
                 $enviar["agentes"] = $agentes;
                 $enviar["series"] = $series;
                 $enviar["tarifas"] = $tarifas;
                 $enviar["formas"] = $formas;
                 $enviar["clientes"] = $clientes;
                 $enviar["empresa"] = $empresa;
                 $url = $this->opciones->url . "/sync/interfaz.php";
                 $peticion = array('comando' => 'actualizar', 'datos' => $enviar);
                 $result = $this->curl_post($url, $peticion);
                 echo "<b>DATOS:</b> {$result}";
                 $this->sincroniza_fotos_articulos();
                 $archivos = $this->getFileList("images/autoventas");
                 $peticion = array('comando' => 'archivos', 'datos' => $archivos);
                 $result = $this->curl_post($url, $peticion);
                 $sincroniza = json_decode($result, true);
                 $enviados = $realizados = 0;
                 foreach ($sincroniza["data"] as $k => $v) {
                     //echo "SINCRONIZANDO ...  $k<br>";
                     if (strpos($k, '..') == false) {
                         if (file_exists($k)) {
                             $enviados += 1;
                             //       echo "Enviando... $k<br>";
                             $fp = fopen($k, 'rb');
                             $datos = fread($fp, filesize($k));
                             fclose($fp);
                             $peticion = array('comando' => 'archivo', 'nombre' => $k, 'timestamp' => $v["timestamp"], 'data' => base64_encode($datos));
                             $result = $this->curl_post($url, $peticion);
                             //       echo "<br>ENS ARRIBA : $result";
                             if ($result == "OK") {
                                 $realizados += 1;
                             }
                         }
                     }
                 }
                 echo " <b>ARCHIVOS:</b> {$realizados} / {$enviados}";
                 $this->opciones->last_sincro = date("U");
                 $this->opciones->sincro();
                 echo " <b>LAST SINCRO:</b>" . $this->fecha_sincro();
                 $this->template = "";
                 break;
             case 3:
                 // Recoger pedidos pendientes
                 $url = $this->opciones->url . "/sync/interfaz.php";
                 $peticion = array('comando' => 'pedidos');
                 $result = $this->curl_post($url, $peticion);
                 $valores = json_decode($result);
                 //print_r($valores);
                 require_once "/plugins/autoventas/extras/autoventas_pedidos.php";
                 $objpedidos = new autoventas_pedidos();
                 $respuesta = $objpedidos->trata_pedidos($valores);
                 echo $respuesta;
                 $this->template = "";
                 break;
             default:
         }
     }
     //print_r($this->opciones);
 }
 protected function private_core()
 {
     $this->share_extension();
     if (isset($_REQUEST["cat"])) {
         switch ($_REQUEST["cat"]) {
             case "fam":
                 if (isset($_REQUEST["cod"])) {
                     $this->codFamilia = $this->db->escape_string($_REQUEST["cod"]);
                 }
                 $catf = new autoventas_familia();
                 if (isset($_REQUEST["action"])) {
                     switch ($_REQUEST["action"]) {
                         case 1:
                             // Actualitzem dades
                             $catf->nombre = $this->db->escape_string($_REQUEST["fam_nombre"]);
                             $catf->descripcion = $this->db->escape_string($_REQUEST["fam_descripcion"]);
                             if (isset($_REQUEST["fam_visible"])) {
                                 $catf->visible = 1;
                             } else {
                                 $catf->visible = 0;
                             }
                             $catf->codigo = $this->codFamilia;
                             $catf->save();
                             break;
                         case 2:
                             // Pugem foto
                             $imagen = $this->guarda_foto_familia($this->codFamilia);
                             if ($imagen) {
                                 $this->familia = $catf->load_data($this->codFamilia);
                                 $catf->codigo = $this->familia["codigo"];
                                 $catf->nombre = $this->familia["nombre"];
                                 $catf->descripcion = $this->familia["descripcion"];
                                 $catf->visible = $this->familia["visible"];
                                 $catf->imagen = $imagen;
                                 $catf->save();
                                 $this->new_message("Imagen subida correctamente : {$imagen}");
                             }
                             break;
                         case 3:
                             // Borrem foto
                             if ($this->borra_foto($this->codFamilia)) {
                                 $this->new_message("Imagen borrada correctamente");
                                 $this->familia = $catf->load_data($this->codFamilia);
                                 $catf->codigo = $this->familia["codigo"];
                                 $catf->nombre = $this->familia["nombre"];
                                 $catf->descripcion = $this->familia["descripcion"];
                                 $catf->visible = $this->familia["visible"];
                                 $catf->imagen = "";
                                 $catf->save();
                             } else {
                                 $this->new_error_msg("Hubo un problema a la hora de borrar la imagen");
                             }
                             break;
                         default:
                             $this->new_error_msg("Autoventas: Código de accion desconocido");
                     }
                 } else {
                     $catf->codigo = $this->codFamilia;
                     if (!$catf->exists()) {
                         // No existeix, afegim les dades que tenim per defecte.
                         $fam = new familia();
                         $f1 = $fam->get($this->codFamilia);
                         $catf->codigo = $f1->codfamilia;
                         $catf->nombre = $f1->codfamilia;
                         $catf->descripcion = $f1->descripcion;
                         $catf->visible = 1;
                         $catf->imagen = "";
                         $catf->save();
                     }
                 }
                 $this->familia = $catf->load_data($this->codFamilia);
                 $this->template = "autoventas_familias";
                 break;
             case "firma":
                 if (isset($_REQUEST["tipo"])) {
                     $this->tipo = $_REQUEST["tipo"];
                     $this->id = (int) $_REQUEST["id"];
                     switch ($this->tipo) {
                         case "albaran":
                             if (isset($_REQUEST["action"])) {
                                 $accion = $_REQUEST["action"];
                             } else {
                                 $accion = "";
                             }
                             require_model("albaran_cliente.php");
                             $a = new albaran_cliente();
                             $b = $a->get($this->id);
                             $numero2 = $b->numero2;
                             $path = "images/autoventas/firmas";
                             switch ($accion) {
                                 case "sincroniza":
                                     $op = new autoventas_opcionesdb();
                                     $opciones = new autoventas_opcionesdb($op->load());
                                     $url = $opciones->url . "/images/autoventas/firmas/{$numero2}.jpg";
                                     if (@get_headers($url)[0] == 'HTTP/1.1 404 Not Found') {
                                         $this->new_error_msg('El archivo de firma no existe.');
                                     } else {
                                         $archivo = file_get_contents($url);
                                         if ($archivo) {
                                             file_put_contents($path . "/" . $numero2 . ".jpg", $archivo);
                                         }
                                     }
                                     break;
                                 case "borra":
                                     if (file_exists($path . "/{$numero2}.jpg")) {
                                         unlink($path . "/{$numero2}.jpg");
                                     }
                                     break;
                                 default:
                             }
                             if (!file_exists($path)) {
                                 if (!mkdir($path, 0777, TRUE)) {
                                     $this->new_error_msg('Error al crear la carpeta images/autoventas/familias.');
                                 }
                             }
                             if (!file_exists($path . "/{$numero2}.jpg")) {
                                 $this->firmaUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAMAAABOo35HAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl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ZgARYKYAEWYAEWYAEWCmABFmABFmABFgpgARZgARZgARYKYAHWY8q/AwC5r4fHLh7jqQAAAABJRU5ErkJggg==";
                                 $this->firmaSolicitar = 1;
                             } else {
                                 $this->firmaUrl = "{$path}/{$numero2}.jpg";
                                 $this->firmaSolicitar = 0;
                             }
                             break;
                         case "pedido":
                             if (isset($_REQUEST["action"])) {
                                 $accion = $_REQUEST["action"];
                             } else {
                                 $accion = "";
                             }
                             require_model("pedido_cliente.php");
                             $a = new pedido_cliente();
                             $b = $a->get($this->id);
                             $numero2 = $b->numero2;
                             $path = "images/autoventas/firmas";
                             switch ($accion) {
                                 case "sincroniza":
                                     $op = new autoventas_opcionesdb();
                                     $opciones = new autoventas_opcionesdb($op->load());
                                     $url = $opciones->url . "/images/autoventas/firmas/{$numero2}.jpg";
                                     if (@get_headers($url)[0] == 'HTTP/1.1 404 Not Found') {
                                         $this->new_error_msg('El archivo de firma no existe.');
                                     } else {
                                         $archivo = file_get_contents($url);
                                         if ($archivo) {
                                             file_put_contents($path . "/" . $numero2 . ".jpg", $archivo);
                                         }
                                     }
                                     break;
                                 case "borra":
                                     if (file_exists($path . "/{$numero2}.jpg")) {
                                         unlink($path . "/{$numero2}.jpg");
                                     }
                                     break;
                                 default:
                             }
                             if (!file_exists($path)) {
                                 if (!mkdir($path, 0777, TRUE)) {
                                     $this->new_error_msg('Error al crear la carpeta images/autoventas/familias.');
                                 }
                             }
                             if (!file_exists($path . "/{$numero2}.jpg")) {
                                 $this->firmaUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAMAAABOo35HAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8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wXoWuyTlcmkDo+/0j6d4x+K/gZWFoTwK+QTB1HhW5pXDnkkb0mIX/HXQmumDOwOrub4f3DN44Cbqlvl+NgS+ZtLoPaHudnsQLJW+dzX6zrkWr+/R/x/6nhgasWOdgqXR97FK3zlYucUOn3MseueXGROfk+Wq1noW+e/yzhNM9wqV7KWWD6NEK1lt5s7EK9f49VfGs3w5QYo64j8bWm5bAZDzX/G22jX9w7ZtSfvMd0ith5v27dA9b92nycttTdjx+eO9Nj+Yr8WJZS/A+g6QdfHFlQWU2jBEASzAAizA+qMLZkN4FmABFmABFgpmQ3gWYAEWYAEWCmABFmABFmABFgpgARZgARZgARYKYAEWYAEWYAEWCmABFmABFmABFgpgARZgARZgARYKYAEWYAEWYAEWCmABFmABFmABFgpgARZgARZgARYKYAHWY8q/AwC5r4fHLh7jqQAAAABJRU5ErkJggg==";
                                 $this->firmaSolicitar = 1;
                             } else {
                                 $this->firmaUrl = "{$path}/{$numero2}.jpg";
                                 $this->firmaSolicitar = 0;
                             }
                             break;
                         default:
                             $this->new_error_msg("Autoventas: Tipo de documento desconocido");
                     }
                 }
                 $this->template = "autoventas_firma";
                 break;
             case "imprimir":
                 $this->albaran = FALSE;
                 $this->cliente = FALSE;
                 $this->pedido = FALSE;
                 $this->impuesto = new impuesto();
                 /// obtenemos los datos de configuración de impresión
                 $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0', 'print_formapago' => '1');
                 $fsvar = new fs_var();
                 $this->impresion = $fsvar->array_get($this->impresion, FALSE);
                 $this->logo = FALSE;
                 if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) {
                     $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.png';
                 } else {
                     if (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) {
                         $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.jpg';
                     }
                 }
                 if (isset($_REQUEST['albaran']) and isset($_REQUEST['id'])) {
                     $alb = new albaran_cliente();
                     $this->albaran = $alb->get($_REQUEST['id']);
                     if ($this->albaran) {
                         $cliente = new cliente();
                         $this->cliente = $cliente->get($this->albaran->codcliente);
                     }
                     if (isset($_POST['email'])) {
                         $this->enviar_email('albaran');
                     } else {
                         $this->generar_pdf_albaran();
                     }
                 } else {
                     if (isset($_REQUEST['pedido']) and isset($_REQUEST['id'])) {
                         require_model("pedido_cliente.php");
                         $fac = new pedido_cliente();
                         $this->pedido = $fac->get($_REQUEST['id']);
                         if ($this->pedido) {
                             $cliente = new cliente();
                             $this->cliente = $cliente->get($this->pedido->codcliente);
                         }
                         if (isset($_POST['email'])) {
                             $this->enviar_email('pedido');
                         } else {
                             $this->generar_pdf_pedido();
                         }
                     }
                 }
                 break;
             default:
                 $this->new_error_msg('Autoventas: Error categoría desconocida');
         }
     } else {
         $this->new_error_msg('Autoventas: Error sin categoría');
     }
 }