AGG
This commit is contained in:
@@ -1385,11 +1385,10 @@ function updateArticoloFromGM($idarticolo) {
|
|||||||
->orderBy('dataOra', 'desc')
|
->orderBy('dataOra', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($articles as $article) {
|
|
||||||
setProductFromGM($article, false, $productLogger);
|
|
||||||
}
|
|
||||||
|
|
||||||
$productLogger->setLogandSendEmail();
|
foreach ($articles as $article) {
|
||||||
|
// setProductFromGM($article, false, $productLogger);
|
||||||
|
}
|
||||||
|
|
||||||
return $productLogger->concatenateLogs();
|
return $productLogger->concatenateLogs();
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ class ProductLogger
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$oraUpdate = Carbon::now();
|
$oraUpdate = Carbon::now();
|
||||||
$this->logs['start'] = 'Inizio da ' . $this->settingOra . "\n";
|
if ($this->settingOra) {
|
||||||
$this->logs['end'] = 'Fino a ' . $oraUpdate->toDateTimeString() . "\n";
|
$this->logs['start'] = 'Inizio da ' . $this->settingOra . "\n";
|
||||||
|
$this->logs['end'] = 'Fino a ' . $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";
|
||||||
$this->logs['updated'] = 'PRODOTTI AGGIORNATI' . "\n";
|
$this->logs['updated'] = 'PRODOTTI AGGIORNATI' . "\n";
|
||||||
@@ -39,25 +41,25 @@ class ProductLogger
|
|||||||
$this->settingOra = $newOra;
|
$this->settingOra = $newOra;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogandSendEmail() {
|
public function setLogandSendEmail()
|
||||||
$ora_update = Carbon::now();
|
{
|
||||||
|
|
||||||
if ($this->settingOra) {
|
if ($this->settingOra) {
|
||||||
$this->settingOra->value = $ora_update;
|
$this->settingOra->save();
|
||||||
$this->settingOra->save();
|
|
||||||
}
|
}
|
||||||
if ($this->aggiornato) {
|
if ($this->aggiornato) {
|
||||||
Log::channel('updateproducts')->notice($this->concatenateLogs());
|
Log::channel('updateproducts')->notice($this->concatenateLogs());
|
||||||
|
|
||||||
Mail::raw($this->concatenateLogs(), function ($message) {
|
Mail::raw($this->concatenateLogs(), function ($message) {
|
||||||
$titolo = "Inserim. nuovi prodotti";
|
|
||||||
if (!$this->settingOra) {
|
if (!$this->settingOra) {
|
||||||
$titolo = "Inserim. prodotto:";
|
$titolo = "Inserim. prodotto:";
|
||||||
|
} else {
|
||||||
|
$titolo = "Inserim. nuovi prodotti";
|
||||||
}
|
}
|
||||||
$message->to(Mylog::getEmail());
|
$message->to(Mylog::getEmail());
|
||||||
$message->subject(Mylog::getSubjectEmail($titolo));
|
$message->subject(Mylog::getSubjectEmail($titolo));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLog($type, $message)
|
public function addLog($type, $message)
|
||||||
@@ -77,12 +79,13 @@ class ProductLogger
|
|||||||
return implode("", $this->logs);
|
return implode("", $this->logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAggiornato($aggiornato) {
|
public function setAggiornato($aggiornato)
|
||||||
|
{
|
||||||
$this->aggiornato = $aggiornato;
|
$this->aggiornato = $aggiornato;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAggiornato() {
|
public function getAggiornato()
|
||||||
|
{
|
||||||
return $this->aggiornato;
|
return $this->aggiornato;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user