Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7e757f0cd | |||
| 08551e0013 |
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
class Siti_Stock_Supplier_Exports {
|
class Siti_Stock_Supplier_Exports {
|
||||||
|
|
||||||
const CRON_HOOK = 'siti_stock_plugin_supplier_export';
|
const CRON_HOOK = 'siti_stock_plugin_supplier_export';
|
||||||
const SUPPLIER_META_KEY = '_wpbc_supplier';
|
const SUPPLIER_META_KEY = '_wpci_supplier';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Siti_Stock_Settings
|
* @var Siti_Stock_Settings
|
||||||
@@ -258,7 +258,7 @@ class Siti_Stock_Supplier_Exports {
|
|||||||
$body_lines[] = $csv;
|
$body_lines[] = $csv;
|
||||||
|
|
||||||
$headers = array( 'Content-Type: text/plain; charset=UTF-8' );
|
$headers = array( 'Content-Type: text/plain; charset=UTF-8' );
|
||||||
$sent = wp_mail( $admin_email, $subject, implode( "\n", $body_lines ), $headers );
|
$sent = wp_mail( $admin_email, $subject, implode( "\r\n", $body_lines ), $headers );
|
||||||
|
|
||||||
if ( ! $sent ) {
|
if ( ! $sent ) {
|
||||||
return new WP_Error( 'siti_stock_mail_failed', __( 'E-mail verzenden is mislukt.', 'siti-stock-plugin' ) );
|
return new WP_Error( 'siti_stock_mail_failed', __( 'E-mail verzenden is mislukt.', 'siti-stock-plugin' ) );
|
||||||
@@ -307,16 +307,18 @@ class Siti_Stock_Supplier_Exports {
|
|||||||
private function collect_rows_for_supplier( $supplier ) {
|
private function collect_rows_for_supplier( $supplier ) {
|
||||||
$key = $this->normalize_supplier_key( $supplier );
|
$key = $this->normalize_supplier_key( $supplier );
|
||||||
|
|
||||||
$after_timestamp = current_time( 'timestamp' ) - DAY_IN_SECONDS;
|
$site_timezone = function_exists( 'wp_timezone' ) ? wp_timezone() : new DateTimeZone( wp_timezone_string() );
|
||||||
$date_filter = array(
|
$after_date = new DateTimeImmutable( 'now', $site_timezone );
|
||||||
'after' => gmdate( 'Y-m-d H:i:s', $after_timestamp ),
|
$after_date = $after_date->sub( new DateInterval( 'P1D' ) );
|
||||||
);
|
$after_utc = $after_date->setTimezone( new DateTimeZone( 'UTC' ) );
|
||||||
|
|
||||||
if ( class_exists( 'WC_DateTime' ) ) {
|
$date_query = array(
|
||||||
$after_object = new WC_DateTime( '@' . $after_timestamp );
|
array(
|
||||||
$after_object->setTimezone( new DateTimeZone( 'UTC' ) );
|
'column' => 'date_created_gmt',
|
||||||
$date_filter = array( 'after' => $after_object );
|
'after' => $after_utc->format( 'Y-m-d H:i:s' ),
|
||||||
}
|
'inclusive' => true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
$query = new WC_Order_Query(
|
$query = new WC_Order_Query(
|
||||||
array(
|
array(
|
||||||
@@ -324,7 +326,7 @@ class Siti_Stock_Supplier_Exports {
|
|||||||
'limit' => -1,
|
'limit' => -1,
|
||||||
'type' => 'shop_order',
|
'type' => 'shop_order',
|
||||||
'return' => 'objects',
|
'return' => 'objects',
|
||||||
'date_created' => $date_filter,
|
'date_query' => $date_query,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -437,7 +439,7 @@ class Siti_Stock_Supplier_Exports {
|
|||||||
$lines[] = sprintf( '%s;%d', $sku, $quantity );
|
$lines[] = sprintf( '%s;%d', $sku, $quantity );
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode( "\n", $lines );
|
return implode( "\r\n", $lines );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Siti Stock Plugin
|
* Plugin Name: Siti Stock Plugin
|
||||||
* Plugin URI: https://github.com/SitiWeb/siti-stock-plugin
|
* Plugin URI: https://github.com/SitiWeb/siti-stock-plugin
|
||||||
* Description: Synchroniseert WooCommerce voorraad met het externe Siti voorraadplatform.
|
* Description: Synchroniseert WooCommerce voorraad met het externe Siti voorraadplatform.
|
||||||
* Version: 1.2.3
|
* Version: 1.2.5
|
||||||
* Author: Siti Web
|
* Author: Siti Web
|
||||||
* Author URI: https://www.siti.nl
|
* Author URI: https://www.siti.nl
|
||||||
* Requires PHP: 8.1
|
* Requires PHP: 8.1
|
||||||
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'SITI_STOCK_PLUGIN_VERSION', '1.2.3' );
|
define( 'SITI_STOCK_PLUGIN_VERSION', '1.2.5' );
|
||||||
define( 'SITI_STOCK_PLUGIN_FILE', __FILE__ );
|
define( 'SITI_STOCK_PLUGIN_FILE', __FILE__ );
|
||||||
define( 'SITI_STOCK_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
define( 'SITI_STOCK_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user