2 Commits

2 changed files with 21 additions and 18 deletions

View File

@@ -239,25 +239,28 @@ class Siti_Stock_Supplier_Exports {
$config['supplier'] $config['supplier']
); );
$body_lines = array(); $rows_count = count( $data['rows'] );
$body_lines[] = sprintf( $body = '';
$body .= '<p>' . sprintf(
/* translators: %s supplier name */ /* translators: %s supplier name */
__( 'Overzicht voor leverancier %s.', 'siti-stock-plugin' ), esc_html__( 'Overzicht voor leverancier %s.', 'siti-stock-plugin' ),
$config['supplier'] esc_html( $config['supplier'] )
); ) . '</p>';
$body_lines[] = sprintf( $body .= '<p>' . sprintf(
/* translators: %d total items */ /* translators: %d total items */
__( 'Totaal aantal regels: %d.', 'siti-stock-plugin' ), esc_html__( 'Totaal aantal regels: %d.', 'siti-stock-plugin' ),
count( $data['rows'] ) (int) $rows_count
); ) . '</p>';
if ( empty( $data['rows'] ) ) {
$body_lines[] = __( 'Er zijn geen bestellingen gevonden in de afgelopen 24 uur.', 'siti-stock-plugin' );
}
$body_lines[] = '';
$body_lines[] = $csv;
$headers = array( 'Content-Type: text/plain; charset=UTF-8' ); if ( empty( $data['rows'] ) ) {
$sent = wp_mail( $admin_email, $subject, implode( "\r\n", $body_lines ), $headers ); $body .= '<p>' . esc_html__( 'Er zijn geen bestellingen gevonden in de afgelopen 24 uur.', 'siti-stock-plugin' ) . '</p>';
} else {
$body .= '<p>' . esc_html__( 'CSV-overzicht (kopieer onderstaande tabel):', 'siti-stock-plugin' ) . '</p>';
$body .= '<pre style="font-family: monospace; white-space: pre;">' . esc_html( $csv ) . '</pre>';
}
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
$sent = wp_mail( $admin_email, $subject, $body, $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' ) );

View File

@@ -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.6 * Version: 1.2.7
* 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.6' ); define( 'SITI_STOCK_PLUGIN_VERSION', '1.2.7' );
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__ ) );