diff --git a/apps/maarch_entreprise/js/accounting.js b/apps/maarch_entreprise/js/accounting.min.js similarity index 100% rename from apps/maarch_entreprise/js/accounting.js rename to apps/maarch_entreprise/js/accounting.min.js diff --git a/apps/maarch_entreprise/merged_jsAbstract.php b/apps/maarch_entreprise/merged_jsAbstract.php index 71149633c0e72753f7d374d27366536a66024f62..a1d2e0c9e4cd56027a43519a7478050bc89aeded 100644 --- a/apps/maarch_entreprise/merged_jsAbstract.php +++ b/apps/maarch_entreprise/merged_jsAbstract.php @@ -39,7 +39,7 @@ class MergedJsAbstract { } public function merge_lib() { - readfile('apps/maarch_entreprise/js/accounting.js'); + readfile('apps/maarch_entreprise/js/accounting.min.js'); include('apps/maarch_entreprise/js/functions.js'); readfile('apps/maarch_entreprise/js/prototype.js'); readfile('apps/maarch_entreprise/js/scriptaculous.js'); diff --git a/core/Models/AttachmentModel.php b/core/Models/AttachmentModel.php new file mode 100644 index 0000000000000000000000000000000000000000..a11ce4d22640f7a50178a396941d285bd6440553 --- /dev/null +++ b/core/Models/AttachmentModel.php @@ -0,0 +1,21 @@ +<?php + +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. +* +*/ + +/** +* @brief Attachment Model +* @author dev@maarch.org +* @ingroup core +*/ + +namespace Core\Models; + +class AttachmentModel extends AttachmentModelAbstract +{ + // Do your stuff in this class +} diff --git a/core/Models/AttachmentModelAbstract.php b/core/Models/AttachmentModelAbstract.php new file mode 100644 index 0000000000000000000000000000000000000000..2419f2d52c11463c3d2c66cfca9f27e6a10d47ec --- /dev/null +++ b/core/Models/AttachmentModelAbstract.php @@ -0,0 +1,47 @@ +<?php + +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. +* +*/ + +/** +* @brief Status Model +* @author dev@maarch.org +* @ingroup core +*/ + +namespace Core\Models; + +require_once 'apps/maarch_entreprise/services/Table.php'; + +class AttachmentModelAbstract extends \Apps_Table_Service +{ + public static function getAttachmentsTypesByXML() + { + if (file_exists('custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml')) { + $path = 'custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml'; + } else { + $path = 'apps/maarch_entreprise/xml/entreprise.xml'; + } + + $xmlfile = simplexml_load_file($path); + $attachmentTypes = []; + $attachmentTypesXML = $xmlfile->attachment_types; + if (count($attachmentTypesXML) > 0) { + foreach ($attachmentTypesXML->type as $value) { + $label = defined((string) $value->label) ? constant((string) $value->label) : (string) $value->label; + $attachmentTypes[(string) $value->id] = [ + 'label' => $label, + 'icon' => (string)$value['icon'], + 'sign' => (empty($value['sign']) || (string)$value['sign'] == 'true') ? true : false + ]; + } + } + + return $attachmentTypes; + } + +} diff --git a/core/init.php b/core/init.php index d4c888260bb0dae841d511d52051add437518bc2..707e41ca1cffc09d4c2f34e5b1eede918e63227b 100644 --- a/core/init.php +++ b/core/init.php @@ -65,6 +65,8 @@ if (isset($_SESSION['custom_override_id']) ); } +require_once 'vendor/autoload.php'; + /** * Get an array that represents directory tree diff --git a/modules/visa/class/class_modules_tools_Abstract.php b/modules/visa/class/class_modules_tools_Abstract.php index 17e6e2152b0b930d4bb29cd70f8a1e7a740844f6..1fd48cec48d037830db91ca69efe29190d572e09 100644 --- a/modules/visa/class/class_modules_tools_Abstract.php +++ b/modules/visa/class/class_modules_tools_Abstract.php @@ -31,6 +31,7 @@ define('FPDF_FONTPATH',$core_path.'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/font/'); require($core_path.'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf.php'); require($core_path.'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdi.php'); +use Core\Models\AttachmentModel; abstract class visa_Abstract extends Database { @@ -223,8 +224,17 @@ abstract class visa_Abstract extends Database public function checkResponseProject($res_id, $coll_id) { $this->errorMessageVisa = null; + $attachmentTypes = AttachmentModel::getAttachmentsTypesByXML(); + + $noSignableAttachments = []; + foreach ($attachmentTypes as $key => $value) { + if (!$value['sign']) { + $noSignableAttachments[] = $key; + } + } + $db = new Database(); - $stmt = $db->query("SELECT * FROM res_view_attachments WHERE res_id_master = ? AND coll_id = ? AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('converted_pdf','print_folder', 'incoming_mail_attachment') ", array($res_id, $coll_id)); + $stmt = $db->query("SELECT * FROM res_view_attachments WHERE res_id_master = ? AND coll_id = ? AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN (?) ", [$res_id, $coll_id, $noSignableAttachments]); if ($stmt->rowCount() <= 0) { $this->errorMessageVisa = _NO_RESPONSE_PROJECT_VISA; return false;