protection double facture
This commit is contained in:
parent
75cd96080a
commit
16fda3c959
@ -46,12 +46,19 @@ class PEPPOL_Woocommerce_controller {
|
||||
public static function post_payment(int $order_id): void {
|
||||
$order_id = (int) $order_id;
|
||||
|
||||
global $wpdb;
|
||||
|
||||
if ($order_id <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$order = \wc_get_order($order_id);
|
||||
|
||||
$is_invoice_exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}esi_peppol_invoices WHERE order_id = %d", $order_id));
|
||||
if ($is_invoice_exists > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$order instanceof \WC_Order) {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user