Aggiornamento classe Uploads per futura rimozione
Fix di alcuni bug ristretti a PHP 8.
This commit is contained in:
parent
c60b5d0bd9
commit
dc43af57b0
|
@ -70,13 +70,13 @@ if (post('action') == 'init') {
|
||||||
|
|
||||||
// Logo stampe
|
// Logo stampe
|
||||||
if (!empty($_FILES) && !empty($_FILES['blob']['name'])) {
|
if (!empty($_FILES) && !empty($_FILES['blob']['name'])) {
|
||||||
$file = Uploads::upload($_FILES['blob'], [
|
$upload = Uploads::upload($_FILES['blob'], [
|
||||||
'name' => 'Logo stampe',
|
'name' => 'Logo stampe',
|
||||||
'id_module' => $id_module,
|
'id_module' => $id_module,
|
||||||
'id_record' => $id_record,
|
'id_record' => $id_record,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Settings::setValue('Logo stampe', $file);
|
Settings::setValue('Logo stampe', $upload->filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,13 +166,14 @@ switch (post('op')) {
|
||||||
|
|
||||||
// Upload file
|
// Upload file
|
||||||
if (!empty($_FILES) && !empty($_FILES['immagine']['name'])) {
|
if (!empty($_FILES) && !empty($_FILES['immagine']['name'])) {
|
||||||
$filename = Uploads::upload($_FILES['immagine'], [
|
$upload = Uploads::upload($_FILES['immagine'], [
|
||||||
'name' => 'Immagine',
|
'name' => 'Immagine',
|
||||||
'id_module' => $id_module,
|
'id_module' => $id_module,
|
||||||
'id_record' => $id_record,
|
'id_record' => $id_record,
|
||||||
], [
|
], [
|
||||||
'thumbnails' => true,
|
'thumbnails' => true,
|
||||||
]);
|
]);
|
||||||
|
$filename = $upload->filename;
|
||||||
|
|
||||||
if (!empty($filename)) {
|
if (!empty($filename)) {
|
||||||
$dbo->update('mg_articoli', [
|
$dbo->update('mg_articoli', [
|
||||||
|
|
|
@ -391,15 +391,14 @@ $riga = $contratto->getRiga($type, $id_riga);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copia degli allegati
|
// Copia degli allegati
|
||||||
Uploads::copy([
|
$allegati = $promemoria->uploads();
|
||||||
'id_module' => $id_module,
|
foreach ($allegati as $allegato) {
|
||||||
'id_plugin' => Plugins::get('Pianificazione interventi')['id'],
|
$allegato->copia([
|
||||||
'id_record' => $p['id'],
|
'id_module' => $id_module,
|
||||||
], [
|
'id_plugin' => Plugins::get('Pianificazione interventi')['id'],
|
||||||
'id_module' => $id_module,
|
'id_record' => $id_promemoria,
|
||||||
'id_plugin' => Plugins::get('Pianificazione interventi')['id'],
|
]);
|
||||||
'id_record' => $id_promemoria,
|
}
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambio stato precedente contratto in concluso (non più pianificabile)
|
// Cambio stato precedente contratto in concluso (non più pianificabile)
|
||||||
|
|
|
@ -501,7 +501,7 @@ class Fattura extends Document
|
||||||
|
|
||||||
$file = $this->uploads()->where('name', 'Fattura Elettronica')->first();
|
$file = $this->uploads()->where('name', 'Fattura Elettronica')->first();
|
||||||
|
|
||||||
return file_get_contents($file->filepath);
|
return $file->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,13 +51,14 @@ switch ($op) {
|
||||||
|
|
||||||
// Upload file
|
// Upload file
|
||||||
if (!empty($_FILES) && !empty($_FILES['immagine']['name'])) {
|
if (!empty($_FILES) && !empty($_FILES['immagine']['name'])) {
|
||||||
$filename = Uploads::upload($_FILES['immagine'], [
|
$upload = Uploads::upload($_FILES['immagine'], [
|
||||||
'name' => 'Immagine',
|
'name' => 'Immagine',
|
||||||
'id_module' => $id_module,
|
'id_module' => $id_module,
|
||||||
'id_record' => $id_record,
|
'id_record' => $id_record,
|
||||||
], [
|
], [
|
||||||
'thumbnails' => true,
|
'thumbnails' => true,
|
||||||
]);
|
]);
|
||||||
|
$filename = $upload->filename;
|
||||||
|
|
||||||
if (!empty($filename)) {
|
if (!empty($filename)) {
|
||||||
$dbo->update('my_impianti', [
|
$dbo->update('my_impianti', [
|
||||||
|
|
|
@ -28,7 +28,7 @@ switch (filter('op')) {
|
||||||
|
|
||||||
$id_record = $import->id;
|
$id_record = $import->id;
|
||||||
|
|
||||||
$upload = Uploads::upload($_FILES['file'], [
|
Uploads::upload($_FILES['file'], [
|
||||||
'id_module' => $import->getModule()->id,
|
'id_module' => $import->getModule()->id,
|
||||||
'id_record' => $id_record,
|
'id_record' => $id_record,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -302,20 +302,16 @@ class FatturaElettronica
|
||||||
$this->delete();
|
$this->delete();
|
||||||
|
|
||||||
$name = 'Fattura Elettronica';
|
$name = 'Fattura Elettronica';
|
||||||
$data = $this->getUploadData();
|
$info = $this->getUploadData();
|
||||||
|
|
||||||
// Generazione nome XML
|
// Generazione nome XML
|
||||||
$filename = $this->getFilename(true);
|
$filename = $this->getFilename(true);
|
||||||
|
|
||||||
// Salvataggio del file
|
|
||||||
$file = rtrim($directory, '/').'/'.$filename;
|
|
||||||
$result = directory($directory) && file_put_contents($file, $this->toXML());
|
|
||||||
|
|
||||||
// Registrazione come allegato
|
// Registrazione come allegato
|
||||||
Uploads::register(array_merge([
|
Uploads::upload($this->toXML(), array_merge($info, [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'original' => $filename,
|
'original_name' => $filename,
|
||||||
], $data));
|
]));
|
||||||
|
|
||||||
// Aggiornamento effettivo
|
// Aggiornamento effettivo
|
||||||
database()->update('co_documenti', [
|
database()->update('co_documenti', [
|
||||||
|
@ -1617,24 +1613,26 @@ class FatturaElettronica
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $fattura->getUploadData();
|
$data = $fattura->getUploadData();
|
||||||
$dir = static::getDirectory();
|
|
||||||
|
|
||||||
|
// Generazione stampa
|
||||||
$print = Prints::getModulePredefinedPrint($id_module);
|
$print = Prints::getModulePredefinedPrint($id_module);
|
||||||
$info = Prints::render($print['id'], $documento['id'], base_dir().'/'.$dir);
|
$info = Prints::render($print['id'], $documento['id'], null, true);
|
||||||
|
|
||||||
|
// Salvataggio stampa come allegato
|
||||||
$name = 'Stampa allegata';
|
$name = 'Stampa allegata';
|
||||||
$is_presente = database()->fetchNum('SELECT id FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($documento['id']).' AND name = '.prepare($name));
|
$is_presente = database()->fetchNum('SELECT id FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($documento['id']).' AND name = '.prepare($name));
|
||||||
if (empty($is_presente)) {
|
if (empty($is_presente)) {
|
||||||
Uploads::register(array_merge([
|
Uploads::upload($info['pdf'], array_merge($data, [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'original' => basename($info['path']),
|
'original_name' => $info['path'],
|
||||||
], $data));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Introduzione allegato in Fattura Elettronica
|
||||||
$attachments[] = [
|
$attachments[] = [
|
||||||
'NomeAttachment' => 'Fattura',
|
'NomeAttachment' => 'Fattura',
|
||||||
'FormatoAttachment' => 'PDF',
|
'FormatoAttachment' => 'PDF',
|
||||||
'Attachment' => base64_encode(file_get_contents($info['path'])),
|
'Attachment' => base64_encode($info['pdf']),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $attachments;
|
return $attachments;
|
||||||
|
|
|
@ -185,22 +185,16 @@ class FatturaElettronica
|
||||||
}
|
}
|
||||||
|
|
||||||
$original = $allegato['NomeAttachment'].$extension;
|
$original = $allegato['NomeAttachment'].$extension;
|
||||||
$filename = Uploads::getName($original, [
|
Uploads::upload($content, array_merge($info, [
|
||||||
'id_module' => $module['id'],
|
'name' => $allegato['NomeAttachment'],
|
||||||
]);
|
'original_name' => $original,
|
||||||
|
|
||||||
file_put_contents($module->upload_directory.'/'.$filename, $content);
|
|
||||||
|
|
||||||
Uploads::register(array_merge($info, [
|
|
||||||
'filename' => $filename,
|
|
||||||
'original' => $original,
|
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registrazione XML come allegato
|
// Registrazione XML come allegato
|
||||||
Uploads::upload($this->file, array_merge($info, [
|
Uploads::upload($this->file, array_merge($info, [
|
||||||
'name' => tr('Fattura Elettronica'),
|
'name' => tr('Fattura Elettronica'),
|
||||||
'original' => basename($this->file),
|
'original_name' => basename($this->file),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ switch ($operazione) {
|
||||||
'data_richiesta' => post('data_richiesta'),
|
'data_richiesta' => post('data_richiesta'),
|
||||||
'idtipointervento' => post('idtipointervento'),
|
'idtipointervento' => post('idtipointervento'),
|
||||||
'richiesta' => post('richiesta'),
|
'richiesta' => post('richiesta'),
|
||||||
'idimpianti' => implode(',', post('idimpianti')),
|
'idimpianti' => implode(',', post('idimpianti') ?: []),
|
||||||
'idsede' => implode(',', post('idsede_c')),
|
'idsede' => implode(',', post('idsede_c') ?: []),
|
||||||
], ['id' => $id_record]);
|
], ['id' => $id_record]);
|
||||||
|
|
||||||
flash()->info(tr('Promemoria inserito!'));
|
flash()->info(tr('Promemoria inserito!'));
|
||||||
|
|
|
@ -29,16 +29,4 @@ class Articolo extends Article
|
||||||
use RelationTrait;
|
use RelationTrait;
|
||||||
|
|
||||||
protected $table = 'co_righe_promemoria';
|
protected $table = 'co_righe_promemoria';
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea un nuovo articolo collegato ad un contratto.
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function build(Promemoria $promemoria, Original $articolo)
|
|
||||||
{
|
|
||||||
$model = parent::build($promemoria, $articolo);
|
|
||||||
|
|
||||||
return $model;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,16 +28,4 @@ class Descrizione extends Description
|
||||||
use RelationTrait;
|
use RelationTrait;
|
||||||
|
|
||||||
protected $table = 'co_righe_promemoria';
|
protected $table = 'co_righe_promemoria';
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea una nuova riga collegata ad un contratto.
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function build(Promemoria $promemoria)
|
|
||||||
{
|
|
||||||
$model = parent::build($promemoria);
|
|
||||||
|
|
||||||
return $model;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,16 +28,4 @@ class Riga extends Row
|
||||||
use RelationTrait;
|
use RelationTrait;
|
||||||
|
|
||||||
protected $table = 'co_righe_promemoria';
|
protected $table = 'co_righe_promemoria';
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea una nuova riga collegata ad un contratto.
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function build(Promemoria $promemoria)
|
|
||||||
{
|
|
||||||
$model = parent::build($promemoria);
|
|
||||||
|
|
||||||
return $model;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,4 @@ class Sconto extends Discount
|
||||||
use RelationTrait;
|
use RelationTrait;
|
||||||
|
|
||||||
protected $table = 'co_righe_promemoria';
|
protected $table = 'co_righe_promemoria';
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea un nuovo sconto collegato ad un contratto.
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function build(Promemoria $promemoria)
|
|
||||||
{
|
|
||||||
$model = parent::build($promemoria);
|
|
||||||
|
|
||||||
return $model;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,4 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!--
|
|
||||||
~ OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
||||||
~ Copyright (C) DevCode s.r.l.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ (at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<xsl:stylesheet
|
<xsl:stylesheet
|
||||||
version="1.1"
|
version="1.1"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
@ -161,9 +143,9 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="DatiDDT">
|
<xsl:template match="DatiDDT">
|
||||||
<xsl:variable name="descri_DAO" >
|
<xsl:variable name="descri_DAO" >
|
||||||
|
|
||||||
<xsl:text>DDT </xsl:text>
|
<xsl:text>DDT </xsl:text>
|
||||||
<xsl:value-of select="NumeroDDT" />
|
<xsl:value-of select="NumeroDDT" />
|
||||||
<xsl:if test="DataDDT">
|
<xsl:if test="DataDDT">
|
||||||
|
@ -172,7 +154,7 @@
|
||||||
<xsl:with-param name="DateTime" select="DataDDT" />
|
<xsl:with-param name="DateTime" select="DataDDT" />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:if test="$descri_DAO">
|
<xsl:if test="$descri_DAO">
|
||||||
|
@ -181,7 +163,7 @@
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="DettaglioLinee">
|
<xsl:template match="DettaglioLinee">
|
||||||
<xsl:param name="r" />
|
<xsl:param name="r" />
|
||||||
<xsl:param name="posASWRELSTD" />
|
<xsl:param name="posASWRELSTD" />
|
||||||
|
@ -192,9 +174,9 @@
|
||||||
<xsl:variable name="valNumeroLinea" >
|
<xsl:variable name="valNumeroLinea" >
|
||||||
<xsl:value-of select="number(NumeroLinea)" />
|
<xsl:value-of select="number(NumeroLinea)" />
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<!--Pre LINEA OpzPreLineaDatiDDT -->
|
<!--Pre LINEA OpzPreLineaDatiDDT -->
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
|
||||||
<xsl:when test="OpzPreLineaDatiDDT">
|
<xsl:when test="OpzPreLineaDatiDDT">
|
||||||
|
@ -204,15 +186,15 @@
|
||||||
<xsl:with-param name="textDescrizione" select = "." />
|
<xsl:with-param name="textDescrizione" select = "." />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiDDT[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiDDT[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:apply-templates select="."/> <!-- apply DatiDDT template -->
|
<xsl:apply-templates select="."/> <!-- apply DatiDDT template -->
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,10 +208,10 @@
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiOrdineAcquisto[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiOrdineAcquisto[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:call-template name="DatiCorrelati" >
|
<xsl:call-template name="DatiCorrelati" >
|
||||||
<xsl:with-param name="Prefix" select='"Vs.Ord. "'/>
|
<xsl:with-param name="Prefix" select='"Vs.Ord. "'/>
|
||||||
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
||||||
|
@ -237,9 +219,9 @@
|
||||||
<xsl:with-param name="CodiceCUP" select="CodiceCUP"/>
|
<xsl:with-param name="CodiceCUP" select="CodiceCUP"/>
|
||||||
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
||||||
</xsl:call-template >
|
</xsl:call-template >
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
@ -253,9 +235,9 @@
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiContratto[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiContratto[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:call-template name="DatiCorrelati" >
|
<xsl:call-template name="DatiCorrelati" >
|
||||||
<xsl:with-param name="Prefix" select='"Contratto "'/>
|
<xsl:with-param name="Prefix" select='"Contratto "'/>
|
||||||
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
||||||
|
@ -263,8 +245,8 @@
|
||||||
<xsl:with-param name="CodiceCUP" select="CodiceCUP"/>
|
<xsl:with-param name="CodiceCUP" select="CodiceCUP"/>
|
||||||
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
||||||
</xsl:call-template >
|
</xsl:call-template >
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
@ -278,10 +260,10 @@
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiConvenzione[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiConvenzione[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:call-template name="DatiCorrelati" >
|
<xsl:call-template name="DatiCorrelati" >
|
||||||
<xsl:with-param name="Prefix" select='"Convenzione "'/>
|
<xsl:with-param name="Prefix" select='"Convenzione "'/>
|
||||||
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
<xsl:with-param name="IdDocumento" select="IdDocumento"/>
|
||||||
|
@ -290,7 +272,7 @@
|
||||||
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
||||||
</xsl:call-template >
|
</xsl:call-template >
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
@ -304,9 +286,9 @@
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiRicezione[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiRicezione[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:call-template name="DatiCorrelati" >
|
<xsl:call-template name="DatiCorrelati" >
|
||||||
<xsl:with-param name="Prefix" select='"Ricezione "'/>
|
<xsl:with-param name="Prefix" select='"Ricezione "'/>
|
||||||
|
@ -316,7 +298,7 @@
|
||||||
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
||||||
</xsl:call-template >
|
</xsl:call-template >
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
@ -329,9 +311,9 @@
|
||||||
<xsl:with-param name="textDescrizione" select = "." />
|
<xsl:with-param name="textDescrizione" select = "." />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiFattureCollegate[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaBody[$IndiceBody]/DatiGenerali/DatiFattureCollegate[ number(./RiferimentoNumeroLinea) = $valNumeroLinea] ">
|
||||||
<xsl:call-template name="DatiCorrelati" >
|
<xsl:call-template name="DatiCorrelati" >
|
||||||
<xsl:with-param name="Prefix" select='"Fatt.coll. "'/>
|
<xsl:with-param name="Prefix" select='"Fatt.coll. "'/>
|
||||||
|
@ -341,7 +323,7 @@
|
||||||
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
<xsl:with-param name="CodiceCIG" select="CodiceCIG"/>
|
||||||
</xsl:call-template >
|
</xsl:call-template >
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
|
@ -403,8 +385,8 @@
|
||||||
<xsl:if test=" translate( TipoDato,
|
<xsl:if test=" translate( TipoDato,
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
'abcdefghijklmnopqrstuvwxyz'
|
'abcdefghijklmnopqrstuvwxyz'
|
||||||
) != 'aswrelstd'
|
) != 'aswrelstd'
|
||||||
and
|
and
|
||||||
translate( TipoDato,
|
translate( TipoDato,
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
'abcdefghijklmnopqrstuvwxyz'
|
'abcdefghijklmnopqrstuvwxyz'
|
||||||
|
@ -600,8 +582,8 @@
|
||||||
<xsl:if test=" translate( TipoDato,
|
<xsl:if test=" translate( TipoDato,
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
'abcdefghijklmnopqrstuvwxyz'
|
'abcdefghijklmnopqrstuvwxyz'
|
||||||
) != 'aswrelstd'
|
) != 'aswrelstd'
|
||||||
and
|
and
|
||||||
translate( TipoDato,
|
translate( TipoDato,
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
'abcdefghijklmnopqrstuvwxyz'
|
'abcdefghijklmnopqrstuvwxyz'
|
||||||
|
@ -671,7 +653,7 @@
|
||||||
|
|
||||||
<xsl:template match="DatiRitenuta">
|
<xsl:template match="DatiRitenuta">
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td >
|
<td >
|
||||||
|
|
||||||
|
@ -744,7 +726,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="DettaglioPagamento">
|
<xsl:template match="DettaglioPagamento">
|
||||||
|
@ -854,10 +836,10 @@
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<div id="fattura-elettronica" class="page">
|
<div id="fattura-elettronica" class="page">
|
||||||
|
|
||||||
<!-- FatturaElettronicaHeader -->
|
<!-- FatturaElettronicaHeader -->
|
||||||
<xsl:if test="$TipoFattura/FatturaElettronicaHeader">
|
<xsl:if test="$TipoFattura/FatturaElettronicaHeader">
|
||||||
|
|
||||||
<xsl:if test="$TipoFattura/FatturaElettronicaHeader/NomeDocumento">
|
<xsl:if test="$TipoFattura/FatturaElettronicaHeader/NomeDocumento">
|
||||||
<table class="tbNoBorder">
|
<table class="tbNoBorder">
|
||||||
<tr >
|
<tr >
|
||||||
|
@ -867,7 +849,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<table id="tbHeader" class="tbHeader">
|
<table id="tbHeader" class="tbHeader">
|
||||||
|
|
||||||
<tr >
|
<tr >
|
||||||
|
@ -1174,7 +1156,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<xsl:if test="Denominazione">
|
<xsl:if test="Denominazione">
|
||||||
<div class="headContent">
|
<div class="headContent">
|
||||||
|
|
||||||
Denominazione:
|
Denominazione:
|
||||||
|
@ -1353,7 +1335,7 @@
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
<!--INIZIO TerzoIntermediarioOSoggettoEmittente-->
|
<!--INIZIO TerzoIntermediarioOSoggettoEmittente-->
|
||||||
<xsl:if test="$TipoFattura/FatturaElettronicaHeader/TerzoIntermediarioOSoggettoEmittente">
|
<xsl:if test="$TipoFattura/FatturaElettronicaHeader/TerzoIntermediarioOSoggettoEmittente">
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -1436,12 +1418,12 @@
|
||||||
|
|
||||||
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<!--FINE TerzoIntermediarioOSoggettoEmittente-->
|
<!--FINE TerzoIntermediarioOSoggettoEmittente-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--FINE CEDENTE PRESTATORE-->
|
<!--FINE CEDENTE PRESTATORE-->
|
||||||
|
|
||||||
|
@ -1459,7 +1441,7 @@
|
||||||
<table class="tableHead">
|
<table class="tableHead">
|
||||||
<tr>
|
<tr>
|
||||||
<td >
|
<td >
|
||||||
|
|
||||||
<div class="headBorder" >
|
<div class="headBorder" >
|
||||||
<label class= "headerLabel" >Cessionario/committente (cliente) </label>
|
<label class= "headerLabel" >Cessionario/committente (cliente) </label>
|
||||||
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente">
|
<xsl:for-each select="$TipoFattura/FatturaElettronicaHeader/CessionarioCommittente">
|
||||||
|
@ -1771,7 +1753,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1786,12 +1768,12 @@
|
||||||
|
|
||||||
|
|
||||||
<xsl:variable name="BodyIndex" select="position()"/>
|
<xsl:variable name="BodyIndex" select="position()"/>
|
||||||
|
|
||||||
<!-- Conforme Standard AssoSoftware se altridatigestionali presenta ASWRELSTD -->
|
<!-- Conforme Standard AssoSoftware se altridatigestionali presenta ASWRELSTD -->
|
||||||
<xsl:variable name="posASWRELSTD" >
|
<xsl:variable name="posASWRELSTD" >
|
||||||
<xsl:for-each select="DatiBeniServizi/DettaglioLinee">
|
<xsl:for-each select="DatiBeniServizi/DettaglioLinee">
|
||||||
<xsl:variable name="DettaglioLinee" select="."/>
|
<xsl:variable name="DettaglioLinee" select="."/>
|
||||||
|
|
||||||
<xsl:variable name="posDettaglioLinee" select="position()"/>
|
<xsl:variable name="posDettaglioLinee" select="position()"/>
|
||||||
<xsl:for-each select="AltriDatiGestionali">
|
<xsl:for-each select="AltriDatiGestionali">
|
||||||
|
|
||||||
|
@ -1820,11 +1802,11 @@
|
||||||
<xsl:if test="$IsFPRS='0'">
|
<xsl:if test="$IsFPRS='0'">
|
||||||
<th class="perc">Art. 73</th>
|
<th class="perc">Art. 73</th>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:if test="$IsFPRS='1'">
|
<xsl:if test="$IsFPRS='1'">
|
||||||
<th class="perc">Imposta bollo</th>
|
<th class="perc">Imposta bollo</th>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<th >Numero documento</th>
|
<th >Numero documento</th>
|
||||||
<th class="data">Data documento</th>
|
<th class="data">Data documento</th>
|
||||||
<th >Codice destinatario</th>
|
<th >Codice destinatario</th>
|
||||||
|
@ -1897,7 +1879,7 @@
|
||||||
<xsl:when test="$TD='TD27'">
|
<xsl:when test="$TD='TD27'">
|
||||||
fattura per autoconsumo o per cessioni gratuite senza rivalsa
|
fattura per autoconsumo o per cessioni gratuite senza rivalsa
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<!--FPRS-->
|
<!--FPRS-->
|
||||||
<xsl:when test="$TD='TD07'">
|
<xsl:when test="$TD='TD07'">
|
||||||
fattura semplificata
|
fattura semplificata
|
||||||
|
@ -1925,7 +1907,7 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</td>
|
</td>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:if test="$IsFPRS='1'">
|
<xsl:if test="$IsFPRS='1'">
|
||||||
<td class="textCenter">
|
<td class="textCenter">
|
||||||
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/BolloVirtuale">
|
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/BolloVirtuale">
|
||||||
|
@ -2086,7 +2068,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
|
||||||
<xsl:if test="count(DatiGenerali/DatiOrdineAcquisto[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
<xsl:if test="count(DatiGenerali/DatiOrdineAcquisto[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
||||||
count(DatiGenerali/DatiContratto[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
count(DatiGenerali/DatiContratto[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
||||||
count(DatiGenerali/DatiDDT[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
count(DatiGenerali/DatiDDT[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
||||||
count(DatiGenerali/DatiFattureCollegate[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
count(DatiGenerali/DatiFattureCollegate[not(./RiferimentoNumeroLinea) or normalize-space(./RiferimentoNumeroLinea)='']) +
|
||||||
|
@ -2509,7 +2491,7 @@
|
||||||
Sconto/Maggiorazione
|
Sconto/Maggiorazione
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<th class="perc">Arr.</th>
|
<th class="perc">Arr.</th>
|
||||||
<th colspan="4" >
|
<th colspan="4" >
|
||||||
|
@ -2521,7 +2503,7 @@
|
||||||
|
|
||||||
<tr >
|
<tr >
|
||||||
<td colspan="2" class="import" >
|
<td colspan="2" class="import" >
|
||||||
|
|
||||||
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiBollo">
|
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiBollo">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="DatiGenerali/DatiGeneraliDocumento/DatiBollo/ImportoBollo">
|
<xsl:when test="DatiGenerali/DatiGeneraliDocumento/DatiBollo/ImportoBollo">
|
||||||
|
@ -2531,9 +2513,9 @@
|
||||||
<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/DatiBollo/BolloVirtuale" />
|
<xsl:value-of select="DatiGenerali/DatiGeneraliDocumento/DatiBollo/BolloVirtuale" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise></xsl:otherwise>
|
<xsl:otherwise></xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td colspan="3" class="import">
|
<td colspan="3" class="import">
|
||||||
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/ScontoMaggiorazione" >
|
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/ScontoMaggiorazione" >
|
||||||
|
@ -2549,8 +2531,8 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td class="import">
|
<td class="import">
|
||||||
|
|
||||||
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Arrotondamento">
|
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/Arrotondamento">
|
||||||
|
@ -2580,7 +2562,7 @@
|
||||||
<!-- Dati Ritenuta Acconto -->
|
<!-- Dati Ritenuta Acconto -->
|
||||||
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta">
|
<xsl:if test="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta">
|
||||||
<div class="separa"> </div>
|
<div class="separa"> </div>
|
||||||
|
|
||||||
<table class="tbFoglio">
|
<table class="tbFoglio">
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -2592,13 +2574,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta" >
|
<xsl:for-each select="DatiGenerali/DatiGeneraliDocumento/DatiRitenuta" >
|
||||||
<xsl:apply-templates select="." />
|
<xsl:apply-templates select="." />
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<!-- Fine Dati Ritenuta -->
|
<!-- Fine Dati Ritenuta -->
|
||||||
|
|
||||||
|
@ -2719,7 +2701,7 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
|
@ -2732,7 +2714,7 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<xsl:if test="DataRiferimentoTerminiPagamento or GiorniTerminiPagamento">
|
<xsl:if test="DataRiferimentoTerminiPagamento or GiorniTerminiPagamento">
|
||||||
|
@ -2886,7 +2868,7 @@
|
||||||
.headBorder
|
.headBorder
|
||||||
{
|
{
|
||||||
<!--border: 2px solid black;
|
<!--border: 2px solid black;
|
||||||
width:100%;
|
width:100%;
|
||||||
height: 210px;
|
height: 210px;
|
||||||
border-bottom-left-radius:30px;
|
border-bottom-left-radius:30px;
|
||||||
border-bottom-right-radius:30px; -->
|
border-bottom-right-radius:30px; -->
|
||||||
|
@ -2950,7 +2932,7 @@
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
word-wrap:break-word;
|
word-wrap:break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.tbFoglio th {
|
table.tbFoglio th {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
@ -3083,13 +3065,13 @@
|
||||||
|
|
||||||
table.tbNoBorder
|
table.tbNoBorder
|
||||||
{
|
{
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
font-size:small;
|
font-size:small;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
width:800px;
|
width:800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -3132,4 +3114,4 @@
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
|
@ -40,7 +40,6 @@ class FileManager implements ManagerInterface
|
||||||
{
|
{
|
||||||
$options['readonly'] = !empty($options['readonly']) ? true : false;
|
$options['readonly'] = !empty($options['readonly']) ? true : false;
|
||||||
$options['showpanel'] = isset($options['showpanel']) ? $options['showpanel'] : true;
|
$options['showpanel'] = isset($options['showpanel']) ? $options['showpanel'] : true;
|
||||||
$options['label'] = isset($options['label']) ? $options['label'] : tr('Allegato').':';
|
|
||||||
|
|
||||||
$options['id_plugin'] = !empty($options['id_plugin']) ? $options['id_plugin'] : null;
|
$options['id_plugin'] = !empty($options['id_plugin']) ? $options['id_plugin'] : null;
|
||||||
|
|
||||||
|
@ -158,7 +157,7 @@ class FileManager implements ManagerInterface
|
||||||
|
|
||||||
if (!$options['readonly']) {
|
if (!$options['readonly']) {
|
||||||
$result .= '
|
$result .= '
|
||||||
<button type="button" class="btn btn-xs btn-info" data-href="'.base_url().'/actions.php?op=visualizza-modifica-allegato&id_module='.$options['id_module'].'&id_allegato='.$r['id'].'" data-title="'.tr('Modifica allegato').'">
|
<button type="button" class="btn btn-xs btn-warning" data-href="'.base_url().'/actions.php?op=visualizza-modifica-allegato&id_module='.$options['id_module'].'&id_allegato='.$r['id'].'" data-title="'.tr('Modifica allegato').'">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -188,15 +187,7 @@ class FileManager implements ManagerInterface
|
||||||
// Form per l'upload di un nuovo file
|
// Form per l'upload di un nuovo file
|
||||||
if (!$options['readonly']) {
|
if (!$options['readonly']) {
|
||||||
$result .= '
|
$result .= '
|
||||||
<b>'.$options['label'].'</b>
|
|
||||||
<div id="upload-form" class="row">
|
<div id="upload-form" class="row">
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "text", "placeholder": "'.tr('Nome').'", "name": "nome_allegato", "class": "unblockable" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "text", "placeholder": "'.tr('Categoria').'", "name": "categoria_allegato", "id": "categoria_allegato", "class": "unblockable" ]}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="dropzone dz-clickable" id="dragdrop">
|
<div class="dropzone dz-clickable" id="dragdrop">
|
||||||
|
|
||||||
|
@ -252,11 +243,6 @@ $(document).ready(function() {
|
||||||
autoQueue: true,
|
autoQueue: true,
|
||||||
url: "'.base_path().'/actions.php?op=aggiungi-allegato&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'",
|
url: "'.base_path().'/actions.php?op=aggiungi-allegato&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'",
|
||||||
init: function (file, xhr, formData) {
|
init: function (file, xhr, formData) {
|
||||||
this.on("sending", function(file, xhr, formData) {
|
|
||||||
formData.append("categoria", $("#categoria_allegato").val());
|
|
||||||
formData.append("nome_allegato", $("#nome_allegato").val());
|
|
||||||
});
|
|
||||||
|
|
||||||
this.on("success", function (file) {
|
this.on("success", function (file) {
|
||||||
dragdrop.removeFile(file);
|
dragdrop.removeFile(file);
|
||||||
});
|
});
|
||||||
|
@ -318,19 +304,6 @@ $(document).ready(function() {
|
||||||
return [filename, ext];
|
return [filename, ext];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-completamento nome
|
|
||||||
$("#'.$attachment_id.' #blob").change(function(){
|
|
||||||
var nome = $("#'.$attachment_id.' #nome_allegato");
|
|
||||||
|
|
||||||
if (!nome.val()) {
|
|
||||||
var fullPath = $(this).val();
|
|
||||||
|
|
||||||
var filename = getFilenameAndExtension(fullPath);
|
|
||||||
|
|
||||||
nome.val(filename[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Auto-completamento categoria
|
// Auto-completamento categoria
|
||||||
$("#'.$attachment_id.' #categoria_allegato").autocomplete({
|
$("#'.$attachment_id.' #categoria_allegato").autocomplete({
|
||||||
source: '.json_encode($source).',
|
source: '.json_encode($source).',
|
||||||
|
@ -350,16 +323,6 @@ $(document).ready(function() {
|
||||||
$("#'.$attachment_id.' #upload").click(function(){
|
$("#'.$attachment_id.' #upload").click(function(){
|
||||||
$form = $("#'.$attachment_id.' #upload-form");
|
$form = $("#'.$attachment_id.' #upload-form");
|
||||||
|
|
||||||
if($form.find("input[name=nome_allegato]").val() == "" || $form.find("input[name=blob]").val() == "") {
|
|
||||||
swal({
|
|
||||||
type: "error",
|
|
||||||
title: "'.tr('Errore').'",
|
|
||||||
text: "'.tr('Alcuni campi obbligatori non sono stati compilati correttamente.').'",
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form.ajaxSubmit({
|
$form.ajaxSubmit({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
data: data,
|
data: data,
|
||||||
|
|
|
@ -70,7 +70,10 @@ class Module extends Model
|
||||||
$dbo = $database = database();
|
$dbo = $database = database();
|
||||||
|
|
||||||
// Lettura delle variabili nei singoli moduli
|
// Lettura delle variabili nei singoli moduli
|
||||||
$variables = include $this->filepath('variables.php');
|
$path = $this->filepath('variables.php');
|
||||||
|
if (!empty($path)) {
|
||||||
|
$variables = include $path;
|
||||||
|
}
|
||||||
|
|
||||||
// Sostituzione delle variabili di base
|
// Sostituzione delle variabili di base
|
||||||
$replaces = [];
|
$replaces = [];
|
||||||
|
|
|
@ -22,12 +22,22 @@ namespace Models;
|
||||||
use Common\SimpleModelTrait;
|
use Common\SimpleModelTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Intervention\Image\ImageManagerStatic;
|
use Intervention\Image\ImageManagerStatic;
|
||||||
|
use UnexpectedValueException;
|
||||||
use Util\FileSystem;
|
use Util\FileSystem;
|
||||||
|
|
||||||
class Upload extends Model
|
class Upload extends Model
|
||||||
{
|
{
|
||||||
use SimpleModelTrait;
|
use SimpleModelTrait;
|
||||||
|
|
||||||
|
/** @var array Elenco delle tipologie di file pericolose */
|
||||||
|
protected static $not_allowed_types = [
|
||||||
|
'php' => 'application/php',
|
||||||
|
'php5' => 'application/php',
|
||||||
|
'phtml' => 'application/php',
|
||||||
|
'html' => 'text/html',
|
||||||
|
'htm' => 'text/html',
|
||||||
|
];
|
||||||
|
|
||||||
protected $table = 'zz_files';
|
protected $table = 'zz_files';
|
||||||
|
|
||||||
protected $file_info;
|
protected $file_info;
|
||||||
|
@ -55,8 +65,10 @@ class Upload extends Model
|
||||||
/**
|
/**
|
||||||
* Crea un nuovo upload.
|
* Crea un nuovo upload.
|
||||||
*
|
*
|
||||||
* @param array $source
|
* @param string|array $source
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @param null $name
|
||||||
|
* @param null $category
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
|
@ -66,6 +78,8 @@ class Upload extends Model
|
||||||
|
|
||||||
// Informazioni di base
|
// Informazioni di base
|
||||||
$original_name = isset($source['name']) ? $source['name'] : basename($source);
|
$original_name = isset($source['name']) ? $source['name'] : basename($source);
|
||||||
|
$name = isset($data['name']) ? $data['name'] : $name;
|
||||||
|
$category = isset($data['category']) ? $data['category'] : $category;
|
||||||
|
|
||||||
// Nome e categoria dell'allegato
|
// Nome e categoria dell'allegato
|
||||||
$model->name = !empty($name) ? $name : $original_name;
|
$model->name = !empty($name) ? $name : $original_name;
|
||||||
|
@ -76,27 +90,39 @@ class Upload extends Model
|
||||||
$model->original_name = $original_name; // Fix per "original" di Eloquent
|
$model->original_name = $original_name; // Fix per "original" di Eloquent
|
||||||
|
|
||||||
// Informazioni sulle relazioni
|
// Informazioni sulle relazioni
|
||||||
$model->id_module = !empty($data['id_module']) ? $data['id_module'] : null;
|
$model->id_module = !empty($data['id_module']) && empty($data['id_plugin']) ? $data['id_module'] : null;
|
||||||
$model->id_plugin = !empty($data['id_plugin']) ? $data['id_plugin'] : null;
|
$model->id_plugin = !empty($data['id_plugin']) ? $data['id_plugin'] : null;
|
||||||
$model->id_record = !empty($data['id_record']) ? $data['id_record'] : null;
|
$model->id_record = !empty($data['id_record']) ? $data['id_record'] : null;
|
||||||
|
|
||||||
// Nome fisico del file
|
// Definizione del nome fisico del file
|
||||||
$directory = base_dir().'/'.$model->directory;
|
$directory = base_dir().'/'.$model->directory;
|
||||||
$filename = self::getNextName($original_name, $directory);
|
$filename = self::getNextName($original_name, $directory);
|
||||||
|
if (empty($filename)){
|
||||||
|
throw new UnexpectedValueException("Estensione dell'allegato non supportata");
|
||||||
|
}
|
||||||
$model->filename = $filename;
|
$model->filename = $filename;
|
||||||
|
|
||||||
// Creazione file fisico
|
// Creazione del file fisico
|
||||||
directory($directory);
|
directory($directory);
|
||||||
if (
|
if (
|
||||||
(is_array($source) && is_uploaded_file($source['tmp_name']) && !move_uploaded_file($source['tmp_name'], $directory.'/'.$filename)) ||
|
(is_array($source) && is_uploaded_file($source['tmp_name']) && !move_uploaded_file($source['tmp_name'], $directory.'/'.$filename)) ||
|
||||||
(is_string($source) && !copy($source, $directory.'/'.$filename))
|
(is_string($source) && is_file($source) && !copy($source, $directory.'/'.$filename)) ||
|
||||||
|
(is_string($source) && !is_file($source) && file_put_contents($directory.'/'.$filename, $source) === false)
|
||||||
) {
|
) {
|
||||||
return null;
|
throw new UnexpectedValueException("Errore durante il salvataggio dell'allegato");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggiornamento dimensione fisica e responsabile del caricamento
|
||||||
$model->size = FileSystem::fileSize($directory.'/'.$filename);
|
$model->size = FileSystem::fileSize($directory.'/'.$filename);
|
||||||
$model->user()->associate(auth()->getUser());
|
$model->user()->associate(auth()->getUser());
|
||||||
|
|
||||||
|
// Rimozione estensione dal nome visibile
|
||||||
|
$extension = $model->extension;
|
||||||
|
if (string_ends_with($model->name, $extension)) {
|
||||||
|
$length = strlen($extension) + 1;
|
||||||
|
$model->name = substr($model->name, 0, -$length);
|
||||||
|
}
|
||||||
|
|
||||||
$model->save();
|
$model->save();
|
||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
|
@ -200,6 +226,18 @@ class Upload extends Model
|
||||||
return $this->extension == 'pdf';
|
return $this->extension == 'pdf';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controlla se l'estensione è supportata dal sistema di upload.
|
||||||
|
*
|
||||||
|
* @param string $extension
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected static function isSupportedType($extension)
|
||||||
|
{
|
||||||
|
return !in_array(strtolower($extension), array_keys(self::$not_allowed_types));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -273,6 +311,12 @@ class Upload extends Model
|
||||||
$extension = self::getInfo($file)['extension'];
|
$extension = self::getInfo($file)['extension'];
|
||||||
$extension = strtolower($extension);
|
$extension = strtolower($extension);
|
||||||
|
|
||||||
|
// Controllo sulle estensioni permesse
|
||||||
|
$allowed = self::isSupportedType($extension);
|
||||||
|
if (!$allowed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$filename = random_string().'.'.$extension;
|
$filename = random_string().'.'.$extension;
|
||||||
} while (file_exists($directory.'/'.$filename));
|
} while (file_exists($directory.'/'.$filename));
|
||||||
|
|
206
src/Uploads.php
206
src/Uploads.php
|
@ -17,6 +17,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Models\Upload;
|
||||||
use Util\FileSystem;
|
use Util\FileSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,15 +27,6 @@ use Util\FileSystem;
|
||||||
*/
|
*/
|
||||||
class Uploads
|
class Uploads
|
||||||
{
|
{
|
||||||
/** @var array Elenco delle tipologie di file pericolose */
|
|
||||||
protected static $not_allowed_types = [
|
|
||||||
'php' => 'application/php',
|
|
||||||
'php5' => 'application/php',
|
|
||||||
'phtml' => 'application/php',
|
|
||||||
'html' => 'text/html',
|
|
||||||
'htm' => 'text/html',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restituisce l'elenco degli allegati registrati per un determinato modulo/plugin e record.
|
* Restituisce l'elenco degli allegati registrati per un determinato modulo/plugin e record.
|
||||||
*
|
*
|
||||||
|
@ -74,89 +66,18 @@ class Uploads
|
||||||
return $structure->upload_directory;
|
return $structure->upload_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Individua il nome fisico per il file indicato.
|
|
||||||
*
|
|
||||||
* @param string $source
|
|
||||||
* @param array $data
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getName($source, $data)
|
|
||||||
{
|
|
||||||
$extension = strtolower(self::fileInfo($source)['extension']);
|
|
||||||
$allowed = self::isSupportedType($extension);
|
|
||||||
|
|
||||||
if (!$allowed) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$directory = base_dir().'/'.self::getDirectory($data['id_module'], $data['id_plugin']);
|
|
||||||
|
|
||||||
do {
|
|
||||||
$filename = random_string().'.'.$extension;
|
|
||||||
} while (file_exists($directory.'/'.$filename));
|
|
||||||
|
|
||||||
return $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Effettua l'upload di un file nella cartella indicata.
|
* Effettua l'upload di un file nella cartella indicata.
|
||||||
*
|
*
|
||||||
* @param array $source
|
* @param string|array $source
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*
|
*
|
||||||
* @return string
|
* @return Upload
|
||||||
*/
|
*/
|
||||||
public static function upload($source, $data, $options = [])
|
public static function upload($source, $data, $options = [])
|
||||||
{
|
{
|
||||||
$original = isset($source['name']) ? $source['name'] : basename($source);
|
return Upload::build($source, $data);
|
||||||
|
|
||||||
$filename = self::getName($original, $data);
|
|
||||||
$directory = base_dir().'/'.self::getDirectory($data['id_module'], $data['id_plugin']);
|
|
||||||
|
|
||||||
// Creazione file fisico
|
|
||||||
if (
|
|
||||||
!directory($directory) ||
|
|
||||||
(is_array($source) && is_uploaded_file($source['tmp_name']) && !move_uploaded_file($source['tmp_name'], $directory.'/'.$filename)) ||
|
|
||||||
(is_string($source) && !copy($source, $directory.'/'.$filename))
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Registrazione del file
|
|
||||||
$data['filename'] = $filename;
|
|
||||||
$data['original'] = $original;
|
|
||||||
$data['size'] = FileSystem::fileSize($directory.'/'.$filename);
|
|
||||||
self::register($data);
|
|
||||||
|
|
||||||
// Operazioni finali
|
|
||||||
self::processOptions($data, $options);
|
|
||||||
|
|
||||||
return $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra nel database il file caricato con i dati richiesti.
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
public static function register($data)
|
|
||||||
{
|
|
||||||
$database = database();
|
|
||||||
|
|
||||||
$database->insert('zz_files', [
|
|
||||||
'name' => !empty($data['name']) ? $data['name'] : $data['original'],
|
|
||||||
'filename' => !empty($data['filename']) ? $data['filename'] : $data['original'],
|
|
||||||
'original' => $data['original'],
|
|
||||||
'category' => !empty($data['category']) ? $data['category'] : null,
|
|
||||||
'id_module' => !empty($data['id_module']) && empty($data['id_plugin']) ? $data['id_module'] : null,
|
|
||||||
'id_plugin' => !empty($data['id_plugin']) ? $data['id_plugin'] : null,
|
|
||||||
'id_record' => $data['id_record'],
|
|
||||||
'size' => $data['size'],
|
|
||||||
'created_by' => auth()->getUser()->id,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -232,123 +153,4 @@ class Uploads
|
||||||
|
|
||||||
return $infos;
|
return $infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Genera un ID fittizio per l'aggiunta di allegati a livello temporaneo.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public static function getFakeID()
|
|
||||||
{
|
|
||||||
return -rand(1, 9999);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sposta gli allegati fittizi a un record reale.
|
|
||||||
*
|
|
||||||
* @param int $fake_id
|
|
||||||
* @param int $id_record
|
|
||||||
*/
|
|
||||||
public static function updateFake($fake_id, $id_record)
|
|
||||||
{
|
|
||||||
database()->update('zz_files', [
|
|
||||||
'id_record' => $id_record,
|
|
||||||
], [
|
|
||||||
'id_record' => $fake_id,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copia gli allegati di un record in un altro record.
|
|
||||||
*
|
|
||||||
* @param array $from
|
|
||||||
* @param array $to
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function copy($from, $to)
|
|
||||||
{
|
|
||||||
$attachments = self::get($from);
|
|
||||||
|
|
||||||
$directory = base_dir().'/'.self::getDirectory($to['id_module'], $to['id_plugin']);
|
|
||||||
$directory_from = base_dir().'/'.self::getDirectory($from['id_module'], $from['id_plugin']);
|
|
||||||
|
|
||||||
foreach ($attachments as $attachment) {
|
|
||||||
$data = array_merge($attachment, $to);
|
|
||||||
|
|
||||||
// Individuazione del nuovo nome fisico
|
|
||||||
$data['filename'] = self::getName($directory_from.'/'.$attachment['filename'], $data);
|
|
||||||
|
|
||||||
// Copia fisica
|
|
||||||
if (!copy($directory_from.'/'.$attachment['filename'], $directory.'/'.$data['filename'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Registrazione del file
|
|
||||||
self::register($data);
|
|
||||||
|
|
||||||
// Operazioni finali
|
|
||||||
$options = [];
|
|
||||||
self::processOptions($data, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function processOptions($data, $options)
|
|
||||||
{
|
|
||||||
$directory = base_dir().'/'.self::getDirectory($data['id_module'], $data['id_plugin']);
|
|
||||||
|
|
||||||
if (!empty($options['thumbnails'])) {
|
|
||||||
self::thumbnails($directory.'/'.$data['filename'], $directory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controlla se l'estensione è supportata dal sistema di upload.
|
|
||||||
*
|
|
||||||
* @param string $extension
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected static function isSupportedType($extension)
|
|
||||||
{
|
|
||||||
return !in_array(strtolower($extension), array_keys(self::$not_allowed_types));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Genera le thumbnails per le immagini.
|
|
||||||
*
|
|
||||||
* @param string $filepath
|
|
||||||
* @param string $directory
|
|
||||||
*/
|
|
||||||
protected static function thumbnails($filepath, $directory = null)
|
|
||||||
{
|
|
||||||
$fileinfo = self::fileInfo($filepath);
|
|
||||||
$directory = empty($directory) ? dirname($filepath) : $directory;
|
|
||||||
|
|
||||||
if (!in_array(mime_content_type($filepath), ['image/x-png', 'image/gif', 'image/jpeg'])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$driver = extension_loaded('gd') ? 'gd' : 'imagick';
|
|
||||||
Intervention\Image\ImageManagerStatic::configure(['driver' => $driver]);
|
|
||||||
|
|
||||||
$img = Intervention\Image\ImageManagerStatic::make($filepath);
|
|
||||||
|
|
||||||
$img->resize(600, null, function ($constraint) {
|
|
||||||
$constraint->aspectRatio();
|
|
||||||
});
|
|
||||||
$img->save(slashes($directory.'/'.$fileinfo['filename'].'_thumb600.'.$fileinfo['extension']));
|
|
||||||
|
|
||||||
$img->resize(250, null, function ($constraint) {
|
|
||||||
$constraint->aspectRatio();
|
|
||||||
});
|
|
||||||
$img->save(slashes($directory.'/'.$fileinfo['filename'].'_thumb250.'.$fileinfo['extension']));
|
|
||||||
|
|
||||||
$img->resize(100, null, function ($constraint) {
|
|
||||||
$constraint->aspectRatio();
|
|
||||||
});
|
|
||||||
$img->save(slashes($directory.'/'.$fileinfo['filename'].'_thumb100.'.$fileinfo['extension']));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue