diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php
index 431b9cf9..f05006a4 100644
--- a/app/CustomFuncPao.php
+++ b/app/CustomFuncPao.php
@@ -110,6 +110,7 @@ function formatDateToItalian($date_string, $input_format = 'Y-m-d H:i:s.u')
}
}
+
function setPreOrder($sku, $aggiornapreordine, $debug)
{
try {
@@ -481,6 +482,8 @@ function showOrdini()
->take(20)
->get();
+ $sep = "";
+
// Show the fields of the orders
foreach ($orders as $order) {
$product = Product::where('sku', $order->CodArticoloGM)->first();
@@ -492,9 +495,9 @@ function showOrdini()
$str .= getvalstr("", $order->Codice) . " ";
$str .= getvalstr("", $order->DataOra);
- $str .= getvalstr("Titolo", $titolo);
- $str .= getvalstr("Codice Ordine", $order->IdInternet, true) . " ";
- $str .= getvalstr("Cod. Articolo", $order->CodArticoloGM, true);
+ $str .= getvalstr("", $titolo);
+ $str .= getvalstr("Ordine", $order->IdInternet, true) . " ";
+ $str .= getvalstr("Articolo", $order->CodArticoloGM, true);
$str .= getvalstr("Prezzo", $order->PrezzoLordo);
$str .= getvalstr("Quantità ", $order->Qta);
if ($order->PercSconto)
@@ -502,6 +505,8 @@ function showOrdini()
if ($order->Descrizione)
$str .= getvalstr("Descr", $order->Descrizione);
+ $str .= 'ELIMINA!' . $sep;
+
// $str .= getarraystr($product) . "
";
// $str .= $product;
$str .= '
';
@@ -513,6 +518,27 @@ function showOrdini()
return $str;
}
+function setOrdine($idinternet, $mode)
+{
+ $str = "";
+ $ordine = Orderdetail::where('IdInternet', $idinternet)->get();
+
+ $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first();
+
+ $str .= getarraystr($prodotto) . "
";
+ $str .= getarraystr($ordine) . "
";
+
+ if ($mode === 'del' && $ordine) {
+ // delete record $ordine
+
+ $ordine->delete();
+
+ }
+
+ return $str;
+}
+
+
function showDettOrdini()
{
$str = "Ordini Woocommerce:" . PHP_EOL . '
';
diff --git a/routes/web.php b/routes/web.php
index d11bf5ae..acce1584 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -6105,6 +6105,10 @@ Route::get('/aggiornapreorder/{idarticolo}/{aggiornapreordine}', function ($idar
setPreOrder($idarticolo, $aggiornapreordine, true);
});
+Route::get('/setordine/{idinternet}/{mode}', function ($idinternet, $mode) {
+ setOrdine($idinternet, $mode);
+});
+
Route::get('/aggiornadatapubblicazione/{idarticolo}', function ($idarticolo) {
setDataPubblicazione($idarticolo, true);
});
@@ -6180,6 +6184,8 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) {
return libriInPrevendita();
} elseif ($action == 'showOrdini') {
return showOrdini();
+ } elseif ($action == 'setOrdine') {
+ return setOrdine($id, '');
} elseif ($action == 'showDettOrdini') {
return showDettOrdini();
} elseif ($action == 'setDataPubblicazione') {