diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php
index 9f585c9ff..14b3a72c5 100755
--- a/modules/fatture/bulk.php
+++ b/modules/fatture/bulk.php
@@ -90,11 +90,11 @@ switch (post('op')) {
} else {
$print_name = 'Fattura elettronica di acquisto';
}
- $print = $dbo->SelectOne('zz_prints', 'id', ['name' => $print_name]);
+ $id_print = Prints::getPrints()[$print_name];
if (!empty($id_records)) {
foreach ($id_records as $id_record) {
- Prints::render($print['id'], $id_record, $dir.'tmp/');
+ Prints::render( $id_print, $id_record, $dir.'tmp/', false, true);
}
// Creazione zip
diff --git a/src/Prints.php b/src/Prints.php
index 71561dea8..fe51ad340 100755
--- a/src/Prints.php
+++ b/src/Prints.php
@@ -138,6 +138,7 @@ class Prints
* @param int $id_record
* @param string $directory
* @param bool $return_string
+ * @param bool $overwrite
*/
public static function render($print, $id_record, $directory = null, $return_string = false, $overwrite = true)
{
diff --git a/templates/fatture_elettroniche/body.php b/templates/fatture_elettroniche/body.php
index deb49d082..fd61e4181 100644
--- a/templates/fatture_elettroniche/body.php
+++ b/templates/fatture_elettroniche/body.php
@@ -25,79 +25,81 @@ $fattura = Fattura::find($id_record);
$file = $fattura->uploads()->where('name', 'Fattura Elettronica')->first();
if (empty($file)) {
+
echo '
'.tr('Questo documento non possiede una fattura elettronica associata').'
';
- return;
-}
+}else{
-$link = base_path().'/'.$file->filepath;
+ if ($file->isFatturaElettronica()) {
-if ($file->isFatturaElettronica()) {
- $content = file_get_contents(base_dir().'/'.$file->filepath);
+ $content = file_get_contents(base_dir().'/'.$file->filepath);
+
+ // Individuazione stylesheet
+ $default_stylesheet = 'asso-invoice';
+
+ $name = basename($file->original_name);
+ $filename2 = explode('.', $name)[0];
+ $pieces = explode('_', $filename2);
+ $stylesheet = $pieces[2];
+
+ $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl';
+ $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl';
- // Individuazione stylesheet
- $default_stylesheet = 'asso-invoice';
+ // XML
+ $xml = new DOMDocument();
+ $xml->loadXML($content);
+
- $name = basename($file->original_name);
- $filename = explode('.', $name)[0];
- $pieces = explode('_', $filename);
- $stylesheet = $pieces[2];
+ // XSL
+ $xsl = new DOMDocument();
+ $xsl->load($stylesheet);
+
- $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl';
- $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl';
-
- // XML
- $xml = new DOMDocument();
- $xml->loadXML($content);
-
- // XSL
- $xsl = new DOMDocument();
- $xsl->load($stylesheet);
-
- // XSLT
- $xslt = new XSLTProcessor();
- $xslt->importStylesheet($xsl);
- echo $xslt->transformToXML($xml);
-
-
-
- echo '
-';
-
-exit;
-} else {
- echo '
-';
-
- if ($file->isImage()) {
+ // XSLT
+ $xslt = new XSLTProcessor();
+ $xslt->importStylesheet($xsl);
+ echo $xslt->transformToXML($xml);
+
echo '
- ';
- } else {
- if ($file->isPDF()) {
- $src = \Prints::getPDFLink($file->filepath);
+ ';
+
+
+ } else {
echo '
- ';
+ ';
+
+ $link = base_path().'/'.$file->filepath;
+
+ if ($file->isImage()) {
+ echo '
+ ';
+ } else {
+ if ($file->isPDF()) {
+ $src = \Prints::getPDFLink($file->filepath);
+ }
+
+ echo '
+ ';
+ }
}
-}
+}
\ No newline at end of file