From ca8c01ed4cf76b52d38403b2e49ec9850fa6ef1d Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Thu, 18 Jul 2024 15:04:18 +0200 Subject: [PATCH] aa --- app/CustomFuncPao.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php index 254ab105..40ead42f 100644 --- a/app/CustomFuncPao.php +++ b/app/CustomFuncPao.php @@ -525,18 +525,25 @@ function showOrdini() function setOrdine($idinternet, $mode) { - $str = ""; - $ordine = Orderdetail::where('IdInternet', $idinternet)->get(); + try { + $str = ""; + $ordine = Orderdetail::where('IdInternet', $idinternet)->get(); - $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first(); + if ($ordine) + $str .= getarraystr($ordine) . "
"; - $str .= getarraystr($prodotto) . "
"; - $str .= getarraystr($ordine) . "
"; + $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first(); - if ($mode === 'del' && $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(); } return $str; @@ -1760,7 +1767,6 @@ function getClienteByIdInternet_Ordine($idInternet) try { $clienteinGM = Clientegm::where('IdInternet', $idInternet)->first(); - } catch (\Exception $e) { return null; } @@ -1773,7 +1779,6 @@ function getClienteByIdCodClienteInternet($codClienteInternet) try { $clienteinGM = Clientegm::where('codClienteInternet', $codClienteInternet)->first(); - } catch (\Exception $e) { return null; } @@ -1781,13 +1786,13 @@ function getClienteByIdCodClienteInternet($codClienteInternet) return $clienteinGM; } -function getClienti() { +function getClienti() +{ try { $clienti = Clientegm::all(); dd($clienti); - } catch (\Exception $e) { return null; } -} \ No newline at end of file +}