effettuato modifiche per mappatura campi [BUG] non trova il file
This commit is contained in:
@@ -5,10 +5,12 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Rap2hpoutre\FastExcel\FastExcel;
|
||||
use App\Models\Categorie;
|
||||
use App\Models\Conto;
|
||||
use App\Models\User;
|
||||
//use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class Movimenti extends Model
|
||||
{
|
||||
@@ -45,7 +47,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||
|
||||
public function Tags()
|
||||
{
|
||||
return $this->belongsTo(Tags::class);
|
||||
return $this->belongsTo(tag::class);
|
||||
}
|
||||
|
||||
public static function getList() {
|
||||
@@ -242,7 +244,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||
public static function importEstrattoIng($filename)
|
||||
{
|
||||
|
||||
$inputPath='/var/www/html/gestionale_mt/public/storage/tenant'.tenant('id').'/'.$filename;
|
||||
$inputPath='/var/www/html/gestionale2025/storage/app/public/'.$filename;
|
||||
// $outputPath='/var/www/html/gestionale_mt/public/tenant'.tenant('id').'/import/'.$filename.'.csv';
|
||||
$outputPath = $inputPath.'.csv';
|
||||
rename($inputPath,$outputPath);
|
||||
@@ -275,7 +277,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||
|
||||
public static function importEstrattoCR($filename)
|
||||
{
|
||||
$inputPath='/var/www/html/gestionale_mt/public/storage/tenant'.tenant('id').'/'.$filename;
|
||||
$inputPath='/var/www/html/gestionale2025/storage/app/public/'.$filename;
|
||||
// $outputPath='/var/www/html/gestionale_mt/public/'.tenant('id')."/app/".$filename;
|
||||
$outputPath = $inputPath.'.csv';
|
||||
rename($inputPath,$outputPath);
|
||||
@@ -317,15 +319,27 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||
}
|
||||
|
||||
// Test filtri categoria
|
||||
public function mapFieldByName($name)
|
||||
public static function retrieveHeaders($filename)
|
||||
{
|
||||
// definisce lo schema per rigenerare il file CSV secondo standard di importazione
|
||||
$fields = Illuminate\Support\Facade\Schema::getColumnListing('movimentis')->mapFieldByName;
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
echo $column . "\n";
|
||||
}
|
||||
$inputPath= Storage::path($filename);
|
||||
$outputPath = $inputPath.'.csv';
|
||||
rename($inputPath,$outputPath);
|
||||
|
||||
$rows = (new FastExcel)->configureCsv(';')->import($outputPath);
|
||||
$headers = array_keys($rows->first());
|
||||
return $headers;
|
||||
}
|
||||
|
||||
public static function getDbFields()
|
||||
{
|
||||
return [
|
||||
"Data movimento"=>"mov_data",
|
||||
"Descrizione"=>"mov_descrizione",
|
||||
"Importo"=>"mov_importo",
|
||||
"Categoria"=>"mov_fk_categoria",
|
||||
"Tag"=>"mov_fk_tags",
|
||||
"Conto"=>"conto_id",
|
||||
];
|
||||
}
|
||||
|
||||
// Test applicazione regole
|
||||
|
||||
Reference in New Issue
Block a user