Esempio n. 1
0
 public function hookExtraCarrier()
 {
     if (Configuration::get('SEUR_Configured') == 1) {
         $process_type = Configuration::get('PS_ORDER_PROCESS_TYPE');
         $seur_carrier_pos = SeurLib::getSeurCarrier('SEP');
         $seur_carriers = SeurLib::getSeurCarriers(true);
         $pos_is_enabled = SeurLib::getConfigurationField('pos');
         $seur_carriers_without_pos = '';
         foreach ($seur_carriers as $seur_carrier) {
             if ($seur_carrier['id'] != $seur_carrier_pos['id']) {
                 $seur_carriers_without_pos .= (int) $seur_carrier['id'] . ',';
             }
         }
         $seur_carriers_without_pos = trim($seur_carriers_without_pos, ',');
         if ($process_type == '0') {
             $this->context->smarty->assign('id_address', $this->context->cart->id_address_delivery);
         }
         $this->context->smarty->assign(array('posEnabled' => $pos_is_enabled, 'id_seur_pos' => (int) $seur_carrier_pos['id'], 'seur_resto' => $seur_carriers_without_pos, 'src' => $this->_path . 'img/unknown.gif', 'ps_version' => version_compare(_PS_VERSION_, '1.5', '<') ? 'ps4' : 'ps5'));
         return $this->display(__FILE__, 'views/templates/hook/seur.tpl');
     }
 }
 public function hookPayment($params)
 {
     if (!$this->active || !SeurLib::getConfigurationField('seur_cod')) {
         // Cash on delivery is disabled in Seur Configuration
         return;
     }
     $address = new Address((int) $params['cart']->id_address_delivery);
     $country = new Country((int) $address->id_country);
     $seur_carrier_sen = SeurLib::getSeurCarrier('SEN');
     $seur_carrier_scn = SeurLib::getSeurCarrier('SCN');
     $seur_carrier_sce = SeurLib::getSeurCarrier('SCE');
     $cod_carriers = array($seur_carrier_scn['id'], $seur_carrier_sen['id'], $seur_carrier_sce['id']);
     if (($country->iso_code == 'ES' || $country->iso_code == 'PT' || $country->iso_code == 'AD') && in_array($params['cart']->id_carrier, $cod_carriers)) {
         $cost = (double) abs($params['cart']->getOrderTotal(true, Cart::BOTH));
         $cargo = number_format($this->getCargo($params['cart']), 2, '.', '');
         $total_con_cargo = (double) ($cost + $cargo);
         if (version_compare(_PS_VERSION_, "1.5", ">=")) {
             $this->context->smarty->assign(array('ruta' => $this->_path, 'coste' => $cost, 'cargo' => $cargo, 'total' => $total_con_cargo, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/', 'enlace' => $this->context->link->getModuleLink('seurcashondelivery', 'validation', array(), true), 'visible' => 1));
             $id_carrier = "";
             $delivery_options_array = Tools::getValue('delivery_option');
             if (is_array($delivery_options_array)) {
                 foreach ($delivery_options_array as $id_carrier) {
                     if ($seur_carrier_scn['id'] == (int) $id_carrier || $seur_carrier_sen['id'] == (int) $id_carrier || $seur_carrier_sce['id'] == (int) $id_carrier) {
                         return $this->display(__FILE__, 'views/templates/hook/payment.tpl');
                     }
                 }
             }
             if ($id_carrier == "") {
                 if (in_array(Configuration::get('PS_CARRIER_DEFAULT'), $cod_carriers)) {
                     return $this->display(__FILE__, 'views/templates/hook/payment.tpl');
                 } else {
                     $this->context->smarty->assign('visible', 0);
                     return $this->display(__FILE__, 'views/templates/hook/payment.tpl');
                 }
             }
         } else {
             $smarty = $this->context->smarty;
             $url = $this->getModuleLink('seurcashondelivery', 'payment.php');
             $smarty->assign(array('ruta' => $this->_path, 'coste' => $cost, 'cargo' => $cargo, 'total' => $total_con_cargo, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/', 'enlace' => $url, 'visible' => 1));
             if (in_array(Tools::getValue('id_carrier'), $cod_carriers)) {
                 return $this->display($this->path, 'views/templates/hook/payment.tpl');
             } else {
                 $this->context->smarty->assign('visible', 0);
                 return $this->display($this->path, 'views/templates/hook/payment.tpl');
             }
         }
     }
     return '';
 }
Esempio n. 3
0
    public function displayFormDeliveries($response = null, $detail = null, $error = null)
    {
        $token = Tools::getValue('token');
        $back = Tools::safeOutput($_SERVER['REQUEST_URI']);
        $seur_order_states = array('' => $this->module_instance->l('All', self::FILENAME), '1' => $this->module_instance->l('Delivered', self::FILENAME), '2' => $this->module_instance->l('In transit', self::FILENAME), '3' => $this->module_instance->l('Incidents fixable by customer', self::FILENAME), '4' => $this->module_instance->l('Incident management SEUR', self::FILENAME), '5' => $this->module_instance->l('Returned', self::FILENAME), '6' => $this->module_instance->l('Sinister', self::FILENAME), '7' => $this->module_instance->l('Canceled', self::FILENAME));
        Tools::safePostVars();
        if (empty($_POST)) {
            $delivery_valuend_data = date('d-m-Y');
            $start_data = strtotime('-1 day', strtotime(date('Y-m-d')));
            $start_data = date('d-m-Y', $start_data);
        } else {
            $start_data = Tools::getValue('start_date');
            $delivery_valuend_data = Tools::getValue('end_date');
        }
        if ($response == null && $detail == null) {
            $tab_view = 'deliveries';
        } elseif ($response == true && $detail == null) {
            $tab_view = 'deliveries';
        } elseif ($response == true && $detail == true) {
            $tab_view = 'deliveries';
        }
        $ps_version = 'ps' . (version_compare(_PS_VERSION_, '1.5', '>=') > 1.4 ? '5' : '4');
        $img_dir = __PS_BASE_URI__ . 'modules/seur/img/';
        if (!empty($error)) {
            $this->content .= $this->module_instance->displayError($error);
        }
        if (Tools::getValue('error')) {
            $this->content .= $this->module_instance->displayError(Tools::getValue('codigo') . ' => ' . Tools::getValue('error'));
        }
        $this->content .= "<div id='contenttab'>";
        if (_PS_VERSION_ > '1.5') {
            $this->content .= "<script>\n\t\t\t\t\$( document ).ready(function() {\n\t\t\t\t\t\$('#submitFilter').click(function(){\n\t\t\t\t\t\tdocument.formfilter.submit();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>";
        }
        $this->content .= "<fieldset>\n\t\t\t\t<legend>\n\t\t\t\t\t<img src='{$img_dir}/logonew.png' />\n\t\t\t \t</legend>\n\t\t\t\t<div id='seur_module' class='{$ps_version}'>\n\t\t\t\t\t<ul class='configuration_menu'>\n\t\t\t\t\t\t<li class='button btnTab" . ($tab_view == 'deliveries' ? ' active' : '') . "' tab='deliveries'>\n\t\t\t\t\t\t\t<img src='{$img_dir}/config.png' alt=" . $this->module_instance->l('Shipments', self::FILENAME) . ' title=' . $this->module_instance->l('Shipments', self::FILENAME) . ' />
							' . $this->module_instance->l('Shipments', self::FILENAME) . "\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li class='button btnTab" . ($tab_view == 'packing_list' ? ' active' : '') . "' tab='packing_list'>\n\t\t\t\t\t\t\t<img src='{$img_dir}/manifest.png' alt='" . $this->module_instance->l('Packing List', self::FILENAME) . "' title='" . $this->module_instance->l('Packing List', self::FILENAME) . "' />\n\t\t\t\t\t\t\t" . $this->module_instance->l('Packing List', self::FILENAME) . "\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li class='button btnTab" . ($tab_view == 'pickups' ? ' active' : '') . "' tab='pickups'>\n\t\t\t\t\t\t\t<img src='{$img_dir}/recogidas.png' alt='" . $this->module_instance->l('Pickups', self::FILENAME) . "' title='" . $this->module_instance->l('Pickups', self::FILENAME) . "' />\n\t\t\t\t\t\t\t" . $this->module_instance->l('Pickups', self::FILENAME) . "\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t<ul class='configuration_tabs'>\n\t\t\t\t\t\t<li id='deliveries'" . ($tab_view == 'deliveries' ? ' class="default"' : '') . ">\n\t\t\t\t\t\t\t<form action='index.php?controller=" . $this->current_controller . '&submitFilter=1&token=' . $token . $this->ps14_tab . "' method='post' id='formfilter' name='formfilter'>\n\t\t\t\t\t\t\t\t<table id='deliveriesTable' class='table' cellpadding='0' cellspacing='0'>\n\t\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t\t<tr> \n\t\t\t\t\t\t\t\t\t\t\t<th>" . $this->module_instance->l('Reference number', self::FILENAME) . '</th>
											<th>' . $this->module_instance->l('Expedition number', self::FILENAME) . '</th>
											<th>' . $this->module_instance->l('Start date', self::FILENAME) . '</th>
											<th>' . $this->module_instance->l('End date', self::FILENAME) . "</th>\n\t\t\t\t\t\t\t\t\t\t\t<th colspan='5'>" . $this->module_instance->l('Estate', self::FILENAME) . "</th>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr class='filtros'>\n\t\t\t\t\t\t\t\t\t\t\t<td><input class='ps14_input' type='text' name='reference_number' value='' autocomplete='off' /></td>\n\t\t\t\t\t\t\t\t\t\t\t<td><input class='ps14_input' type='text' name='expedition_number' value='' autocomplete='off' /></td>\n\t\t\t\t\t\t\t\t\t\t\t<td><input class='ps14_input' type='text' name='start_date' id='start_date' autocomplete='off' value='" . $start_data . "'/></td>\n\t\t\t\t\t\t\t\t\t\t\t<td><input class='ps14_input' type='text' name='end_date' id='end_date' class='datepicker' autocomplete='off' value='" . $delivery_valuend_data . "'/></td>\n\t\t\t\t\t\t\t\t\t\t\t<td colspan='4'>\n\t\t\t\t\t\t\t\t\t\t\t\t<select id='order_state' name='order_state' value='' autocomplete='off'>";
        foreach ($seur_order_states as $key => $seur_order_state) {
            $this->content .= "<option value='{$key}'>{$seur_order_state}</option>";
        }
        $this->content .= "</select>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t<input type='submit' value=" . $this->module_instance->l('Filter', self::FILENAME) . " name='submitFilter' id='submitFilter' class='filter' />\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</thead>";
        if ($response == true && $detail == null) {
            $string_xml = htmlspecialchars_decode($response->out);
            $string_xml = str_replace('&', '&amp; ', $string_xml);
            $xml = simplexml_load_string($string_xml);
            if ($xml->DESCRIPCION) {
                $this->content .= $this->module_instance->displayError($xml->DESCRIPCION);
            } else {
                if ($xml->attributes()->NUM[0] != 0) {
                    $deliveries_data = array();
                    foreach ($xml->EXPEDICION as $delivery) {
                        $headers = array('order' => $this->module_instance->l('Order/Reference', self::FILENAME), 'expedition' => $this->module_instance->l('Expedition', self::FILENAME), 'name' => $this->module_instance->l('Name'), 'description' => $this->module_instance->l('Description', self::FILENAME), 'date' => $this->module_instance->l('Date', self::FILENAME), 'delivery' => $this->module_instance->l('Delivery', self::FILENAME), 'details' => $this->module_instance->l('Details', self::FILENAME));
                        $headersOcultas = array('EXPEDICION', 'DESTINA_PAIS' => (string) $delivery->DESTINA_PAIS);
                        $deliveries_data[] = array('Pedido/Referencia' => (string) $delivery->REMITE_REF, 'Expedicion' => (string) $delivery->EXPEDICION_NUM, 'Nombre' => (string) $delivery->DESTINA_NOMBRE, 'Descripcion' => (string) $delivery->DESCRIPCION_PARA_CLIENTE, 'date' => (string) $delivery->FECHA_CAPTURA, 'EXPEDICION' => (string) $delivery->EXPEDICION_NUM, 'Detalles' => '');
                    }
                    $this->content .= "<tbody>\n\t\t\t\t\t\t<tr class='bold'>";
                    foreach ($headers as $key => $header) {
                        $this->content .= '<th ' . ($key == 'delivery' || $key == 'details' ? 'colspan="2"' : '') . '>' . $header . '</th>';
                    }
                    $this->content .= '</tr>';
                    $line = 1;
                    $countryTo = '';
                    foreach ($deliveries_data as $delivery_data) {
                        $this->content .= '<tr ' . ($line % 2 != 0 ? 'class="alternate"' : '') . '>';
                        $delivered = false;
                        foreach ($delivery_data as $key => $delivery_value) {
                            if ($key == 'Expedicion') {
                                $delivery_number = $delivery_value;
                            }
                            $this->content .= '<td class=' . $key . ' ' . ($key == 'EXPEDICION' || $key == 'Detalles' ? 'colspan="2"' : '') . '>' . (!in_array($key, $headersOcultas) ? $delivery_value : '');
                            if ($key == 'Descripcion' && $delivery_value == 'ENTREGA EFECTUADA') {
                                $delivered = true;
                            }
                            if ($key == 'EXPEDICION' && ($countryTo == 'ES' || $countryTo == '-' || $countryTo == '') && $delivered) {
                                $this->content .= '<a href="../modules/seur/ajax/createDeliveryNote.php?back=' . $back . '&token=' . Tools::getValue('token') . '&expedition_number=' . $delivery_value . '&token=' . $token . '&id_employee=' . (int) $this->context->cookie->id_employee . '">
										<img src="' . $img_dir . '/png_ico.png" alt="' . $this->module_instance->l('Delivery', self::FILENAME) . '" title="' . $this->module_instance->l('Delivery', self::FILENAME) . '" />
									</a>
									<!--a class="verDetalles" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&verDetalle=1&token=' . $token . '&expedition_number=' . $delivery_value . '&id_employee=' . (int) $this->context->cookie->id_employee . '"-->';
                            }
                            if ($key == 'Detalles') {
                                $this->content .= '<a class="verDetalles" href="' . __PS_BASE_URI__ . 'modules/seur/ajax/getExpeditionAjax.php?expedition_number=' . $delivery_number . '&token=' . $token . '&id_employee=' . (int) $this->context->cookie->id_employee . '">
										<img src="' . $img_dir . '/details.png" alt="' . $this->module_instance->l('See details', self::FILENAME) . '" title="' . $this->module_instance->l('See details', self::FILENAME) . '" />
									</a>';
                            }
                            $this->content .= '</td>';
                        }
                        $this->content .= '</tr>';
                        $line++;
                    }
                } else {
                    $this->content .= $this->module_instance->displayError($this->module_instance->l('No results.', self::FILENAME));
                }
                $this->content .= ' </tbody>';
            }
        }
        $this->content .= '</table>
				</form>
			</li>
			<li id="packing_list"' . ($tab_view == 'packing_list' ? '  class="default"' : '') . '>
				<table class="table" cellspacing="0" cellpadding="0">
				<thead>
					<tr>
						<th>' . $this->module_instance->l('Download today packing list', self::FILENAME) . '</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>
							<a href="../modules/seur/ajax/createPackingList.php?back=' . $back . '&token=' . Tools::getValue('token') . '&id_employee=' . $this->context->cookie->id_employee . '" target="_blank">
							<img src="' . $img_dir . '/ico_descargar.png" alt="' . $this->module_instance->l('Packing List', self::FILENAME) . '" />' . $this->module_instance->l('Download', self::FILENAME) . '</a>
						</td>
					</tr>
				</tbody>
				</table>
			</li>';
        $this->content .= '<li id="pickups"' . ($tab_view == 'pickups' ? 'class="default"' : '') . '>
			<table class="table" cellspacing="0">
			<thead>';
        $pickup_data = Pickup::getLastPickup();
        $steady_pickup = false;
        if ($pickup_data) {
            $pickup_date = explode(' ', $pickup_data['date']);
        }
        if (SeurLib::getConfigurationField('pickup') == 1) {
            $steady_pickup = true;
        }
        if (!empty($pickup_data) && strtotime(date('Y-m-d')) == strtotime($pickup_date[0]) && !$steady_pickup) {
            $this->content .= '<tr>
						<th>' . $this->module_instance->l('Localizer', self::FILENAME) . '</th>
						<th colspan="2">' . $this->module_instance->l('Date', self::FILENAME) . '</th>
					</tr>
				</thead>
				<tbody>
					<tr >
					   <td>' . $pickup_data['localizer'] . '</td>
					   <td>' . $pickup_data['date'] . '</td>
					</tr>
				</tbody>';
        } elseif ((int) date('H') < 14 && !$steady_pickup) {
            $this->content .= '<tr>
					<td class="createpickup">
						<a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&createPickup=1">' . $this->module_instance->l('Create pickup', self::FILENAME) . '</a>
					</td>
					</tr>';
        } elseif ($steady_pickup) {
            $this->content .= '<tr>
					<th>' . $this->module_instance->l('Fixed pickup.', self::FILENAME) . '</th>
					</tr>';
        } elseif ((int) date('H') >= 14) {
            $this->content .= '<tbody>
						<tr>
							<td>
							<p><img src="../img/admin/help2.png" /> 
							   ' . $this->module_instance->l('14H is past, to create a pickup please contact SEUR on 902101010 or via ', self::FILENAME) . '
							</p>
							<p><a href="http://www.seur.com" target="_blank">www.seur.com</a></p>
							<p>' . $this->module_instance->l('Thank you.', self::FILENAME) . '</p>
							</td>
						</tr>
						</tbody>';
        }
        $this->content .= '</thead>
					</table>
				</li>
			</ul>
		  </div>
	  </fieldset>

	  </div>';
    }
Esempio n. 4
0
    public static function createLabels($label_data, $tipo)
    {
        try {
            if (Validate::isFileName($label_data['pedido'])) {
                $label_name = $label_data['pedido'];
            } else {
                $module_instance = Module::getInstanceByName('seur');
                return SeurLib::displayErrors($label_data['pedido'] . ' ' . $module_instance->l('could not be used as file name', 'Label'));
            }
            $sc_options = array('connection_timeout' => 30);
            $soap_client = new SoapClient((string) Configuration::get('SEUR_URLWS_ET'), $sc_options);
            $merchant_data = SeurLib::getMerchantData();
            $notification = SeurLib::getConfigurationField('notification_advice_radio');
            $advice_checkbox = SeurLib::getConfigurationField('advice_checkbox');
            $distribution_checkbox = SeurLib::getConfigurationField('distribution_checkbox');
            $servicio = 31;
            $producto = 2;
            $mercancia = false;
            $claveReembolso = '';
            $valorReembolso = '';
            if (SeurLib::getConfigurationField('international_orders') == 1 && ($label_data['iso'] != 'ES' && $label_data['iso'] != 'PT' && $label_data['iso'] != 'AD')) {
                $servicio = 77;
                $producto = 70;
                $mercancia = true;
                $label_data['total_bultos'] = 1;
            }
            if (isset($label_data['reembolso']) && ($label_data['iso'] == 'ES' || $label_data['iso'] == 'PT' || $label_data['iso'] == 'AD')) {
                $claveReembolso = 'f';
                $valorReembolso = (double) $label_data['reembolso'];
            }
            if (isset($label_data['cod_centro']) && ($label_data['iso'] == 'ES' || $label_data['iso'] == 'PT' || $label_data['iso'] == 'AD')) {
                $servicio = 1;
                $producto = 48;
            }
            $total_weight = $label_data['total_kilos'];
            $total_packages = $label_data['total_bultos'];
            $pesoBulto = $total_weight / $total_packages;
            if ($pesoBulto < 1) {
                $pesoBulto = 1;
                $total_weight = $total_packages;
            }
            $cont = 0;
            $xml = '<?xml version="1.0" encoding="ISO-8859-1"?><root><exp>';
            for ($i = 0; $i <= (double) $total_packages - 1; $i++) {
                $cont++;
                $xml .= '<bulto>
							<ci>' . (int) $merchant_data['cit'] . '</ci>
							<nif>' . pSQL($merchant_data['nif_dni']) . '</nif>
							<ccc>' . (int) $merchant_data['ccc'] . '</ccc>
							<servicio>' . pSQL($servicio) . '</servicio>
							<producto>' . pSQL($producto) . '</producto>';
                if ($mercancia) {
                    $xml .= '<id_mercancia>382</id_mercancia>';
                }
                $xml .= '<cod_centro></cod_centro>
							<total_bultos>' . pSQL($total_packages) . '</total_bultos>
							<total_kilos>' . pSQL($total_weight) . '</total_kilos>
							<pesoBulto>' . pSQL($pesoBulto) . '</pesoBulto>
							<observaciones>' . pSQL($label_data['info_adicional']) . '</observaciones>
							<referencia_expedicion>' . pSQL($label_data['pedido']) . '</referencia_expedicion>
							<ref_bulto>' . pSQL($label_data['pedido'] . sprintf('%03d', (int) $i + 1)) . '</ref_bulto>
							<clavePortes>F</clavePortes>
							<clavePod></clavePod>
							<claveReembolso>' . pSQL($claveReembolso) . '</claveReembolso>
							<valorReembolso>' . pSQL($valorReembolso) . '</valorReembolso>
							<libroControl></libroControl>
							<nombre_consignatario>' . pSQL($label_data['name']) . '</nombre_consignatario>
							<direccion_consignatario>' . pSQL($label_data['direccion_consignatario']) . '</direccion_consignatario>
							<tipoVia_consignatario>CL</tipoVia_consignatario>
							<tNumVia_consignatario>N</tNumVia_consignatario>
							<numVia_consignatario>.</numVia_consignatario>
							<escalera_consignatario>.</escalera_consignatario>
							<piso_consignatario>.</piso_consignatario>
							<puerta_consignatario>.</puerta_consignatario>
							<poblacion_consignatario>' . pSQL($label_data['consignee_town']) . '</poblacion_consignatario>';
                if (!empty($label_data['codPostal_consignatario'])) {
                    $xml .= '<codPostal_consignatario>' . pSQL($label_data['codPostal_consignatario']) . '</codPostal_consignatario>';
                }
                $xml .= '   <pais_consignatario>' . pSQL($label_data['iso']) . '</pais_consignatario>
							<codigo_pais_origen>' . pSQL($label_data['iso_merchant']) . '</codigo_pais_origen>
							<email_consignatario>' . pSQL($label_data['email_consignatario']) . '</email_consignatario>
							<sms_consignatario>' . ((int) $notification ? pSQL($label_data['movil']) : '') . '</sms_consignatario>
							<test_sms>' . ((int) $notification ? 'S' : 'N') . '</test_sms>
							<test_preaviso>' . ((int) $advice_checkbox ? 'S' : 'N') . '</test_preaviso>
							<test_reparto>' . ((int) $distribution_checkbox ? 'S' : 'N') . '</test_reparto>
							<test_email>' . ((int) $notification ? 'N' : 'S') . '</test_email>
							<eci>N</eci>
							<et>N</et>
							<telefono_consignatario>' . pSQL($label_data['telefono_consignatario']) . '</telefono_consignatario>
							<atencion_de>' . pSQL($label_data['companyia']) . '</atencion_de>
						 </bulto>
						 ';
            }
            $xml .= '</exp></root>';
            $xml_name = (int) $merchant_data['franchise'] . '_' . (int) $merchant_data['cit'] . '_' . date('dmYHi') . '.xml';
            $make_pickup = false;
            $auto = false;
            $pickup_data = Pickup::getLastPickup();
            if (!empty($pickup_data)) {
                $datepickup = explode(' ', $pickup_data['date']);
                $datepickup = $datepickup[0];
                if (strtotime(date('Y-m-d')) != strtotime($datepickup)) {
                    $make_pickup = true;
                }
                if (SeurLib::getConfigurationField('pickup') == 0) {
                    $auto = true;
                }
            }
            if ($tipo == 'pdf') {
                $data = array('in0' => $merchant_data['user'], 'in1' => $merchant_data['pass'], 'in2' => $xml, 'in3' => $xml_name, 'in4' => $merchant_data['nif_dni'], 'in5' => $merchant_data['franchise'], 'in6' => '-1', 'in7' => 'prestashop');
                $response = $soap_client->impresionIntegracionPDFConECBWS($data);
                if ($response->out == 'ERROR') {
                    return SeurLib::displayErrors((string) $response->out);
                }
                if ($response->out->mensaje != 'OK') {
                    return SeurLib::displayErrors((string) $response->out->mensaje);
                } else {
                    $pdf = base64_decode($response->out->PDF);
                    if (is_writable(_PS_MODULE_DIR_ . 'seur/files/deliveries_labels/')) {
                        file_put_contents(_PS_MODULE_DIR_ . 'seur/files/deliveries_labels/' . $label_name . '.pdf', $pdf);
                    }
                    SeurLib::setSeurOrder($label_data['pedido'], $total_packages, $total_weight, 'PDF');
                    if ($make_pickup && $auto) {
                        Pickup::createPickup();
                    }
                }
            } elseif ($tipo == 'zebra') {
                $data = array('in0' => pSQL($merchant_data['user']), 'in1' => pSQL($merchant_data['pass']), 'in2' => 'ZEBRA', 'in3' => 'LP2844-Z', 'in4' => '2C', 'in5' => $xml, 'in6' => $xml_name, 'in7' => pSQL($merchant_data['nif_dni']), 'in8' => pSQL($merchant_data['franchise']), 'in9' => '-1', 'in10' => 'prestashop');
                $response = $soap_client->impresionIntegracionConECBWS($data);
                if ($response->out == 'ERROR' || $response->out->mensaje != 'OK') {
                    return SeurLib::displayErrors('Error al crear el envio y la etiqueta: ' . $response->out->mensaje);
                } else {
                    if (is_writable(_PS_MODULE_DIR_ . 'seur/files/deliveries_labels/')) {
                        file_put_contents(_PS_MODULE_DIR_ . 'seur/files/deliveries_labels/' . pSQL($label_name) . '.txt', (string) $response->out->traza);
                    }
                    SeurLib::setSeurOrder(pSQL($label_data['pedido']), (double) $total_packages, (double) $total_weight, 'zebra');
                    if ($make_pickup && $auto) {
                        Pickup::createPickup();
                    }
                }
            }
        } catch (PrestaShopException $e) {
            $e->displayMessage();
        }
        return true;
    }