/* Decoded by unphp.net */ plugin_name = $plugin_name; $this->version = $version; $this->current_version = $current_version; $this->menu_position = $menu_position; } // Register the stylesheets for the admin area public function enqueue_styles() { wp_enqueue_style( 'woocommerce_admin', plugins_url().'/' . class_MRWP_main::WOOCOMMERCE_FOLDER . '/assets/css/admin.css', $this->version, 'all' ); wp_enqueue_style( 'mondialrelay_admin', plugin_dir_url(dirname(__FILE__)).'admin/css/MRWP-admin.css', $this->version, 'all' ); } // Register the JavaScript for the admin area public function enqueue_scripts( $hook_suffix ) { // WooCommerce scripts $this->woocommerce_scripts(); // Mondial Relay scripts wp_register_script( 'jquery_validate', plugin_dir_url(dirname(__FILE__)).'admin/js/jquery.validate.min.js', array( 'jquery')); wp_enqueue_script( 'jquery_validate', $this->version, false); wp_register_script( 'mondialrelay_admin_validate', plugin_dir_url(dirname(__FILE__)).'admin/js/MRWP-admin.js', array( 'jquery')); // Localize the script with new data $translation_array = array( 'message1' => __(' < Entrez votre code client', 'mondialrelay-wordpress'), 'message2' => __(' < Votre code client doit être de 8 caractères', 'mondialrelay-wordpress'), 'message3' => __(' < Entrez votre code marque', 'mondialrelay-wordpress'), 'message4' => __(' < Entrez votre clé privé', 'mondialrelay-wordpress'), 'message5' => __(' < Entrez votre niveau d\'assurance', 'mondialrelay-wordpress'), 'message6' => __(' < Entrez un nombre valide', 'mondialrelay-wordpress'), 'message7' => __(' < Entrez votre nom d\'expéditeur', 'mondialrelay-wordpress'), 'message8' => __(' < Votre nom d\'expéditeur doit contenir au maximum 32 caractères', 'mondialrelay-wordpress'), 'message9' => __(' < Votre complément d\'expéditeur doit contenir au maximum 32 caractères', 'mondialrelay-wordpress'), 'message10' => __(' < Entrez votre rue', 'mondialrelay-wordpress'), 'message11' => __(' < Votre rue doit contenir au maximum 32 caractères', 'mondialrelay-wordpress'), 'message12' => __(' < Entrez votre code postal', 'mondialrelay-wordpress'), 'message13' => __(' < Votre code postal doit contenir au maximum 5 caractères', 'mondialrelay-wordpress'), 'message14' => __(' < Entrez votre ville', 'mondialrelay-wordpress'), 'message15' => __(' < Votre ville doit contenir au maximum 26 caractères', 'mondialrelay-wordpress'), 'message16' => __(' < Entrez votre pays', 'mondialrelay-wordpress'), 'message17' => __(' < Votre pays doit contenir au maximum 2 caractères', 'mondialrelay-wordpress'), 'message18' => __(' < Entrez votre numéro de téléphone', 'mondialrelay-wordpress'), 'message19' => __(' < Votre numéro de téléphone doit contenir au maximum 13 caractères', 'mondialrelay-wordpress'), 'message20' => __(' < Votre adresse e-mail doit contenir au maximum 70 caractères', 'mondialrelay-wordpress'), 'message21' => __(' ^ Entrez un sujet', 'mondialrelay-wordpress'), 'message22' => __(' ^ Entrez le contenu de votre email', 'mondialrelay-wordpress'), 'message23' => __(' < Choisissez la position du menu du plugin Mondial Relay', 'mondialrelay-wordpress'), 'message24' => __(' < Votre complément d\'adresse doit contenir au maximum 32 caractères', 'mondialrelay-wordpress'), ); wp_localize_script( 'mondialrelay_admin_validate', 'MRWP_i18n', $translation_array ); // @todo Refactoring Revoir tous les wp_register_script() et wp_enqueue_script() qui ne sont pas corrects wp_enqueue_script( 'mondialrelay_admin_validate', $this->version, false); // Only enqueue the zones export script in the appropriate page if ( 'toplevel_page_wp-mondialrelay' == $hook_suffix ) { wp_register_script( 'mondialrelay_zones', plugin_dir_url( __DIR__ ) . 'admin/js/shipping-zones.js', array( 'jquery' ), $this->version ); wp_enqueue_script( 'mondialrelay_zones' ) ; } } /** * Enqueue JS for Ajax WP_List_Table */ public function enqueue_list_script() { wp_register_script( 'mondialrelay_admin_mass_shipping', plugin_dir_url(dirname(__FILE__)). 'admin/js/list-table.js', array( 'jquery', 'jquery-ui-datepicker' ) ); wp_enqueue_script( 'mondialrelay_admin_mass_shipping', $this->version, false); // Date picker wp_enqueue_script( 'jquery-ui-datepicker' ); /* Choose jQuery UI theme on this page * https://jqueryui.com/themeroller/#!zThemeParams=5d00008000ea05000000000000003d8888d844329a8dfe02723de3e5701258a13d5ba490adca99e4a02bf259c3083bccd292fbc7a815b30f470ff7864f8c0d0abbfd0926063d14faae19f29b086c2f4cf156a8205f7f8a4665545a5673e9f68749a54ab4746c69d599dce963fc3aa65b2c0af8483da4f905056d9752840f949d1956aecdd062dd566cab69194f70740c7a8eb43b906c3dfb317e62615319e0ccabb3fa3370a66b6d22a53a0ae6b209b465064ce1462b9be2cf60c233a80f57f75a7c2f469e6b8439ad8c1db376bb6a8cdfd2627f4334b44198e955e4256b0a8a6ee6d2f45da7567e0f7aa22c9d81d684db86e18ece2497400fe0f135cc38bfd1e55939aeda6c2ecfdab826c6779b110967ae1299dff254dcd78dd5b26dd2df26cffa81bbc523debff64e26be65e6a620c045190e203904e9d81bcea2f4834a2016ed531ec391294e7673cab97b38ffe66c2dc20e96b09790d2ca260d9b778eb49c95cf80aece999855d79bbd8568647998fac2fcbce76524897433dc876aa689b6bc8494075f7ec0a68f66d3f2417247e5b022db641f3a79f968edd1bf078f7f6b79d5faf38bb47379b04163fb66f4b32fa24b8722298ca1f9505a194f03142c8f3dc1affe3191d6 * * Theme name goes after 1.12.1/themes/ * Eg 1.12.1/themes/flick/ */ wp_enqueue_style( 'mrwp-jquery-ui','https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/flick/jquery-ui.css', false, '1.12.1', false ); } // Register the WooCommerce JavaScript for the admin area public function woocommerce_scripts() { // Register scripts wp_register_script( 'woocommerce_admin', plugins_url().'/' . class_MRWP_main::WOOCOMMERCE_FOLDER . '/assets/js/admin/woocommerce_admin.min.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), WC_VERSION ); wp_register_script( 'jquery-blockui', plugins_url().'/' . class_MRWP_main::WOOCOMMERCE_FOLDER . '/assets/js/jquery-blockui/jquery.blockUI.min.js', array( 'jquery' ), WC_VERSION, true ); wp_register_script( 'jquery-tiptip', plugins_url().'/' . class_MRWP_main::WOOCOMMERCE_FOLDER . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), WC_VERSION,true ); // Enqueue scripts //wp_enqueue_script( 'iris' ); //wp_enqueue_script( 'woocommerce_admin' ); } // Show row meta on the plugin screen public static function plugin_row_meta( $links, $file ) { if ( strpos( $file, class_MRWP_main::PLUGIN_NAME ) !== false ) { $new_links = array( '' . __('Documentation', 'mondialrelay-wordpress') . '', '' . __('Espace client', 'mondialrelay-wordpress') . '', ); $links = array_merge( $links, $new_links ); } return $links; } // Add Mondial Relay menu public function MondialRelayMenu() { $mondialrelay_menu_position = get_option( 'mondialrelay_menu_position', class_MRWP_main::MENU_POSITION ); add_menu_page( __('Mondial Relay - Mondial Relay pour WordPress', 'mondialrelay-wordpress'), __('Mondial Relay', 'mondialrelay-wordpress'), 'manage_woocommerce', 'wp-mondialrelay', array($this, 'MondialRelayPage'), 'dashicons-location', $mondialrelay_menu_position ); $pagename = add_submenu_page( 'wp-mondialrelay', __('Création en masse - Mondial Relay pour WordPress', 'mondialrelay-wordpress'), __('Création en masse', 'mondialrelay-wordpress'), 'manage_woocommerce', 'wp-mondialrelay-mass-expeditions', array( $this, 'MondialRelayMassShipping' ) ); // Enqueue JS for this page only // @see https://wordpress.stackexchange.com/a/76420 add_action( 'load-' . $pagename, array( $this, 'enqueue_list_script' ) ); $pagename = add_submenu_page( 'wp-mondialrelay', __('Expéditions - Mondial Relay pour WordPress', 'mondialrelay-wordpress'), __('Expéditions', 'mondialrelay-wordpress'), 'manage_woocommerce', 'wp-mondialrelay-expeditions', array( $this, 'MondialRelayShipping' ) ); // Enqueue JS for this page only add_action( 'load-' . $pagename, array( $this, 'enqueue_list_script' ) ); add_submenu_page( 'wp-mondialrelay', __('Maintenance - Mondial Relay pour WordPress', 'mondialrelay-wordpress'), __('Maintenance', 'mondialrelay-wordpress'), 'manage_woocommerce', 'wp-mondialrelay-maintenance', array($this, 'MondialRelayMaintenance') ); } // Notification when the plugin has an update available public function notificationMenu() { if (false !== ($contents = @file_get_contents($this->current_version))) { $current = file_get_contents($this->current_version); } else { $current = $this->version; } if (version_compare($this->version, $current, '<')) { $submenu['wp-mondialrelay'][5][0] .= "1"; $menu[$this->menu_position][0] .= "1"; } } // Mondial Relay options page function MondialRelayPage($settings) { require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/parts/MRWP-admin-page.php'; } // Expeditions listing page of Mondial Relay function MondialRelayShipping($settings) { require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/parts/MRWP-admin-history.php'; } // Mass Expeditions function MondialRelayMassShipping($settings) { require_once plugin_dir_path( __DIR__ ) . 'admin/parts/MRWP-admin-mass-shipping.php'; } // Mondial Relay maintenance page function MondialRelayMaintenance($settings) { global $wpdb; $prefixe = $wpdb->prefix; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/parts/MRWP-admin-maintenance.php'; } // Mondial Relay in a WooCommerce order function actions_mr_meta_box($order_id) { add_meta_box( 'mondialrelay_expedition_meta_box', __( 'Mondial Relay', 'mondialrelay-wordpress' ), array($this, 'actions_mr_meta_box_callback'), 'shop_order', 'side' ); } // Mondial Relay function in a WooCommerce order function actions_mr_meta_box_callback( $order ) { global $wpdb; $prefixe = $wpdb->prefix; $order_id = $order->ID; // Check if the order uses Mondial Relay $mondial_relay_shipping_code = class_MRWP_db::get_meta_champ($order_id, 'Mondial Relay Shipping Code'); $isMR = $mondial_relay_shipping_code; if (isset($isMR) && $isMR != 'HMR' && $isMR != '' ) { // Display the right box wp_nonce_field( 'actions_mr_meta_box', 'actions_mr_meta_box_nonce' ); // Check if a Mondial Relay expedition already exists $exist_expedition = class_MRWP_db::get_meta_champ($order_id, 'ExpeditionNum', 1); // A Mondial Relay expedition already exists for this order if (isset($exist_expedition) && $exist_expedition) { $expedition_num = class_MRWP_db::get_meta_champ($order_id, 'ExpeditionNum'); $expedition_statusid = class_MRWP_db::get_meta_champ($order_id, 'ExpeditionStatus'); $expedition_status = class_MRWP_helpers::etat_expedition($expedition_statusid); // Get Mondial Relais oint if exists $point_mondial_relay = class_MRWP_db::get_meta_champ($order_id, 'Mondial Relay Parcel Shop ID'); ?>
$params_compte['mondialrelay_code_client'], 'Expeditions' => $expedition_num, 'Langue' => $liv_rel_pays_mondial_relay, ); // Generation of the security key $code = implode("", $params); $code .= $params_compte['mondialrelay_cle_privee']; $params["Security"] = strtoupper(md5($code)); try{ if ($client == '') { $callback = 789; } else { $etiquette = $client->WSI3_GetEtiquettes($params)->WSI3_GetEtiquettesResult; $callback = $etiquette->STAT; } } catch(Exception $e){ $debug_except .= $e; $callback = 789; } if ($callback == 0) { // Colis tracking add_thickbox(); // Format 10x15 //$etiquette->URL_PDF_10x15 = str_replace('A4', '10x15', $etiquette->URL_PDF_A4); ?>

" data-order="" data-expedition="" data-langue="">

class_MRWP_main::MODE_COL, 'ModeLiv' => $mondial_relay_shipping_code, 'Poids' => $mondial_relay_parcel_weight, 'Assurance' => $assurance, ); $this->actions_mr_meta_box_create_view($order_id, $data); } } else { ?>
prefix; // Get the debug mode $mondialrelay_debug = get_option('mondialrelay_debug', class_MRWP_main::DEBUG); // Get the order number $order_id = intval( $_POST['order'] ); // Get the Mondial Relay parameters $params_compte = class_MRWP_order::get_params_compte(); // Mondial Relay WebService $client = new SoapClient(class_MRWP_main::MONDIALRELAY_WEBSERVICE); // Get the Mondial Relay point $id_mondial_relay = class_MRWP_db::get_meta_champ($order_id, 'Mondial Relay Parcel Shop ID'); if ((isset($id_mondial_relay) && $id_mondial_relay)) { $explode_id_mondial_relay = explode('-', $id_mondial_relay); $params_livraison = class_MRWP_order::get_params_livraison(); $params_livraison['liv_rel_pays_mondial_relay'] = $explode_id_mondial_relay[0]; $params_livraison['liv_rel_mondial_relay'] = $explode_id_mondial_relay[1]; } else { $params_livraison['liv_rel_pays_mondial_relay'] = ''; $params_livraison['liv_rel_mondial_relay'] = ''; } // Get the sender parameters $params_expediteur = class_MRWP_order::get_params_expediteur(); // Get the recipient parameters $params_destinataire = class_MRWP_order::get_params_destinataire($order_id); // Hook to change the expedition address $params_destinataire = apply_filters( 'mrwp_chg_expe_add', $params_destinataire, $order_id); // Remove accents foreach($params_destinataire as $key => $champ) { $params_destinataire[$key] = remove_accents($champ); } // Split adress if more than 32 characters $numchar = strlen($params_destinataire['_shipping_address_1']); if ($numchar > 32 ) { $numcut = strrpos($params_destinataire['_shipping_address_1'],' ', -($numchar - 30)); $params_destinataire['_shipping_address_2'] = substr($params_destinataire['_shipping_address_1'], $numcut + 1, $numchar); $params_destinataire['_shipping_address_1'] = substr($params_destinataire['_shipping_address_1'], 0, $numcut); } if (strlen($params_destinataire['_shipping_company']) > 32 ) { $params_destinataire['_shipping_company'] = substr($params_destinataire['_shipping_company'], 0, 31); } // Remove quotes (') on Dest_Ad3 parameter for the Mondial Relay webservice $params_destinataire['_shipping_address_1'] = str_replace("'", " ", $params_destinataire['_shipping_address_1']); // Remove CRLF codes and specials characters for the Mondial Relay webservice $elim = array("'", "°", "’", "¨", "«", "»", "(", ")", "+", "''", '"', "'"); $params_destinataire['_shipping_full_name'] = str_replace(" ","", $params_destinataire['_shipping_full_name']); $params_destinataire['_shipping_full_name'] = str_replace(" ","", $params_destinataire['_shipping_full_name']); $params_destinataire['_shipping_full_name'] = str_replace($elim, " ", $params_destinataire['_shipping_full_name']); $params_destinataire['_shipping_company'] = str_replace(" ","", $params_destinataire['_shipping_company']); $params_destinataire['_shipping_company'] = str_replace(" ","", $params_destinataire['_shipping_company']); $params_destinataire['_shipping_company'] = str_replace("°"," ", $params_destinataire['_shipping_company']); $params_destinataire['_shipping_company'] = str_replace($elim, " ", $params_destinataire['_shipping_company']); $params_destinataire['_shipping_company'] = preg_replace("/@/", ' ', $params_destinataire['_shipping_company']); $params_destinataire['_shipping_address_1'] = str_replace(" ","", $params_destinataire['_shipping_address_1']); $params_destinataire['_shipping_address_1'] = str_replace(" ","", $params_destinataire['_shipping_address_1']); $params_destinataire['_shipping_address_1'] = str_replace($elim, " ", $params_destinataire['_shipping_address_1']); $params_destinataire['_shipping_address_2'] = str_replace(" ","", $params_destinataire['_shipping_address_2']); $params_destinataire['_shipping_address_2'] = str_replace(" ","", $params_destinataire['_shipping_address_2']); $params_destinataire['_shipping_address_2'] = str_replace($elim, " ", $params_destinataire['_shipping_address_2']); $params_destinataire['_shipping_city'] = str_replace(" ","", $params_destinataire['_shipping_city']); $params_destinataire['_shipping_city'] = str_replace(" ","", $params_destinataire['_shipping_city']); $params_destinataire['_shipping_city'] = str_replace($elim, " ", $params_destinataire['_shipping_city']); $params_destinataire['_shipping_postcode'] = str_replace(" ","", $params_destinataire['_shipping_postcode']); $params_destinataire['_shipping_postcode'] = str_replace(" ","", $params_destinataire['_shipping_postcode']); $params_destinataire['_shipping_postcode'] = str_replace($elim, " ", $params_destinataire['_shipping_postcode']); $params_destinataire['_shipping_country'] = str_replace(" ","", $params_destinataire['_shipping_country']); $params_destinataire['_shipping_country'] = str_replace(" ","", $params_destinataire['_shipping_country']); $params_destinataire['_shipping_country'] = str_replace($elim, " ", $params_destinataire['_shipping_country']); // Get the order parameters $params_commande =class_MRWP_order::get_params_commande(); $params_commande['ModeCol'] = class_MRWP_main::MODE_COL; $params_commande['ModeLiv'] = class_MRWP_db::get_meta_champ($order_id, 'Mondial Relay Shipping Code'); $params_commande['NDossier'] = $order_id; $params_commande['NClient'] = apply_filters( 'mrwp_add_nclient', $params_commande['NClient']); // Get assurance $assurance = intval( $_POST['Assurance'] ); // Get the collect point parameters $params_collecte = class_MRWP_order::get_params_collecte(); // Expedition parameters $params = array( 'Enseigne' => $params_compte['mondialrelay_code_client'] ,'ModeCol' => $params_commande['ModeCol'] ,'ModeLiv' => $params_commande['ModeLiv'] ,'NDossier' => $params_commande['NDossier'] ,'NClient' => $params_commande['NClient'] ,'Expe_Langage' => $params_expediteur['mondialrelay_vendeur_langage'] ,'Expe_Ad1' => $params_expediteur['mondialrelay_vendeur_adresse1'] ,'Expe_Ad2' => $params_expediteur['mondialrelay_vendeur_adresse2'] ,'Expe_Ad3' => $params_expediteur['mondialrelay_vendeur_adresse3'] ,'Expe_Ad4' => $params_expediteur['mondialrelay_vendeur_adresse4'] ,'Expe_Ville' => $params_expediteur['mondialrelay_vendeur_ville'] ,'Expe_CP' => $params_expediteur['mondialrelay_vendeur_cp'] ,'Expe_Pays' => $params_expediteur['mondialrelay_vendeur_pays'] ,'Expe_Tel1' => $params_expediteur['mondialrelay_vendeur_tel'] ,'Expe_Tel2' => $params_expediteur['mondialrelay_vendeur_tel2'] ,'Expe_Mail' => $params_expediteur['mondialrelay_vendeur_email'] ,'Dest_Langage' => $params_destinataire['_shipping_langage'] ,'Dest_Ad1' => $params_destinataire['_shipping_full_name'] ,'Dest_Ad2' => $params_destinataire['_shipping_company'] ,'Dest_Ad3' => $params_destinataire['_shipping_address_1'] ,'Dest_Ad4' => $params_destinataire['_shipping_address_2'] ,'Dest_Ville' => $params_destinataire['_shipping_city'] ,'Dest_CP' => $params_destinataire['_shipping_postcode'] ,'Dest_Pays' => $params_destinataire['_shipping_country'] ,'Dest_Tel1' => $params_destinataire['_billing_phone'] ,'Dest_Mail' => $params_destinataire['_billing_email'] ,'Poids' => $params_commande['Poids'] ,'Longueur' => $params_commande['Longueur'] ,'Taille' => $params_commande['Taille'] ,'NbColis' => $params_commande['NbColis'] ,'CRT_Valeur' => $params_commande['CRT_Valeur'] ,'CRT_Devise' => $params_commande['CRT_Devise'] ,'Exp_Valeur' => $params_commande['Exp_Valeur'] ,'Exp_Devise' => $params_commande['Exp_Devise'] ,'COL_Rel_Pays' => $params_collecte['col_rel_pays_mondial_relay'] ,'COL_Rel' => $params_collecte['col_rel_mondial_relay'] ,'LIV_Rel_Pays' => $params_livraison['liv_rel_pays_mondial_relay'] ,'LIV_Rel' => $params_livraison['liv_rel_mondial_relay'] ,'TAvisage' => $params_commande['TAvisage'] ,'TReprise' => $params_commande['TReprise'] ,'Montage' => $params_commande['Montage'] ,'TRDV' => $params_commande['TRDV'] //,'Instructions' => $params_commande['Instructions'] ,'Instructions' => '' ,'Assurance' => $assurance ); // Generation of the security key $code = implode("", $params); $code .= $params_compte['mondialrelay_cle_privee']; $params["Security"] = strtoupper(md5($code)); // Expedition creation // Si le num d'expé existe déjà, alors message d'erreur, sinon création d'expédition $expe_exist = class_MRWP_db::get_meta_champ($order_id, 'ExpeditionNum'); if ($expe_exist) { $callback = 421; } else { try{ $expedition = $client->WSI2_CreationExpedition($params)->WSI2_CreationExpeditionResult; $callback = $expedition->STAT; } catch(Exception $e){ $debug_except .= $e; $callback = 789; } } // Statut code if ($callback != 0) { echo $callback . '
' . class_MRWP_helpers::statut($callback); if ($mondialrelay_debug) { if ($callback == 789) { class_MRWP_helpers::VarPrint($debug_except); } class_MRWP_helpers::VarPrint($params); } } elseif ($callback == 0) { // Add the Mondial Relay expedition paramaters in the database $champs_bdd = class_MRWP_order::get_expedition_champs($expedition, $params_commande['NbColis']); class_MRWP_db::insert_meta_champs($order_id, $champs_bdd); // Get the Mondial Relay email $email = class_MRWP_order::get_params_emails($order_id); // Hook creation after db updated do_action('MRWP_after_expedition_creation', $order_id); // Update the checkout status $checkout_status = get_option( 'mondialrelay_state_order', '' ); if ($checkout_status) { $order = new WC_Order($order_id); if (!empty($order)) { $order->update_status($checkout_status); } } // br in html $email['message'] = nl2br($email['message']); // Check if email send is activated if ($email['send'] == 1) { $destinataire = $params_destinataire['_billing_email']; // Send the Mondial Relay tracking email to the client $mail = wc_mail($destinataire, $email['sujet'], $email['message']); } // Hook creation after db updated do_action('MRWP_after_order_status_updated', $order_id); } die(); } // Javascript script for the tracking of the Mondial Relay expedition function tracking_javascript() { ?> $params_compte['mondialrelay_code_client'], 'Expedition' => $expedition, 'Langue' => $langue, ); // Generation of the security key $code = implode("", $params); $code .= $params_compte['mondialrelay_cle_privee']; $params["Security"] = strtoupper(md5($code)); try{ $tracking = $client->WSI2_TracingColisDetaille($params)->WSI2_TracingColisDetailleResult; $callback = $tracking->STAT; } catch(Exception $e){ $debug_except .= $e; $callback = 789; } if ($callback == 0) { $response = 1; $notification = 'Succès'; // Correct tracking result } elseif ($callback == 80 || $callback == 81 || $callback == 82){ $response = 1; $notification = $callback . ' : ' . class_MRWP_helpers::statut($callback ); update_post_meta($order_id, 'ExpeditionStatus', $callback); update_post_meta($order_id, 'ExpeditionStatusDate', time()); // Update the status if ( 82 == $callback ) { $order_delivered_status = get_option( 'mondialrelay_state_order_delivered', 0 ); $order = new WC_Order($order_id); if ( '' != $order_delivered_status ) { $order->update_status( $order_delivered_status ); } } // Incorrect tracking result } elseif ($callback == 83){ $response = 0; $notification = $callback . ' : ' . class_MRWP_helpers::statut($callback ); update_post_meta($order_id, 'ExpeditionStatus', $callback); update_post_meta($order_id, 'ExpeditionStatusDate', time()); // Error } else { $response = 0; $notification = $callback . ' : ' . class_MRWP_helpers::statut($callback ); if ($mondialrelay_debug) { $notification = $notification . '

' . print_r($params, true); } } $debug = 0; if ($mondialrelay_debug) { $debug = 1; } $data = array( 'response' => $response, 'notification' => $notification, 'content' => json_encode( $tracking ), 'debug' => $debug, ); echo json_encode( $data ); die(); } } ?>