diff --git a/services/nginx/app/modules/xlvask/helpers/xlvask_parser_ikke_ht_dysebom_mellom_bil_trailer.php b/services/nginx/app/modules/xlvask/helpers/xlvask_parser_ikke_ht_dysebom_mellom_bil_trailer.php new file mode 100644 index 00000000..44745cd8 --- /dev/null +++ b/services/nginx/app/modules/xlvask/helpers/xlvask_parser_ikke_ht_dysebom_mellom_bil_trailer.php @@ -0,0 +1,26 @@ +setup('ikke_ht_dysebom_mellom_bil_trailer'); + } + + + /** + * @inheritDoc + * @throws Exception + */ + protected function parse(xlvask_wash_item $wash_item, xlvask_usage_log $xlvask_usage_log): products_o + { + return (new products_o())->select(64); // Irrelevant product ID + } +} \ No newline at end of file diff --git a/services/nginx/app/modules/xlvask/xlvask_helpers.php b/services/nginx/app/modules/xlvask/xlvask_helpers.php index 95cca407..09da031d 100644 --- a/services/nginx/app/modules/xlvask/xlvask_helpers.php +++ b/services/nginx/app/modules/xlvask/xlvask_helpers.php @@ -50,6 +50,7 @@ require_once WD . '/modules/xlvask/helpers/xlvask_parser_ikke_ht_dysebom_p_tag.p require_once WD . '/modules/xlvask/helpers/xlvask_parser_ht_osc_sider.php'; require_once WD . '/modules/xlvask/helpers/xlvask_parser_kun_b_rster_ved_hytten.php'; require_once WD . '/modules/xlvask/helpers/xlvask_parser_h_nger.php'; +require_once WD . '/modules/xlvask/helpers/xlvask_parser_ikke_ht_dysebom_mellom_bil_trailer.php'; use helpers\xlvask_cache; use helpers\xlvask_create_customer; diff --git a/services/nginx/app/objects/orders_o.php b/services/nginx/app/objects/orders_o.php index 7a82c965..71ed9ab0 100644 --- a/services/nginx/app/objects/orders_o.php +++ b/services/nginx/app/objects/orders_o.php @@ -971,7 +971,7 @@ class orders_o extends db // Prepare the SQL query to find orders with possible duplicates in the date range $dateFrom = $db->escape_string($dateFrom); $dateTo = $db->escape_string($dateTo); - $sql = "SELECT id, customer_id, reg_1, created_at FROM $this->table WHERE created_at BETWEEN '$dateFrom' AND '$dateTo' AND deleted_at IS NULL"; + $sql = "SELECT id, customer_id, reg_1, reg_2, reg_3, created_at FROM $this->table WHERE created_at BETWEEN '$dateFrom' AND '$dateTo' AND deleted_at IS NULL"; $result = $db->query($sql); if ($result->num_rows === 0) { return []; // No orders found in the date range @@ -981,30 +981,35 @@ class orders_o extends db $tmp = [ 'id' => (int)$row['id'], 'reg_1' => (string)$row['reg_1'], + 'reg_2' => (string)$row['reg_2'] ?? '', + 'reg_3' => (string)$row['reg_3'] ?? '', 'created_at' => (string)$row['created_at'], ]; // Add the order to the list $orders[$tmp['reg_1']][] = [ 'id' => $tmp['id'], 'reg_1' => $tmp['reg_1'], + 'reg_2' => (string)$row['reg_2'] ?? '', + 'reg_3' => (string)$row['reg_3'] ?? '', 'created_at' => $tmp['created_at'], 'object' => (new orders_o())->select((int)$tmp['id']) ]; } - // Filter out orders with more than one entry for the same registration number (in a 24 hour period) + // Filter out orders with more than one entry for the same registration numbers (in a 24 hour period) $possibleDuplicates = []; // Loop through the registration numbers foreach ( $orders as $reg_1 => $orderList ) { // If there are more than one order for the same registration number, add it to the possible duplicates if (count($orderList) > 1) { + // Loop through the orders and check if they are within 24 hours of each other $filteredOrders = []; foreach ( $orderList as $order ) { - // Check if the order is within 24 hours of the first order + // Check if the order is within 24 hours of the previous order (if any) if (empty($filteredOrders)) { $filteredOrders[] = $order; // Add the first order } else { - // Check if the order is within 24 hours of the first order + // Check if the order is within 24 hours of the previous order $firstOrderTime = strtotime($filteredOrders[0]['created_at']); $currentOrderTime = strtotime($order['created_at']); if ($currentOrderTime - $firstOrderTime <= 86400) { // 86400 seconds = 24 hours diff --git a/services/nginx/app/routes/InvoicingPeriodRoute.php b/services/nginx/app/routes/InvoicingPeriodRoute.php index 6bd2b7fc..3e37db8a 100644 --- a/services/nginx/app/routes/InvoicingPeriodRoute.php +++ b/services/nginx/app/routes/InvoicingPeriodRoute.php @@ -500,7 +500,7 @@ class InvoicingPeriodRoute // Construct the transaction object from the order return $transaction['object']; }, $order), - true, // Requires action because there are possible duplicates + false, // Requires action because there are possible duplicates $customer['id'] ?? null // Use the id from the customer object if available ); }