diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php
index dd82a20b..5d93237c 100644
--- a/app/CustomFuncPao.php
+++ b/app/CustomFuncPao.php
@@ -497,6 +497,7 @@ function showOrdini()
foreach ($orders as $order) {
$product = Product::where('sku', $order->CodArticoloGM)->first();
+ dd($product);
// $product = null;
if ($product)
@@ -2020,3 +2021,23 @@ function getClienti()
return null;
}
}
+
+function getvalstr($mystr, $value, $separato = false)
+{
+ $my = '';
+ if ($mystr) {
+ $my = " " . $mystr . ": " . $value;
+ } else {
+ $my = $value;
+ if (!$separato) {
+ $my = " " . $value;
+ }
+ }
+
+ if ($separato) {
+ $my = '[' . $my . '] ';
+ }
+
+ return $my;
+}
+
diff --git a/app/CustomFuncPao.php.save b/app/CustomFuncPao.php.save
new file mode 100644
index 00000000..5d93237c
--- /dev/null
+++ b/app/CustomFuncPao.php.save
@@ -0,0 +1,2043 @@
+' . json_encode($array, JSON_PRETTY_PRINT) . '';
+};
+
+function getarraystr($array)
+{
+ return '
' . json_encode($array, JSON_PRETTY_PRINT) . '
';
+};
+
+function isKeyPresent($array, $key)
+{
+ foreach ($array as $item) {
+ if (isset($item->key) && $item->key === $key) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function getValueByKey($array, $key)
+{
+ foreach ($array as $item) {
+ if (isset($item->key) && $item->key === $key) {
+ return $item->value;
+ }
+ }
+ return null; // If key is not found
+}
+
+// Funzione per aggiornare il valore di un certo key in un array di oggetti
+function updateValueByKey(&$array, $key, $newValue)
+{
+ foreach ($array as &$item) {
+ if (is_object($item) && property_exists($item, 'key') && $item->key === $key) {
+ $item->value = $newValue;
+ return; // Se trova il key, termina il loop
+ }
+ }
+
+ // Se il key non esiste nell'array, aggiungi il nuovo key-value pair
+ $newItem = new stdClass();
+ $newItem->key = $key;
+ $newItem->value = $newValue;
+
+ $array[] = $newItem; // Aggiungi il nuovo elemento all'array
+}
+
+function updateValueByKeyArr(&$array, $key, $newValue)
+{
+ foreach ($array as &$item) {
+ if ($item['key'] === $key) {
+ $item['value'] = $newValue;
+ break; // Se trova il key, termina il loop
+ }
+ }
+
+ $array[$key] = $newValue;
+}
+
+
+function formatDateToItalian($date_string, $input_format = 'Y-m-d H:i:s.u')
+{
+ // Crea un oggetto DateTime dal formato della stringa di input
+ $date = DateTime::createFromFormat($input_format, $date_string);
+
+ // Verifica se la creazione dell'oggetto DateTime è riuscita
+ if ($date) {
+ // Crea l'oggetto IntlDateFormatter per formattare la data in italiano
+ $formatter = new IntlDateFormatter(
+ 'it_IT', // Imposta la localizzazione in italiano
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::NONE,
+ 'Europe/Rome', // Imposta il fuso orario (opzionale)
+ IntlDateFormatter::GREGORIAN,
+ 'd MMMM yyyy' // Specifica il formato desiderato
+ );
+
+ // Formatta la data
+ return ucfirst($formatter->format($date));
+ } else {
+ return false; // Ritorna false se la data non è valida o il formato non è corretto
+ }
+}
+
+
+function setPreOrder($sku, $aggiornapreordine, $debug)
+{
+ try {
+ // Aggiorna Preorder
+ $product = Product::where('sku', $sku)->first();
+
+ // get the article by product
+ // $article = Article::where('IdArticolo', $idarticolo)->first();
+
+ // showarray($article);
+
+ if ($debug) {
+ echo "Product: " . $sku;
+ showarray($product);
+ }
+
+ $campoPreOrder = '_wpro_variable_is_preorder';
+
+ if ($product) {
+ $titolo = $product['name'];
+
+ if ($debug)
+ echo "Prodotto trovato: " . $titolo . " StockQty = " . $product['stock_quantity'] . "
";
+
+ $preorder = false;
+ if (isKeyPresent($product['meta_data'], $campoPreOrder)) {
+ $preorder = getValueByKey($product['meta_data'], $campoPreOrder);
+ }
+
+ if ($debug) {
+ if ($preorder) {
+ if ($preorder === 'true') {
+ echo "PREORDER SI !: " . $preorder;
+ } else {
+ echo "PREORDER:: " . $preorder;
+ }
+ } else {
+ echo "preorder non presente !: ";
+ }
+ echo "
";
+ }
+
+ $idprodotto = $product['parent_id'];
+
+ if ($aggiornapreordine === '1') {
+ $data = [];
+
+ $article = getArticoloById($sku);
+
+ echo $article->titolo . " DataPubblicazione: " . $article->DataPubblicazione . "
";
+
+ $datepubblstr = "";
+ $datepubbllabel = "";
+ $label_prenotalo_con_data = "";
+
+ if ($article->DataPubblicazione) {
+ $datepubbl = DateTime::createFromFormat('Y-m-d H:i:s.u', $article->DataPubblicazione);
+
+ if ($datepubbl !== false) {
+ $datepubblstr = $datepubbl->format('Y-m-d');
+ $datepubbllabel = formatDateToItalian($article->DataPubblicazione);
+ $label_prenotalo_con_data = 'Prenotalo per riceverlo entro il ' . $datepubbllabel;
+ } else {
+ // Gestire il caso in cui la data di pubblicazione non è valida
+ echo "Errore: La data di pubblicazione non è valida.
";
+ }
+ }
+
+ if ($idprodotto > 0) {
+
+ if ($debug) {
+ echo "Variazioni: " . $product['parent_id'] . "
";
+ echo "Data Pubblicazione: " . $datepubblstr . "
";
+ }
+ $variations = Variation::all($product['parent_id']);
+ if ($debug)
+ showarray($variations);
+ for ($i = 0; $i < count($variations); $i++) {
+ $variation = $variations[$i];
+ if ($variation->id == $product['id']) {
+ // convert object into array
+ $data = json_decode(json_encode($variation), true);
+ break;
+ }
+ }
+
+ $data['stock_quantity'] = QTA_IN_PREVENDITA;
+
+ if ($debug) {
+ echo "Data:";
+ showarray($data);
+ }
+
+ $agg = true;
+ $data['meta_data'] = $product['meta_data'];
+ if ($agg) {
+ updateValueByKey($data['meta_data'], $campoPreOrder, 'yes');
+ updateValueByKey($data['meta_data'], '_is_pre_order', 'yes');
+ updateValueByKey($data['meta_data'], '_pre_order_date', $datepubblstr);
+ updateValueByKey($data['meta_data'], '_wpro_date_label_variable', $label_prenotalo_con_data);
+ updateValueByKey($data['meta_data'], '_wpro_no_date_label_variable', '');
+ updateValueByKey($data['meta_data'], '_wpro_manage_price_variable', '');
+ updateValueByKey($data['meta_data'], '_wpro_price_variable', '');
+ updateValueByKey($data['meta_data'], '_wpro_label_variable', 'Pre Ordinalo!');
+ updateValueByKey($data['meta_data'], '_wpro_price_type_variable', 'manual');
+ updateValueByKey($data['meta_data'], '_wpro_amount_price_variable', 'fixed');
+ updateValueByKey($data['meta_data'], '_wpro_date_variable', $datepubblstr);
+ updateValueByKey($data['meta_data'], '_wpro_time_variable', '');
+ updateValueByKey($data['meta_data'], '_rank_math_gtin_code', '');
+ }
+
+ if ($debug) {
+ echo "
Dati da Salvare:";
+ showarray($data);
+ }
+
+ $variation = Variation::update($idprodotto, $product['id'], $data);
+
+ if ($variation) {
+ if ($debug)
+ echo "Aggiornato Preorder: [ParentId=" . $idprodotto . '] ProdId= ' . $product['id'] . ' ' . $variation['name'] . "
";
+ }
+ }
+ } else if ($aggiornapreordine === '-1') {
+
+ if ($idprodotto > 0) {
+
+ $variations = Variation::all($product['parent_id']);
+ if ($debug)
+ showarray($variations);
+ for ($i = 0; $i < count($variations); $i++) {
+ $variation = $variations[$i];
+ if ($variation->id == $product['id']) {
+ // convert object into array
+ $data = json_decode(json_encode($variation), true);
+ break;
+ }
+ }
+
+ $data['stock_quantity'] = 0;
+
+ if ($debug) {
+ echo "Data:";
+ showarray($data);
+ }
+
+ $agg = true;
+ $data['meta_data'] = $product['meta_data'];
+ if ($agg) {
+ updateValueByKey($data['meta_data'], $campoPreOrder, 'no');
+ updateValueByKey($data['meta_data'], '_is_pre_order', 'no');
+ }
+
+ if ($debug) {
+ echo "
Dati da Salvare:";
+ showarray($data);
+ }
+
+ $variation = Variation::update($idprodotto, $product['id'], $data);
+
+ if ($variation) {
+ if ($debug)
+ echo "Aggiornato come Non Disponibile : [ParentId=" . $idprodotto . '] ProdId= ' . $product['id'] . ' ' . $variation['name'] . "
";
+ }
+ }
+ } else if ($aggiornapreordine === '0') {
+ if ($idprodotto > 0) {
+
+ $variations = Variation::all($product['parent_id']);
+ if ($debug)
+ showarray($variations);
+ for ($i = 0; $i < count($variations); $i++) {
+ $variation = $variations[$i];
+ if ($variation->id == $product['id']) {
+ // convert object into array
+ $data = json_decode(json_encode($variation), true);
+ break;
+ }
+ }
+
+ $agg = true;
+ $data['meta_data'] = $product['meta_data'];
+ if ($agg) {
+ updateValueByKey($data['meta_data'], $campoPreOrder, 'no');
+ updateValueByKey($data['meta_data'], '_is_pre_order', 'no');
+ }
+
+ if ($debug) {
+ echo "
Dati da Salvare:";
+ showarray($data);
+ }
+
+ $variation = Variation::update($idprodotto, $product['id'], $data);
+
+ if ($variation) {
+ if ($debug)
+ echo "Aggiornato come in Vendita : [ParentId=" . $idprodotto . '] ProdId= ' . $product['id'] . ' ' . $variation['name'] . "
";
+ }
+ }
+ }
+ } else {
+ if ($debug)
+ echo "Il prodotto non esiste";
+ }
+ } catch (Exception $e) {
+ echo "Errore: " . $e->getMessage();
+ }
+}
+
+function setDataPubblicazione($sku, $debug)
+{
+ try {
+ // Aggiorna Preorder
+ $product = Product::where('sku', $sku)->first();
+
+
+ if ($debug) {
+ echo "Product: " . $sku;
+ showarray($product);
+ }
+
+ if ($product) {
+ $titolo = $product['name'];
+
+ if ($debug)
+ echo "Prodotto trovato: " . $titolo . " StockQty = " . $product['stock_quantity'] . "
";
+
+ $idprodotto = $product['parent_id'];
+
+ if (true) {
+ $data = [];
+
+ $article = getArticoloById($sku);
+
+ echo $article->titolo . " DataPubblicazione: " . $article->DataPubblicazione . "
";
+
+ $datepubblstr = "";
+ $datepubbl_ts = 0;
+
+ if ($article->DataPubblicazione) {
+ $datepubbl = DateTime::createFromFormat('Y-m-d H:i:s.u', $article->DataPubblicazione);
+
+ if ($datepubbl !== false) {
+ $datepubbl_ts = $datepubbl->getTimestamp();
+ $datepubblstr = $datepubbl->format('d/m/Y');
+ }
+ }
+
+ if ($idprodotto > 0) {
+
+ if ($debug) {
+ echo "Variazioni: " . $product['parent_id'] . "
";
+ echo "Data Pubblicazione: " . $datepubblstr . "
";
+ }
+ $variations = Variation::all($product['parent_id']);
+ if ($debug)
+ showarray($variations);
+ for ($i = 0; $i < count($variations); $i++) {
+ $variation = $variations[$i];
+ if ($variation->id == $product['id']) {
+ // convert object into array
+ $data = json_decode(json_encode($variation), true);
+ break;
+ }
+ }
+
+ $agg = true;
+ // $data['meta_data'] = $product['meta_data'];
+ if ($data) {
+ $dataPubbSaved = getValueByKey($product['meta_data'], 'DataPubblicazione');
+ if ($dataPubbSaved != $datepubbl_ts) {
+ updateValueByKey($data['meta_data'], 'DataPubblicazione', $datepubbl_ts);
+ updateValueByKey($data['meta_data'], 'DataPubbStr', $datepubblstr);
+
+ if ($debug) {
+ echo "
Dati da Salvare:";
+ showarray($data);
+ }
+
+ $variation = Variation::update($idprodotto, $product['id'], $data);
+ if ($variation) {
+ if ($debug)
+ echo "Aggiornato: [ParentId=" . $idprodotto . '] ProdId= ' . $product['id'] . ' ' . $variation['name'] . "
";
+ }
+ return true;
+ }
+ }
+ }
+ }
+ } else {
+ if ($debug)
+ echo "Il prodotto non esiste";
+ }
+ return false;
+ } catch (Exception $e) {
+ echo "Errore: " . $e->getMessage();
+ }
+}
+
+function isArticleInPrevendita($id, $checkqtanegativa)
+{
+ return loadArticleByIdArticle($id, true);
+}
+
+
+function loadArticleByIdArticle($id, $checkprevendita = false, $checkqtanegativa = false)
+{
+
+ try {
+ $articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
+ ->on('T_WEB_Articoli.DataOra', '=', 'b.data');
+ })
+ ->leftJoin(DB::raw('(SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto FROM T_WEB_StatiProdotto e JOIN (SELECT IdStatoProdotto, MAX(DataOra) as data1 from T_WEB_StatiProdotto GROUP BY IdStatoProdotto) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1 ) f'), function ($join) {
+ $join->on('T_WEB_Articoli.IdStatoProdotto', '=', 'f.IdStatoProdotto');
+ })
+ ->leftJoin(DB::raw('(SELECT o.Codice, o.QtaDisponibile FROM T_WEB_Disponibile o JOIN (SELECT Codice, MAX(DataOra) as data1 from T_WEB_Disponibile GROUP BY Codice) p ON o.Codice = p.Codice AND o.DataOra = p.data1 ) q'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'q.Codice');
+ })
+ ->where('T_WEB_Articoli.IdArticolo', $id)
+ ->get();
+
+ if ($checkprevendita) {
+ foreach ($articles as $article) {
+ $qtaneg = $article->QtaDisponibile < 0;
+ $inprevendita = false;
+ if ($article) {
+ $inprevendita = ($article->DescrizioneStatoProdotto === 'In prevendita');
+ if ($checkqtanegativa) {
+ $inprevendita = $inprevendita && $qtaneg;
+ }
+ }
+ if ($inprevendita) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ $ris = 'Articles di ' . $id . ' :' . PHP_EOL;
+ $ris .= getarraystr($articles); // Converte solo i dati specificati in JSON
+
+ try {
+ $product = Product::where('sku', $id)->first();
+
+ $ris .= 'Product:' . PHP_EOL;
+ $ris .= getarraystr($product);
+ } catch (\Exception $e) {
+ $ris .= "!!! Errore loadArticleByIdArticle Product: " . $e->getMessage();
+ }
+
+ return $ris;
+ } catch (\Exception $e) {
+
+ return "Errore loadArticleByIdArticle: " . $e->getMessage();
+ }
+}
+
+function showOrdini()
+{
+ $str = "";
+
+
+ try {
+
+ // $str = Schema::getColumnListing('Orderdetails');
+
+ $orders = Orderdetail::orderBy('DataOra', 'desc')
+ ->take(5)
+ ->get();
+
+ $sep = "";
+
+ // dd($orders);
+
+ $baseUrl = Request::root(); // URL di base (dominio)
+
+ // Show the fields of the orders
+ foreach ($orders as $order) {
+ $product = Product::where('sku', $order->CodArticoloGM)->first();
+
+ dd($product);
+ // $product = null;
+
+ if ($product)
+ $titolo = "" . $product['name'] . "";
+ else
+ $titolo = "";
+
+ $str .= getvalstr("", $order->Codice) . " ";
+ $str .= getvalstr("", $order->DataOra);
+ $str .= getvalstr("", $titolo);
+ $str .= getvalstr("Ordine", $order->IdInternet, true) . " ";
+ $str .= getvalstr("Cod Cliente", $order->CodClienteInternet, true);
+ $str .= getvalstr("Articolo", $order->CodArticoloGM, true);
+ $str .= getvalstr("IdSito", $order->IdSito, true);
+ $str .= getvalstr("Prezzo", $order->PrezzoLordo);
+ $str .= getvalstr("Quantità", $order->Qta);
+ if ($order->PercSconto)
+ $str .= getvalstr("Sconto", $order->PercSconto);
+ if ($order->Descrizione)
+ $str .= getvalstr("Descr", $order->Descrizione);
+
+ $str .= ' [IMPOSTA IDSITO FDV] ' . $sep;
+ $str .= ' ELIMINA! ' . $sep;
+
+ // $str .= getarraystr($product) . "
";
+ // $str .= $product;
+ $str .= '
';
+ }
+ } catch (\Exception $e) {
+ return "Errore: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showOrdiniWeb()
+{
+ $str = "";
+
+ try {
+
+ // $str = Schema::getColumnListing('Orderdetails');
+
+ $orders = OrderdetailWeb::orderBy('DataOra', 'desc')
+ ->take(5)
+ ->get();
+
+ $sep = "";
+
+ $baseUrl = Request::root(); // URL di base (dominio)
+
+ // Show the fields of the orders
+ foreach ($orders as $order) {
+ $product = Product::where('sku', $order->CodArticoloGM)->first();
+
+ if ($product)
+ $titolo = "" . $product['name'] . "";
+ else
+ $titolo = "";
+
+ $str .= getvalstr("", $order->Codice) . " ";
+ $str .= getvalstr("", $order->DataOra);
+ $str .= getvalstr("", $titolo);
+ $str .= getvalstr("Ordine", $order->IdInternet, true) . " ";
+ $str .= getvalstr("Cod Cliente", $order->CodClienteInternet, true);
+ $str .= getvalstr("Articolo", $order->CodArticoloGM, true);
+ $str .= getvalstr("Prezzo", $order->PrezzoLordo);
+ $str .= getvalstr("IdSito", $order->IdSito, true);
+ $str .= getvalstr("Quantità", $order->Qta);
+ if ($order->PercSconto)
+ $str .= getvalstr("Sconto", $order->PercSconto);
+ if ($order->Descrizione)
+ $str .= getvalstr("Descr", $order->Descrizione);
+
+ // $str .= ' ELIMINA!' . $sep;
+ $str .= ' IMPOSTA IDSITO FDV' . $sep;
+
+ // $str .= getarraystr($product) . "
";
+ // $str .= $product;
+ $str .= '
';
+ }
+ } catch (\Exception $e) {
+ return "Errore: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function getStructTable($tableName)
+{
+ $str = '';
+
+ $columns = Schema::getColumnListing($tableName);
+
+ $str .= '
Tabella: ' . $tableName . '
';
+
+ $str .= '';
+
+ // Recupera i tipi di dati e lunghezza per ogni colonna
+ $types = DB::select("SELECT column_name, data_type, character_maximum_length
+ FROM information_schema.columns
+ WHERE table_name = '$tableName'");
+ $columnInfo = [];
+ foreach ($types as $type) {
+ $columnInfo[$type->column_name] = [
+ 'data_type' => $type->data_type,
+ 'length' => $type->character_maximum_length
+ ];
+ }
+
+ // Stampa la struttura della tabella con i tipi di dati e lunghezza dei campi
+ foreach ($columns as $column) {
+ $str .= ' ' . $column . " - " . $columnInfo[$column]['data_type'] . " (" . $columnInfo[$column]['length'] . ")" . "
";
+ }
+
+ $str .= '';
+
+ return $str;
+}
+
+function getAllTables()
+{
+ $tables = DB::select("SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE'");
+
+ $tableNames = array_map('current', $tables);
+
+ return $tableNames;
+}
+
+
+function getAllTablesStr()
+{
+ // Utilizzo della funzione per ottenere la lista delle tabelle
+ $tables = getAllTables();
+
+ $str = "TABELLE:
";
+
+ // Stampa la lista delle tabelle
+ foreach ($tables as $table) {
+ $str .= getStructTable($table) . '
';
+ }
+
+ return $str;
+}
+
+function setOrdine($idinternet, $mode)
+{
+ try {
+
+ $str = "setOrdine: mode =" . $mode . ' idinternet=' . $idinternet;
+
+ // $str .= getAllTablesStr();
+
+ $str .= getStructTable('T_WOO_TestateOrdini');
+
+ $ordine = Orderdetail::where('IdInternet', $idinternet)->first();
+
+ $ordergm = AppOrder::where('IdInternet', $idinternet)->first();
+
+ if ($ordergm) {
+ $str .= getarraystr($ordergm) . "
";
+ // $ordergm = $ordergms[0];
+ // $str .= getarraystr($ordergm) . "
";
+ }
+
+ if ($ordine) {
+
+ if ($ordine)
+ $str .= getarraystr($ordine) . "
";
+
+ $prodotto = Product::where('sku', $ordine["CodArticoloGM"])->first();
+
+ if ($prodotto)
+ $str .= getarraystr($prodotto) . "
";
+
+ if ($mode === 'del' && $ordine) {
+ $str .= "... Cancellazione in CORSO ...";
+ // delete record $ordine
+ $deletedCount = Orderdetail::where('IdInternet', $idinternet)->delete();
+ $str .= "
Numero di record eliminati: " . $deletedCount . "";
+ }
+ if ($mode === 'idsito' && $ordine) {
+ $str .= "... CAMBIA ID SITO ...";
+
+ // Update field IdSito to "7"
+ $updatedCount = Orderdetail::where('IdInternet', $idinternet)
+ ->update([
+ 'IdSito' => "7"
+ ]);
+
+ $str .= "
record Aggiornati: " . $updatedCount . "";
+ }
+ }
+ } catch (\Exception $e) {
+ $str .= "Errore: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showRecordOrder($orders)
+{
+
+ try {
+ $str = '';
+
+ // Show the fields of the orders
+ foreach ($orders as $order) {
+ $str .= getvalstr("IdInternet", $order->IdInternet, true) . " ";
+ $str .= getvalstr("CodCliente", $order->CodClienteInternet, true);
+ $str .= getvalstr("IdSito", $order->IdSito, true);
+ $str .= getvalstr("Note", $order->Note, true);
+ $str .= getvalstr("Totale", $order->Totale, true);
+ $str .= getvalstr("DataOra", $order->DataOra, true);
+ $str .= getvalstr("DataSpedizione", $order->DataSpedizione, true);
+ $str .= '
';
+ }
+ } catch (\Exception $e) {
+ return "Errore showDettOrdini: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+
+function showDettOrdini()
+{
+ $str = "Ordini Woocommerce:" . PHP_EOL . '
';
+
+ try {
+ // sort DataOra desc
+ $orders = AppOrder::all()->sortByDesc('DataOra');
+
+ $str .= showRecordOrder($orders);
+ } catch (\Exception $e) {
+ return "Errore showDettOrdini: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showDettSingleOrdine($idordine)
+{
+ $str = "Ordini Woocommerce:" . PHP_EOL . '
';
+
+ try {
+ // sort DataOra desc
+ $orders = AppOrder::where('IdInternet', $idordine)->get();
+
+ $str .= showRecordOrder($orders);
+ } catch (\Exception $e) {
+ return "Errore showDettOrdini: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showDettOrdiniWeb()
+{
+ try {
+
+ $str = "Ordini T_WEB_TestateOrdini:" . PHP_EOL . '
';
+
+ $orders = AppOrderWeb::all()->sortByDesc('DataOra');
+
+ $str .= showRecordOrder($orders);
+ } catch (\Exception $e) {
+ return "Errore showDettOrdini: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showDettSingleOrdineWeb($idordine)
+{
+ try {
+
+ $str = "Ordini T_WEB_TestateOrdini:" . PHP_EOL . '
';
+
+ $orders = AppOrderWeb::where('IdInternet', $idordine)->get();
+
+ $str .= showRecordOrder($orders);
+ } catch (\Exception $e) {
+ return "Errore showDettOrdini: " . $e->getMessage();
+ }
+
+ return $str;
+}
+
+function showprice($prezzo)
+{
+ return ' € ' . number_format($prezzo, 2);
+}
+
+function libriInPrevendita()
+{
+ try {
+ $articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
+ ->on('T_WEB_Articoli.DataOra', '=', 'b.data');
+ })
+
+ ->leftJoin(DB::raw('(SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto FROM T_WEB_StatiProdotto e JOIN (SELECT IdStatoProdotto, MAX(DataOra) as data1 from T_WEB_StatiProdotto GROUP BY IdStatoProdotto) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1 ) f'), function ($join) {
+ $join->on('T_WEB_Articoli.IdStatoProdotto', '=', 'f.IdStatoProdotto');
+ })
+ ->leftJoin(DB::raw('(SELECT g.IdTipologia, g.Descrizione as DescrizioneTipologia FROM T_WEB_Tipologie g JOIN (SELECT IdTipologia, MAX(DataOra) as data1 from T_WEB_Tipologie GROUP BY IdTipologia) h ON g.IdTipologia = h.IdTipologia AND g.DataOra = h.data1 ) i'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipologia', '=', 'i.IdTipologia');
+ })
+ ->leftJoin(DB::raw('(SELECT l.IdTipoFormato, l.Descrizione as DescrizioneFormato FROM T_WEB_TipiFormato l JOIN (SELECT IdTipoFormato, MAX(DataOra) as data1 from T_WEB_TipiFormato GROUP BY IdTipoFormato) m ON l.IdTipoFormato = m.IdTipoFormato AND l.DataOra = m.data1 ) n'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipoFormato', '=', 'n.IdTipoFormato');
+ })
+ ->leftJoin(DB::raw('(SELECT o.Codice, o.QtaDisponibile FROM T_WEB_Disponibile o JOIN (SELECT Codice, MAX(DataOra) as data1 from T_WEB_Disponibile GROUP BY Codice) p ON o.Codice = p.Codice AND o.DataOra = p.data1 ) q'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'q.Codice');
+ })
+
+ ->where('DescrizioneStatoProdotto', 'In prevendita')
+ ->where(DB::raw('CONVERT(INT, QtaDisponibile)'), '<', 0)
+ // ->where('DescrizioneFormato', 'brossura')
+ // ->where('DescrizioneTipologia', 'Libri')
+ ->where(DB::raw('DATEDIFF(day, \'1970-01-01\', DataPubblicazione)'), '>', 1)
+ ->orderBy('DataPubblicazione', 'desc')
+ ->get();
+ $sep = ' | ';
+
+ $ind = 1;
+ foreach ($articles as $article) {
+ // $titolo = rtrim(str_ireplace('USATO', '', $article->Titolo));
+
+ $mydatestr = $article->DataPubblicazione;
+
+ $sku = $article->IdArticolo;
+
+ $prodotto = Product::where('sku', $sku)->first();
+
+ $qtyinstock = intval($prodotto['stock_quantity']);
+ $prezzo = $prodotto['sale_price'];
+ if (!$prezzo) {
+ $prezzo = $prodotto['price'];
+ }
+
+ if ($qtyinstock <= 0) {
+ $colore = 'red';
+ } else {
+ $colore = 'green';
+ }
+
+
+ // echo '[' . $ind . ']' . $sep . $mydatestr . $sep . $article->IdArticolo . $sep . $article->Titolo . $sep . $article->DescrizioneStatoProdotto . $sep . $article->DescrizioneFormato . ' [Quantita = ' . $article->QtaDisponibile . ']';
+ $myview = '[' . $ind . ']' . $sep .
+ '' . $article->IdArticolo . '' . $sep .
+ ' ' . $article->Titolo . '' . $sep .
+ ' Pubb:' . formatDateToItalian($article->DataPubblicazione) . $sep .
+ $article->DescrizioneStatoProdotto . ' (' . $article->DescrizioneFormato . ')' . $sep .
+ '[Qta = ' . $article->QtaDisponibile . ']' . $sep .
+ ' [' . showprice($prezzo) . ' ]' . $sep .
+ '[In Stock = ' . $qtyinstock . ']' . $sep;
+
+ if ($qtyinstock < QTA_MINIMA_PER_PREVENDITA) {
+ $myview .= 'Imposta in PRE-ORDINE!' . $sep;
+ } else {
+ $myview .= 'Impostalo Non Disponibile' . $sep;
+ }
+ $myview .= 'Aggiorna Data Pubb' . $sep;
+
+ echo $myview;
+
+ if ($prodotto) {
+
+ if (isset($prodotto['_wpro_variable_is_preorder'])) {
+ echo '
PREORDINE: ' . $prodotto['_wpro_variable_is_preorder'] . '';
+ }
+ if (isset($prodotto['_wpro_label_variable'])) {
+ echo 'Etichetta: ' . $prodotto['_wpro_label_variable'];
+ }
+ if (isset($prodotto['_wpro_date_variable'])) {
+ echo 'Data Preordine: ' . $prodotto['_wpro_date_variable'];
+ }
+ echo '
';
+ }
+
+ $ind++;
+ }
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+
+ return true;
+}
+
+function setProductFromGM($article, $initlog, ProductLogger &$passproductLogger)
+{
+ if ($initlog) {
+ $productLogger = new ProductLogger(null, '');
+ } else {
+ $productLogger = $passproductLogger;
+ }
+
+ $preorder = true;
+
+ try {
+ $productsku = Product::where('sku', $article->IdArticolo)->first();
+ //if(Gm_product::where('id_gm',$article->IdArticolo)->doesntExist())
+ if ($productsku->count() == 0) {
+ $titolo = null;
+ $formato = null;
+ $prodotti = null;
+ $prodotti = new ModelsProduct();
+ $titolo = $article->Titolo;
+ echo $titolo . ' ';
+ switch ($article->DescrizioneTipologia) {
+
+ case 'Libri':
+
+ $prodotti = $prodotti->where('name', $titolo)->get();
+ $id = 0;
+
+ if (!is_null($prodotti) && $prodotti->count() > 0) {
+ foreach ($prodotti as $prodotto) {
+ if (strtolower($prodotto->name) === strtolower($titolo)) {
+ $found_key = array_search('Autore libro', array_column($prodotto->attributes, 'name'));
+ if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
+ $id = $prodotto->id;
+ $variations = Variation::all($prodotto->id);
+ foreach ($variations as $variation) {
+ $found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
+ if ($variation->attributes[$found_key_version]->option == 'Nuovo') {
+ $id = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ $datepubbl = DateTime::createFromFormat('Y-m-d H:i:s.u', $article->DataPubblicazione);
+
+ if ($datepubbl !== false) {
+ $datepubbl_ts = $datepubbl->getTimestamp();
+ $datepubblstr = $datepubbl->format('d/m/Y');
+ }
+
+ $data1 = [
+
+ 'regular_price' => $article->PrezzoIvato,
+ 'sku' => $article->IdArticolo,
+ 'sale_price' => $article->PrezzoIvatoScontatoCampagna,
+ 'date_on_sale_from' => $article->DataInizioCampagna,
+ 'date_on_sale_to' => $article->DataFineCampagna,
+ 'manage_stock' => true,
+ 'stock_quantity' => $article->stock,
+ 'purchasable' => false,
+
+ 'attributes' => [
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'option' => 'Nuovo'
+ ]
+
+ ],
+ 'meta_data' => [
+ [
+ 'key' => 'ISBN',
+ 'value' => $article->Ean13
+ ],
+ [
+ 'key' => 'misure',
+ 'value' => $article->Misure
+ ],
+ [
+ 'key' => 'formato',
+ 'value' => $article->DescrizioneFormato
+ ],
+ [
+ 'key' => 'pagine',
+ 'value' => $article->Pagine
+ ],
+ [
+ 'key' => 'edizione',
+ 'value' => $article->Edizione
+ ],
+ [
+ 'key' => 'ristampa',
+ 'value' => $article->Ristampa
+ ],
+ [
+ 'key' => 'DataPubblicazione',
+ 'value' => $datepubbl_ts
+ ],
+ [
+ 'key' => 'DataPubbStr',
+ 'value' => $datepubblstr
+ ],
+
+ ]
+ ];
+ if ($id == 0) {
+ $versione = 'Nuova versione';
+ $category = Category::where('name', $article->argomento);
+ if ($category->count() > 0) {
+ $categoria = $category->first();
+ $categoriaid = $categoria['id'];
+ } else {
+ $categoriaid = 0;
+ }
+ $data = [
+
+ 'name' => $article->Titolo,
+ 'type' => 'variable',
+ 'short_description' => $article->Sottotitolo,
+ 'categories' => [
+ ['id' => $categoriaid]
+
+ ],
+ 'status' => 'draft',
+
+
+
+
+ //'description' => 'Simple product full description.',
+ //'short_description' => 'Simple product short description.',
+
+
+ 'attributes' => [
+
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ],
+
+ [
+ //'id' => 5,
+ 'id' => 7,
+ 'visible' => true,
+
+ 'options' =>
+ $article->authors
+
+
+ ],
+ [
+ //'id' => 2,
+ 'id' => 8,
+ 'visible' => true,
+
+ 'options' => [
+ $article->editore
+
+ ]
+ ],
+ [
+ //'id' => 7,
+ 'id' => 9,
+ 'visible' => true,
+
+ 'options' => [
+ $article->DescrizioneTipologia
+
+ ]
+ ]
+ ],
+
+ 'default_attributes' => [
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'option' => 'Nuovo'
+ ]
+ ],
+
+
+
+
+ ];
+
+ $product = Product::create($data);
+
+ $idprodotto = $product['id'];
+
+
+ $variation = Variation::create($idprodotto, $data1);
+ //dd($variation);
+
+
+
+ } else {
+ $versione = "Aggiunta versione";
+ $product = Product::find($id);
+ $old_attributes = $product['attributes'];
+ $attributes = [];
+ foreach ($old_attributes as $old_attribute) {
+ if ($old_attribute->id <> 6) {
+
+ $attributes[] = [
+ 'id' => $old_attribute->id,
+ 'variation' => $old_attribute->variation,
+ 'visible' => $old_attribute->visible,
+ 'options' => $old_attribute->options
+ ];
+ }
+ }
+
+ $attributes[] = [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ];
+ //dd($attributes);
+
+ $data = [
+
+ 'attributes' => $attributes
+
+
+ ];
+ Product::update($id, $data);
+
+ $variation = Variation::create($id, $data1);
+ }
+ $productLogger->addLog('inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - ' . $versione . ' - ' . $variation['permalink'] . "\n");
+ $productLogger->setAggiornato(true);
+ break;
+
+ case 'E-book':
+
+ if ($article->DescrizioneFormato === 'Epub') {
+
+
+ $titolo = rtrim(str_ireplace('EPUB', '', $article->Titolo));
+
+ $formato = 'Epub';
+ } elseif ($article->DescrizioneFormato === 'Pdf') {
+ $titolo = rtrim(str_ireplace('PDF', '', $article->Titolo));
+
+ $formato = 'PDF';
+ } elseif ($article->DescrizioneFormato === 'Mobi') {
+ $titolo = rtrim(str_ireplace('MOBI', '', $article->Titolo));
+
+
+ $formato = 'Mobi';
+ } else {
+ $productLogger->addLog('not_inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . "\n");
+ $productLogger->setAggiornato(true);
+ break;
+ }
+ $titolo = rtrim($titolo);
+ $titolo = rtrim(str_ireplace('EBOOK', '', $titolo));
+ $titolo = rtrim($titolo);
+ $titolo = rtrim(str_ireplace('_', '', $titolo));
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '-');
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '_');
+ $titolo = rtrim($titolo);
+
+ $prodotti = $prodotti->where('name', $titolo)->get();
+ $id = 0;
+
+ if (!is_null($prodotti) && $prodotti->count() > 0) {
+ foreach ($prodotti as $prodotto) {
+ if (strtolower($prodotto->name) === strtolower($titolo)) {
+ $found_key = array_search('Autore libro', array_column($prodotto->attributes, 'name'));
+ if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
+ $id = $prodotto->id;
+ $variations = Variation::all($prodotto->id);
+ foreach ($variations as $variation) {
+ $found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
+ if ($variation->attributes[$found_key_version]->option == $formato) {
+ $id = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ $data1 = [
+
+ 'regular_price' => $article->PrezzoIvato,
+ 'sku' => $article->IdArticolo,
+ 'sale_price' => $article->PrezzoIvatoScontatoCampagna,
+ 'date_on_sale_from' => $article->DataInizioCampagna,
+ 'date_on_sale_to' => $article->DataFineCampagna,
+ //'manage_stock' => true,
+ //'stock_quantity' => $article->stock,
+ 'purchasable' => 'false',
+
+ 'attributes' => [
+ [
+ 'id' => 6,
+ 'option' => $formato
+ ]
+
+ ],
+ 'meta_data' => [
+ [
+ 'key' => 'ISBN',
+ 'value' => $article->Ean13
+ ],
+ [
+ 'key' => 'misure',
+ 'value' => $article->Misure
+ ],
+ [
+ 'key' => 'formato',
+ 'value' => $article->DescrizioneFormato
+ ],
+ [
+ 'key' => 'pagine',
+ 'value' => $article->Pagine
+ ],
+ [
+ 'key' => 'edizione',
+ 'value' => $article->Edizione
+ ],
+ ]
+ ];
+ if ($id == 0) {
+
+ $versione = 'Nuova versione';
+
+ $category = Category::where('name', $article->argomento);
+ if ($category->count() > 0) {
+ $categoria = $category->first();
+ $categoriaid = $categoria['id'];
+ } else {
+ $categoriaid = 0;
+ }
+
+ $data = [
+
+ 'name' => $titolo,
+ 'type' => 'variable',
+ 'short_description' => $article->Sottotitolo,
+ 'categories' => [
+ ['id' => $categoriaid]
+
+ ],
+ 'status' => 'draft',
+
+ 'attributes' => [
+
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ],
+
+ [
+ //'id' => 5,
+ 'id' => 7,
+ 'visible' => true,
+
+ 'options' =>
+ $article->authors
+
+
+ ],
+ [
+ //'id' => 2,
+ 'id' => 8,
+ 'visible' => true,
+
+ 'options' => [
+ $article->editore
+
+ ]
+ ],
+ [
+ //'id' => 7,
+ 'id' => 9,
+ 'visible' => true,
+
+ 'options' => [
+ $article->DescrizioneTipologia
+
+ ]
+ ]
+ ],
+
+ 'default_attributes' => [
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'option' => 'Nuovo'
+ ]
+ ],
+
+
+
+
+ ];
+
+ $product = Product::create($data);
+
+ $idprodotto = $product['id'];
+
+
+ $variation = Variation::create($idprodotto, $data1);
+ } else {
+ $versione = "Aggiunta versione";
+ $product = Product::find($id);
+ $old_attributes = $product['attributes'];
+ $attributes = [];
+ foreach ($old_attributes as $old_attribute) {
+ if ($old_attribute->id <> 6) {
+
+ $attributes[] = [
+ 'id' => $old_attribute->id,
+ 'variation' => $old_attribute->variation,
+ 'visible' => $old_attribute->visible,
+ 'options' => $old_attribute->options
+ ];
+ }
+ }
+
+ $attributes[] = [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ];
+ //dd($attributes);
+
+ $data = [
+
+ 'attributes' => $attributes
+
+
+ ];
+ Product::update($id, $data);
+ $variation = Variation::create($id, $data1);
+ }
+
+ $productLogger->addLog('inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - ' . $versione . ' - ' . $variation['permalink'] . "\n");
+ $productLogger->setAggiornato(true);
+ break;
+
+ case 'Dvd':
+ $titolo = rtrim($article->Titolo);
+ $titolo = rtrim(str_ireplace('DVD', '', $titolo));
+ $titolo = rtrim($titolo);
+ $titolo = rtrim(str_ireplace('_', '', $titolo));
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '-');
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '_');
+ $titolo = rtrim($titolo);
+ $prodotti = $prodotti->where('name', $titolo)->get();
+ $id = 0;
+
+ if (!is_null($prodotti) && $prodotti->count() > 0) {
+ foreach ($prodotti as $prodotto) {
+ if (strtolower($prodotto->name) === strtolower($titolo)) {
+ $found_key = array_search('Autore libro', array_column($prodotto->attributes, 'name'));
+ if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
+ $id = $prodotto->id;
+ $variations = Variation::all($prodotto->id);
+ foreach ($variations as $variation) {
+ $found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
+ if ($variation->attributes[$found_key_version]->option == 'DVD') {
+ $id = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $data1 = [
+
+ 'regular_price' => $article->PrezzoIvato,
+ 'sku' => $article->IdArticolo,
+ 'sale_price' => $article->PrezzoIvatoScontatoCampagna,
+ 'date_on_sale_from' => $article->DataInizioCampagna,
+ 'date_on_sale_to' => $article->DataFineCampagna,
+ 'manage_stock' => true,
+ 'stock_quantity' => $article->stock,
+ 'purchasable' => false,
+
+ 'attributes' => [
+ [
+ 'id' => 6,
+ 'option' => 'DVD'
+ ]
+
+ ],
+ 'meta_data' => [
+ [
+ 'key' => 'ISBN',
+ 'value' => $article->Ean13
+ ],
+ [
+ 'key' => 'misure',
+ 'value' => $article->Misure
+ ],
+ [
+ 'key' => 'formato',
+ 'value' => $article->DescrizioneFormato
+ ],
+ [
+ 'key' => 'pagine',
+ 'value' => $article->Pagine
+ ],
+ [
+ 'key' => 'edizione',
+ 'value' => $article->Edizione
+ ],
+ ]
+ ];
+ if ($id == 0) {
+ $versione = 'Nuova versione';
+ $category = Category::where('name', $article->argomento);
+ if ($category->count() > 0) {
+ $categoria = $category->first();
+ $categoriaid = $categoria['id'];
+ } else {
+ $categoriaid = 0;
+ }
+ $data = [
+
+ 'name' => $article->Titolo,
+ 'type' => 'variable',
+ 'short_description' => $article->Sottotitolo,
+ 'categories' => [
+ ['id' => $categoriaid]
+
+ ],
+ 'status' => 'draft',
+
+
+ //'description' => 'Simple product full description.',
+ //'short_description' => 'Simple product short description.',
+
+
+ 'attributes' => [
+
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ],
+
+ [
+ //'id' => 5,
+ 'id' => 7,
+ 'visible' => true,
+
+ 'options' =>
+ $article->authors
+
+
+ ],
+ [
+ //'id' => 2,
+ 'id' => 8,
+ 'visible' => true,
+
+ 'options' => [
+ $article->editore
+
+ ]
+ ],
+ [
+ //'id' => 7,
+ 'id' => 9,
+ 'visible' => true,
+
+ 'options' => [
+ $article->DescrizioneTipologia
+
+ ]
+ ]
+ ],
+
+ 'default_attributes' => [
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'option' => 'Nuovo'
+ ]
+ ],
+
+
+
+
+ ];
+
+ $product = Product::create($data);
+
+ $idprodotto = $product['id'];
+
+
+ $variation = Variation::create($idprodotto, $data1);
+ } else {
+ $versione = "Aggiunta versione";
+ $product = Product::find($id);
+ $old_attributes = $product['attributes'];
+ $attributes = [];
+ foreach ($old_attributes as $old_attribute) {
+ if ($old_attribute->id <> 6) {
+
+ $attributes[] = [
+ 'id' => $old_attribute->id,
+ 'variation' => $old_attribute->variation,
+ 'visible' => $old_attribute->visible,
+ 'options' => $old_attribute->options
+ ];
+ }
+ }
+
+ $attributes[] = [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ];
+ //dd($attributes);
+
+ $data = [
+
+ 'attributes' => $attributes
+
+
+ ];
+ Product::update($id, $data);
+
+ $variation = Variation::create($id, $data1);
+ }
+
+ $productLogger->addLog('inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - ' . $versione . ' - ' . $variation['permalink'] . "\n");
+ $productLogger->setAggiornato(true);
+
+ break;
+
+ case 'Video Streaming':
+ case 'Video On Demand':
+ if ($article->DescrizioneFormato === 'Streaming') {
+
+
+ $titolo = rtrim($article->Titolo, 'STR');
+ $titolo = rtrim(str_ireplace('streaming', '', $titolo));
+ $formato = 'Streaming';
+ } elseif ($article->DescrizioneFormato === 'Download') {
+ $titolo = rtrim($article->Titolo, 'VOD');
+ $titolo = rtrim(str_ireplace('download', '', $titolo));
+ $formato = 'Download';
+ } else {
+ $productLogger->addLog('not_inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . "\n");
+ $productLogger->setAggiornato(true);
+ break;
+ }
+
+ $titolo = rtrim($titolo);
+
+ $titolo = rtrim(str_ireplace('_', '', $titolo));
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '-');
+ $titolo = rtrim($titolo);
+ $titolo = rtrim($titolo, '_');
+ $titolo = rtrim($titolo);
+
+ $prodotti = $prodotti->where('name', $titolo)->get();
+ $id = 0;
+ if (!is_null($prodotti) && $prodotti->count() > 0) {
+ foreach ($prodotti as $prodotto) {
+
+ if (strtolower($prodotto->name) === strtolower($titolo)) {
+
+ $found_key = array_search('Autore libro', array_column($prodotto->attributes, 'name'));
+
+
+ if (array_diff($prodotto->attributes[$found_key]->options, $article->authors) === array_diff($article->authors, $prodotto->attributes[$found_key]->options)) {
+ $id = $prodotto->id;
+ $variations = Variation::all($prodotto->id);
+ foreach ($variations as $variation) {
+ $found_key_version = array_search('Versione', array_column($variation->attributes, 'name'));
+ if ($variation->attributes[$found_key_version]->option == $formato) {
+ $id = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $data1 = [
+
+ 'regular_price' => $article->PrezzoIvato,
+ 'sku' => $article->IdArticolo,
+ 'sale_price' => $article->PrezzoIvatoScontatoCampagna,
+ 'date_on_sale_from' => $article->DataInizioCampagna,
+ 'date_on_sale_to' => $article->DataFineCampagna,
+ //'manage_stock' => true,
+ //'stock_quantity' => $article->stock,
+ 'purchasable' => false,
+
+ 'attributes' => [
+ [
+ 'id' => 6,
+ 'option' => $formato
+ ]
+
+ ],
+ 'meta_data' => [
+ [
+ 'key' => 'ISBN',
+ 'value' => $article->Ean13
+ ],
+ [
+ 'key' => 'misure',
+ 'value' => $article->Misure
+ ],
+ [
+ 'key' => 'formato',
+ 'value' => $article->DescrizioneFormato
+ ],
+ [
+ 'key' => 'pagine',
+ 'value' => $article->Pagine
+ ],
+ [
+ 'key' => 'edizione',
+ 'value' => $article->Edizione
+ ],
+ ]
+ ];
+ if ($id == 0) {
+ $versione = 'Nuova versione';
+ $category = Category::where('name', $article->argomento);
+ if ($category->count() > 0) {
+ $categoria = $category->first();
+ $categoriaid = $categoria['id'];
+ } else {
+ $categoriaid = 0;
+ }
+
+ $data = [
+
+ 'name' => $titolo,
+ 'type' => 'variable',
+ 'short_description' => $article->Sottotitolo,
+ 'categories' => [
+ ['id' => $categoriaid]
+
+ ],
+ 'status' => 'draft',
+
+ 'attributes' => [
+
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ],
+
+ [
+ //'id' => 5,
+ 'id' => 7,
+ 'visible' => true,
+
+ 'options' =>
+ $article->authors
+
+
+ ],
+ [
+ //'id' => 2,
+ 'id' => 8,
+ 'visible' => true,
+
+ 'options' => [
+ $article->editore
+
+ ]
+ ],
+ [
+ //'id' => 7,
+ 'id' => 9,
+ 'visible' => true,
+
+ 'options' => [
+ $article->DescrizioneTipologia
+
+ ]
+ ]
+ ],
+
+ 'default_attributes' => [
+ [
+ //'id' => 1,
+ 'id' => 6,
+ 'option' => 'Nuovo'
+ ]
+ ],
+
+
+
+
+ ];
+
+ $product = Product::create($data);
+
+ $idprodotto = $product['id'];
+
+
+ $variation = Variation::create($idprodotto, $data1);
+ } else {
+ $versione = "Aggiunta versione";
+ $product = Product::find($id);
+ $old_attributes = $product['attributes'];
+ $attributes = [];
+ foreach ($old_attributes as $old_attribute) {
+ if ($old_attribute->id <> 6) {
+
+ $attributes[] = [
+ 'id' => $old_attribute->id,
+ 'variation' => $old_attribute->variation,
+ 'visible' => $old_attribute->visible,
+ 'options' => $old_attribute->options
+ ];
+ }
+ }
+
+ $attributes[] = [
+ //'id' => 1,
+ 'id' => 6,
+ 'position' => 0,
+ 'visible' => true,
+ 'variation' => true,
+ 'options' => [
+ 'Nuovo',
+ 'Usato',
+ 'PDF',
+ 'Epub',
+ 'Mobi',
+ 'DVD',
+ 'Streaming',
+ 'Download'
+ ]
+ ];
+ //dd($attributes);
+
+ $data = [
+
+ 'attributes' => $attributes
+
+
+ ];
+ Product::update($id, $data);
+ $variation = Variation::create($id, $data1);
+ }
+ $productLogger->addLog('inserted', $article->Titolo . ' - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - ' . $versione . ' - ' . $variation['permalink'] . "\n");
+ $productLogger->setAggiornato(true);
+ break;
+ }
+ } else {
+
+ $data1 = [
+
+ 'regular_price' => $article->PrezzoIvato,
+ 'sale_price' => $article->PrezzoIvatoScontatoCampagna,
+ 'date_on_sale_from' => $article->DataInizioCampagna,
+ 'date_on_sale_to' => $article->DataFineCampagna,
+ 'stock_quantity' => $article->stock,
+ ];
+
+ $idprodotto = $productsku['parent_id'];
+ if ($idprodotto > 0) {
+ $variation = Variation::update($idprodotto, $productsku['id'], $data1);
+
+ $productLogger->addLog('updated', $article->Titolo . ' - [Quantità: ' . $data1['stock_quantity'] . '] - ' . $article->DescrizioneTipologia . ' - ' . $article->DescrizioneFormato . ' - Articolo aggiornato - ' . $variation['permalink'] . "\n");
+ $productLogger->setAggiornato(true);
+ }
+ }
+
+ if ($preorder) {
+ // Controlla se è in preordine
+ $inprevendita = isArticleInPrevendita($article->IdArticolo, true);
+ if ($inprevendita) {
+ setPreOrder($article->IdArticolo, "1", false);
+ $productLogger->addLog('pre_order', $article->titolo . ' [' . $article->IdArticolo . '] Impostato IN PREVENDITA !' . "\n");
+ } else {
+ setPreOrder($article->IdArticolo, "0", false);
+ $productLogger->addLog('mettilo in Vendita (no pre-order)', $article->titolo . ' [' . $article->IdArticolo . '] Impostato IN VENDITA !' . "\n");
+ }
+ }
+ } catch (\Exception $e) {
+ $productLogger->addLog('server_issues', $article->IdArticolo . ' - ' . $article->Titolo . "\n");
+ $productLogger->setAggiornato(true);
+ }
+}
+
+function getArticoloById($idarticolo)
+{
+ $articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
+ ->on('T_WEB_Articoli.DataOra', '=', 'b.data');
+ })
+ ->leftJoin(DB::raw('(SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto FROM T_WEB_StatiProdotto e JOIN (SELECT IdStatoProdotto, MAX(DataOra) as data1 from T_WEB_StatiProdotto GROUP BY IdStatoProdotto) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1 ) f'), function ($join) {
+ $join->on('T_WEB_Articoli.IdStatoProdotto', '=', 'f.IdStatoProdotto');
+ })
+ ->leftJoin(DB::raw('(SELECT g.IdTipologia, g.Descrizione as DescrizioneTipologia FROM T_WEB_Tipologie g JOIN (SELECT IdTipologia, MAX(DataOra) as data1 from T_WEB_Tipologie GROUP BY IdTipologia) h ON g.IdTipologia = h.IdTipologia AND g.DataOra = h.data1 ) i'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipologia', '=', 'i.IdTipologia');
+ })
+ ->leftJoin(DB::raw('(SELECT l.IdTipoFormato, l.Descrizione as DescrizioneFormato FROM T_WEB_TipiFormato l JOIN (SELECT IdTipoFormato, MAX(DataOra) as data1 from T_WEB_TipiFormato GROUP BY IdTipoFormato) m ON l.IdTipoFormato = m.IdTipoFormato AND l.DataOra = m.data1 ) n'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipoFormato', '=', 'n.IdTipoFormato');
+ })
+ ->where('T_WEB_Articoli.IdArticolo', $idarticolo)
+ /*
+ ->leftJoin(DB::raw('(SELECT o.Codice, o.QtaDisponibile FROM T_WEB_Disponibile o JOIN (SELECT Codice, MAX(DataOra) as data1 from T_WEB_Disponibile GROUP BY Codice) p ON o.Codice = p.Codice AND o.DataOra = p.data1 ) q'), function($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'q.Codice');
+ })
+ */
+
+ //->where('T_WEB_Articoli.DataOra','>',$settingora->value)
+ ->where(function ($query) {
+ $query->where('DescrizioneStatoProdotto', 'In commercio')
+ ->orWhere('DescrizioneStatoProdotto', 'In prevendita')
+ ->orWhere('DescrizioneStatoProdotto', 'Prossima uscita');
+ })
+ //->where('DescrizioneTipologia','Video Streaming')
+ ->orderBy('dataOra', 'desc')
+ ->get();
+
+ // se $articles è un array
+ if (count($articles) > 0) {
+ $article = $articles[0];
+ } else {
+ $article = null;
+ }
+
+ return $article;
+}
+
+function updateArticoloFromGM($idarticolo)
+{
+ $productLogger = new ProductLogger(null, '');
+
+ try {
+ $articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
+ ->on('T_WEB_Articoli.DataOra', '=', 'b.data');
+ })
+ ->leftJoin(DB::raw('(SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto FROM T_WEB_StatiProdotto e JOIN (SELECT IdStatoProdotto, MAX(DataOra) as data1 from T_WEB_StatiProdotto GROUP BY IdStatoProdotto) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1 ) f'), function ($join) {
+ $join->on('T_WEB_Articoli.IdStatoProdotto', '=', 'f.IdStatoProdotto');
+ })
+ ->leftJoin(DB::raw('(SELECT g.IdTipologia, g.Descrizione as DescrizioneTipologia FROM T_WEB_Tipologie g JOIN (SELECT IdTipologia, MAX(DataOra) as data1 from T_WEB_Tipologie GROUP BY IdTipologia) h ON g.IdTipologia = h.IdTipologia AND g.DataOra = h.data1 ) i'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipologia', '=', 'i.IdTipologia');
+ })
+ ->leftJoin(DB::raw('(SELECT l.IdTipoFormato, l.Descrizione as DescrizioneFormato FROM T_WEB_TipiFormato l JOIN (SELECT IdTipoFormato, MAX(DataOra) as data1 from T_WEB_TipiFormato GROUP BY IdTipoFormato) m ON l.IdTipoFormato = m.IdTipoFormato AND l.DataOra = m.data1 ) n'), function ($join) {
+ $join->on('T_WEB_Articoli.IdTipoFormato', '=', 'n.IdTipoFormato');
+ })
+ ->where('T_WEB_Articoli.IdArticolo', $idarticolo)
+ /*
+ ->leftJoin(DB::raw('(SELECT o.Codice, o.QtaDisponibile FROM T_WEB_Disponibile o JOIN (SELECT Codice, MAX(DataOra) as data1 from T_WEB_Disponibile GROUP BY Codice) p ON o.Codice = p.Codice AND o.DataOra = p.data1 ) q'), function($join) {
+ $join->on('T_WEB_Articoli.IdArticolo', '=', 'q.Codice');
+ })
+ */
+
+ //->where('T_WEB_Articoli.DataOra','>',$settingora->value)
+ ->where(function ($query) {
+ $query->where('DescrizioneStatoProdotto', 'In commercio')
+ ->orWhere('DescrizioneStatoProdotto', 'In prevendita')
+ ->orWhere('DescrizioneStatoProdotto', 'Prossima uscita');
+ })
+ //->where('DescrizioneTipologia','Video Streaming')
+ ->orderBy('dataOra', 'desc')
+ ->get();
+
+ // se $articles è un array
+ if (count($articles) > 0) {
+ $article = $articles[0];
+ } else {
+ $article = null;
+ }
+
+ if ($article) {
+ $str = "Articolo: ";
+ $str .= getarraystr($article);
+
+ $str .= "setProductFromGM: ";
+ setProductFromGM($article, false, $productLogger);
+
+
+ $str .= $productLogger->concatenateLogs();
+
+ return $str;
+ } else {
+ return "Articolo non trovato";
+ }
+ } catch (\Exception $e) {
+ return "Errore updateArticoloFromGM: " . $e->getMessage();
+ }
+}
+
+function getClienteByIdInternet_Ordine($idInternet)
+{
+
+ try {
+ $clienteinGM = Clientegm::where('IdInternet', $idInternet)->first();
+ } catch (\Exception $e) {
+ return null;
+ }
+
+ return $clienteinGM;
+}
+
+function getClienteByIdCodClienteInternet($codClienteInternet)
+{
+
+ try {
+ $clienteinGM = Clientegm::where('codClienteInternet', $codClienteInternet)->first();
+ } catch (\Exception $e) {
+ return null;
+ }
+
+ return $clienteinGM;
+}
+
+function getOrderByIdInternet($idInternet)
+{
+
+ try {
+ $ordergm = Orderdetail::where('IdInternet', $idInternet)->first();
+
+ return $ordergm;
+ } catch (\Exception $e) {
+ return null;
+ }
+}
+
+function getClienti()
+{
+ try {
+ $clienti = Clientegm::all();
+
+ dd($clienti);
+ } catch (\Exception $e) {
+ return null;
+ }
+}
+
+function getvalstr($mystr, $value, $separato = false)
+{
+ $my = '';
+ if ($mystr) {
+ $my = " " . $mystr . ": " . $value;
+ } else {
+ $my = $value;
+ if (!$separato) {
+ $my = " " . $value;
+ }
+ }
+
+ if ($separato) {
+ $my = '[' . $my . '] ';
+ }
+
+ return $my;
+}
+
diff --git a/composer.json b/composer.json
index 4c5df611..f9e94392 100755
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,4 @@
-{
- "name": "laravel/laravel",
+"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
diff --git a/resources/views/ordini.blade.php b/resources/views/ordini.blade.php
new file mode 100644
index 00000000..662a974a
--- /dev/null
+++ b/resources/views/ordini.blade.php
@@ -0,0 +1,25 @@
+@foreach($orders as $order)
+ @php
+ $product = $order->product;
+ $titolo = $product && isset($product->permalink)
+ ? "{$product->name}"
+ : "";
+ @endphp
+
+ {{ getvalstr("", $order->Codice) }}
+ {{ getvalstr("", $order->DataOra) }}
+ {{ getvalstr("", $titolo) }}
+ {{ getvalstr("Ordine", $order->IdInternet, true) }}
+ {{ getvalstr("Articolo", $order->CodArticoloGM, true) }}
+ {{ getvalstr("Prezzo", $order->PrezzoLordo) }}
+ {{ getvalstr("Quantità", $order->Qta) }}
+ @if($order->PercSconto)
+ {{ getvalstr("Sconto", $order->PercSconto) }}
+ @endif
+ @if($order->Descrizione)
+ {{ getvalstr("Descr", $order->Descrizione) }}
+ @endif
+
+ ELIMINA!
+
+@endforeach
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index b5188cb7..98214e35 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1679,26 +1679,6 @@ Route::get('/autori_test', function () {
}
});
-function getvalstr($mystr, $value, $separato = false)
-{
- $my = '';
- if ($mystr) {
- $my = " " . $mystr . ": " . $value;
- } else {
- $my = $value;
- if (!$separato) {
- $my = " " . $value;
- }
- }
-
- if ($separato) {
- $my = '[' . $my . '] ';
- }
-
- return $my;
-}
-
-
Route::get('/test7/{name}', function ($name) {
$articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli WHERE Titolo LIKE \'%' . $name . '%\' GROUP BY IdArticolo) b'), function ($join) {
$join->on('T_WEB_Articoli.IdArticolo', '=', 'b.IdArticolo')
diff --git a/vendor/laravel/framework/src/Illuminate/Container/Container.php b/vendor/laravel/framework/src/Illuminate/Container/Container.php
index e6cd346f..7d69c3af 100755
--- a/vendor/laravel/framework/src/Illuminate/Container/Container.php
+++ b/vendor/laravel/framework/src/Illuminate/Container/Container.php
@@ -14,6 +14,9 @@ use ReflectionException;
use ReflectionParameter;
use TypeError;
+use ReturnTypeWillChange; // Aggiungi questa riga in cima al file se non è già presente
+
+
class Container implements ArrayAccess, ContainerContract
{
/**
@@ -182,8 +185,8 @@ class Container implements ArrayAccess, ContainerContract
public function bound($abstract)
{
return isset($this->bindings[$abstract]) ||
- isset($this->instances[$abstract]) ||
- $this->isAlias($abstract);
+ isset($this->instances[$abstract]) ||
+ $this->isAlias($abstract);
}
/**
@@ -209,7 +212,7 @@ class Container implements ArrayAccess, ContainerContract
}
return isset($this->resolved[$abstract]) ||
- isset($this->instances[$abstract]);
+ isset($this->instances[$abstract]);
}
/**
@@ -221,8 +224,8 @@ class Container implements ArrayAccess, ContainerContract
public function isShared($abstract)
{
return isset($this->instances[$abstract]) ||
- (isset($this->bindings[$abstract]['shared']) &&
- $this->bindings[$abstract]['shared'] === true);
+ (isset($this->bindings[$abstract]['shared']) &&
+ $this->bindings[$abstract]['shared'] === true);
}
/**
@@ -262,7 +265,7 @@ class Container implements ArrayAccess, ContainerContract
// up inside its own Closure to give us more convenience when extending.
if (! $concrete instanceof Closure) {
if (! is_string($concrete)) {
- throw new TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
+ throw new \TypeError(self::class . '::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
}
$concrete = $this->getClosure($abstract, $concrete);
@@ -293,7 +296,9 @@ class Container implements ArrayAccess, ContainerContract
}
return $container->resolve(
- $concrete, $parameters, $raiseEvents = false
+ $concrete,
+ $parameters,
+ $raiseEvents = false
);
};
}
@@ -330,7 +335,7 @@ class Container implements ArrayAccess, ContainerContract
protected function parseBindMethod($method)
{
if (is_array($method)) {
- return $method[0].'@'.$method[1];
+ return $method[0] . '@' . $method[1];
}
return $method;
@@ -943,8 +948,8 @@ class Container implements ArrayAccess, ContainerContract
// primitive type which we can not resolve since it is not a class and
// we will just bomb out with an error since we have no-where to go.
$result = is_null(Util::getParameterClassName($dependency))
- ? $this->resolvePrimitive($dependency)
- : $this->resolveClass($dependency);
+ ? $this->resolvePrimitive($dependency)
+ : $this->resolveClass($dependency);
if ($dependency->isVariadic()) {
$results = array_merge($results, $result);
@@ -965,7 +970,8 @@ class Container implements ArrayAccess, ContainerContract
protected function hasParameterOverride($dependency)
{
return array_key_exists(
- $dependency->name, $this->getLastParameterOverride()
+ $dependency->name,
+ $this->getLastParameterOverride()
);
}
@@ -1000,7 +1006,7 @@ class Container implements ArrayAccess, ContainerContract
*/
protected function resolvePrimitive(ReflectionParameter $parameter)
{
- if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) {
+ if (! is_null($concrete = $this->getContextualConcrete('$' . $parameter->getName()))) {
return $concrete instanceof Closure ? $concrete($this) : $concrete;
}
@@ -1023,8 +1029,8 @@ class Container implements ArrayAccess, ContainerContract
{
try {
return $parameter->isVariadic()
- ? $this->resolveVariadicClass($parameter)
- : $this->make(Util::getParameterClassName($parameter));
+ ? $this->resolveVariadicClass($parameter)
+ : $this->make(Util::getParameterClassName($parameter));
}
// If we can not resolve the class instance, we will check to see if the value
@@ -1209,7 +1215,8 @@ class Container implements ArrayAccess, ContainerContract
$this->fireCallbackArray($object, $this->globalResolvingCallbacks);
$this->fireCallbackArray(
- $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
+ $object,
+ $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
);
$this->fireAfterResolvingCallbacks($abstract, $object);
@@ -1227,7 +1234,8 @@ class Container implements ArrayAccess, ContainerContract
$this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks);
$this->fireCallbackArray(
- $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks)
+ $object,
+ $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks)
);
}
@@ -1414,7 +1422,7 @@ class Container implements ArrayAccess, ContainerContract
* @return mixed
*/
#[\ReturnTypeWillChange]
- public function offsetGet($key)
+ public function offsetGet($key)
{
return $this->make($key);
}
@@ -1427,7 +1435,7 @@ class Container implements ArrayAccess, ContainerContract
* @return void
*/
#[\ReturnTypeWillChange]
- public function offsetSet($key, $value)
+ public function offsetSet($key, $value)
{
$this->bind($key, $value instanceof Closure ? $value : function () use ($value) {
return $value;