This commit is contained in:
paoloar77
2024-06-17 15:09:49 +02:00
parent 752599bde5
commit 0dd72f04a0
2 changed files with 22 additions and 12 deletions

View File

@@ -416,6 +416,7 @@ function setProductFromGM($article, $initlog, ProductLogger $passproductLogger)
$preorder = true; $preorder = true;
try { try {
$productLogger->addlog('')
$productsku = Product::where('sku', $article->IdArticolo)->first(); $productsku = Product::where('sku', $article->IdArticolo)->first();
//if(Gm_product::where('id_gm',$article->IdArticolo)->doesntExist()) //if(Gm_product::where('id_gm',$article->IdArticolo)->doesntExist())
if ($productsku->count() == 0) { if ($productsku->count() == 0) {
@@ -1371,7 +1372,8 @@ function setProductFromGM($article, $initlog, ProductLogger $passproductLogger)
} }
function updateArticoloFromGM($idarticolo) { function updateArticoloFromGM($idarticolo)
{
$productLogger = new ProductLogger(""); $productLogger = new ProductLogger("");
$articles = Article::where('IdArticolo', $idarticolo) $articles = Article::where('IdArticolo', $idarticolo)
@@ -1385,17 +1387,23 @@ function updateArticoloFromGM($idarticolo) {
->orderBy('dataOra', 'desc') ->orderBy('dataOra', 'desc')
->get(); ->get();
if ($articles->count() > 0) {
foreach ($articles as $article) { $article = $articles[0];
// setProductFromGM($article, false, $productLogger); } else {
$article = null;
} }
$str = "Concatena "; if ($article) {
$str .= getarraystr($articles); setProductFromGM($article, false, $productLogger);
$str = "Concatena: ";
$str .= getarraystr($article);
$str .= $productLogger->concatenateLogs(); $str .= $productLogger->concatenateLogs();
return $str; return $str;
} else {
return "Articolo non trovato";
}
} }

View File

@@ -27,6 +27,8 @@ class ProductLogger
if ($this->settingOra) { if ($this->settingOra) {
$this->logs['start'] = 'Inizio da ' . $this->settingOra . "\n"; $this->logs['start'] = 'Inizio da ' . $this->settingOra . "\n";
$this->logs['end'] = 'Fino a ' . $oraUpdate->toDateTimeString() . "\n"; $this->logs['end'] = 'Fino a ' . $oraUpdate->toDateTimeString() . "\n";
} else {
$this->logs['start'] = 'Iniziato: ' . $oraUpdate->toDateTimeString() . "\n";
} }
$this->logs['inserted'] = 'PRODOTTI INSERITI' . "\n"; $this->logs['inserted'] = 'PRODOTTI INSERITI' . "\n";
$this->logs['not_inserted'] = 'EVENTUALI PRODOTTI NON INSERITI' . "\n"; $this->logs['not_inserted'] = 'EVENTUALI PRODOTTI NON INSERITI' . "\n";