Commit 5dd98840 authored by Pegane Nestor's avatar Pegane Nestor
Browse files

FEAT #6457 watermark condition added for outgoing mail

FEAT #6457

FEAT #6457 request parameter name fix
parent e70aa265
......@@ -731,7 +731,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module
//RESOURCE FRAME
$frm_str .= '<iframe src="' . $_SESSION['config']['businessappurl']
. 'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
. $res_id . '" name="viewframe" id="viewframe" scrolling="auto" frameborder="0" width="100%" style="width:100% !important;"></iframe>';
. $res_id . '&watermark_outgoing=true" name="viewframe" id="viewframe" scrolling="auto" frameborder="0" width="100%" style="width:100% !important;"></iframe>';
$frm_str .= '</div>';
......
......@@ -124,13 +124,23 @@ if ($s_id == '') {
array($s_id, $_SESSION['collection_id_choice']));
$res_att = $stmt->fetchObject();
if ($stmt->rowCount() > 0) {
if($_REQUEST['watermark_outgoing']=='true'){ ?>
<script type="text/javascript">
window.location.href = '<?php
echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=view_attachment&res_id_master=<?php echo $s_id;?>&id=<?php echo $res_att->res_id;?>&watermark_outgoing=true'
</script>
<?php
} else {
?>
<script type="text/javascript">
window.location.href = '<?php
echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=view_attachment&res_id_master=<?php echo $s_id;?>&id=<?php echo $res_att->res_id;?>'
</script>
<script type="text/javascript">
window.location.href = '<?php
echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=view_attachment&res_id_master=<?php echo $s_id;?>&id=<?php echo $res_att->res_id;?>'
</script>
<?php
}
exit();
} else {
$stmt = $db->query("SELECT res_id FROM res_view_attachments WHERE status <> 'DEL' and status <> 'OBS' "
......@@ -139,12 +149,12 @@ if ($s_id == '') {
. "OR (attachment_type = 'signed_response' and format = 'pdf')) order by res_id desc",
array($s_id, $_SESSION['collection_id_choice']));
$res_att = $stmt->fetchObject();
if ($stmt->rowCount() > 0) {
if ($stmt->rowCount() > 0) {
?>
<script type="text/javascript">
window.location.href = '<?php
echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=view_attachment&res_id_master=<?php
?>index.php?display=true&module=attachments&page=view_attachment&res_id_master=<?php
echo $s_id;?>&id=<?php echo $res_att->res_id;?>'
</script>
<?php
......@@ -187,7 +197,7 @@ if ($s_id == '') {
}else{
$_SESSION['origin'] = '';
}
if (!$right) {
if (!$right) {
$_SESSION['error'] = _NO_RIGHT_TXT;
?>
<script type="text/javascript">
......@@ -235,7 +245,6 @@ if ($s_id == '') {
) {
$viewResourceArr['mime_type'] = "text/html";
}
//WATERMARK
if (strtoupper($viewResourceArr['ext']) == 'PDF') {
if ($_SESSION['features']['watermark']['enabled'] == 'true') {
......
......@@ -48,7 +48,7 @@ if ($watermarkTab['text'] == '') {
$watermark = 'watermark by ' . $_SESSION['user']['UserId'];
} elseif ($watermarkTab['text'] <> '') {
$watermark = $watermarkTab['text'];
preg_match_all('/\[(.*?)\]/i', $watermarkTab['text'], $matches);
preg_match_all('/\[(.*?)\]/i', $watermarkTab['text'], $matches);
$date_now = '';
$sqlArr = array();
for ($z=0;$z<count($matches[1]);$z++) {
......@@ -57,7 +57,14 @@ if ($watermarkTab['text'] == '') {
$currentText = date('d-m-Y');
} elseif ($matches[1][$z] == 'hour_now') {
$currentText = date('H:m:i');
} else {
} elseif($matches[1][$z] == 'alt_identifier'){
$dbView = new Database();
$query = " select " . $matches[1][$z]
. " as thecolumn from mlb_coll_ext where res_id = ?";
$stmt = $dbView->query($query, array($_REQUEST['res_id_master']));
$returnQuery = $stmt->fetchObject();
$currentText = $returnQuery->thecolumn;
} else {
$dbView = new Database();
$query = " select " . $matches[1][$z]
. " as thecolumn from " . $table . " where res_id = ?";
......@@ -72,6 +79,7 @@ if ($watermarkTab['text'] == '') {
);
}
}
$positionDefault = array();
$position = array();
$positionDefault['X'] = 50;
......
......@@ -141,7 +141,6 @@ if (! empty($_SESSION['error'])) {
$docserver = $lineDoc->path_template;
$file = $docserver . $path . $filename;
$file = str_replace("#", DIRECTORY_SEPARATOR, $file);
if (strtoupper($format) == "MAARCH") {
if (file_exists($file)) {
$myfile = fopen($file, "r");
......@@ -178,6 +177,9 @@ if (! empty($_SESSION['error'])) {
}
//WATERMARK
if (strtoupper($format) == 'PDF') {
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;
......
......@@ -10,7 +10,7 @@
<loaded>true</loaded>
<watermark>
<enabled>false</enabled> <!-- If true, a watermark is applied on the document /!\ WARNING /!\ BUG WITH SIGNATUREBOOK IF TRUE -->
<text>Copie conforme de [title] au statut [status] le [date_now] [hour_now]</text> <!-- text with fusion fields [column_name] or [date_now], ex : [alt_identifier] with status [status] the [date_now] [hour_now]-->
<text>Copie conforme de [title] [alt_identifier] au statut [status] le [date_now] [hour_now]</text> <!-- text with fusion fields [column_name] or [date_now], ex : [alt_identifier] with status [status] the [date_now] [hour_now]-->
<position>30,35,0,0.5</position> <!-- Setup position with X, Y, angle, opacity ; ex : 50,450,30,0.5 -->
<font>helvetica,10</font> <!-- Setup the font name and her size, ex: helvetica,10 -->
<text_color>20,192,30</text_color> <!-- Setup the color of the text, ex: 192,192,192 -->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment