This commit is contained in:
paoloar77
2024-08-23 15:24:40 +02:00
parent e877e7096e
commit 671173ecd4

View File

@@ -75,14 +75,14 @@ class OrderUpdateGm extends Command
foreach ($all_orderswoo as $orderwoo) {
$this->info("Processing order #{$orderwoo->id}...");
$productLogger->addLog('', "Processing order #{$orderwoo->id}...");
$ordergm = AppOrder::where('IdInternet', $orderwoo->id)->latest('DataOra')->first();
if ($ordergm) {
$this->info("Order #{$orderwoo->id} found in GM, checking status...");
$productLogger->addLog('', "Order #{$orderwoo->id} found in GM, checking status...");
if ($orderwoo->status == 'processing') {
$this->info("Order #{$orderwoo->id} is processing, checking if it needs to be completed...");
if ($ordergm->EnabledWoo == 1) {
$this->info("Order #{$orderwoo->id} needs to be completed, updating WooCommerce...");
$productLogger->addLog('', "Order #{$orderwoo->id} needs to be completed, updating WooCommerce...");
$data = [
'status' => 'completed',
];
@@ -92,9 +92,9 @@ class OrderUpdateGm extends Command
$orderupdated++;
}
} elseif ($orderwoo->status == 'on-hold') {
$this->info("Order #{$orderwoo->id} is on-hold, checking if it needs to be processed...");
$productLogger->addLog('', "Order #{$orderwoo->id} is on-hold, checking if it needs to be processed...");
if ($ordergm->FlagSospeso == 0) {
$this->info("Order #{$orderwoo->id} needs to be processed, updating WooCommerce...");
$productLogger->addLog('', "Order #{$orderwoo->id} needs to be processed, updating WooCommerce...");
$data = [
'status' => 'processing',
];
@@ -105,7 +105,7 @@ class OrderUpdateGm extends Command
}
}
} else {
$this->info("Order #{$orderwoo->id} not found in GM, skipping...");
$productLogger->addLog('', "Order #{$orderwoo->id} not found in GM, skipping...");
}
}