log
This commit is contained in:
109
app/Article.php
109
app/Article.php
@@ -8,74 +8,71 @@ class Article extends Model
|
||||
{
|
||||
protected $table = 'T_WEB_Articoli';
|
||||
|
||||
/*
|
||||
/*
|
||||
public function authors()
|
||||
{
|
||||
return $this->hasMany(Author::class);
|
||||
}
|
||||
*/
|
||||
|
||||
public function getAuthorsAttribute()
|
||||
{
|
||||
$authorId = $this->getRawOriginal('ListaAutori');
|
||||
$ids = explode(",",$authorId);
|
||||
$autori = [];
|
||||
foreach ($ids as $id)
|
||||
public function getAuthorsAttribute()
|
||||
{
|
||||
$authorId = $this->getRawOriginal('ListaAutori');
|
||||
$ids = explode(",", $authorId);
|
||||
$autori = [];
|
||||
foreach ($ids as $id) {
|
||||
|
||||
$autore = Author::where('IdAutore',$id)->orderBy('DataOra', 'desc')->first();
|
||||
if($autore){
|
||||
//$autori[] = ($autore->Nome != '' ? trim($autore->Nome) . " " : '') . trim($autore->Cognome);
|
||||
$autori[] = trim($autore->Nome) . "," . trim($autore->Cognome);
|
||||
$autore = Author::where('IdAutore', $id)->orderBy('DataOra', 'desc')->first();
|
||||
if ($autore) {
|
||||
//$autori[] = ($autore->Nome != '' ? trim($autore->Nome) . " " : '') . trim($autore->Cognome);
|
||||
$autori[] = trim($autore->Nome) . "," . trim($autore->Cognome);
|
||||
}
|
||||
}
|
||||
|
||||
return $autori;
|
||||
}
|
||||
|
||||
public function getStockAttribute()
|
||||
{
|
||||
$qtas = Stock::where('Codice', $this->IdArticolo)->orderBy('DataOra', 'desc');
|
||||
if ($qtas->count() > 0) {
|
||||
$qta = $qtas->first();
|
||||
$disponibilita = $qta->QtaDisponibile;
|
||||
} else {
|
||||
$disponibilita = 0;
|
||||
}
|
||||
return $disponibilita;
|
||||
}
|
||||
public function getStatoprodottoAttribute()
|
||||
{
|
||||
$status = Statusproduct::where('IdStatoProdotto', $this->IdStatoProdotto)->orderBy('DataOra', 'desc')->first();
|
||||
return $status->Descrizione;
|
||||
}
|
||||
|
||||
public function getEditoreAttribute()
|
||||
{
|
||||
if ($this->IdMarchioEditoriale > 0) {
|
||||
$editore = Publisher::where('IdMarchioEditoriale', $this->IdMarchioEditoriale)->orderBy('DataOra', 'desc')->first();
|
||||
return $editore->Descrizione;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $autori;
|
||||
}
|
||||
|
||||
public function getStockAttribute()
|
||||
{
|
||||
$qtas = Stock::where('Codice', $this->IdArticolo)->orderBy('DataOra', 'desc');
|
||||
if($qtas->count() > 0 ){
|
||||
$qta = $qtas->first();
|
||||
$disponibilita = $qta->QtaDisponibile;
|
||||
} else {
|
||||
$disponibilita = 0;
|
||||
public function getArgomentoAttribute()
|
||||
{
|
||||
$argomenti = Category::where('IdArgomento', $this->ListaArgomenti)->orderBy('DataOra', 'desc');
|
||||
if ($argomenti->count() > 0) {
|
||||
$argomento = $argomenti->first();
|
||||
$descrizione = $argomento->Descrizione;
|
||||
} else {
|
||||
$descrizione = "Nessuna categoria";
|
||||
}
|
||||
return $descrizione;
|
||||
}
|
||||
return $disponibilita;
|
||||
}
|
||||
public function getStatoprodottoAttribute()
|
||||
{
|
||||
$status = Statusproduct::where('IdStatoProdotto', $this->IdStatoProdotto)->orderBy('DataOra', 'desc')->first();
|
||||
return $status->Descrizione;
|
||||
}
|
||||
|
||||
public function getEditoreAttribute()
|
||||
{
|
||||
if($this->IdMarchioEditoriale > 0){
|
||||
$editore = Publisher::where('IdMarchioEditoriale', $this->IdMarchioEditoriale)->orderBy('DataOra', 'desc')->first();
|
||||
return $editore->Descrizione;
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
public function nimaia()
|
||||
{
|
||||
return $this->hasOne('App\Artnim', 'id_gm', 'IdArticolo');
|
||||
}
|
||||
}
|
||||
|
||||
public function getArgomentoAttribute()
|
||||
{
|
||||
$argomenti = Category::where('IdArgomento', $this->ListaArgomenti)->orderBy('DataOra', 'desc');
|
||||
if($argomenti->count() > 0){
|
||||
$argomento = $argomenti->first();
|
||||
$descrizione = $argomento->Descrizione;
|
||||
} else {
|
||||
$descrizione = "Nessuna categoria";
|
||||
}
|
||||
return $descrizione;
|
||||
}
|
||||
|
||||
public function nimaia()
|
||||
{
|
||||
return $this->hasOne('App\Artnim', 'id_gm', 'IdArticolo' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mylog;
|
||||
use App\Order as AppOrder;
|
||||
use Codexshaper\WooCommerce\Facades\Order;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -91,9 +92,8 @@ class OrderUpdateGm extends Command
|
||||
}
|
||||
|
||||
// get the directory actual name and put in the log file
|
||||
$title = '*** SITO DI PRODUZIONE *** ';
|
||||
|
||||
$log = $title . ' Ordini aggiornati' . "\n";
|
||||
$log = ' Ordini aggiornati' . "\n";
|
||||
|
||||
// check if there are orders to log
|
||||
if($orderupdated > 0) {
|
||||
@@ -101,7 +101,7 @@ class OrderUpdateGm extends Command
|
||||
Mail::raw($log, function ($message, $orderupdated) {
|
||||
$message->to("log@fioredellavita.it");
|
||||
//$message->bcc('');
|
||||
$message->subject("Ordini Aggiornati su GM:" . $orderupdated);
|
||||
$message->subject(Mylog::getSubjectEmail("Ordini Aggiornati su GM:" . $orderupdated));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Codexshaper\WooCommerce\Facades\Product;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Setting;
|
||||
use App\Article;
|
||||
use App\Mylog;
|
||||
use Codexshaper\WooCommerce\Models\Product as ModelsProduct;
|
||||
use Codexshaper\WooCommerce\Facades\Variation;
|
||||
use Codexshaper\WooCommerce\Facades\Category;
|
||||
@@ -1108,7 +1109,7 @@ class ProductUpdateGm extends Command
|
||||
Mail::raw($loginizio. $log . $log2 . $log1 . $log3 . $logfine, function ($message) {
|
||||
$message->to("log@fioredellavita.it");
|
||||
//$message->bcc('luca@pecos.it');
|
||||
$message->subject("Inserimento nuovi prodotti");
|
||||
$message->subject(Mylog::getSubjectEmail("Inserim. nuovi prodotti"));
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use Codexshaper\WooCommerce\Facades\Product;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Setting;
|
||||
use App\Article;
|
||||
use App\Mylog;
|
||||
use App\Stock;
|
||||
use Codexshaper\WooCommerce\Models\Product as ModelsProduct;
|
||||
use Codexshaper\WooCommerce\Facades\Variation;
|
||||
@@ -111,7 +112,7 @@ class ProductUpdateQta extends Command
|
||||
Mail::raw($loginizio. $lognrprodotti . $logfine, function ($message) {
|
||||
$message->to("log@fioredellavita.it");
|
||||
//$message->bcc('luca@pecos.it');
|
||||
$message->subject("Aggiornamento Quantità Prodotti:");
|
||||
$message->subject(Mylog::getSubjectEmail("Aggiornam. Qtà Prodotti:"));
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use Codexshaper\WooCommerce\Facades\Product;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Setting;
|
||||
use App\Article;
|
||||
use App\Mylog;
|
||||
use Codexshaper\WooCommerce\Models\Product as ModelsProduct;
|
||||
use Codexshaper\WooCommerce\Facades\Variation;
|
||||
use Codexshaper\WooCommerce\Facades\Category;
|
||||
@@ -16,6 +17,7 @@ use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
|
||||
class ProductUpdateUsedGm extends Command
|
||||
{
|
||||
/**
|
||||
@@ -95,8 +97,7 @@ class ProductUpdateUsedGm extends Command
|
||||
Log::channel('updateproductsused')->notice('Inizio da '.$settingora->value."\n");
|
||||
$loginizio = 'Inizio da '.$settingora->value."\n";
|
||||
$logfine = 'Fino a '.$ora_update."\n";
|
||||
$title = '*** SITO DI PRODUZIONE *** ';
|
||||
$log = $title . ' PRODOTTI USATI INSERITI'."\n";
|
||||
$log = ' PRODOTTI USATI INSERITI'."\n";
|
||||
$log1 = 'EVENTUALI PRODOTTI USATI NON INSERITI'."\n";
|
||||
$log2 = 'PRODOTTI USATI AGGIORNATI' . "\n";
|
||||
$log3 = 'PRODOTTI USATI NON INSERITI PER PROBLEMI SERVER' . "\n";
|
||||
@@ -286,7 +287,7 @@ class ProductUpdateUsedGm extends Command
|
||||
Mail::raw($loginizio. $log . $log2 . $log1 . $log3 . $logfine, function ($message) {
|
||||
$message->to("log@fioredellavita.it");
|
||||
//$message->bcc('luca@pecos.it');
|
||||
$message->subject("Inserimento nuovi prodotti Usati");
|
||||
$message->subject(Mylog::getSubjectEmail("Inserim. nuovi prodotti Usati"));
|
||||
|
||||
});
|
||||
|
||||
|
||||
15
app/Mylog.php
Normal file
15
app/Mylog.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Mylog extends Model
|
||||
{
|
||||
public $subject = '*** PROD: ';
|
||||
|
||||
public static function getSubjectEmail(string $subject) {
|
||||
return self::$subject . " " . $subject;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user