From 664330cd13758b5927d9b2f238263002a311af6b Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Thu, 18 Jul 2024 15:07:56 +0200 Subject: [PATCH] aaa --- app/CustomFuncPao.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php index f1546ec6..3d83fe3b 100644 --- a/app/CustomFuncPao.php +++ b/app/CustomFuncPao.php @@ -527,20 +527,24 @@ function setOrdine($idinternet, $mode) { try { $str = "setOrdine"; - $ordine = Orderdetail::where('IdInternet', $idinternet)->get(); + $ordini = Orderdetail::where('IdInternet', $idinternet)->get(); - if ($ordine) - $str .= getarraystr($ordine) . "
"; + if (!$ordini->isEmpty()) { + $ordine = $ordini[0]; - $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first(); + if ($ordine) + $str .= getarraystr($ordine) . "
"; - if ($prodotto) - $str .= getarraystr($prodotto) . "
"; + $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first(); - if ($mode === 'AAAdel' && $ordine) { - // delete record $ordine - $deletedCount = Orderdetail::where('IdInternet', $idinternet)->delete(); - $str .= "
Numero di record eliminati: " . $deletedCount . ""; + if ($prodotto) + $str .= getarraystr($prodotto) . "
"; + + if ($mode === 'AAAdel' && $ordine) { + // delete record $ordine + $deletedCount = Orderdetail::where('IdInternet', $idinternet)->delete(); + $str .= "
Numero di record eliminati: " . $deletedCount . ""; + } } } catch (\Exception $e) { $str .= "Errore: " . $e->getMessage();