Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update WP version and fix PCP errors #194

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion postnl-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
* Description: With this plug-in you can easily confirm your PostNL shipments and print shipping labels in no time. In addition, your customers are more in control because they choose where and when they receive their order.
* Author: PostNL
* Author URI: https://postnl.post/
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Version: 5.6.2
* Tested up to: 6.6
* Tested up to: 6.7
* Requires Plugins: woocommerce
* WC requires at least: 4.0
* WC tested up to: 9.3
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: PostNL, shadim, abdalsalaam
Tags: woocommerce, export, delivery, packages, PostNL, Shipping
Requires at least: 4.6
Requires PHP: 5.6
Tested up to: 6.6
Tested up to: 6.7
Stable tag: 5.6.2
WC requires at least: 4.0
WC tested up to: 9.3
OlfatProgressus marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
4 changes: 2 additions & 2 deletions src/Emails/WC_Email_Smart_Return.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct() {
* @since 3.1.0
*/
public function get_default_subject() {
return __( '[{site_title}]: PostNL Smart Returns', 'woocommerce' );
return __( '[{site_title}]: PostNL Smart Returns', 'postnl-for-woocommerce' );
}

/**
Expand All @@ -63,7 +63,7 @@ public function get_default_subject() {
* @since 3.1.0
*/
public function get_default_heading() {
return __( 'PostNL Smart Returns', 'woocommerce' );
return __( 'PostNL Smart Returns', 'postnl-for-woocommerce' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Frontend/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function validate_posted_data( $data ) {
$nonce_value = wc_get_var( $_REQUEST['woocommerce-process-checkout-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // phpcs:ignore
$expiry_message = sprintf(
/* translators: %s: shop cart url */
__( 'Sorry, your session has expired. <a href="%s" class="wc-backward">Return to shop</a>', 'woocommerce' ),
__( 'Sorry, your session has expired. <a href="%s" class="wc-backward">Return to shop</a>', 'postnl-for-woocommerce' ),
esc_url( wc_get_page_permalink( 'shop' ) )
);

Expand Down
3 changes: 3 additions & 0 deletions src/Order/Bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,15 @@ public function bulk_action_change_shipping_options( $redirect, $doaction, $obje

if ( $have_label_file ) {
$array_messages[] = array(
// Translators: %1$d is the order ID.
'message' => sprintf( esc_html__( 'Order #%1$d already has a label.', 'postnl-for-woocommerce' ), $order_id ),
'type' => 'error',
);
}

if ( ! $match_shipping_zones ) {
$array_messages[] = array(
// Translators: %1$d is the order ID.
'message' => sprintf( esc_html__( 'Order #%1$d is from another shipping zone.', 'postnl-for-woocommerce' ), $order_id ),
'type' => 'error',
);
Expand Down Expand Up @@ -666,6 +668,7 @@ public function generate_label_and_notes( $order_id, $post_data ) {
$order->add_order_note( $tracking_note, $customer_note );
$label_link = esc_url( $this->get_download_label_url( $order_id ) );
$result['message'] = array(
// Translators: %1$s is the order ID, %2$s is the link to download the file, %3$s is the closing link tag.
'message' => sprintf( esc_html__( '#%1$s : PostNL label has been created - %2$sdownload file%3$s', 'postnl-for-woocommerce' ),
$order_id, '<a href="' . $label_link . '" download>', '</a>' ),
'type' => 'success',
Expand Down
5 changes: 4 additions & 1 deletion src/Order/Single.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,10 @@ public function postnl_activate_return_function() {

wp_send_json_success();
} else {
throw new \Exception( esc_html__( print_r( $response['errorsPerBarcode'][0]['errors'][0], true ) ) );
$error_message = isset($response['errorsPerBarcode'][0]['errors'][0]) ? $response['errorsPerBarcode'][0]['errors'][0] : 'Unknown error';

// Translators: %s is the error message.
throw new \Exception( sprintf( esc_html__( 'Error: %s', 'postnl-for-woocommerce' ), esc_html( $error_message ) ) );
}
} catch ( \Exception $e ) {
wp_send_json_error(
Expand Down
3 changes: 2 additions & 1 deletion src/Rest_API/Shipping/Item_Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,8 @@ protected function check_insurance_amount_limit( $backend_data, $order_total ) {
} // For EU shipments, validate that insurance does not exceed €5000
elseif ( ! $is_non_eu_shipment && 'yes' === $backend_data['insured_shipping'] && $order_total > 5000 ) {
throw new \Exception(
__( 'Insurance amount for EU shipments cannot exceed €5000. Your total is: ' . $order_total, 'postnl-for-woocommerce' )
// Translators: %s is the order total.
sprintf( __( 'Insurance amount for EU shipments cannot exceed €5000. Your total is: %s', 'postnl-for-woocommerce' ), wp_kses_post( $order_total ) )
OlfatProgressus marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Shipping_Method/PostNL.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function instance_form_fields( $form_fields ) {
$currency_symbol = get_woocommerce_currency_symbol();

$form_fields['minimum_for_free_shipping'] = array(
// Translators: %s is the currency symbol.
'title' => sprintf( esc_html__( 'Free shipping from %s', 'postnl-for-woocommerce' ), $currency_symbol ),
'type' => 'number',
'desc_tip' => esc_html__( 'Keep empty if you don’t want to use Free shipping', 'postnl-for-woocommerce' ),
Expand Down
5 changes: 3 additions & 2 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,9 @@ public static function is_eligible_auto_letterbox( $order ) {
$products = $order->get_cart();
}

$is_eligible = self::check_products_for_letterbox( $products );

if( isset( $products ) ) {
$is_eligible = self::check_products_for_letterbox( $products );
}
OlfatProgressus marked this conversation as resolved.
Show resolved Hide resolved
// Save the state for the order.
if ( is_a( $order, 'WC_Order' ) ) {
$order->update_meta_data( '_postnl_letterbox', $is_eligible );
Expand Down
2 changes: 1 addition & 1 deletion templates/checkout/postnl-delivery-day.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class="<?php echo esc_attr( $option['type'] . ' ' . $is_active ); ?>"
name="<?php echo esc_attr( $data['field_name'] ); ?>"
class="postnl_sub_radio"
value="<?php echo esc_attr( $value ); ?>"
<?php echo $is_checked; ?>
<?php echo wp_kses_post( $is_checked ); ?>
OlfatProgressus marked this conversation as resolved.
Show resolved Hide resolved
/>
<i><?php echo wp_kses_post( $is_charged ); ?></i>
<i><?php echo esc_html( $delivery_time ); ?></i>
Expand Down