This commit is contained in:
paoloar77
2024-07-16 10:48:28 +02:00
parent ef63b91ea9
commit cbcba94734
2 changed files with 35 additions and 3 deletions

View File

@@ -110,6 +110,7 @@ function formatDateToItalian($date_string, $input_format = 'Y-m-d H:i:s.u')
} }
} }
function setPreOrder($sku, $aggiornapreordine, $debug) function setPreOrder($sku, $aggiornapreordine, $debug)
{ {
try { try {
@@ -481,6 +482,8 @@ function showOrdini()
->take(20) ->take(20)
->get(); ->get();
$sep = "";
// Show the fields of the orders // Show the fields of the orders
foreach ($orders as $order) { foreach ($orders as $order) {
$product = Product::where('sku', $order->CodArticoloGM)->first(); $product = Product::where('sku', $order->CodArticoloGM)->first();
@@ -492,9 +495,9 @@ function showOrdini()
$str .= getvalstr("", $order->Codice) . " "; $str .= getvalstr("", $order->Codice) . " ";
$str .= getvalstr("", $order->DataOra); $str .= getvalstr("", $order->DataOra);
$str .= getvalstr("Titolo", $titolo); $str .= getvalstr("", $titolo);
$str .= getvalstr("Codice Ordine", $order->IdInternet, true) . " "; $str .= getvalstr("Ordine", $order->IdInternet, true) . " ";
$str .= getvalstr("Cod. Articolo", $order->CodArticoloGM, true); $str .= getvalstr("Articolo", $order->CodArticoloGM, true);
$str .= getvalstr("Prezzo", $order->PrezzoLordo); $str .= getvalstr("Prezzo", $order->PrezzoLordo);
$str .= getvalstr("Quantità", $order->Qta); $str .= getvalstr("Quantità", $order->Qta);
if ($order->PercSconto) if ($order->PercSconto)
@@ -502,6 +505,8 @@ function showOrdini()
if ($order->Descrizione) if ($order->Descrizione)
$str .= getvalstr("Descr", $order->Descrizione); $str .= getvalstr("Descr", $order->Descrizione);
$str .= '<a href="' . $product->permalink . '/apimacro/public/setordine/' . $order->IdInternet . '/del/" target="_blank">ELIMINA!</a>' . $sep;
// $str .= getarraystr($product) . "<br>"; // $str .= getarraystr($product) . "<br>";
// $str .= $product; // $str .= $product;
$str .= '<br>'; $str .= '<br>';
@@ -513,6 +518,27 @@ function showOrdini()
return $str; return $str;
} }
function setOrdine($idinternet, $mode)
{
$str = "";
$ordine = Orderdetail::where('IdInternet', $idinternet)->get();
$prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first();
$str .= getarraystr($prodotto) . "<br>";
$str .= getarraystr($ordine) . "<br>";
if ($mode === 'del' && $ordine) {
// delete record $ordine
$ordine->delete();
}
return $str;
}
function showDettOrdini() function showDettOrdini()
{ {
$str = "Ordini Woocommerce:" . PHP_EOL . '<br>'; $str = "Ordini Woocommerce:" . PHP_EOL . '<br>';

View File

@@ -6105,6 +6105,10 @@ Route::get('/aggiornapreorder/{idarticolo}/{aggiornapreordine}', function ($idar
setPreOrder($idarticolo, $aggiornapreordine, true); setPreOrder($idarticolo, $aggiornapreordine, true);
}); });
Route::get('/setordine/{idinternet}/{mode}', function ($idinternet, $mode) {
setOrdine($idinternet, $mode);
});
Route::get('/aggiornadatapubblicazione/{idarticolo}', function ($idarticolo) { Route::get('/aggiornadatapubblicazione/{idarticolo}', function ($idarticolo) {
setDataPubblicazione($idarticolo, true); setDataPubblicazione($idarticolo, true);
}); });
@@ -6180,6 +6184,8 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) {
return libriInPrevendita(); return libriInPrevendita();
} elseif ($action == 'showOrdini') { } elseif ($action == 'showOrdini') {
return showOrdini(); return showOrdini();
} elseif ($action == 'setOrdine') {
return setOrdine($id, '');
} elseif ($action == 'showDettOrdini') { } elseif ($action == 'showDettOrdini') {
return showDettOrdini(); return showDettOrdini();
} elseif ($action == 'setDataPubblicazione') { } elseif ($action == 'setDataPubblicazione') {