From 89c9ae73b4ce13c60014bac8c5898e416c9a46cd Mon Sep 17 00:00:00 2001 From: Alex Orluc <alex.orluc@maarch.org> Date: Mon, 27 Jun 2016 13:58:08 +0000 Subject: [PATCH] FIX #4253 add catchable error --- visa/trunk/js/functions.js | 10 +++++----- visa/trunk/printFolder_ajax.php | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/visa/trunk/js/functions.js b/visa/trunk/js/functions.js index fcc9df83a87..1901cbe8445 100644 --- a/visa/trunk/js/functions.js +++ b/visa/trunk/js/functions.js @@ -1060,11 +1060,11 @@ function printFolder(res_id, coll_id, form_id, path){ /*winPrint.focus(); winPrint.print();*/ } - else if (response.status == 1) { - $('divErrorPrint').innerHTML = response.error_txt; - $('divErrorPrint').style.display = 'table-cell'; - Element.hide.delay(5, 'divErrorPrint'); - } + else if (response.status == 1 || response.status == -1) { + $('divErrorPrint').innerHTML = response.error_txt; + $('divErrorPrint').style.display = 'table-cell'; + Element.hide.delay(5, 'divErrorPrint'); + } } }); diff --git a/visa/trunk/printFolder_ajax.php b/visa/trunk/printFolder_ajax.php index ed2e011dafd..871493fc088 100644 --- a/visa/trunk/printFolder_ajax.php +++ b/visa/trunk/printFolder_ajax.php @@ -47,7 +47,13 @@ function concat_files($folder){ require_once("modules".DIRECTORY_SEPARATOR."visa".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); $pdf = new ConcatPdf(); $pdf->setFiles($folder); - $pdf->concat(); + try { + $pdf->concat(); + } catch (Exception $e) { + return $e->getMessage(); + } + + $tmpFileName = 'tmp_print_folder_' . rand() . '.pdf'; $filePathOnTmp = $_SESSION['config']['tmppath'] . $tmpFileName; @@ -306,7 +312,7 @@ if (count($list_path_folder) == 0){ } else{ $out_file = concat_files($list_path_folder); - if (!file_exists($out_file)) echo "{status : -1}"; + if (!file_exists($out_file)) echo "{status : -1, error_txt : '".$out_file."'}"; else{ $id_folder = ajout_bdd($out_file,$_SESSION['doc_id']); echo "{status : 0, id_folder : $id_folder}"; -- GitLab