diff --git a/modules/attachments/view_attachment.php b/modules/attachments/view_attachment.php index fcdf0c0eb686f3e0346bca2051c95dd01a29b9b8..6b8ec147e4b748d29fd241f1892051534278bed7 100755 --- a/modules/attachments/view_attachment.php +++ b/modules/attachments/view_attachment.php @@ -52,7 +52,6 @@ if (! empty($_SESSION['error'])) { header("location: " . $_SESSION['config']['businessappurl'] . "index.php"); exit(); } else { - if (!empty($_REQUEST['isVersion'])) { if ($_REQUEST['isVersion'] == 'false') { $stmt = $db->query("SELECT coll_id, res_id_master FROM res_attachments WHERE res_id = ? AND res_id_master = ?", [$sId, $_REQUEST['res_id_master']]); @@ -63,7 +62,9 @@ if (! empty($_SESSION['error'])) { $stmt = $db->query( "SELECT coll_id, res_id_master FROM res_view_attachments - WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc", [$sId,$sId,$_REQUEST['res_id_master']]); + WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc", + [$sId,$sId,$_REQUEST['res_id_master']] + ); } $res = $stmt->fetchObject(); $collId = $res->coll_id; @@ -88,12 +89,14 @@ if (! empty($_SESSION['error'])) { //fonction qui va permettre de récupérer les infos auxquels l'utilisateur à la possibilité de voir $security = new security(); $right = $security->test_right_doc( - $_SESSION['collection_id_choice'], + $_SESSION['collection_id_choice'], $resIdMaster ); $table = $sec->retrieve_view_from_coll_id($collId); $stmt = $db->query( - "SELECT res_id FROM " . $table . " WHERE res_id = ? ".$where2,array($resIdMaster)); + "SELECT res_id FROM " . $table . " WHERE res_id = ? ".$where2, + array($resIdMaster) + ); if ($stmt->rowCount() == 0 and !$right) { $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS; @@ -112,7 +115,8 @@ if (! empty($_SESSION['error'])) { $stmt = $db->query( "SELECT docserver_id, path, filename, format, title FROM res_view_attachments - WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc", array($sId,$sId,$_REQUEST['res_id_master']) + WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc", + array($sId,$sId,$_REQUEST['res_id_master']) ); } if ($stmt->rowCount() == 0) { @@ -125,17 +129,18 @@ if (! empty($_SESSION['error'])) { } else { $line = $stmt->fetchObject(); - if((!empty($_GET['editingMode']) || !empty($_GET['viewpdf'])) && strpos($line->format, 'xl') === false && strpos($line->format, 'ppt') === false){ + if ((!empty($_GET['editingMode']) || !empty($_GET['viewpdf'])) && strpos($line->format, 'xl') === false && strpos($line->format, 'ppt') === false) { header( "location: ../../rest/res/".$_REQUEST['res_id_master']."/attachments/".$_GET['id']."/content" ); $stmtPdf = $db->query( "SELECT docserver_id, path, filename, format, title FROM res_view_attachments - WHERE filename=? AND (status = 'TRA' or status = 'A_TRA')", array(substr($line->filename, 0, strrpos($line->filename, ".")).'.pdf') + WHERE filename=? AND (status = 'TRA' or status = 'A_TRA')", + array(substr($line->filename, 0, strrpos($line->filename, ".")).'.pdf') ); $linePdf = $stmtPdf->fetchObject(); - if(!empty($linePdf)){ + if (!empty($linePdf)) { $line = $linePdf; } } @@ -149,15 +154,17 @@ if (! empty($_SESSION['error'])) { $format = $line->format; $stmt = $db->query( "select path_template from " . _DOCSERVERS_TABLE_NAME - . " where docserver_id = ?",array($docserver) + . " where docserver_id = ?", + array($docserver) ); //$db->show(); $lineDoc = $stmt->fetchObject(); $docserver = $lineDoc->path_template; $file = $docserver . $path . $filename; $file = str_replace("#", DIRECTORY_SEPARATOR, $file); - if(!file_exists($file)){ - echo _FILE_NOT_EXISTS_ON_THE_SERVER; exit; + if (!file_exists($file)) { + echo _FILE_NOT_EXISTS_ON_THE_SERVER; + exit; } if (!copy($file, $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR . $filename)) { @@ -189,7 +196,7 @@ if (! empty($_SESSION['error'])) { $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS . "..."; ?><script type="text/javascript">window.opener.top.location.href='index.php';self.close();</script><?php } - } else if(!empty($_GET['editingMode']) && !in_array($format, ['pdf', 'jpg', 'jpeg', 'png'])){ + } elseif (!empty($_GET['editingMode']) && !in_array($format, ['pdf', 'jpg', 'jpeg', 'png'])) { ?> <div style="border: dashed;font-weight: bold;opacity: 0.5;font-size: 30px;height: 96%;text-align: center"> <div style="padding-top: 25%;"><?php echo _NO_PREVIEW_AVAILABLE;?><br><sub><?php echo _FILE_HAS_NO_PDF;?></sub></div> @@ -203,22 +210,27 @@ if (! empty($_SESSION['error'])) { if ($_SESSION['history']['attachview'] == "true") { $hist = new history(); $hist->add( - $table, $sId, "VIEW", 'attachview', _VIEW_DOC_NUM . "" . $sId, - $_SESSION['config']['databasetype'], 'apps' + 'res_attachments', + $sId, + "VIEW", + 'attachview', + _VIEW_DOC_NUM . "" . $sId, + $_SESSION['config']['databasetype'], + 'apps' ); } //WATERMARK if (strtoupper($format) == 'PDF') { - if($_REQUEST['watermark_outgoing'] == 'true'){ + if ($_REQUEST['watermark_outgoing'] == 'true') { $_SESSION['modules_loaded']['attachments']['watermark']['enabled'] = 'true'; } if ($_SESSION['modules_loaded']['attachments']['watermark']['enabled'] == 'true') { $table = 'res_attachments'; $watermarkForAttachments = true; - try{ + try { include 'apps/maarch_entreprise/indexing_searching/watermark.php'; - } catch(Exception $e) { + } catch (Exception $e) { $logger = Logger::getLogger('loggerTechnique'); $logger->warn( "[{$_SESSION['user']['UserId']}][View_attachment] Watermark has failed" diff --git a/modules/templates/class/templates_controler_Abstract.php b/modules/templates/class/templates_controler_Abstract.php index 7d5d942822489aa54bc187dcf2630f01d5b83755..bf27752ec6ca2c62b197907381a9d572d7902d5e 100755 --- a/modules/templates/class/templates_controler_Abstract.php +++ b/modules/templates/class/templates_controler_Abstract.php @@ -898,7 +898,7 @@ abstract class templates_controler_Abstract extends ObjectControler implements O * @param string $outputType : save to 'file', retrieve 'content' * @return merged content or path to file */ - public function merge($templateId, $params = array(), $outputType) + public function merge($templateId, $params = array(), $outputType, $context = '') { include_once 'core/class/class_functions.php'; include_once 'modules/templates/templates_tables_definition.php'; diff --git a/modules/templates/datasources/letterbox_attachment.php b/modules/templates/datasources/letterbox_attachment.php index 9f8119fd2de41fdb1b6f2d9849c0517a7e717f79..1036d7410c8e599b15ee9ff6ea5c64e87d545792 100755 --- a/modules/templates/datasources/letterbox_attachment.php +++ b/modules/templates/datasources/letterbox_attachment.php @@ -84,7 +84,7 @@ if (!empty($res_id)) { $myContact['title'] = $contacts->get_civility_contact($myContact['title']); $datasources['contact'][] = $myContact; - // single Contact + // single Contact } elseif (isset($res_contact_id) && isset($res_address_id) && is_numeric($res_contact_id)) { $stmt = $dbDatasource->query('SELECT * FROM view_contacts WHERE contact_id = ? and ca_id = ? ', array($res_contact_id, $res_address_id)); $myContact = $stmt->fetch(PDO::FETCH_ASSOC); @@ -96,6 +96,13 @@ if (!empty($res_id)) { $stmt = $dbDatasource->query('SELECT firstname, lastname, user_id, mail, phone, initials FROM users WHERE user_id = ?', [$res_contact_id]); $myContact = $stmt->fetch(PDO::FETCH_ASSOC); $datasources['contact'][] = $myContact; + } elseif (!empty($context)) { + $stmt = $dbDatasource->query('SELECT * FROM view_contacts WHERE contact_id = ? and ca_id = ?', array($datasources['res_letterbox'][0]['contact_id'], $datasources['res_letterbox'][0]['address_id'])); + $myContact = $stmt->fetch(PDO::FETCH_ASSOC); + $myContact['postal_address'] = \Contact\controllers\ContactController::formatContactAddressAfnor($myContact); + $myContact['contact_title'] = $contacts->get_civility_contact($myContact['contact_title']); + $myContact['title'] = $contacts->get_civility_contact($myContact['title']); + $datasources['contact'][] = $myContact; } if (isset($datasources['contact'][0]['title']) && $datasources['contact'][0]['title'] == '') { @@ -236,7 +243,6 @@ if (!empty($res_id)) { $copiesContact = false; $copiesEntity = false; if ($copies->item_type == 'user_id') { - $stmt2 = $dbDatasource->query('SELECT * FROM users WHERE user_id = ?', [$copies->item_id]); $copiesContact = $stmt2->fetchObject(); $stmt3 = $dbDatasource->query('SELECT en.entity_id, en.entity_label FROM entities en, users_entities ue ' diff --git a/modules/templates/templates_ajax_content_for_mails.php b/modules/templates/templates_ajax_content_for_mails.php index bed42750e244883d1b910e6fadd64fcb65aa5fb5..3b8de783bae0db4e5b34be4299674515750654f3 100755 --- a/modules/templates/templates_ajax_content_for_mails.php +++ b/modules/templates/templates_ajax_content_for_mails.php @@ -33,23 +33,23 @@ $sec = new security(); $res_view = $sec->retrieve_view_from_coll_id('letterbox_coll'); $params = array( - 'res_id' => $_GET['id'], - 'coll_id'=> "letterbox_coll", - 'res_view'=> $res_view - ); + 'res_id' => $_GET['id'], + 'coll_id'=> "letterbox_coll", + 'res_view'=> $res_view + ); $template = $templateController->get($_REQUEST['templateId']); -$template->template_content = $templateController->merge($_REQUEST['templateId'], $params, 'content'); +$template->template_content = $templateController->merge($_REQUEST['templateId'], $params, 'content', 'email'); $template->template_content = str_replace("\r\n", "\n", $template->template_content); $template->template_content = str_replace("\r", "\n", $template->template_content); $template->template_content = str_replace("\n", "\\n ", $template->template_content); $template->template_content = str_replace("''", "'", $template->template_content); -if($_REQUEST['mode'] == 'raw'){ +if ($_REQUEST['mode'] == 'raw') { $template->template_content = str_replace("<br>", "\\n", $template->template_content); $template->template_content = str_replace("<br />", "\\n", $template->template_content); $template->template_content = strip_tags($template->template_content); } echo "{status : 0, content : '" . addslashes($template->template_content) . "'}"; -exit(); \ No newline at end of file +exit(); diff --git a/package.json b/package.json index c6f759b88eb5bec7b49af494a017c7434e7c5986..2cd9273bf19898b68b59e866b933f9afe210b312 100755 --- a/package.json +++ b/package.json @@ -33,15 +33,15 @@ "devDependencies": { "@angular-devkit/build-angular": "^0.12.2", "@angular/animations": "^7.2.5", - "@angular/cdk": "^7.2.1", - "@angular/cli": "^7.3.2", + "@angular/cdk": "^7.3.3", + "@angular/cli": "^7.3.3", "@angular/common": "^7.2.5", "@angular/compiler": "^7.2.5", "@angular/compiler-cli": "^7.2.5", "@angular/core": "^7.2.5", "@angular/forms": "^7.2.5", "@angular/http": "^7.2.5", - "@angular/material": "^7.2.1", + "@angular/material": "^7.3.3", "@angular/platform-browser": "^7.2.5", "@angular/platform-browser-dynamic": "^7.2.5", "@angular/platform-server": "^7.2.5", diff --git a/src/frontend/app/list/summarySheet/summary-sheet.component.html b/src/frontend/app/list/summarySheet/summary-sheet.component.html index b1016fe18b0b0151a12b0c20d282da161a7a04b4..ff410aa34d3fbbd1e4ec4eb2287e4b1af3c41c3e 100644 --- a/src/frontend/app/list/summarySheet/summary-sheet.component.html +++ b/src/frontend/app/list/summarySheet/summary-sheet.component.html @@ -55,7 +55,9 @@ </div> </div> </div> - +<div *ngIf="data.selectedRes.length > 500" mat-dialog-actions class="actions"> + <span style="color: #d24747; font-style: italic">{{lang.firstSummarySheetsGenerated}}</span> +</div> <div mat-dialog-actions class="actions"> <button mat-raised-button mat-button color="primary" (click)="genSummarySheets();">{{lang.genSummarySheets}}</button> <button mat-raised-button mat-button [mat-dialog-close]="">{{lang.cancel}}</button> @@ -63,6 +65,3 @@ <mat-icon fontSet="fas" fontIcon="fa-plus" style="height: auto;"></mat-icon> </button> </div> -<div *ngIf="data.selectedRes.length > 500" mat-dialog-actions class="actions"> - <span style="color: #d24747; font-style: italic">{{lang.firstSummarySheetsGenerated}}</span> -</div> diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index be3030d95d0246f3330ff6d61ccb82db7d397816..4a3109f6a49f1adee07ff6a38d76db7ebd59dd69 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -866,7 +866,7 @@ export const LANG_FR = { "userIsNotDeletable" : "Vous n'avez pas la totalité des <b>droits d'accès</b> sur les listes de diffusion ou les courriers de l'utilisateur ", "userIsDeletableBy" : "Seul un utilisateur ayant la <b>totalité des droits d'accès</b> pourra supprimer ou suspendre cet utilisateur.", "mailEntitiesList" : "Liste des entités rattachées aux courriers", - "firstSummarySheetsGenerated" : "Seules les 500 premières fiches de liaison seront générés.", + "firstSummarySheetsGenerated" : "Seules les 500 premières fiches de liaison seront générées.", "selectAction" : "Effectuer une action", "emptyBasket" : "Bannette vide", "actionNotExist" : "L'action n'existe pas",