aa
This commit is contained in:
@@ -416,6 +416,7 @@ function setProductFromGM($article, $initlog, ProductLogger $passproductLogger)
|
||||
$preorder = true;
|
||||
|
||||
try {
|
||||
$productLogger->addlog('')
|
||||
$productsku = Product::where('sku', $article->IdArticolo)->first();
|
||||
//if(Gm_product::where('id_gm',$article->IdArticolo)->doesntExist())
|
||||
if ($productsku->count() == 0) {
|
||||
@@ -1366,12 +1367,13 @@ function setProductFromGM($article, $initlog, ProductLogger $passproductLogger)
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$productLogger->addLog('server_issues',$article->IdArticolo . ' - ' . $article->Titolo . "\n");
|
||||
$productLogger->addLog('server_issues', $article->IdArticolo . ' - ' . $article->Titolo . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updateArticoloFromGM($idarticolo) {
|
||||
function updateArticoloFromGM($idarticolo)
|
||||
{
|
||||
$productLogger = new ProductLogger("");
|
||||
|
||||
$articles = Article::where('IdArticolo', $idarticolo)
|
||||
@@ -1385,17 +1387,23 @@ function updateArticoloFromGM($idarticolo) {
|
||||
->orderBy('dataOra', 'desc')
|
||||
->get();
|
||||
|
||||
|
||||
foreach ($articles as $article) {
|
||||
// setProductFromGM($article, false, $productLogger);
|
||||
if ($articles->count() > 0) {
|
||||
$article = $articles[0];
|
||||
} else {
|
||||
$article = null;
|
||||
}
|
||||
|
||||
$str = "Concatena ";
|
||||
$str .= getarraystr($articles);
|
||||
if ($article) {
|
||||
setProductFromGM($article, false, $productLogger);
|
||||
|
||||
$str .= $productLogger->concatenateLogs();
|
||||
$str = "Concatena: ";
|
||||
$str .= getarraystr($article);
|
||||
|
||||
|
||||
return $str;
|
||||
|
||||
}
|
||||
$str .= $productLogger->concatenateLogs();
|
||||
|
||||
return $str;
|
||||
} else {
|
||||
return "Articolo non trovato";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ class ProductLogger
|
||||
if ($this->settingOra) {
|
||||
$this->logs['start'] = 'Inizio da ' . $this->settingOra . "\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['not_inserted'] = 'EVENTUALI PRODOTTI NON INSERITI' . "\n";
|
||||
|
||||
Reference in New Issue
Block a user