ftp service

This commit is contained in:
amazuecos
2024-08-28 22:28:34 +02:00
parent c8106eafa1
commit da379a7af9
6 changed files with 122 additions and 684 deletions

View File

@ -9,6 +9,7 @@ use App\Models\Pedidos\PedidoLineaModel;
use App\Models\Presupuestos\PresupuestoModel;
use DOMDocument;
use DOMNode;
use FTP;
class PedidoXMLService extends BaseService
{
@ -168,8 +169,15 @@ class PedidoXMLService extends BaseService
$xml_products_el->appendChild($xml->createElement('CommentsClient', $data["pedido_cliente_presupuesto"]->comentarios_cliente));
$xml->appendChild($xml_products_el);
$file_has_suffix = hash('sha512',$data["pedido_cliente_presupuesto"]->pedidoId);
$file_name = PedidoXMLService::generate_xml_file_name($file_has_suffix);
$ftp = service('FTPService');
$ftp->uploadXML($xml->textContent,$file_name);
return $data;
}
protected static function generate_xml_file_name(string $hash) : string
{
return implode("",["Safekat_",$hash,".xml"]);
}
protected static function get_color_interior($pre_linea): ?string
{
$color_interior = null;