diff --git a/apps/maarch_entreprise/_no_file.pdf b/apps/maarch_entreprise/_no_file.pdf deleted file mode 100755 index 9d9232393111deba6f1d726a371da01b8fbcb52e..0000000000000000000000000000000000000000 Binary files a/apps/maarch_entreprise/_no_file.pdf and /dev/null differ diff --git a/apps/maarch_entreprise/css/styles.css b/apps/maarch_entreprise/css/styles.css index ccb8ee7caad05cdd99d42dc34ee06cb91e8d189e..d679e2dece376a3fcef67d6f1f0ccf40de92a5e8 100755 --- a/apps/maarch_entreprise/css/styles.css +++ b/apps/maarch_entreprise/css/styles.css @@ -2274,22 +2274,6 @@ hr { margin-left: 330px; } -#choose_exp_link { - margin-left: 0px; -} - -#info_user_welcome { - width: 100%; - padding-top: 10px; - border: 1px solid #BBBBBB; - background-color: White; - padding-bottom: 20px; - margin: 0px 0px 15px 0px; - padding: 5px 5px 2px 5px; - line-height: 1.8em; -} - - #info_user .button, #select_folder .button { width: 125px; @@ -2332,21 +2316,6 @@ hr { font-size: 12px; } -.dir_second_level { - margin-left: 20px; - margin-top: 0px; - margin-bottom: 15px; - font-size: 12px; -} - -.dir_third_level { - margin-left: 20px; - margin-top: 0px; - margin-bottom: 10px; - font-size: 11px; - -} - #link_right { text-align: right; margin-left: 100px; @@ -2680,18 +2649,6 @@ margin-right: 12px;*/ font-size: 14px; } -.header_menu { - display: none; - background-color: #135F7F; - height: 23px; - color: white; - - font-weight: bold; - font-size: 1.3em; - text-align: right; - border-bottom: 2px solid #FFFFFF; -} - .footer_menu { background-color: #135F7F; width: 100%; @@ -2723,10 +2680,6 @@ margin-right: 12px;*/ padding-right: 10px; } -.header_menu_blank { - height: 10px; -} - .img_credits_maarch_box { width: 100%; position: relative; @@ -3000,59 +2953,6 @@ height: 100%;*/ margin-bottom: 10px; } -#content_process { - text-align: left; -} - -/*********** ScrollBox *********************/ -.scrollbox_scrollbar { - float: left; - width: 10px; - height: 380px; - padding: 0; - margin: 0; - background: url(static.php?filename=scrollbox_blank.gif) top left no-repeat; - -} - -.scrollbox_up_button { - background: url(static.php?filename=scrollbox_up.png) no-repeat scroll right top; - /*_background:none; - _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../static.php?filename=scrollbox_up.png', sizingMethod='crop');*/ - height: 7px; - - width: 10px; - display: block; - - margin: 0; - padding: 0; - cursor: pointer; -} - -.scrollbox_down_button { - background: url(static.php?filename=down.png) no-repeat scroll right top; - /*_background:none; - _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../static.php?filename=scrollbox_down.png', sizingMethod='crop');*/ - height: 7px; - width: 10px; - display: block; - margin: 0; - padding: 0; - cursor: pointer; -} - -.scrollbox_handle { - background: url(static.php?filename=scrollbox_middle.png) top left no-repeat; - /* _background:none; - _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../static.php?filename=scrollbox_middle.png', sizingMethod='crop');*/ - width: 10px; - height: 10px; - display: block; - margin: 0; - padding: 0; - cursor: pointer; -} - #hist_courrier_frame .listing { width: 100%; } @@ -3075,40 +2975,6 @@ height: 100%;*/ color: #000000; } -#welcome_box_right { - border: 1px; - float: right; - /*min-width: 40%;*/ - width: 38%; - margin: 0 10px 0 13px; - display: inline; - /*position:absolute;*/ -} - -#welcome_box_left_quick_lunch { - border: 1px; - float: left; - min-width: 55%; - margin: 0 10px 0 13px; - /*display:relative;*/ -} - -#welcome_box_left_baskets { - border: 1px; - float: left; - min-width: 55%; - margin: 0 10px 0 13px; - /*display:relative;*/ -} - -#welcome_box_left_text { - border: 100px; - /*float: left;*/ - width: 97%; - margin: 0 10px 0 13px; - /*display:relative;*/ -} - .scroll_div { overflow: auto; } diff --git a/apps/maarch_entreprise/img/loading.gif b/apps/maarch_entreprise/img/loading.gif deleted file mode 100755 index 068cce8533cdd9680ad57456ff79403d92e62868..0000000000000000000000000000000000000000 Binary files a/apps/maarch_entreprise/img/loading.gif and /dev/null differ diff --git a/apps/maarch_entreprise/indexing_searching/choose_file.php b/apps/maarch_entreprise/indexing_searching/choose_file.php deleted file mode 100755 index abbd9f5ca4dc5e4e3e1b012f02305df7837cf8c8..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/indexing_searching/choose_file.php +++ /dev/null @@ -1,202 +0,0 @@ -<?php - -/* -* Copyright 2008-2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** - * @brief Frame to choose a file to index - * - * @file choose_file.php - * - * @author Claire Figueras <dev@maarch.org> - * @date $date$ - * - * @version $Revision$ - * @ingroup indexing_searching_mlb - */ -$core_tools = new core_tools(); -$core_tools->load_lang(); -$func = new functions(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$upFileOK = false; -$_SESSION['with_file'] = false; -$_SESSION['upfile']['fileNamePdfOnTmp'] = ''; -?> - <body> - <?php - $_SESSION['upfile']['error'] = 0; - if (isset($_FILES['file']['error']) && $_FILES['file']['error'] == 1) { - $_SESSION['upfile']['error'] = $_FILES['file']['error']; - if ($_SESSION['upfile']['error'] == 1) { - ?> - <script language="javascript" type="text/javascript"> - var test = window.top.document.getElementById('file_iframe'); - if (test != null) - { - test.src = '<?php - echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0'; - } - </script> - <?php - } - } elseif (!empty($_FILES['file']['tmp_name']) && $_FILES['file']['error'] != 1) { - $extension = explode('.', $_FILES['file']['name']); - $count_level = count($extension) - 1; - $the_ext = $extension[$count_level]; - $fileNameOnTmp = 'tmp_file_'.$_SESSION['user']['UserId'] - .'_'.rand().'.'.strtolower($the_ext); - $filePathOnTmp = $_SESSION['config']['tmppath'].$fileNameOnTmp; - if (!is_uploaded_file($_FILES['file']['tmp_name'])) { - $_SESSION['error'] = _FILE_NOT_SEND.'. '._TRY_AGAIN - .'. '._MORE_INFOS.' (<a href="mailto:' - .$_SESSION['config']['adminmail'].'">' - .$_SESSION['config']['adminname'].'</a>)'; - } else { - require_once 'core/docservers_tools.php'; - $arrayIsAllowed = array(); - $arrayIsAllowed = Ds_isFileTypeAllowed($_FILES['file']['tmp_name'], strtolower($the_ext)); - if ($arrayIsAllowed['status'] == false) { - $_SESSION['error'] = _WRONG_FILE_TYPE.' '.$arrayIsAllowed['mime_type']; - $_SESSION['upfile'] = array(); - } elseif (!@move_uploaded_file($_FILES['file']['tmp_name'], $filePathOnTmp)) { - $_SESSION['error'] = _FILE_NOT_SEND.'. '._TRY_AGAIN.'. ' - ._MORE_INFOS.' (<a href="mailto:' - .$_SESSION['config']['adminmail'].'">' - .$_SESSION['config']['adminname'].'</a>)'; - } else { - $_SESSION['upfile']['size'] = $_FILES['file']['size']; - $_SESSION['upfile']['mime'] = $_FILES['file']['type']; - $_SESSION['upfile']['local_path'] = $filePathOnTmp; - //$_SESSION['upfile']['name'] = $_FILES['file']['name']; - $_SESSION['upfile']['name'] = $fileNameOnTmp; - $_SESSION['upfile']['format'] = $the_ext; - $upFileOK = true; - } - } - } elseif ($_REQUEST['with_file'] == 'true') { - $_SESSION['with_file'] = true; - $pathToFile = 'apps/'.$_SESSION['config']['app_id'].'/_no_file.pdf'; - - if (is_file('custom/'.$_SESSION['custom_override_id'].'/'.$pathToFile)) { - $pathToFile = 'custom/'.$_SESSION['custom_override_id'].'/'.$pathToFile; - } - - $_SESSION['upfile']['size'] = filesize($pathToFile); - $_SESSION['upfile']['mime'] = 'application/pdf'; - $fileNameOnTmp = 'tmp_file_'.$_SESSION['user']['UserId'] - .'_'.rand().'.pdf'; - $_SESSION['upfile']['name'] = $fileNameOnTmp; - $filePathOnTmp = $_SESSION['config']['tmppath'].$fileNameOnTmp; - $_SESSION['upfile']['local_path'] = $filePathOnTmp; - if (copy($pathToFile, $filePathOnTmp)) { - $upFileOK = true; - } - } elseif ($_REQUEST['with_file'] == 'false') { - $_SESSION['upfile'] = []; - $upFileOK = true; - } - //if ($upFileOK) { - ?> - <script language="javascript" type="text/javascript"> - function refreshFrame(frameId) { - frameId.src = '<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&dir=indexing_searching&page=file_iframe'; - } - - var test = window.top.document.getElementById('file_iframe'); - if (test.src == '<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0') { - //test.location.refresh(); - //test.src = ''; - refreshFrame(test); - } - - if (test != null) { - //fix pb with toolbar of pdf - test.src = '<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0'; - } - </script> - <?php - //} - ?> - <form name="select_file_form" id="select_file_form" method="get" enctype="multipart/form-data" action="<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&dir=indexing_searching&page=choose_file" class="forms"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="dir" value="indexing_searching" /> - <input type="hidden" name="page" value="choose_file" /> - <p> - <label for="file" style="width:90%;margin-right: -12px;margin-top: -2px"> - <?php - if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) { - ?> - <i class="fa fa-check-square fa-2x" title="<?php echo _DOWNLOADED_FILE; ?>"></i> - <input type="button" id="fileButton" onclick="$j('#file').click();" class="button" - value="<?php if ($_REQUEST['with_file'] == 'true') { - echo _WITHOUT_FILE; - } else { - echo _DOWNLOADED_FILE; - } ?>" - style="width: 90%;margin: 0px;margin-top: -2px;font-size: 15px;text-align: center;"> - <?php - } else { - ?> - <i class="fa fa-times fa-2x" title="<?php echo _NO_FILE_SELECTED; ?>"></i> - <input type="button" id="fileButton" onclick="$j('#file').click()" class="button" value="<?php echo _CHOOSE_FILE; ?>" style="width: 90%;margin: 0px;margin-top: -2px;font-size: 15px;text-align: center;"> - <?php - } ?> - </label> - <?php - if ($_REQUEST['with_file'] == 'true') { - ?> - <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$j('#with_file').click();" title="<?php echo _WITHOUT_FILE; ?> (actif)" style="cursor:pointer;"></i> - <?php - } else { - ?> - <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$j('#with_file')[0].value='true';$j('#with_file2').click();" title="<?php echo _WITHOUT_FILE; ?>" style="cursor:pointer;"></i> - <?php - } ?> - - </p> - <p style="display:none;"> - <label for="with_file"> - <?php echo _WITHOUT_FILE; ?> - </label> - <div align="center" style="display:none;"> - <?php echo _YES; ?> - <input <?php if ($_REQUEST['with_file'] == 'true') { - echo 'checked="checked"'; - } ?> - type="radio" name="with_file" id="with_file2" value="true" onclick="this.form.method = 'post';this.form.submit();" /> - <?php echo _NO; ?> - <input <?php if ($_REQUEST['with_file'] == 'false' || $_REQUEST['with_file'] == '') { - echo 'checked="checked"'; - } ?> - type="radio" name="with_file" id="with_file" value="false" onclick="this.form.method = 'post';this.form.submit();" /> - </div> - </p> - </form> - <?php $core_tools->load_js();?> - </body> -</html> diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index fc4e1e3b1798643356dd4fa2e5a39ae6c9bf9e93..3e34183967a42d15055f28edae3b2b5cb4f4a5be 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -2307,39 +2307,6 @@ function resetSelect(id) { $j('#' + id).trigger("chosen:updated"); } -function getChildrenHtml(branch_id, treeDiv, path_manage_script, opened, closed) { - var minus; - if ($j('#' + branch_id + ' i').first().prop('class') == closed) { - minus = false; - } else { - minus = true; - } - - $j.ajax({ - url: path_manage_script, - type: 'POST', - data: { - branch_id: branch_id - }, - success: function (result) { - if (minus) { - BootstrapTree.removeSons($j('#' + branch_id + ' > ul')); - $j('#' + branch_id + ' i').first().prop('class', closed); - } else { - if (result != '') { - BootstrapTree.addNode($j('#' + branch_id), $j(result), opened, closed); - BootstrapTree.init($j('#' + treeDiv), opened, closed); - $j('#' + branch_id + ' > ul').first().find('li').hide(); - $j('#' + branch_id + ' > ul').first().find('li').show('fast'); - $j('#' + branch_id + ' i').first().prop('class', opened); - } else { - $j('#' + branch_id + ' i').first().prop('class', 'emptyNode'); - } - } - } - }); -} - function titleWithTooltipster(id) { $j(document).ready(function () { $j('#' + id).tooltipster({ diff --git a/apps/maarch_entreprise/no_right.php b/apps/maarch_entreprise/no_right.php deleted file mode 100755 index 679580a008801ff6b83abd17584f41f7e8074c14..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/no_right.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/* -* Copyright 2008,2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* File : no_right.php -* -* Default error of right page -* -* @package Maarch PeopleBox 1.0 -* @version 2.1 -* @since 10/2005 -* @license GPL -* @author Claire Figueras <dev@maarch.org> -*/; - -$core_tools = new core_tools(); - -unset($_SESSION['location_bar']['level2']); -unset($_SESSION['location_bar']['level3']); -unset($_SESSION['location_bar']['level4']); -$core_tools->manage_location_bar(); -?> -<h1><?php echo _NO_RIGHT;?></h1> -<div id="inner_content" class="clearfix"> -<br/><br/> -<div class="error"><?php echo _NO_RIGHT_TXT;?></div> -</div> diff --git a/modules/attachments/js/functions.js b/modules/attachments/js/functions.js index b58ba4704b8a6ab4d597dddc6c9de98205d45797..df00c72f140a5e34d642bfd0e2095b2a71a70ca8 100755 --- a/modules/attachments/js/functions.js +++ b/modules/attachments/js/functions.js @@ -1,9 +1,3 @@ -function cleanTitle(str) { - //permet de supprimer les # dans le titre qui bloque l'ouverture de l'applet java - var res = str.replace(/#/g, " "); - return(res); -} - function activePjTab(target) { $j('[id^=PjDocument_],#MainDocument').css('background-color', 'rgb(197, 197, 197)'); diff --git a/modules/avis/class/avis_controler_Abstract.php b/modules/avis/class/avis_controler_Abstract.php index 14d31acdedd6377e543d4170df2640c667e6c9ed..8bccb708261bfc9cd987987e1460663b870fd8b6 100755 --- a/modules/avis/class/avis_controler_Abstract.php +++ b/modules/avis/class/avis_controler_Abstract.php @@ -14,247 +14,5 @@ */ abstract class avis_controler_Abstract { - public function getAvis($resId) - { - //define avis limit date - $db = new Database(); - $query = "SELECT notes.user_id,notes.note_text, opinion_limit_date FROM notes,res_letterbox WHERE identifier = ? AND note_text LIKE '[POUR AVIS]%' AND notes.identifier = res_letterbox.res_id"; - - $stmt = $db->query($query, array($resId)); - - $avis = $stmt->fetchObject(); - - return $avis; - } - - //#################################### - //# send avis - //#################################### - - public function getList($res_id, $coll_id, $bool_modif = false, $typeList, $isAvisStep = false, $fromDetail = '') - { - $circuit = $this->getWorkflow($res_id, $coll_id, $typeList); - - $str = '<div class="error" id="divErrorAvis" onclick="this.hide();"></div>'; - $str .= '<div class="info" id="divInfoAvis" onclick="this.hide();"></div>'; - - //AVIS USER LIST - if ($bool_modif == true) { - $str .= '<select data-placeholder="'._ADD_AVIS_ROLE.'" id="avisUserList" onchange="addAvisUser();">'; - $str .= '<option value="" ></option>'; - - $tab_userentities = $this->getEntityAvis(); - $tab_users = $this->getUsersAvis(); - //Order by parent entity - foreach ($tab_userentities as $key => $value) { - $str .= '<optgroup label="'.$tab_userentities[$key]['entity_id'].'">'; - foreach ($tab_users as $user) { - if ($tab_userentities[$key]['entity_id'] == $user['entity_id']) { - $selected = ' '; - if ($user['id'] == $step['user_id']) { - $selected = ' selected'; - } - $str .= '<option value="'.$user['id'].'" '.$selected.'>'.$user['lastname'].' '.$user['firstname'].'</option>'; - } - } - $str .= '</optgroup>'; - } - $str .= '</select>'; - $str .= '<script>'; - $str .= '$j("#avisUserList").chosen({width: "250px", disable_search_threshold: 10});'; - $str .= '</script>'; - - - $str .= ' <select data-placeholder="'._ADD_AVIS_MODEL.'" name="modelList" id="modelList" onchange="loadAvisModelUsers();">'; - $str .= '<option value=""></option>'; - $str .= '</select>'; - - $str .= '<script>'; - $str .= '$j("#modelList").chosen({width: "250px", disable_search_threshold: 10});'; - $str .= '</script>'; - $str .= '<br/><br/>'; - } - - $str .= '<div id="avis_content">'; - //AVIS USER IN DOCUMENT - $i = 1; - $lastUserAvis = true; - - if (empty($circuit['avis']['users']) || !is_array($circuit['avis']['users']) || count($circuit['avis']['users']) == 0) { - $str .= '<div id="emptyAvis"><strong><em>'._EMPTY_AVIS_WORKFLOW.'</em></strong></div>'; - } else { - $str .= '<div id="emptyAvis" style="display:none;"><strong><em>'._EMPTY_AVIS_WORKFLOW.'</em></strong></div>'; - if (count($circuit['avis']['users']) > 0) { - foreach ($circuit['avis']['users'] as $it => $info_userAvis) { - if (empty($info_userAvis['process_date'])) { - if ($lastUserAvis == true && $isAvisStep == true) { - $vised = ' currentAvis'; - $modif = 'false'; - $disabled = ''; - $link_vis = 'arrow-right '; - $del_vis = '<div class="delete_avis"></div>'; - if ($info_userAvis['user_id'] != $_SESSION['user']['UserId']) { - //$info_vised = '<p style="color:red;">Vous donnez votre avis à la place de ' . $info_userAvis['firstname'] . ' ' . $info_userAvis['lastname'] . '!</p>'; - $dropZone = ''; - } else { - //$info_vised = 'Vous êtes l\'actuel conseiller'; - $dropZone = ''; - } - } else { - $dropZone = '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true" title="'._DRAG_N_DROP_CHANGE_ORDER.'" style="cursor: pointer"></i>'; - $vised = ''; - if ($bool_modif == true) { - $modif = 'true'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delAvisUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - $disabled = ''; - } else { - $dropZone = ''; - $modif = 'false'; - $del_vis = ''; - $disabled = ' disabled="disabled"'; - } - - $info_vised = ''; - $link_vis = 'hourglass-half'; - } - - $lastUserAvis = false; - } else { - $lastUserAvis = true; - $modif = 'false'; - $vised = ' vised'; - $link_vis = 'check'; - $disabled = ' disabled="disabled"'; - $info_vised = '<br/><sub>avis donné le : '.functions::format_date_db($info_userAvis['process_date'], '', '', true).'</sub>'; - $del_vis = ''; - } - //AVIS USER LINE CIRCUIT - $str .= '<div class="droptarget'.$vised.'" id="avis_'.$i.'" draggable="'.$modif.'">'; - $str .= '<span class="avisUserStatus">'; - $str .= '<i class="fa fa-'.$link_vis.'" aria-hidden="true"></i>'; - $str .= '</span>'; - $str .= '<span class="avisUserInfo">'; - $str .= '<sup class="avisUserPos nbResZero">'.$i.'</sup> '; - $str .= '<i class="fa fa-user fa-2x" aria-hidden="true"></i> '.$info_userAvis['lastname'].' '.$info_userAvis['firstname'].' <sup class="nbRes">'.$info_userAvis['entity_id'].'</sup>'.$info_vised; - $str .= '</span>'; - $str .= '<span class="avisUserAction">'; - $str .= $del_vis; - $str .= '</span>'; - $str .= '<span class="avisUserConsigne">'; - $str .= '<input class="userId" type="hidden" value="'.$info_userAvis['user_id'].'"/><input class="avisDate" type="hidden" value="'.$info_userAvis['process_date'].'"/><input'.$disabled.' class="consigne" type="text" value="'.$info_userAvis['process_comment'].'"/>'; - $str .= '</span>'; - $str .= '<span id="dropZone">'; - $str .= $dropZone; - $str .= '</span>'; - $str .= '</div>'; - - ++$i; - } - } - } - - $str .= '</div>'; - - if ($bool_modif == true) { - //SAVE AVIS CIRCUIT - $str .= '<input type="button" name="send" id="send" value="'._SAVE_CHANGES.'" class="button" '; - $str .= 'onclick="updateAvisWorkflow('.$res_id.');" /> '; - - //SAVE AS MODEL - $str .= '<input type="button" name="save" id="save" value="Enregistrer comme modèle" class="button" onclick="$(\'modalSaveAvisModel\').style.display = \'block\';" />'; - $str .= '<div id="modalSaveAvisModel" >'; - $str .= '<h3>'._SAVE_POSITION.' '._AVIS_WORKFLOW.'</h3><br/>'; - $str .= '<label for="titleModel">'._TITLE.'</label> '; - $str .= '<input type="text" name="titleModel" id="titleModel"/><br/>'; - $str .= '<input type="button" name="saveModel" id="saveModel" value="'._VALIDATE.'" class="button" onclick="saveAvisWorkflowAsModel();" /> '; - $str .= '<input type="button" name="cancelModel" id="cancelModel" value="'._CANCEL.'" class="button" onclick="$(\'modalSaveAvisModel\').style.display = \'none\';" />'; - $str .= '</div>'; - } - $str .= '<script>initDragNDropAvis();</script>'; - - return $str; - } - - public function getWorkflow($res_id, $coll_id, $typeList) - { - require_once 'modules/entities/class/class_manage_listdiff.php'; - $listdiff = new diffusion_list(); - $roles = $listdiff->list_difflist_roles(); - $circuitAvis = $listdiff->get_listinstance($res_id, false, $typeList); - if (isset($circuitAvis['copy'])) { - unset($circuitAvis['copy']); - } - - return $circuitAvis; - } - - public function getEntityAvis() - { - $db = new Database(); - - $stmt = $db->query("SELECT distinct(entities.entity_id) from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ?) - order by entities.entity_id", array('avis_documents')); - - $tab_userentities = array(); - - while ($res = $stmt->fetchObject()) { - array_push($tab_userentities, array('entity_id' => $res->entity_id)); - } - //print_r($tab_userentities); - return $tab_userentities; - } - - public function getUsersAvis($group_id = null) - { - $db = new Database(); - - if ($group_id != null) { - $stmt = $db->query("SELECT users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ? AND group_id = ?) order by users.lastname", array('avis_documents', $group_id)); - } else { - $stmt = $db->query("SELECT users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ?) - order by users.lastname", array('avis_documents')); - } - - $tab_users = array(); - - while ($res = $stmt->fetchObject()) { - array_push($tab_users, array('id' => $res->user_id, 'firstname' => $res->firstname, 'lastname' => $res->lastname, 'group_id' => $res->group_id, 'entity_id' => $res->entity_id)); - } - - return $tab_users; - } - - public function saveModelWorkflow($id_list, $workflow, $typeList, $title) - { - } - - public function saveWorkflow($res_id, $coll_id, $workflow, $typeList) - { - require_once 'modules/entities/class/class_manage_listdiff.php'; - $diff_list = new diffusion_list(); - - $diff_list->save_listinstance( - $workflow, - $typeList, - $coll_id, - $res_id, - $_SESSION['user']['UserId'], - $_SESSION['user']['primaryentity']['id'] - ); - } - - public function nbAvis($res_id, $coll_id) - { - $db = new Database(); - $stmt = $db->query("SELECT listinstance_id from listinstance WHERE res_id= ? and coll_id = ? and item_mode = ? and difflist_type = 'AVIS_CIRCUIT'", array($res_id, $coll_id, 'avis')); - - return $stmt->rowCount(); - } } diff --git a/modules/avis/css/module.css b/modules/avis/css/module.css index 2dca093d37933105855a92452c94098d7b0e6d25..b0ebe1a5e41644161c241eb96c5de937f15cebea 100755 --- a/modules/avis/css/module.css +++ b/modules/avis/css/module.css @@ -1,17 +1,3 @@ -#modalSaveAvisModel{ - padding-top:20px; - z-index: 1050; - width: 300px; - height: 80px; - border: 2px solid #000; - display: none; - position: absolute; - background-color: #F2F2F2; - left: 40%; - top: 10%; - text-align: center; -} - [draggable=true]{ cursor: move; } @@ -21,10 +7,6 @@ [draggable=false]:hover{ cursor: not-allowed; } -#avis_content{ - display: block; - width: 100%; -} .droptarget{ position: relative; background-color: #135F7F33; diff --git a/modules/avis/js/functions.js b/modules/avis/js/functions.js index 4743875272542143f81cf739b2440d28553a9d3e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 --- a/modules/avis/js/functions.js +++ b/modules/avis/js/functions.js @@ -1,336 +0,0 @@ -function addAvisUser(users) { - if (!users) { - nb_avis = $j(".droptarget").length; - next_avis = nb_avis + 1; - if (nb_avis == 0) { - $j("#emptyAvis").hide(); - } - $j("#avis_content").append('<div class="droptarget" id="avis_' + next_avis + '" draggable="true">' - + '<span class="avisUserStatus">' - + '<i class="fa fa-hourglass-half" aria-hidden="true"></i>' - + '</span>' - + '<span class="avisUserInfo">' - +'<sup class="avisUserPos nbResZero">'+next_avis+'</sup> ' - + '<i class="fa fa-user fa-2x" aria-hidden="true"></i> ' + $j("select#avisUserList option:selected").text() + ' <sup class="nbRes">' + $j("select#avisUserList option:selected").parent().get(0).label + '</sup>' - + '<input class="userId" type="hidden" value="' + $j("select#avisUserList option:selected").val() + '"/><input class="avisDate" type="hidden" value=""/>' - + '</span>' - + '<span class="avisUserAction">' - + '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delAvisUser(this.parentElement.parentElement);"></i>' - + '</span>' - + '<span class="avisUserConsigne">' - + '<input type="text" class="consigne" value=""/>' - + '</span>' - + '<span id="dropZone" title="Glisser/déposer pour modifier l\'ordre du circuit" style="cursor: pointer">' - + '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true"></i>' - + '</span>' - + '</div>'); - - document.getElementById("avisUserList").selectedIndex = 0; - $j("#avisUserList").trigger("chosen:updated"); - } else { - nb_avis = $j(".droptarget").length; - next_avis = nb_avis + 1; - if (nb_avis == 0) { - $j("#emptyAvis").hide(); - } - $j("#avis_content").append('<div class="droptarget" id="avis_' + next_avis + '" draggable="true">' - + '<span class="avisUserStatus">' - + '<i class="fa fa-hourglass-half" aria-hidden="true"></i>' - + '</span>' - + '<span class="avisUserInfo">' - +'<sup class="avisUserPos nbResZero">'+next_avis+'</sup> ' - + '<i class="fa fa-user fa-2x" aria-hidden="true"></i> ' + users.lastname + ' ' + users.firstname + ' <sup class="nbRes">' + users.entity_id + '</sup>' - + '<input class="userId" type="hidden" value="' + users.user_id + '"/><input class="avisDate" type="hidden" value=""/>' - + '</span>' - + '<span class="avisUserAction">' - + '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delAvisUser(this.parentElement.parentElement);"></i>' - + '</span>' - + '<span class="avisUserConsigne">' - + '<input type="text" class="consigne" value="' + users.process_comment + '"/>' - + '</span>' - + '<span id="dropZone" title="Glisser/déposer pour modifier l\'ordre du circuit" style="cursor: pointer">' - + '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true"></i>' - + '</span>' - + '</div>'); - - } - resetPosAvis(); -} -function delAvisUser(target) { - console.log(target); - var id = '#' + target.id; - - if ($j(".droptarget").length == 1) { - $j("#emptyAvis").show(); - } - $j(id).remove(); - - resetPosAvis(); - -} -function resetPosAvis() { - i = 1; - $j(".droptarget").each(function () { - this.id = 'avis_' + i; - $j("#" + this.id).find(".avisUserPos").text(i); - i++; - }); -} -function updateAvisWorkflow(resId) { - var $i = 0; - var userList = []; - if ($j(".droptarget").length) { - $j(".droptarget").each(function () { - //console.log('viseur : '+$j("#"+this.id+" .userdId").val()); - userId = $j("#" + this.id).find(".userId").val(); - userConsigne = $j("#" + this.id).find(".consigne").val(); - userAvisDate = $j("#" + this.id).find(".avisDate").val(); - userPos = $i; - userList.push({userId: userId, userPos: userPos, userConsigne: userConsigne, userAvisDate: userAvisDate}); - $i++; - }); - } - - //EXEMPLE BIEN FAIT - $j.ajax({ - url: 'index.php?display=true&module=avis&page=updateAvisWF', - type: 'POST', - dataType: 'JSON', - data: { - resId: resId, - userList: JSON.stringify(userList) - }, - success: function (response) { - if (response.status == 0) { - $('divInfoAvis').innerHTML = 'Mise à jour du circuit effectuée'; - $('divInfoAvis').style.display = 'table-cell'; - Element.hide.delay(5, 'divInfoAvis'); - eval(response.exec_js); - } else if (response.status != 1) { - alert(response.error_txt) - } - }, - error: function (error) { - alert(error); - } - - }); -} -function saveAvisWorkflowAsModel() { - var $i = 0; - var userList = []; - var title = $j("#titleModel").val(); - - if ($j(".droptarget").length) { - $j(".droptarget").each(function () { - //console.log('viseur : '+$j("#"+this.id+" .userdId").val()); - userId = $j("#" + this.id).find(".userId").val(); - userConsigne = $j("#" + this.id).find(".consigne").val(); - userAvisDate = $j("#" + this.id).find(".avisDate").val(); - userPos = $i; - userList.push({userId: userId, userPos: userPos, userConsigne: userConsigne, userAvisDate: userAvisDate}); - $i++; - }); - $j.ajax({ - url: 'index.php?display=true&module=avis&page=saveAvisModel', - type: 'POST', - dataType: 'JSON', - data: { - title: title, - userList: JSON.stringify(userList) - }, - success: function (response) { - if (response.status == 0) { - $('divInfoAvis').innerHTML = 'Modèle enregistré'; - $('divInfoAvis').style.display = 'table-cell'; - Element.hide.delay(5, 'divInfoAvis'); - $j('#modalSaveAvisModel').hide(); - eval(response.exec_js); - } else { - alert(response.error_txt) - } - }, - error: function (error) { - alert(error); - } - - }); - - } else { - alert('Aucun utilisateur dans le circuit !'); - } - -} -function loadAvisModelUsers() { - - var objectId = $j("select#modelList option:selected").val(); - var objectType = 'AVIS_CIRCUIT'; - $j.ajax({ - url: 'index.php?display=true&module=avis&page=load_listmodel_avis_users', - type: 'POST', - dataType: 'JSON', - data: { - objectType: objectType, - objectId: objectId - }, - success: function (response) { - if (response.status == 0) { - - var userList = response.result; - if (userList) { - userList.each(function (user, key) { - addAvisUser(user); - }); - } - - - } else { - alert(response.error_txt); - } - }, - error: function (error) { - alert(error); - } - - }); - - //prototype - document.getElementById("modelList").selectedIndex = 0; - $j("#modelList").trigger("chosen:updated"); -} - -function initDragNDropAvis() { - document.getElementById("avis_content").addEventListener("dragstart", function (event) { - $j(".droptarget").not(".vised,.currentVis").css("border", "dashed 2px #135F7F33"); - // The dataTransfer.setData() method sets the data type and the value of the dragged data - event.dataTransfer.setData("Text", event.target.id); - - // Output some text when starting to drag the p element - //document.getElementById("demo").innerHTML = "Started to drag the p element."; - - // Change the opacity of the draggable element - event.target.style.opacity = "0.4"; - }); - - // While dragging the p element, change the color of the output text - document.getElementById("avis_content").addEventListener("drag", function (event) { - //document.getElementById("demo").style.color = "red"; - }); - - // Output some text when finished dragging the p element and reset the opacity - document.getElementById("avis_content").addEventListener("dragend", function (event) { - //document.getElementById("demo").innerHTML = "Finished dragging the p element."; - $j(".droptarget").not(".vised,.currentVis").css("border", "dashed 2px #135F7F33"); - event.target.style.opacity = "1"; - }); - - - /* Events fired on the drop target */ - - // When the draggable p element enters the droptarget, change the DIVS's border style - document.getElementById("avis_content").addEventListener("dragenter", function (event) { - if (event.target.className == "droptarget") { - event.target.style.border = "dashed 2px green"; - } - }); - - // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element - document.getElementById("avis_content").addEventListener("dragover", function (event) { - event.preventDefault(); - }); - - // When the draggable p element leaves the droptarget, reset the DIVS's border style - document.getElementById("avis_content").addEventListener("dragleave", function (event) { - if (event.target.className == "droptarget") { - event.target.style.border = "dashed 2px #ccc"; - } - }); - - /* On drop - Prevent the browser default handling of the data (default is open as link on drop) - Reset the color of the output text and DIV's border color - Get the dragged data with the dataTransfer.getData() method - The dragged data is the id of the dragged element ("drag1") - Append the dragged element into the drop element - */ - document.getElementById("avis_content").addEventListener("drop", function (event) { - event.preventDefault(); - if (event.target.className == "droptarget") { - /*event.target.style.border = ""; - var data = event.dataTransfer.getData("Text"); - var oldContent = event.target.innerHTML; - var draggedConsigne = $j('#'+data+' .consigne').val(); - var replaceConsigne = $j('#'+event.target.id+' .consigne').val(); - event.target.innerHTML = document.getElementById(data).innerHTML; - $j('#'+event.target.id+' .consigne').val(draggedConsigne); - document.getElementById(data).innerHTML = oldContent; - $j('#'+data+' .consigne').val(replaceConsigne);*/ - var data = event.dataTransfer.getData("Text"); - var target = event.target.id; - posData = data.split("_"); - posTarget = target.split("_"); - if (posData[1] > posTarget[1]) { - $j('#' + target).before($j('#' + data)); - } else { - $j('#' + target).after($j('#' + data)); - } - resetPosAvis(); - - - } - }); - $j('#avis_content') - .on('focus', '.consigne', function(e) { - $j(this).closest('.droptarget').attr("draggable", false); - console.log($j(this).closest('.droptarget')); - }) - .on('blur', '.consigne', function(e) { - $j(this).closest('.droptarget').attr("draggable", true); - }); -} - -function checkRealDateAvis() { - - var processLimitDate; - var avisLimitDate; - - var current_date = Date.now(); - - if ($j('#process_limit_date')) { - processLimitDate = $j('#process_limit_date').val(); - var date4 = new Date(); - date4.setFullYear(processLimitDate.substr(6, 4)); - date4.setMonth(processLimitDate.substr(3, 2) - 1); - date4.setDate(processLimitDate.substr(0, 2)); - date4.setHours(0); - date4.setMinutes(0); - date4.setSeconds(0); - var d4_processLimitDate = date4.getTime(); - } - - - if ($j('#opinion_limit_date')) { - avisLimitDate = $j('opinion_limit_date_tr').val(); - var date5 = new Date(); - date5.setFullYear(avisLimitDate.substr(6, 4)); - date5.setMonth(avisLimitDate.substr(3, 2) - 1); - date5.setDate(avisLimitDate.substr(0, 2)); - date5.setHours(0); - date5.setMinutes(0); - date5.setSeconds(0); - var d5_avisLimitDate; - var d5_avisLimitDate = date5.getTime(); - } - - if (d4_processLimitDate != "" && avisLimitDate != "" && (d5_avisLimitDate > d4_processLimitDate && d4_processLimitDate > current_date)) { - alert("La date limite d'avis doit être antérieure à la date limite du courrier "); - $j('#opinion_limit_date').val(""); - $j('#opinion_limit_date_tr').val(""); - - } - - if (current_date > d5_avisLimitDate && avisLimitDate != "") { - alert("La date d'avis doit être supérieure à la date du jour "); - $j('#opinion_limit_date').val(""); - $j('#opinion_limit_date_tr').val(""); - } -} diff --git a/modules/avis/load_toolbar_avis.php b/modules/avis/load_toolbar_avis.php deleted file mode 100755 index e36f995dbcd9f90ac85618d0e9963e3bef484eaa..0000000000000000000000000000000000000000 --- a/modules/avis/load_toolbar_avis.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -$targetTab = $_REQUEST['targetTab']; -$res_id = $_REQUEST['resId']; -$coll_id = $_REQUEST['collId']; - -require_once 'modules' . DIRECTORY_SEPARATOR . 'avis' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'avis_controler.php'; - -$avis = new avis_controler(); - -$nbAvis = $avis->nbAvis($res_id,$coll_id); - -if ($nbAvis == 0){ - $class = 'nbResZero'; - $style2 = 'display:none;'; - $style = '0.5'; - $styleDetail = '#9AA7AB'; -} -else{ - $class = 'nbRes'; - $style = ''; - $style2 = 'display:inherit;'; - $styleDetail = '#666'; -} - -if($_SESSION['req'] == 'details'){ - if($nbAvis == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')){ - $nav = 'avis_tab'; - $style2 = 'visibility:hidden;'; - - } - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbAvis.'</span>\''; - - }else { - $js .= '$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbAvis.'</span>\''; - - } -}else{ - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbAvis.'</span></sup>\''; - - }else { - $js .= '$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbAvis.'</span></sup>\''; - - } -} - -echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}"; -exit (); \ No newline at end of file diff --git a/modules/avis/saveAvisModel.php b/modules/avis/saveAvisModel.php deleted file mode 100755 index 4afc1b889b77888f8e75c6bc09f2d210017abe0a..0000000000000000000000000000000000000000 --- a/modules/avis/saveAvisModel.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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 saveAvisModel - * @author dev@maarch.org - * @ingroup avis - * - */ -require_once "modules" . DIRECTORY_SEPARATOR . "avis" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "avis_controler.php"; - - -$title = $_REQUEST['title']; -$id_list = 'AVIS_CIRCUIT_' . strtoupper(base_convert(date('U'), 10, 36)); - - -$userList = json_decode($_REQUEST['userList']); - -$avis = new avis_controler(); -$_SESSION['avis_wf']['diff_list']['avis']['users'] = array(); -$_SESSION['avis_wf']['diff_list']['sign']['users'] = array(); - -$i = 0; -foreach ($userList as $user) { - - array_push( - $_SESSION['avis_wf']['diff_list']['avis']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userAvisDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'AVIS_CIRCUIT' - ) - ); -} -$avis->saveModelWorkflow($id_list, $_SESSION['avis_wf']['diff_list'], 'AVIS_CIRCUIT', $title); - -echo "{\"status\" : 0}"; - -exit(); -?> \ No newline at end of file diff --git a/modules/avis/updateAvisWF.php b/modules/avis/updateAvisWF.php deleted file mode 100755 index 5eb31170948a59db1241674e2bbb790b001676f0..0000000000000000000000000000000000000000 --- a/modules/avis/updateAvisWF.php +++ /dev/null @@ -1,55 +0,0 @@ -<?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 updateAvisWF - * @author dev@maarch.org - * @ingroup avis - * - */ -require_once "modules" . DIRECTORY_SEPARATOR . "avis" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "avis_controler.php"; - - -$res_id = $_REQUEST['resId']; -$coll_id = 'letterbox_coll'; - -$userList = json_decode($_REQUEST['userList']); - -$avis = new avis_controler(); -$_SESSION['avis_wf']['diff_list']['avis']['users'] = array(); - -$i = 0; -if ($userList) { - foreach ($userList as $user) { - - array_push( - $_SESSION['avis_wf']['diff_list']['avis']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userAvisDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'AVIS_CIRCUIT' - ) - ); - } -} - -$avis->saveWorkflow($res_id, $coll_id, $_SESSION['avis_wf']['diff_list'], 'AVIS_CIRCUIT'); - -//LOAD TOOLBAR BADGE -$toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=avis&page=load_toolbar_avis&origin=parent&resId=' . $res_id . '&collId=' . $coll_id; -$js = 'loadToolbarBadge(\'avis_tab\',\'' . $toolbarBagde_script . '\');'; - - -echo "{\"status\" : 0, \"exec_js\" : \"" . $js . "\"}"; -exit(); -?> \ No newline at end of file diff --git a/modules/avis/xml/IVS/requests_definitions.xml b/modules/avis/xml/IVS/requests_definitions.xml index 1701e8548208f8c2ecfc162315045d3300c145c9..71544fbeeb51a931741f8623d3a323d93534fd5e 100755 --- a/modules/avis/xml/IVS/requests_definitions.xml +++ b/modules/avis/xml/IVS/requests_definitions.xml @@ -1,14 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <inputValidation xmlns:xi="http://www.w3.org/2001/XInclude"> <requestDefinitions> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="saveAvisModel" > - <parameter name="page" value="saveAvisModel"/> - <parameter name="module" value="Avis"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="saveAvisModel" > - <parameter name="page" value="saveAvisModel"/> - <parameter name="module" value="Avis"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="sign_ans" > <parameter name="page" value="sign_ans"/> <parameter name="module" value="Avis"/> diff --git a/modules/avis/xml/IVS/validation_rules.xml b/modules/avis/xml/IVS/validation_rules.xml index f709fe7f2b1e14818af5d1127013c4dbad8db951..89f446f200a3375e08a53d08181feeb690c16426 100755 --- a/modules/avis/xml/IVS/validation_rules.xml +++ b/modules/avis/xml/IVS/validation_rules.xml @@ -3,13 +3,6 @@ <parameter name="objectType" type="identifier" /> <parameter name="objectId" type="identifier" /> </validationRule> - <validationRule name="saveAvisModel" extends="standardForm" mode="error"> - <parameter name="id_list" type="string" /> - <parameter name="title" type="string" /> - <parameter name="conseillers" type="string" /> - <parameter name="consignes" type="string" /> - <parameter name="list_sign" type="string" /> - </validationRule> <validationRule name="update_AvisPage" extends="standardForm" mode="error"> <parameter name="res_id" type="integer" /> <parameter name="coll_id" type="collection_list" /> diff --git a/modules/basket/lang/en.php b/modules/basket/lang/en.php index ad91095b1a0772cd99c4cc78e2b110c1b89cd79d..704e3f8308af838e45ad9d5268035e71d04a3395 100755 --- a/modules/basket/lang/en.php +++ b/modules/basket/lang/en.php @@ -233,12 +233,6 @@ if (!defined("_MISSING")) define("_MISSING", "Absent"); if (!defined("_BACK_FROM_VACATION")) define("_BACK_FROM_VACATION", "Back from his/her absence"); -if (!defined("_MISSING_ADVERT_TITLE")) - define("_MISSING_ADVERT_TITLE","Absences management"); -if (!defined("_MISSING_ADVERT_01")) - define("_MISSING_ADVERT_01","This account is currently defined as absent and the mails are redirected to an other user."); -if (!defined("_MISSING_ADVERT_02")) - define("_MISSING_ADVERT_02","If you want to connect with this account, the 'absent' mode will be deleted then.<br/> The mails redirection will come at its end and the application will be reactivated"); if (!defined("_MISSING_CHOOSE")) define("_MISSING_CHOOSE"," Do you want to continue ?"); if (!defined("_CHOOSE_PERSON_TO_REDIRECT")) diff --git a/modules/basket/lang/fr.php b/modules/basket/lang/fr.php index c91f5962b385a28aace84c71ea9e61ee91b520da..2d354023ab87fe9c5e9e837a2ee449176c08a11a 100755 --- a/modules/basket/lang/fr.php +++ b/modules/basket/lang/fr.php @@ -178,15 +178,6 @@ if (!defined("_MISSING")) { if (!defined("_BACK_FROM_VACATION")) { define("_BACK_FROM_VACATION", "de retour de son absence"); } -if (!defined("_MISSING_ADVERT_TITLE")) { - define("_MISSING_ADVERT_TITLE", "Gestion des absences"); -} -if (!defined("_MISSING_ADVERT_01")) { - define("_MISSING_ADVERT_01", "Ce compte est actuellement défini en mode 'absent'."); -} -if (!defined("_MISSING_ADVERT_02")) { - define("_MISSING_ADVERT_02", "Si vous desirez vous connecter avec ce compte, le mode 'absent' sera alors supprimé.<br/> La redirection des courriers arrivera à son terme et l'application sera réactivée"); -} if (!defined("_MISSING_CHOOSE")) { define("_MISSING_CHOOSE", "Souhaitez-vous continuer?"); } diff --git a/modules/basket/lang/nl.php b/modules/basket/lang/nl.php index dc43e993f2e3f475bab922f6a4a138a9cf431f32..1e790a7867ebbc6533142dd3af8e981831f6ff58 100755 --- a/modules/basket/lang/nl.php +++ b/modules/basket/lang/nl.php @@ -303,15 +303,6 @@ if (!defined('_MISSING')) { if (!defined('_BACK_FROM_VACATION')) { define('_BACK_FROM_VACATION', 'bij terugkeer na afwezigheid'); } -if (!defined('_MISSING_ADVERT_TITLE')) { - define('_MISSING_ADVERT_TITLE', 'Afwezigheidsbeheer'); -} -if (!defined('_MISSING_ADVERT_01')) { - define('_MISSING_ADVERT_01', 'Deze account is momenteel in “afwezigheidsâ€modus gezet en de brieven worden naar een andere gebruiker omgeleid.'); -} -if (!defined('_MISSING_ADVERT_02')) { - define('_MISSING_ADVERT_02', 'Indien u zich met deze account wil verbinden, zal de modus “afwezig†verwijderd worden.<br/> De omleiding van de brieven zal voltooid worden en de applicatie zal opnieuw ingeschakeld worden'); -} if (!defined('_MISSING_CHOOSE')) { define('_MISSING_CHOOSE', 'Wilt u verdergaan?'); } diff --git a/modules/notes/class/class_modules_tools_Abstract.php b/modules/notes/class/class_modules_tools_Abstract.php index f519b81e3ca4182c654bc6d7f2d7b261dc4ae1ca..c82dbee9ad505d4567dbb2008f13c2da1e5ef2aa 100755 --- a/modules/notes/class/class_modules_tools_Abstract.php +++ b/modules/notes/class/class_modules_tools_Abstract.php @@ -36,7 +36,6 @@ // Loads the required class try { require_once("core/class/class_db.php"); - require_once("modules/notes/notes_tables.php"); require_once("modules/entities/entities_tables.php"); require_once ("modules/notes/class/class_modules_tools.php"); require_once "modules/entities/class/EntityControler.php"; @@ -57,16 +56,6 @@ abstract class notes_Abstract */ public static $ent; - /** - * Notes table - */ - public static $notes_table ; - - /** - * Notes_entities table - */ - public static $notes_entities_table ; - /** * Entities table */ @@ -78,33 +67,7 @@ abstract class notes_Abstract */ public function build_modules_tables() { - if (file_exists( - $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . "modules" - . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR . "xml" - . DIRECTORY_SEPARATOR . "config.xml" - ) - ) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR - . "notes" . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR - . "config.xml"; - } else { - $path = "modules" . DIRECTORY_SEPARATOR . "notes" - . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR - . "config.xml"; - } - $xmlconfig = simplexml_load_file($path); - foreach ($xmlconfig->TABLENAME as $tableName) { - $_SESSION['tablename']['not_notes'] = (string) $tableName->not_notes; - $_SESSION['tablename']['note_entities'] = (string) $tableName->note_entities; - } - $hist = $xmlconfig->HISTORY; - $_SESSION['history']['noteadd'] = (string) $hist->noteadd; - $_SESSION['history']['noteup'] = (string) $hist->noteup; - $_SESSION['history']['notedel'] = (string) $hist->notedel; - } + } /** * Function to get which user can see a note @@ -115,127 +78,22 @@ abstract class notes_Abstract $db = new Database(); $ent = new EntityControler(); - $query = "SELECT entity_id, entity_label, short_label FROM ".NOTE_ENTITIES_TABLE." , entities WHERE item_id LIKE entity_id and note_id = ?"; + $query = "SELECT entity_id, entity_label, short_label FROM note_entities , entities WHERE item_id LIKE entity_id and note_id = ?"; - try{ + try { $stmt = $db->query($query, array($id)); - } catch (Exception $e){} - + } catch (Exception $e) { + } $entitiesList = array(); $entitiesChosen = array(); $entitiesList = $ent->getAllEntities(); - while($res = $stmt->fetchObject()) - { + while ($res = $stmt->fetchObject()) { array_push($entitiesChosen, $ent->get($res->entity_id)); } - //self::disconnect(); return $entitiesChosen; } - - public function getNotes($noteId, $userId, $userPrimaryEntity) - { - $query = "SELECT id FROM notes WHERE id in (" - . "SELECT note_id FROM ". NOTE_ENTITIES_TABLE. " WHERE (item_id in (" - ."SELECT entity_id FROM users_entities WHERE user_id = ?) and note_id = ?))" - . "or (id = ? and user_id = ?)"; - $db = new Database(); - $stmt = $db->query($query, array($userId, $noteId, $noteId, $userId)); - - if ($stmt->rowCount() > 0) { - return true; - } else { - // test if public - $query = "SELECT note_id FROM ". NOTE_ENTITIES_TABLE. " WHERE note_id = ?"; - $stmt = $db->query($query, array($noteId)); - if ($stmt->rowCount() == 0) { - return true; - } else { - return false; - } - } - } - - public function countUserNotes($id, $type = 'resource') { - $not_nbr = 0; - $db = new Database(); - - $stmt = $db->query("SELECT id, identifier, user_id, creation_date, note_text FROM " - . NOTES_TABLE - . " WHERE identifier = ? and type = ? order by creation_date desc", array($id, $type)); - - while ($res = $stmt->fetchObject()) - { - $query = "SELECT id FROM ". NOTE_ENTITIES_TABLE. " WHERE note_id = ?"; - - $stmt2 = $db->query($query, array($res->id)); - - if($stmt2->rowCount()==0) - $not_nbr++; - else - { - $stmt2 = $db->query( "SELECT id FROM notes WHERE id in (" - . "SELECT note_id FROM ". NOTE_ENTITIES_TABLE. " WHERE (item_id in (" - ."SELECT entity_id FROM users_entities WHERE user_id = ?) and note_id = ?))" - . "or (id = ? and user_id = ?)", - array($_SESSION['user']['UserId'], $res->id, $res->id, $_SESSION['user']['UserId'])); - - if($stmt2->rowCount()<>0) - $not_nbr++; - } - } - - return $not_nbr; - } - - public function getUserNotes($id, $coll_id) { - $userNotes = array(); - $db = new Database(); - - $stmt = $db->query("SELECT id, identifier, user_id, creation_date, note_text FROM " - . NOTES_TABLE - . " WHERE identifier = ? order by creation_date desc", - array($id)); - - while ($res = $stmt->fetchObject()) - { - $query = "SELECT id FROM ".NOTE_ENTITIES_TABLE." WHERE note_id = ?"; - - $stmt2 = $db->query($query, array($res->id)); - - $stmt3 = $db->query("SELECT id FROM USERS WHERE user_id = ?", array($_SESSION['user']['UserId'])); - $userInfo = $stmt3->fetchObject(); - - if($stmt2->rowCount()==0) { - array_push($userNotes, - array('id' => $res->id, //ID - 'label' => functions::show_string($res->note_text), //Label - 'author' => $res->user_id, //Author - 'date' => $res->creation_date //Date - ) - ); - } else { - $stmt2 = $db->query( "SELECT id FROM notes WHERE id in (" - . "select note_id from ". NOTE_ENTITIES_TABLE. " where (item_id in (" - ."SELECT entity_id FROM users_entities WHERE user_id = ?) and note_id = ?))" - . "or (id = ? and user_id = ?)", - array($userInfo->id, $res->id, $res->id, $userInfo->id)); - - if($stmt2->rowCount()<>0) { - array_push($userNotes, - array('id' => $res->id, //ID - 'label' => functions::show_string($res->note_text), //Label - 'author' => $res->user_id, //Author - 'date' => $res->creation_date //Date - ) - ); - } - } - } - - return $userNotes; - } } diff --git a/modules/notes/class/notes_controler.php b/modules/notes/class/notes_controler.php deleted file mode 100755 index e0539c49e5f596baa6a953025559deb80bc63d9d..0000000000000000000000000000000000000000 --- a/modules/notes/class/notes_controler.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/* -* Copyright 2013-2016 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the controler of the note Object -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup notes -*/ - -require_once 'modules/notes/class/notes_controler_Abstract.php'; - -/** -* @brief Controler of the note Object -* -* @ingroup notes -*/ -class notes_controler extends notes_controler_Abstract -{ - // custom -} diff --git a/modules/notes/class/notes_controler_Abstract.php b/modules/notes/class/notes_controler_Abstract.php deleted file mode 100755 index 137ca3d52624a97e165bd2995ce7c901424747cf..0000000000000000000000000000000000000000 --- a/modules/notes/class/notes_controler_Abstract.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/* -* Copyright 2013-2016 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the controler of the note Object -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup notes -*/ - -/** -* @brief Controler of the note Object -* -* @ingroup notes -*/ -abstract class notes_controler_Abstract -{ - ##################################### - ## add note on a resource - ##################################### - public function addNote($resId, $collId, $noteContent, $typist='') - { - if(empty($typist)){ - $typist = $_SESSION['user']['UserId']; - } - $status = 'ok'; - $error = ''; - //control parameters - if (isset($resId) && empty($resId)) { - $status = 'ko'; - $error = 'resId empty '; - } - if (isset($collId) && empty($collId)) { - $status = 'ko'; - $error = 'collId empty '; - } - if (isset($noteContent) && empty($noteContent)) { - $status = 'ko'; - $error .= 'noteContent empty '; - } - //process - if ($status == 'ok') { - require_once 'core/class/class_security.php'; - require_once 'modules/notes/notes_tables.php'; - $security = new security(); - $view = $security->retrieve_view_from_coll_id($collId); - $table = $security->retrieve_table_from_coll($collId); - $db = new Database(); - $query = "SELECT res_id FROM " . $view . " WHERE res_id = ?"; - $stmt = $db->query($query, array($resId)); - if ($stmt->rowCount() == 0) { - $status = 'ko'; - $error .= 'resId not exists'; - } else { - $query = - "INSERT INTO " . NOTES_TABLE . "(identifier, note_text, " - . "creation_date, user_id) values" - . " (?, ?, CURRENT_TIMESTAMP, ?)"; - - $stmt = $db->query($query, array($resId, $noteContent, $typist)); - - $hist = new history(); - $stmt = $db->query( - "SELECT id FROM " . NOTES_TABLE . " WHERE " - . "identifier = ? and user_id = ? order by id desc", - array($resId, $typist) - ); - $res = $stmt->fetchObject(); - $id = $res->id; - $hist->add( - $view, $resId, 'UP', 'resup', _ADDITION_NOTE - . _ON_DOC_NUM . $resId . ' (' . $id . ') ' . _FROM_WS, - $_SESSION['config']['databasetype'], 'notes' - ); - $hist->add( - NOTES_TABLE, $id, 'ADD', 'noteadd', _NOTES_ADDED - . ' (' . $id . ') ' . _FROM_WS, - $_SESSION['config']['databasetype'], 'notes' - ); - - } - } - $returnArray = array( - 'status' => $status, - 'value' => $id, - 'error' => $error, - ); - return $returnArray; - } -} diff --git a/modules/notes/css/module.css b/modules/notes/css/module.css index a97d7af7c0b71df4d57ff2cfca448947884aef5d..fab06031e8c8c2ae2825933d1b0b9bcd612e6a39 100755 --- a/modules/notes/css/module.css +++ b/modules/notes/css/module.css @@ -1,4 +1 @@ /* menu */ - - -/* admin modules board */ diff --git a/modules/notes/js/functions.js b/modules/notes/js/functions.js index 434517a222dc9c15606c76137ffe4c848fe67b90..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 --- a/modules/notes/js/functions.js +++ b/modules/notes/js/functions.js @@ -1,92 +0,0 @@ -function showNotesForm(path, width, height) { - - if(typeof(width)==='undefined'){ - var width = '800'; - } - - - if(typeof(height)==='undefined'){ - height = '480'; - } - - $j.ajax({ - url: path, - type: 'POST', - success: function (answer) { - eval("response = "+answer); - if(response.status == 0){ - var modal_content = convertToTextVisibleNewLine(response.content); - createModal(modal_content, 'form_notes', height, width); - } else { - window.top.$j('main_error').html( response.error); - } - }, - error: function (error) { - alert(error); - } - - }); -} - -function validNotesForm(path, form_id) { - - new Ajax.Request(path, - { - asynchronous:false, - method:'post', - parameters: Form.serialize(form_id), - encoding: 'UTF-8', - onSuccess: function(answer){ - eval("response = "+answer.responseText); - if(response.status == 0){ - if (typeof window.parent['angularSignatureBookComponent'] != "undefined") { - // window.parent.angularSignatureBookComponent.componentAfterNotes(); - } - destroyModal('form_notes'); - var modInfo = $j('<div class="info" id="main_info" onclick="this.remove();">'+response.msg_result+'</div>'); - modInfo.appendTo('body'); - modInfo.css({'display' : 'table-cell'}); - setTimeout(function() { - modInfo.remove(); - }, 5000); - - if(parent.$j('.contentShow iframe').length){ - parent.$j('.contentShow iframe')[0].contentWindow.location.reload(true); - } else { - eval(response.exec_js); - } - } else { - alert(response.error); - } - }, - error: function (error) { - alert(error); - } - - }); -} - -function addTemplateToNote(templateNotes, path) -{ - - $j.ajax({ - url: path, - type: 'POST', - data : {templateId : templateNotes}, - success: function (answer) { - eval("response = "+answer); - if (response.status == 0) { - var strContent = response.content; - var reg = new RegExp(/\\n/gi); - var strContentReplace = strContent.replace(reg, '\n'); - $j('#notes').val($j('#notes').val() + ' ' + strContentReplace) ; - } else { - window.top.$j('main_error').html(response.error); - } - }, - error: function (error) { - alert(error); - } - - }); -} diff --git a/modules/notes/lang/en.php b/modules/notes/lang/en.php index 4426bfbcfa70ebcc91d1710f13ff15ffe19e8701..3dadb4e0ba4af0e799d9de20603c680099d6c81c 100755 --- a/modules/notes/lang/en.php +++ b/modules/notes/lang/en.php @@ -33,9 +33,6 @@ if (!defined("_READ")) { if (!defined("_ADDITION_NOTE")) { define("_ADDITION_NOTE", "Note addition"); } -if (!defined("_ADDITION_NOTE_PRIVATE")) { - define("_ADDITION_NOTE_PRIVATE", "Private note addition"); -} if (!defined("_NOTES_ADDED")) { define("_NOTES_ADDED", "Added note"); } @@ -57,21 +54,11 @@ if (!defined("_NOTES_COMMENT")) { if (!defined("_OF")) { define("_OF", "of"); } -if (!defined("_NOTE_DONT_EXIST")) { - define("_NOTE_DONT_EXIST", "This note doesn't exist"); -} -if (!defined("_THIS_NOTE_IS_VISIBLE_BY")) { - define("_THIS_NOTE_IS_VISIBLE_BY", "Limit this note to the following departments (if it's empty, the note is public)"); -} //TEMPLATES FOR NOTES if (!defined("_NOTE_TEMPLATE")) { define("_NOTE_TEMPLATE", "Note template"); } -if (!defined("_SELECT_NOTE_TEMPLATE")) { - define("_SELECT_NOTE_TEMPLATE", "Select a note template"); -} - if (!defined("_NOTE")) { define("_NOTE", "Note"); diff --git a/modules/notes/lang/fr.php b/modules/notes/lang/fr.php index f1fb6144eb238fc86ec9d614c9c35d91f1664bfd..2438d95690afe0c988b4cd8cd8d51e4501f2a401 100755 --- a/modules/notes/lang/fr.php +++ b/modules/notes/lang/fr.php @@ -33,9 +33,6 @@ if (!defined("_READ")) { if (!defined("_ADDITION_NOTE")) { define("_ADDITION_NOTE", "Ajout d'une annotation"); } -if (!defined("_ADDITION_NOTE_PRIVATE")) { - define("_ADDITION_NOTE_PRIVATE", "Ajout d'une annotation privée"); -} if (!defined("_NOTES_ADDED")) { define("_NOTES_ADDED", "Annotation ajoutée"); } @@ -57,20 +54,11 @@ if (!defined("_NOTES_COMMENT")) { if (!defined("_OF")) { define("_OF", "de"); } -if (!defined("_NOTE_DONT_EXIST")) { - define("_NOTE_DONT_EXIST", "Cette annotation n'existe pas"); -} -if (!defined("_THIS_NOTE_IS_VISIBLE_BY")) { - define("_THIS_NOTE_IS_VISIBLE_BY", "Restreindre cette annotation aux entités suivantes (si vide alors l'annotation est publique)"); -} //TEMPLATES FOR NOTES if (!defined("_NOTE_TEMPLATE")) { define("_NOTE_TEMPLATE", "Modèle d'annotation"); } -if (!defined("_SELECT_NOTE_TEMPLATE")) { - define("_SELECT_NOTE_TEMPLATE", "Sélectionner un modèle d'annotation"); -} if (!defined("_NOTE")) { define("_NOTE", "Annotation"); diff --git a/modules/notes/lang/nl.php b/modules/notes/lang/nl.php index d43551d4d0e29f345caf3062b9451a7f946928d2..29c08bd75517ef14ec4389388d2ac334cd40cb56 100755 --- a/modules/notes/lang/nl.php +++ b/modules/notes/lang/nl.php @@ -19,9 +19,6 @@ if (!defined('_READ')) { if (!defined('_ADDITION_NOTE')) { define('_ADDITION_NOTE', 'Toevoeging van een aantekening'); } -if (!defined('_ADDITION_NOTE_PRIVATE')) { - define('_ADDITION_NOTE_PRIVATE', 'Toevoeging van een privéaantekening'); -} if (!defined('_NOTES_ADDED')) { define('_NOTES_ADDED', 'Toegevoegde aantekening'); } @@ -43,60 +40,12 @@ if (!defined('_NOTES_COMMENT')) { if (!defined('_OF')) { define('_OF', 'van'); } -if (!defined('_NOTE_DONT_EXIST')) { - define('_NOTE_DONT_EXIST', 'Deze aantekening bestaat niet'); -} -if (!defined('_THIS_NOTE_IS_VISIBLE_BY')) { - define('_THIS_NOTE_IS_VISIBLE_BY', 'Deze aantekening beperken tot de volgende eenheden (indien leeg, is de aantekening openbaar)'); -} if (!defined('_NOTE_TEMPLATE')) { define('_NOTE_TEMPLATE', 'Aantekeningmodel'); } -if (!defined('_SELECT_NOTE_TEMPLATE')) { - define('_SELECT_NOTE_TEMPLATE', 'Een aantekeningmodel selecteren'); -} -if (!defined('_RESTRICTED_SERVICES')) { - define('_RESTRICTED_SERVICES', 'Beperkt tot de eenheid (eenheden)'); -} if (!defined('_ADD_NOTE')) { define('_ADD_NOTE', 'Toevoeging van een opmerking'); } -if (!defined('_ADDITION_NOTE')) { - define('_ADDITION_NOTE', 'Toevoeging van een opmerking'); -} -if (!defined('_ADDITION_NOTE_PRIVATE')) { - define('_ADDITION_NOTE_PRIVATE', 'Toevoeging van een privé-opmerking'); -} -if (!defined('_NOTES_ADDED')) { - define('_NOTES_ADDED', 'Opmerking toegevoegd'); -} -if (!defined('_NOTES_DELETED')) { - define('_NOTES_DELETED', 'Opmerking verwijderd'); -} -if (!defined('_NOTES_MODIFIED')) { - define('_NOTES_MODIFIED', 'Opmerking gewijzigd'); -} -if (!defined('_NOTE_UPDATED')) { - define('_NOTE_UPDATED', 'Opmerking gewijzigd'); -} -if (!defined('_NOTES')) { - define('_NOTES', 'Opmerkingen'); -} -if (!defined('_NOTES_COMMENT')) { - define('_NOTES_COMMENT', 'Opmerkingen'); -} -if (!defined('_NOTE_DONT_EXIST')) { - define('_NOTE_DONT_EXIST', 'Deze opmerking bestaat niet'); -} -if (!defined('_THIS_NOTE_IS_VISIBLE_BY')) { - define('_THIS_NOTE_IS_VISIBLE_BY', 'Deze opmerking beperken tot de volgende eenheden (indien leeg, is de opmerking openbaar'); -} -if (!defined('_NOTE_TEMPLATE')) { - define('_NOTE_TEMPLATE', 'Opmerkingsmodel'); -} -if (!defined('_SELECT_NOTE_TEMPLATE')) { - define('_SELECT_NOTE_TEMPLATE', 'Een opmerkingsmodel selecteren'); -} if (!defined('_NOTE')) { define('_NOTE', 'Opmerking'); } diff --git a/modules/notes/load_toolbar_notes.php b/modules/notes/load_toolbar_notes.php deleted file mode 100755 index 21f04a963a1e51c084dd485ebfcc586f93733039..0000000000000000000000000000000000000000 --- a/modules/notes/load_toolbar_notes.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -$targetTab = $_REQUEST['targetTab']; -$res_id = $_REQUEST['resId']; - -require_once 'modules/notes/class/class_modules_tools.php'; -$notes_tools = new notes(); -//Count notes -$nbr_notes = $notes_tools->countUserNotes($res_id); -if ($nbr_notes == 0){ - $class = 'nbResZero'; - $style2 = 'display:none;'; - $style = '0.5'; - $styleDetail = '#9AA7AB'; -} -else{ - $class = 'nbRes'; - $style = ''; - $style2 = 'display:inherit;'; - $styleDetail = '#666'; -} - -if($_SESSION['req'] == 'details'){ - - if($nbr_notes == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')){ - $nav = 'notes_tab'; - $style2 = 'visibility:hidden;'; - - } - - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbr_notes.'</span>\''; - - }else { - - $js .= '$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbr_notes.'</span>\''; - - } -}else{ - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbr_notes.'</span></sup>\''; - - }else { - $js .= '$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbr_notes.'</span></sup>\''; - - } -} - -//echo '{status : 0, nav : "'.$nav.'",content : "", error : "", exec_js : "'.addslashes($js).'"}'; -//echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}"; -//echo '{"status" : 0, "nav" : "'.$nav.'","content" : "", "error" : "", "exec_js" : "'.addslashes($js).'"}'; -echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}"; -exit (); \ No newline at end of file diff --git a/modules/notes/note_details.php b/modules/notes/note_details.php deleted file mode 100755 index 25e022f14863ad8aebaf3bd3d8ed4be552491af4..0000000000000000000000000000000000000000 --- a/modules/notes/note_details.php +++ /dev/null @@ -1,360 +0,0 @@ -<?php -/** -* File : notes_details.php -* -* Popup to show the notes -* -* @package Maarch LetterBox 2.3 -* @version 1.0 -* @since 06/2007 -* @license GPL -* @author Claire Figueras <dev@maarch.org> -*/ -require_once "core/class/class_security.php"; -require_once "core/class/class_request.php"; -require_once "core/class/class_history.php"; -require_once "modules/entities/class/EntityControler.php"; -require_once 'core/core_tables.php'; -require_once 'modules/notes/notes_tables.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; -$core = new core_tools(); -$core->load_lang(); -$sec = new security(); -$req = new request(); -$ent = new EntityControler(); -$notes_mod_tools = new notes; -$func = new functions(); -$db = new Database(); -$table = ''; -$collId = ""; -$user = ''; -$text = ""; -$userId = ''; -$date = ""; -$identifier = ''; -if (empty($_SESSION['collection_id_choice'])) { - $_SESSION['collection_id_choice'] = $_SESSION['user']['collections'][0]; - $collId = $_SESSION['collection_id_choice'] ; -} else if (isset($_REQUEST['coll_id'])&& empty($collId)) { - $collId = $_REQUEST['coll_id']; -} -$view = $sec->retrieve_view_from_coll_id($collId); -$table = $sec->retrieve_table_from_coll($collId); - -$error = ''; -if (isset($_REQUEST['modify'])) { - $id = $_REQUEST['id']; - $identifier = $_REQUEST['identifier']; - $table = $_REQUEST['table']; - $collId = $_REQUEST['coll_id']; - - if (empty($_REQUEST['notes'])) { - $error = _NOTES . ' ' . _EMPTY; - } else if (empty($error)) { - $text = $_REQUEST['notes']; - $db->query( - "UPDATE ".NOTES_TABLE." SET note_text = ?, creation_date = CURRENT_TIMESTAMP WHERE id = ?", - array($text, $id) - ); - - echo "<pre>"; - //print_r($_REQUEST['entities_chosen']); - //print_r($_SESSION['notes']['entities']); - echo "</pre>"; - - if (isset($_REQUEST['entities_chosen']) && !empty($_REQUEST['entities_chosen'])) - { - for ($i=0; $i<count($_REQUEST['entities_chosen']); $i++) - { - $stmt = $db->query( - "SELECT id FROM " .NOTE_ENTITIES_TABLE. " WHERE item_id = ? and note_id = ?", - array($_REQUEST['entities_chosen'][$i], $id) - ); - $result = $stmt->fetchObject(); - $note_entity_id = $result->id; - - if ($stmt->rowCount() == 0) - { - $db->query( - "INSERT INTO " . NOTE_ENTITIES_TABLE . "(note_id, item_id) VALUES" - . " (?, ?)", - array($id, $_REQUEST['entities_chosen'][$i]) - ); - } - else - { - $db->query( - "UPDATE ".NOTE_ENTITIES_TABLE." SET item_id = ? WHERE id = ?", - array($_REQUEST['entities_chosen'][$i], $note_entity_id) - ); - } - - } - } - elseif (empty($_REQUEST['entities_chosen'])) - { - $db->query( - "DELETE FROM " . NOTE_ENTITIES_TABLE . " where note_id = ?", - array($id) - ); - } - if ($_SESSION['history']['noteup']) { - $hist = new history(); - $hist->add( - NOTES_TABLE, $id , "UP", 'noteup', _NOTE_UPDATED . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - if ($_SESSION['origin'] == "show_folder" ) { - $hist->add( - $table, $identifier, "UP", 'noteup', _NOTE_UPDATED . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } else { - $hist->add( - $view, $identifier, "UP", 'noteup', _NOTE_UPDATED . _ON_DOC_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } - } - //$_SESSION['error'] = _NOTES_MODIFIED; - ?> - <script type="text/javascript">window.opener.location.reload();self.close();</script> - <?php - exit(); - } - -} -if (isset($_REQUEST['delete'])) { - $id = $_REQUEST['id']; - $identifier = $_REQUEST['identifier']; - - $db->query("DELETE FROM " . NOTE_ENTITIES_TABLE . " WHERE note_id = ?", array($id)); - $db->query("DELETE FROM " . NOTES_TABLE . " WHERE id = ?", array($id)); - - if ($_SESSION['history']['notedel']) { - $hist = new history(); - $hist->add( - NOTES_TABLE, $id, "DEL", 'notedel', _NOTES_DELETED . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - if ($_SESSION['origin'] == "show_folder" ) { - $hist->add( - $table, $identifier, "DEL", 'notedel', _NOTES_DELETED . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } else { - $hist->add( - $view, $identifier, "DEL", 'notedel', _NOTES_DELETED . _ON_DOC_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } - } - //$_SESSION['error'] = _NOTES_DELETED; - ?> - <script type="text/javascript">window.opener.location.reload();self.close();</script> - <?php - exit(); -} - -if (isset($_REQUEST['id'])) { - $sId = $_REQUEST['id']; -} else { - $sId = ""; -} -if (isset($_REQUEST['identifier'])) { - $identifier = $_REQUEST['identifier']; -} -if (isset($_REQUEST['table']) && empty($table)) { - $table = $_REQUEST['table']; -} -if (isset($_REQUEST['coll_id']) && empty($collId)) { - $collId = $_REQUEST['coll_id']; -} - -$core->load_html(); -//here we building the header -$core->load_header(_NOTES); -$time = $core->get_session_time_expire(); -?> -<body id="pop_up" onload="setTimeout(window.close, <?php echo $time;?>*60*1000);"> -<?php -if (empty($table) && empty($collId)) { - $error = _PB_TABLE_COLL; -} else { - - $stmt = $db->query( - "SELECT n.identifier, n.creation_date, n.user_id, n.note_text, u.lastname, " - . "u.firstname FROM " . NOTES_TABLE . " n inner join ". USERS_TABLE - . " u on n.user_id = u.user_id WHERE n.id = :sId ", [":sId" => $sId] - ); - - $line = $stmt->fetchObject(); - $user = $func->show_string($line->lastname . " " . $line->firstname); - $text = $func->show_string($line->note_text); - $userId = $line->user_id; - $date = $line->creation_date; - $identifier = $line->identifier; -} - -$canModify = false; -if (trim($userId) == $_SESSION['user']['UserId']) { - $canModify = true; -} -?> -<div class="error"><?php -echo $error; -$error = ''; -?></div> -<h2 class="tit" style="padding:10px;"><?php echo _NOTES;?> </h2> - <h2 class="sstit" style="padding:10px;"><?php -echo _NOTES . " " . _OF . " " . $user . " (" . $core->format_date_db($date, false, '', true) . ") "; -?></h2> - - <div class="block" style="padding:10px"> - <form name="form1" method="post" class="forms" action="<?php -echo $_SESSION['config']['businessappurl'] . "index.php?display=true" - . "&module=notes&page=note_details"; -?>"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="modules" value="notes" /> - <input type="hidden" name="page" value="note_details" /> - <textarea <?php -if (! $canModify) { - ?>readonly="readonly" class="readonly" <?php -} -?>style="width:380px" cols="70" rows="10" name="notes" id="notes"><?php -functions::xecho($text); -?></textarea> - - <input type="hidden" name="id" id="id" value="<?php functions::xecho($sId);?>"/> - <input type="hidden" name="identifier" id="identifier" value="<?php -functions::xecho($identifier); -?>"/> - <input type="hidden" name="table" id="table" value="<?php -functions::xecho($table); -?>"/> - <input type="hidden" name="coll_id" id="coll_id" value="<?php -functions::xecho($collId); -?>"/> - <br/> - <p class="buttons"> - <?php -if ($canModify) { - ?> - <input type="submit" name="modify" id="modify" value="<?php - echo _MODIFY; - ?>" class="button"/> - <input type="submit" name="delete" id="delete" value="<?php - echo _DELETE; - ?>" class="button"/> - <?php -} -?> - <input type="button" name="close_button" value="<?php -echo _CLOSE_WINDOW; -?>" onclick="javascript:self.close();" class="button"/> - </p> - <?php - -if ($canModify) { - ?> - <div> - <h3 class="sstit" style="color: red"><?php echo _THIS_NOTE_IS_VISIBLE_BY;?></h3> - </div> - <table> - <tr> - <td> - <div id="config_entities" class ="scrollbox" style=" width: 700px; margin-left:auto; margin-right: auto; height:140px; border: 1px solid #999;"> - <table align="center" width="100%" id="template_entities" > - <tr> - <td width="10%" align="center"> - <?php - $notesEntities = array(); - $entitiesList = array(); - $_SESSION['notes']['entities'] = array(); - $_SESSION['notes']['entities'] = $notes_mod_tools->getNotesEntities($sId); - //$notesEntities = $notes_mod_tools->getNotesEntities($sId); - $entitiesList = $ent->getAllEntities(); - echo "<pre>"; - echo "</pre>"; - if ($canModify) { - ?> - <select name="entitieslist[]" id="entitieslist" size="7" - ondblclick='moveclick($(entitieslist), $(entities_chosen));' multiple="multiple" > - <?php - - for ($j=0;$j<count($entitiesList);$j++) { - $state_entity = false; - - if (in_array($entitiesList[$j], $_SESSION['notes']['entities'])) { - $state_entity = true; - } else { - $state_entity = false; - } - - if ($state_entity == false) { - ?> - <option value="<?php - echo $entitiesList[$j]->entity_id; - ?>"><?php - echo $entitiesList[$j]->entity_label; - ?></option> - <?php - } - } - ?> - </select> - <br/> - </td> - <td width="10%" align="center"> - <input type="button" class="button" value="<?php - echo _ADD; - ?> >>" onclick='Move($(entitieslist), $(entities_chosen));' /> - <br /> - <br /> - <input type="button" class="button" value="<< <?php - echo _REMOVE; - ?>" onclick='Move($(entities_chosen), $(entitieslist));' /> - </td> - <?php -} -?> - <td width="10%" align="center"> - <select name="entities_chosen[]" id="entities_chosen" size="7" - ondblclick='moveclick($(entities_chosen), $(entitieslist));' multiple="multiple"> - <?php - for ($i=0;$i<count($_SESSION['notes']['entities']);$i++) { - $state_entity = false; - if ($state_entity == false) { - ?> - <option value="<?php - echo $_SESSION['notes']['entities'][$i]->entity_id; - ?>" selected="selected" ><?php - echo $_SESSION['notes']['entities'][$i]->entity_label; - ?></option> - <?php - } - } - ?> - </select> - </td> - </tr> - </table> - </div> - </td> - </tr> - </table> - <?php - } - ?> - </form> - </div> - <div class="block_end"> </div> -</body> -</html> diff --git a/modules/notes/notes.php b/modules/notes/notes.php deleted file mode 100755 index 03b859e38dcc1a0400924276039733931188f536..0000000000000000000000000000000000000000 --- a/modules/notes/notes.php +++ /dev/null @@ -1,324 +0,0 @@ -<?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 notes -* @author <dev@maarch.org> -* @ingroup notes -*/ - -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"; -require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR - ."class".DIRECTORY_SEPARATOR."class_lists.php"; -require_once "modules".DIRECTORY_SEPARATOR."notes".DIRECTORY_SEPARATOR."notes_tables.php"; -require_once "modules" . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - -$core_tools = new core_tools(); -$request = new request(); -$list = new lists(); -$notes_tools = new notes(); - -$identifier = ''; -$origin = ''; -$parameters = ''; - -//Collection ID -if (isset($_REQUEST['coll_id']) && !empty($_REQUEST['coll_id'])) { - $parameters = "&coll_id=".$_REQUEST['coll_id']; -} - -//Identifier -if (isset($_REQUEST['identifier']) && !empty($_REQUEST['identifier'])) { - $identifier = $_REQUEST['identifier']; -} else { - echo '<span class="error">'._IDENTIFIER.' '._IS_EMPTY.'</span>'; - exit(); -} - -//Origin -if (isset($_REQUEST['origin']) && !empty($_REQUEST['origin'])) { - $origin = $_REQUEST['origin']; -} - -if (empty($origin)) { - $user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]); - $right = \Resource\controllers\ResController::hasRightByResId(['resId' => [$identifier], 'userId' => $user['id']]); - if (!$right) { - exit(_NO_RIGHT_TXT); - } -} - -//Extra parameters -if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) { - $parameters .= '&size='.$_REQUEST['size']; -} -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $parameters .= '&order='.$_REQUEST['order']; -} -if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $parameters .= '&order_field='.$_REQUEST['order_field']; -} -if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $parameters .= '&what='.$_REQUEST['what']; -} - -if (isset($_REQUEST['load'])) { - $core_tools->load_lang(); - $core_tools->load_html(); - $core_tools->load_header('', true, false); ?> - -<body><?php - $core_tools->load_js(); - - //Load list - if (!empty($identifier) && !empty($origin)) { - $target = $_SESSION['config']['businessappurl'] - .'index.php?module=notes&page=notes&identifier=' - .$identifier.'&origin='.$origin.$parameters; - - $listContent = $list->loadList($target); - echo $listContent; - } else { - echo '<span class="error">'._ERROR_IN_PARAMETERS.'</span>'; - } ?> - <div id="container" style="width:100%;min-height:0px;height:0px;"></div> -</body> - -</html><?php -} else { - //If size is full change some parameters - if (isset($_REQUEST['size']) - && ($_REQUEST['size'] == "full") - ) { - $sizeUser = "10"; - $sizeText = "40"; - $css = "listing spec"; - $cutString = 150; - } elseif (isset($_REQUEST['size']) - && ($_REQUEST['size'] == "medium") - ) { - $sizeUser = "15"; - $sizeText = "30"; - $css = "listingsmall"; - $cutString = 100; - } else { - $sizeUser = "10"; - $sizeText = "10"; - $css = "listingsmall"; - $cutString = 20; - } - - //Table or view - $select[NOTES_TABLE] = array(); //Notes - $select[USERS_TABLE] = array(); //Users - - //Fields - array_push($select[NOTES_TABLE], "id", "identifier", "creation_date", "user_id", "note_text", "note_text as note_short"); //Notes - array_push($select[USERS_TABLE], "user_id", "lastname || ' ' || firstname as user", "lastname as visibleBy"); //Users - - //Where clause - $where_tab = array(); - - $rawUserEntities = \Entity\models\EntityModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['entity_id']]); - $userEntities = array_column($rawUserEntities, 'entity_id'); - $userEntities = !empty($userEntities) ? $userEntities : ['']; - - $db = new Database(); - $stmt3 = $db->query("SELECT id FROM USERS WHERE user_id = ?", array($_SESSION['user']['UserId'])); - $userInfo = $stmt3->fetchObject(); - - $where_tab[] = "identifier = ?"; - $where_tab[] = "type = ?"; - $where_tab[] = "notes.id in (select notes.id from notes left join note_entities on notes.id = note_entities.note_id where item_id IS NULL OR item_id in (?) or notes.user_id = ".$userInfo->id.")"; - $arrayPDO = array($identifier); - $arrayPDO[] = 'resource'; - $arrayPDO[] = $userEntities; - - //Build where - $where = implode(' and ', $where_tab); - - //Order - $order = $order_field = ''; - $order = $list->getOrder(); - $order_field = $list->getOrderField(); - if (!empty($order_field) && !empty($order)) { - $orderstr = "order by ".$order_field." ".$order; - } else { - $list->setOrder(); - $list->setOrderField('creation_date'); - $orderstr = "order by creation_date desc"; - } - - if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { - $parameters .= '&start='.$_REQUEST['start']; - $start = $_REQUEST['start']; - } else { - $start = $list->getStart(); - $parameters .= '&start='.$start; - } - - //Request - // $tabNotes=$request->PDOselect( - // $select, - // $where, - // $arrayPDO, - // $orderstr, - // $_SESSION['config']['databasetype'], - // "default", - // true, - // NOTES_TABLE, - // USERS_TABLE, - // "user_id", - // true, - // false, - // false, - // $start - // ); - - // $request->show_array($tabNotes); - for ($indNotes1 = 0; $indNotes1 < count($tabNotes); $indNotes1 ++) { - for ($indNotes2 = 0; $indNotes2 < count($tabNotes[$indNotes1]); $indNotes2 ++) { - foreach (array_keys($tabNotes[$indNotes1][$indNotes2]) as $value) { - if ($tabNotes[$indNotes1][$indNotes2][$value] == "id") { - $tabNotes[$indNotes1][$indNotes2]["id"] = $tabNotes[$indNotes1][$indNotes2]['value']; - $tabNotes[$indNotes1][$indNotes2]["label"] = 'ID'; - $tabNotes[$indNotes1][$indNotes2]["size"] = 1; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = false; - $tabNotes[$indNotes1][$indNotes2]["order"] = "id"; - $indNotes1d = $tabNotes[$indNotes1][$indNotes2]['value']; - } - if ($tabNotes[$indNotes1][$indNotes2][$value] == "user_id") { - $tabNotes[$indNotes1][$indNotes2]["user_id"] = $tabNotes[$indNotes1][$indNotes2]['value']; - $tabNotes[$indNotes1][$indNotes2]["label"] = _ID; - $tabNotes[$indNotes1][$indNotes2]["size"] = 5; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = false; - $tabNotes[$indNotes1][$indNotes2]["order"] = "user_id"; - } - - if ($tabNotes[$indNotes1][$indNotes2][$value] == "creation_date") { - $tabNotes[$indNotes1][$indNotes2]["creation_date"] = $tabNotes[$indNotes1][$indNotes2]['value']; - $tabNotes[$indNotes1][$indNotes2]["value"] = $core_tools->format_date_db($tabNotes[$indNotes1][$indNotes2]['value'], false, '', true); - $tabNotes[$indNotes1][$indNotes2]["label"] = _DATE; - $tabNotes[$indNotes1][$indNotes2]["size"] = 10; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = true; - $tabNotes[$indNotes1][$indNotes2]["order"] = "creation_date"; - } - if ($tabNotes[$indNotes1][$indNotes2][$value] == "user") { - $tabNotes[$indNotes1][$indNotes2]["user"] = $tabNotes[$indNotes1][$indNotes2]['value']; - $tabNotes[$indNotes1][$indNotes2]["label"] = _USER; - $tabNotes[$indNotes1][$indNotes2]["size"] = 10; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = true; - $tabNotes[$indNotes1][$indNotes2]["order"] = "lastname"; - } - if ($tabNotes[$indNotes1][$indNotes2][$value] == "note_text") { - //$tabNotes[$indNotes1][$indNotes2]["note_text"] = $tabNotes[$indNotes1][$indNotes2]['value']; - $tabNotes[$indNotes1][$indNotes2]["note_text"] = $request->cut_string($request->show_string($tabNotes[$indNotes1][$indNotes2]['value']), $cutString); - $tabNotes[$indNotes1][$indNotes2]["label"] = _NOTES; - $tabNotes[$indNotes1][$indNotes2]["size"] = 60; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = true; - $tabNotes[$indNotes1][$indNotes2]["order"] = "note_text"; - } - - if ($tabNotes[$indNotes1][$indNotes2][$value] == "visibleby") { - $noteEntities = $notes_tools->getNotesEntities($indNotes1d); - $tabEntityLabel = []; - $tabEntityId = []; - $allEntities = ''; - $allEntitiesId = ''; - - foreach ($noteEntities as $value) { - $tabEntityLabel[] = $value->short_label; - $tabEntityId[] = $value->entity_id; - } - - if (!empty($tabEntityLabel)) { - $allEntities = implode(' - ', $tabEntityLabel); - if (count($tabEntityId) > 3) { - $allEntitiesId = $tabEntityId[0] .'<br/>'.$tabEntityId[1].'<br/>'.$tabEntityId[2].'<br/>...'; - } else { - $allEntitiesId = implode('<br/>', $tabEntityId); - } - } - - - $tabNotes[$indNotes1][$indNotes2]['value'] = '<div style="cursor:pointer;text-overflow: ellipsis;clear:both;white-space: nowrap;overflow: hidden;"><i title="'.$allEntities.'" >'.$allEntitiesId.'</i></div>'; - $tabNotes[$indNotes1][$indNotes2]["label"] = _VISIBLEBY; - $tabNotes[$indNotes1][$indNotes2]["size"] = 10; - $tabNotes[$indNotes1][$indNotes2]["label_align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["align"] = "left"; - $tabNotes[$indNotes1][$indNotes2]["valign"] = "bottom"; - $tabNotes[$indNotes1][$indNotes2]["show"] = true; - } - } - } - } - - //List - $listKey = 'id'; //Clé de la liste - $paramsTab = array(); //Initialiser le tableau de paramètres - $paramsTab['bool_sortColumn'] = true; //Affichage Tri - $paramsTab['pageTitle'] =''; //Titre de la page - $paramsTab['bool_bigPageTitle'] = false; //Affichage du titre en grand - $paramsTab['urlParameters'] = 'identifier='.$identifier - ."&origin=".$origin.'&display=true'.$parameters; //Parametres d'url supplementaires - $paramsTab['filters'] = array(); //Filtres - $paramsTab['listHeight'] = '100%'; //Hauteur de la liste - $paramsTab['start'] = $start; - $paramsTab['listCss'] = $css; //CSS - $paramsTab['tools'] = array(); //Icones dans la barre d'outils - - $add = array( - "script" => "showNotesForm('".$_SESSION['config']['businessappurl'] - . "index.php?display=true&module=notes&page=notes_ajax_content" - . "&mode=add&identifier=".$identifier."&origin=".$origin - . $parameters."')", - "icon" => 'pencil-alt', - "tooltip" => _ADD_NOTE, - "alwaysVisible" => true - ); - array_push($paramsTab['tools'], $add); - - //Action icons array - $paramsTab['actionIcons'] = array(); - - $read = array( - "script" => "showNotesForm('".$_SESSION['config']['businessappurl'] - ."index.php?display=true&module=notes&page=notes_ajax_content" - ."&mode=up&id=@@id@@&identifier=".$identifier."&origin=".$origin - . $parameters."');", - "class" => "read", - "icon" => "pencil-alt", - // "label" => _UPDATE.'/'._DELETE, - "tooltip" => _UPDATE.'/'._DELETION, - "disabledRules" => "@@user_id@@ != '".$_SESSION['user']['UserId']."'" - ); - array_push($paramsTab['actionIcons'], $read); - - //Output - $status = 0; - $content = $list->showList($tabNotes, $paramsTab, $listKey); - - echo "{status : " . $status . ", content : '" . addslashes($debug.$content) . "', error : '" . addslashes($error) . "'}"; - } diff --git a/modules/notes/notes_ajax_content.php b/modules/notes/notes_ajax_content.php deleted file mode 100755 index 4750096086fe1795139472ac06ab18c3e28d5bd0..0000000000000000000000000000000000000000 --- a/modules/notes/notes_ajax_content.php +++ /dev/null @@ -1,540 +0,0 @@ -<?php -/* -* -* Copyright 2012 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Script to return ajax result -* -* @file notes_ajax_content.php -* @author Yves Christian Kpakpo <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup notes -*/ - -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"; -require_once "modules".DIRECTORY_SEPARATOR."entities" - .DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."EntityControler.php"; -require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR - ."class".DIRECTORY_SEPARATOR."class_lists.php"; -require_once 'modules/notes/notes_tables.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; - -$core_tools = new core_tools(); -$request = new request(); -$db = new Database(); -$sec = new security(); -$ent = new EntityControler(); -$notesTools = new notes(); -$list = new lists(); - -$destination = ''; - -function _parse($text) { - //... - $text = str_replace("\r\n", "\n", $text); - $text = str_replace("\r", "\n", $text); - - // - $text = str_replace("\n", "\\n ", $text); - return $text; -} - -$core_tools->load_lang(); - -$status = 0; -$error = $content = $js = $parameters = ''; - -$labels_array = array(); - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - $error = _ERROR_IN_NOTES_FORM_GENERATION; - $status = 1; -} - -//Identifier of the element wich is noted -$identifier = ''; -if (isset($_REQUEST['identifier']) && ! empty($_REQUEST['identifier'])) { - $identifier = trim($_REQUEST['identifier']); -} - -//Collection -if (isset($_REQUEST['coll_id']) && ! empty($_REQUEST['coll_id'])) { - $collId = trim($_REQUEST['coll_id']); - $parameters .= '&coll_id='.$_REQUEST['coll_id']; - $view = $sec->retrieve_view_from_coll_id($collId); - $table = $sec->retrieve_table_from_coll($collId); - //retrieve the process entity of document - $stmt = $db->query( - "SELECT destination FROM " . $table . " WHERE res_id = ?", array($identifier) - ); - $resultDest = $stmt->fetchObject(); - $destination = $resultDest->destination; -} - -//Keep some origin parameters -if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) $parameters .= '&size='.$_REQUEST['size']; -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $parameters .= '&order='.$_REQUEST['order']; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) $parameters .= '&order_field='.$_REQUEST['order_field']; -} -if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) $parameters .= '&what='.$_REQUEST['what']; -if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) $parameters .= '&template='.$_REQUEST['template']; -if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) $parameters .= '&start='.$_REQUEST['start']; - -//Keep the origin to reload the origin list -$list_origin = $origin = ''; -if (isset($_REQUEST['origin']) && !empty($_REQUEST['origin'])) { - // - $origin = $_REQUEST['origin']; - - if ($_REQUEST['origin'] == "document") { - //From document - $list_origin = "loadList('".$_SESSION['config']['businessappurl'] - ."index.php?display=true&module=notes&page=notes&identifier=" - .$identifier."&origin=document".$parameters."', 'divList', true);"; - } -} - -//Path to actual script -$path_to_script = $_SESSION['config']['businessappurl'] - ."index.php?display=true&module=notes&page=notes_ajax_content&identifier=" - .$identifier."&origin=".$origin.$parameters; - -require 'modules/templates/class/templates_controler.php'; -$templatesControler = new templates_controler(); -$templates = array(); -if ($destination <> '') { - $templates = $templatesControler->getAllTemplatesForProcess($destination); -} else { - $templates = $templatesControler->getAllTemplatesForSelect(); -} -switch ($mode) { - case 'add': - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } else { - $entitiesList = array(); - $entitiesList = $ent->getAllEntities(); - $content .= '<div class="block">'; - $content .= '<form name="formNotes" id="formNotes" method="post" action="#">'; - $content .= '<input type="hidden" value="'.$identifier.'" name="identifier" id="identifier">'; - $content .= '<h2>'._ADD_NOTE.'</h2>'; - $content .= '<label for="templateNotes">' . _NOTE_TEMPLATE .' : </label>'; - $content .= '<select name="templateNotes" id="templateNotes" style="width:250px" ' - . 'onchange="addTemplateToNote($(\'templateNotes\').value, \'' - . $_SESSION['config']['businessappurl'] . 'index.php?display=true' - . '&module=templates&page=templates_ajax_content_for_notes\');">'; - $content .= '<option value="">' . _SELECT_NOTE_TEMPLATE . '</option>'; - for ($i=0;$i<count($templates);$i++) { - if ($templates[$i]['TYPE'] == 'TXT' && ($templates[$i]['TARGET'] == 'notes' || $templates[$i]['TARGET'] == '')) { - $content .= '<option value="'; - $content .= $templates[$i]['ID']; - $content .= '">'; - $content .= $templates[$i]['LABEL']; - } - $content .= '</option>'; - } - $content .= '</select><br />'; - $content .= '<textarea style="width:500px" cols="70" rows="10" name="notes" id="notes" ></textarea>'; - $content .= '<h3 class="sstit" style="color: red">'._THIS_NOTE_IS_VISIBLE_BY.'</h3>'; - $content .= '<table align="center" width="100%" id="template_entities">'; - $content .= '<tr><td width="20%" align="center">'; - $content .= '<select name="entitieslist[]" id="entitieslist" size="7" style="width: 206px" '; - $content .= 'ondblclick=\'moveclick($(entitieslist), $(entities_chosen));\' multiple="multiple">'; - $entitiesForRestriction = null; - if (!empty($_SESSION['user']['entities'])) { - foreach ($_SESSION['user']['entities'] as $tmpEntity) { - //if($tmpEntity['ENTITY_ID'] == $_SESSION['user']['primaryentity']['id']){ - $entitiesForRestriction[] = $tmpEntity['ENTITY_ID']; - //} - } - } - $entitiesForRestriction[] = $destination; - for ($i=0;$i<count($entitiesList);$i++) { - if ($entitiesForRestriction && in_array($entitiesList[$i]->entity_id, $entitiesForRestriction)) { - $state_entity = true; - } else { - $state_entity = false; - } - - if ($state_entity == false) { - $content .= '<option value="' - .$entitiesList[$i]->entity_id.'" alt="' - .functions::xssafe($entitiesList[$i]->short_label).'" title="' - .functions::xssafe($entitiesList[$i]->short_label).'">' - .functions::xssafe($entitiesList[$i]->short_label).'</option>'; - } - } - $content .= '</select><br/> </td>'; - $content .= '<td width="20%" align="center">'; - $content .= '<input type="button" class="button" value="'._ADD.' >>" onclick=\'Move($(entitieslist), $(entities_chosen));\' />'; - $content .= '<br /><br />'; - $content .= '<input type="button" class="button" value="<< '._REMOVE.'" onclick=\'Move($(entities_chosen), $(entitieslist));\' />'; - $content .= '</td>'; - $content .= '<td width="30%" align="center">'; - $content .= '<select name="entities_chosen[]" id="entities_chosen" size="7" style="width: 206px" '; - $content .= 'ondblclick=\'moveclick($(entities_chosen), $(entitieslist));\' multiple="multiple">'; - for ($i=0;$i<count($entitiesList);$i++) { - $state_entity = false; - if ($state_entity == true || ($entitiesForRestriction && in_array($entitiesList[$i]->entity_id, $entitiesForRestriction))) { - $content .= '<option value="' - .$entitiesList[$i]->entity_id.'" alt="' - .functions::xssafe($entitiesList[$i]->short_label).'" title="' - .functions::xssafe($entitiesList[$i]->short_label).'" selected="selected">' - .functions::xssafe($entitiesList[$i]->short_label).'</option>'; - } - } - $content .= '</select></td>'; - $content .= '</tr></table>'; - // Buttons - $content .='<hr />'; - $content .='<div align="center">'; - $content .=' <input type="button" name="valid" value=" '._VALIDATE - .' " id="valid" class="button" onclick="' - .'selectall($(\'entities_chosen\'));validNotesForm(\'' - .$path_to_script.'&mode=added\', \'formNotes\');" /> '; - $content .='<input type="button" name="cancel" id="cancel" class="button" value="' - ._CANCEL.'" onclick="destroyModal(\'form_notes\');"/>'; - $content .='</div">'; - $content .= '</form>'; - $content .= '</div>'; - } - break; - case 'added': - if (strlen(trim($_REQUEST['notes'])) > 0) { - //Identifier? - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } else { - - //Add notes - $notes = $_REQUEST['notes']; - $userId = $_SESSION['user']['UserId']; - $type = 'resource'; - - $db->query( - "INSERT INTO " . NOTES_TABLE . "(identifier, note_text, creation_date, user_id, type) VALUES (?, ?, CURRENT_TIMESTAMP, ?, ?)", - array($identifier, $notes, $userId, $type) - ); - - //Last insert ID from sequence - $id = $db->lastInsertId('notes_id_seq'); - - //Entities selected - if (!empty($id) && isset($_REQUEST['entities_chosen']) && !empty($_REQUEST['entities_chosen'])) - { - for ($i=0; $i<count($_REQUEST['entities_chosen']); $i++) - { - $db->query( - "INSERT INTO " . NOTE_ENTITIES_TABLE . "(note_id, item_id) VALUES" - . " (?, ?)", - array($id, $_REQUEST['entities_chosen'][$i]) - ); - } - } - - //History - if ($_SESSION['history']['noteadd']) { - $hist = new history(); - - if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "folder") { - if (!empty($id) && isset($_REQUEST['entities_chosen']) && !empty($_REQUEST['entities_chosen'])){ - - $hist->add( - $table, $identifier, "UP", 'folderup', _ADDITION_NOTE_PRIVATE . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - }else{ - $hist->add( - $table, $identifier, "UP", 'folderup', _ADDITION_NOTE . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ') : "' . $request->cut_string($notes, 254) .'"', - $_SESSION['config']['databasetype'], 'notes' - ); - } - } else if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "document") { - if (!empty($id) && isset($_REQUEST['entities_chosen']) && !empty($_REQUEST['entities_chosen'])){ - /*show restricted services*/ - $allEntity = ''; - foreach ($_REQUEST['entities_chosen'] as $value){ - - $allEntity .= $value." | "; - - } - $hist->add( - $table, $identifier, "UP", 'folderup', _ADDITION_NOTE_PRIVATE . _ON_DOC_NUM - . $identifier . ' (' . $id . ')'._VISIBLEBY.' '.$allEntity, - $_SESSION['config']['databasetype'], 'notes' - ); - }else{ - $hist->add( - $view, $identifier, "UP", 'resup', _ADDITION_NOTE . _ON_DOC_NUM - . $identifier . ' (' . $id . ') : "' . $request->cut_string($notes, 254) .'"', - $_SESSION['config']['databasetype'], 'notes' - ); - } - } - - $hist->add( - NOTES_TABLE, $id, "ADD", 'noteadd', _NOTES_ADDED . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } - - //Reload and show message - $js = $list_origin; - $msgResult = _NOTES_ADDED; - //Count notes - $toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=notes&page=load_toolbar_notes&origin=parent&resId='.$identifier.'&collId='.$collId; - $js .='loadToolbarBadge(\'notes_tab\',\''.$toolbarBagde_script.'\');'; - } - } else { - $error = $request->wash_html(_NOTES.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } - break; - case 'up': - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - - $id = $_REQUEST['id']; - //Check if ID exists - $stmt = $db->query( - "SELECT n.identifier, n.creation_date, n.user_id, n.note_text, u.lastname, " - . "u.firstname FROM " . NOTES_TABLE . " n inner join ". USERS_TABLE - . " u on n.user_id = u.user_id WHERE n.id = :Id ", [":Id" => $id] - ); - - if($stmt->rowCount() > 0) { - - $line = $stmt->fetchObject(); - - $user = $request->show_string($line->lastname . " " . $line->firstname); - $notes = $line->note_text; - $userId = $line->user_id; - $date = $line->creation_date; - $identifier = $line->identifier; - - $notesEntities = array(); - $entitiesList = array(); - $notesEntities = $notesTools->getNotesEntities($id); - $entitiesList = $ent->getAllEntities(); - //Form - $content .= '<div class="block">'; - $content .= '<form name="formNotes" id="formNotes" method="post" action="#">'; - $content .= '<input type="hidden" value="'.$identifier.'" name="identifier" id="identifier">'; - $content .= '<input type="hidden" value="'.$id.'" name="id" id="id">'; - $content .= '<h2 class="sstit">'._NOTES . " " . _OF . " " . $user . " (" . $date . ")".'</h2>'; - $content .= '<label for="templateNotes">' . _NOTE_TEMPLATE .' : </label>'; - $content .= '<select name="templateNotes" id="templateNotes" style="width:250px" ' - . 'onchange="addTemplateToNote($(\'templateNotes\').value, \'' - . $_SESSION['config']['businessappurl'] . 'index.php?display=true' - . '&module=templates&page=templates_ajax_content_for_notes\');">'; - $content .= '<option value="">' . _SELECT_NOTE_TEMPLATE . '</option>'; - for ($i=0;$i<count($templates);$i++) { - if ($templates[$i]['TYPE'] == 'TXT' && ($templates[$i]['TARGET'] == 'notes' || $templates[$i]['TARGET'] == '')) { - $content .= '<option value="'; - $content .= $templates[$i]['ID']; - $content .= '">'; - $content .= $templates[$i]['LABEL']; - } - $content .= '</option>'; - } - $content .= '</select><br />'; - $content .= '<textarea style="width:500px" cols="70" rows="10" name="notes" id="notes">'.functions::xssafe($notes).'</textarea>'; - $content .= '<h3 class="sstit" style="color: red">'._THIS_NOTE_IS_VISIBLE_BY.'</h3>'; - $content .= '<table align="center" width="100%" id="template_entities">'; - $content .= '<tr><td width="20%" align="center">'; - $content .= '<select name="entitieslist[]" id="entitieslist" size="7" style="width: 206px" '; - $content .= 'ondblclick=\'moveclick($(entitieslist), $(entities_chosen));\' multiple="multiple">'; - for ($i=0;$i<count($entitiesList);$i++) { - if (!in_array($entitiesList[$i], $notesEntities)) { - $content .= '<option value="' - .$entitiesList[$i]->entity_id.'" alt="' - .functions::xssafe($entitiesList[$i]->short_label).'" title="' - .functions::xssafe($entitiesList[$i]->short_label).'">' - .functions::xssafe($entitiesList[$i]->short_label).'</option>'; - } - } - $content .= '</select><br/> </td>'; - $content .= '<td width="20%" align="center">'; - $content .= '<input type="button" class="button" value="'._ADD.' >>" onclick=\'Move($(entitieslist), $(entities_chosen));\' />'; - $content .= '<br /><br />'; - $content .= '<input type="button" class="button" value="<< '._REMOVE.'" onclick=\'Move($(entities_chosen), $(entitieslist));\' />'; - $content .= '</td>'; - $content .= '<td width="30%" align="center">'; - $content .= '<select name="entities_chosen[]" id="entities_chosen" size="7" style="width: 206px" '; - $content .= 'ondblclick=\'moveclick($(entities_chosen), $(entitieslist));\' multiple="multiple">'; - for ($i=0;$i<count($notesEntities);$i++) { - $content .= '<option value="' - .$notesEntities[$i]->entity_id.'" alt="' - .functions::xssafe($notesEntities[$i]->short_label).'" title="' - .functions::xssafe($notesEntities[$i]->short_label).'" selected="selected">' - .functions::xssafe($notesEntities[$i]->short_label).'</option>'; - } - $content .= '</select></td>'; - $content .= '</tr></table>'; - // Buttons - $content .='<hr />'; - $content .='<div align="center">'; - $content .=' <input type="button" name="valid" value=" '._VALIDATE - .' " id="valid" class="button" onclick="' - .'selectall($(\'entities_chosen\'));validNotesForm(\'' - .$path_to_script.'&mode=updated\', \'formNotes\');" /> '; - $content .=' <input type="button" name="valid" value=" '._DELETE - .' " id="valid" class="button" onclick="if(confirm(\''._REALLY_DELETE.': ' - .$request->cut_string(str_replace(array("'", "\n","\"","\r"),array("\'", " ", """, " "), $notes), 250).' ?\')) validNotesForm(\'' - .$path_to_script.'&mode=del\', \'formNotes\');" /> '; - $content .='<input type="button" name="cancel" id="cancel" class="button" value="' - ._CANCEL.'" onclick="destroyModal(\'form_notes\');"/>'; - $content .='</div">'; - $content .= '</form>'; - $content .= '</div>'; - } else { - $error = $request->wash_html($id.': '._NOTE_DONT_EXIST.'!','NONE'); - $status = 1; - } - - } else { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } - break; - case 'updated': - if (strlen(trim($_REQUEST['notes'])) > 0) { - //ID? - if (empty($_REQUEST['id'])) { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } else { - $id = $_REQUEST['id']; - //Identifier? - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } else { - - $notes = $_REQUEST['notes']; - - $db->query( - "UPDATE ".NOTES_TABLE." SET note_text = ?, creation_date = CURRENT_TIMESTAMP WHERE id = ?", - array($notes, $id) - ); - - //Entities selected - $db->query( - "DELETE FROM " . NOTE_ENTITIES_TABLE . " WHERE note_id = ?", array($id) - ); - if (isset($_REQUEST['entities_chosen']) && !empty($_REQUEST['entities_chosen'])) { - - for ($i=0; $i<count($_REQUEST['entities_chosen']); $i++) - { - $db->query( - "INSERT INTO " . NOTE_ENTITIES_TABLE . "(note_id, item_id) VALUES" - . " (?, ?)", - array($id, $_REQUEST['entities_chosen'][$i]) - ); - } - } - - //History - if ($_SESSION['history']['noteup']) { - $hist = new history(); - if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "folder") { - $hist->add( - $table, $identifier, "UP", 'folderup', _NOTE_UPDATED . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ') : "' . $request->cut_string($notes, 254) .'"', - $_SESSION['config']['databasetype'], 'notes' - ); - } else if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "document") { - $hist->add( - $view, $identifier, "UP", 'resup', _NOTE_UPDATED . _ON_DOC_NUM - . $identifier . ' (' . $id . ') ', - $_SESSION['config']['databasetype'], 'notes' - ); - } - - $hist->add( - NOTES_TABLE, $id, "UP", 'noteup', _NOTE_UPDATED . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } - - //Reload and show message - $js = $list_origin; - $msgResult = _NOTE_UPDATED; - } - } - } else { - $error = $request->wash_html(_NOTES.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } - break; - case 'del': - //ID? - if (empty($_REQUEST['id'])) { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!','NONE'); - $status = 1; - } else { - $id = $_REQUEST['id']; - - $db->query("DELETE FROM " . NOTE_ENTITIES_TABLE . " WHERE note_id = ?", array($id)); - $db->query("DELETE FROM " . NOTES_TABLE . " WHERE id = ?", array($id)); - - if ($_SESSION['history']['notedel']) { - $hist = new history(); - $hist->add( - NOTES_TABLE, $id, "DEL", 'notedel', _NOTES_DELETED . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "folder") { - $hist->add( - $table, $identifier, "UP", 'folderup', _NOTES_DELETED . _ON_FOLDER_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } else if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == "document") { - $hist->add( - $view, $identifier, "UP", 'resup', _NOTES_DELETED . _ON_DOC_NUM - . $identifier . ' (' . $id . ')', - $_SESSION['config']['databasetype'], 'notes' - ); - } - } - - //Reload and show message - $js = $list_origin; - $msgResult = _NOTES_DELETED; - - //Count notes - $toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=notes&page=load_toolbar_notes&origin=parent&resId='.$identifier; - $js .='loadToolbarBadge(\'notes_tab\',\''.$toolbarBagde_script.'\');'; - } - break; -} - -echo "{status : " . $status . ", msg_result : '" . $msgResult . "', content : '" . addslashes(_parse($content)) . "', error : '" . addslashes($error) . "', exec_js : '".addslashes($js)."'}"; -exit (); -?> diff --git a/modules/notes/notes_tables.php b/modules/notes/notes_tables.php deleted file mode 100755 index 0a111df74466474bb684cd87db6d38d1d8b166db..0000000000000000000000000000000000000000 --- a/modules/notes/notes_tables.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/* -* Copyright 2008 - 2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Notes tables declarations -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup notes -*/ -if (! defined('NOTES_TABLE')) { - define('NOTES_TABLE', 'notes'); -} - -if (! defined('NOTE_ENTITIES_TABLE')) { - define('NOTE_ENTITIES_TABLE', 'note_entities'); -} diff --git a/modules/notes/xml/IVS/requests_definitions.xml b/modules/notes/xml/IVS/requests_definitions.xml index 0470daec93068a2c68bc4fecc2dd1b9620b2a8d0..87c36b040c37993213bc538cf6e8e522654c5667 100755 --- a/modules/notes/xml/IVS/requests_definitions.xml +++ b/modules/notes/xml/IVS/requests_definitions.xml @@ -1,9 +1,4 @@ <requestDefinitions> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="notes_ajax_content" > - <parameter name="page" value="notes_ajax_content"/> - <parameter name="module" value="notes"/> - <parameter name="display" value="true" /> - </requestDefinition> <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="notes" > <parameter name="page" value="notes"/> <parameter name="module" value="notes"/> @@ -19,9 +14,4 @@ <parameter name="module" value="notes"/> <parameter name="display" value="true" /> </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="note_details" > - <parameter name="page" value="note_details"/> - <parameter name="module" value="notes"/> - <parameter name="display" value="true"/> - </requestDefinition> </requestDefinitions> diff --git a/modules/notes/xml/IVS/validation_rules.xml b/modules/notes/xml/IVS/validation_rules.xml index 587b5e573ae78ffd01d1d03319faf0218c25479b..af0edac910b74f5df3f859fea545b0f484bfcb51 100755 --- a/modules/notes/xml/IVS/validation_rules.xml +++ b/modules/notes/xml/IVS/validation_rules.xml @@ -1,19 +1,4 @@ <validationRules> - <validationRule name="notes_ajax_content" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="coll_id" type="collection_list" /> - <parameter name="identifier" type="integer" /> - <parameter name="origin" type="identifier" /> - <parameter name="size" type="size" /> - <parameter name="cancel" type="identifier" /> - <parameter name="entities_chosen" type="identifier" /> - <parameter name="entitieslist" type="string" /> - <parameter name="notes" type="string" /> - <parameter name="templateNotes" type="identifier" /> - <parameter name="valid" type="string" /> - <parameter name="url" type="url" /> - <parameter name="id" type="integer" /> - </validationRule> <validationRule name="notes" extends="standardForm" mode="error"> <parameter name="module" type="identifier" /> <parameter name="coll_id" type="collection_list" /> @@ -24,12 +9,4 @@ <parameter name="size" type="size" /> <parameter name="url" type="url" /> </validationRule> - <validationRule name="note_details" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="coll_id" type="collection_list" /> - <parameter name="modify" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="resid" type="integer" /> - <parameter name="size" type="identifier" /> - </validationRule> </validationRules> diff --git a/modules/notes/xml/config.xml b/modules/notes/xml/config.xml index 69fe2c4b77af4852a67f08d1200ef97c34a854ff..1340e70494dfd481d3f82592c1a6f5747b526a21 100755 --- a/modules/notes/xml/config.xml +++ b/modules/notes/xml/config.xml @@ -10,9 +10,4 @@ <not_notes>notes</not_notes> <note_entities>note_entities</note_entities> </TABLENAME> - <HISTORY> - <noteadd>true</noteadd> - <noteup>true</noteup> - <notedel>true</notedel> - </HISTORY> </root> diff --git a/modules/notifications/lang/en.php b/modules/notifications/lang/en.php index b4a242bc5dd75eb731cf02302a7a6bd7485dc6fa..a8a0f139d5a82d2b5d8115b622637ccc8bd30ae5 100755 --- a/modules/notifications/lang/en.php +++ b/modules/notifications/lang/en.php @@ -159,8 +159,6 @@ if (!defined("_HELLO_NOTE")) define("_HELLO_NOTE", "Hello, you have a new annotation for the mail"); if (!defined("_NOTE_BODY")) define("_NOTE_BODY", "The note is the next one: "); -if (!defined("_NOTE_DETAILS")) - define("_NOTE_DETAILS", "This note has been added by"); if (!defined("_NOTE_DATE_DETAILS")) define("_NOTE_DATE_DETAILS", "On"); if (!defined("_LINK_TO_MAARCH")) diff --git a/modules/notifications/lang/fr.php b/modules/notifications/lang/fr.php index 9fb0ac7421c2345b7cd5e722bfeb311c088d17b2..7d57aef0611ec1dc329c5222aabd8d806fafdd53 100755 --- a/modules/notifications/lang/fr.php +++ b/modules/notifications/lang/fr.php @@ -159,8 +159,6 @@ if (!defined("_HELLO_NOTE")) define("_HELLO_NOTE", "Bonjour, vous avez une nouvelle annotation pour le courrier"); if (!defined("_NOTE_BODY")) define("_NOTE_BODY", "L'annotation est la suivante : "); -if (!defined("_NOTE_DETAILS")) - define("_NOTE_DETAILS", "Cette annotation à été ajoutée par : "); if (!defined("_NOTE_DATE_DETAILS")) define("_NOTE_DATE_DETAILS", "le"); if (!defined("_LINK_TO_MAARCH")) diff --git a/modules/notifications/lang/nl.php b/modules/notifications/lang/nl.php index 15189d14c35d6fe90683e9146740625429219bf7..fa29149fe3eb6a0d2d67f251fc2e298266f4a952 100755 --- a/modules/notifications/lang/nl.php +++ b/modules/notifications/lang/nl.php @@ -195,9 +195,6 @@ if (!defined('_HELLO_NOTE')) { if (!defined('_NOTE_BODY')) { define('_NOTE_BODY', 'De opmerking is de volgende:'); } -if (!defined('_NOTE_DETAILS')) { - define('_NOTE_DETAILS', 'Deze opmerking werd toegevoegd door:'); -} if (!defined('_NOTE_DATE_DETAILS')) { define('_NOTE_DATE_DETAILS', 'op'); } @@ -405,6 +402,3 @@ if (!defined('_DEPARTMENT')) { if (!defined('_NOTE_BODY')) { define('_NOTE_BODY', 'De opmerking is de volgende: '); } -if (!defined('_NOTE_DETAILS')) { - define('_NOTE_DETAILS', 'Deze opmerking werd toegevoegd door: '); -} diff --git a/modules/sendmail/address_autocompletion.php b/modules/sendmail/address_autocompletion.php deleted file mode 100644 index f3a2d304ee46205191801b36c819a580885349cd..0000000000000000000000000000000000000000 --- a/modules/sendmail/address_autocompletion.php +++ /dev/null @@ -1,112 +0,0 @@ -<?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 address_autocompletion -* @author dev <dev@maarch.org> -* @ingroup sendmail -*/ - -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); - -$db = new Database(); - -$timestart=microtime(true); - -$args = explode(' ', $_REQUEST['what']); -$args[] = $_REQUEST['what']; -$num_args = count($args); -if ($num_args == 0) { - return "<ul></ul>"; -} - -$query = "SELECT result, SUM(confidence) AS score, count(1) AS num FROM ("; -$subQuery = array(); -$subQuery[1] = "SELECT UPPER(lastname) || ' ' || firstname || ' (' || mail || ')' AS result, " - . ' %d AS confidence, mail AS email ' - . "FROM users" - . " WHERE status != 'SPD' AND " - . "(LOWER(lastname) LIKE LOWER('%s') OR LOWER(firstname) LIKE LOWER('%s') OR LOWER(user_id) LIKE LOWER('%s') OR LOWER(user_id) LIKE LOWER('%s') OR LOWER(user_id) LIKE LOWER('%s') OR LOWER(user_id) LIKE LOWER('%s') OR LOWER(mail) LIKE LOWER('%s'))"; - -$subQuery[2]= - "SELECT CASE WHEN contact_lastname = '' THEN UPPER(lastname) ELSE UPPER(contact_lastname) END || ' ' || CASE WHEN contact_firstname = '' THEN firstname ELSE contact_firstname END || CASE WHEN society = '' THEN '' ELSE ' - '||society END || " - . "' (' || email || ')' AS result, " - . ' %d AS confidence, email' - . " FROM view_contacts" - . " WHERE " - . " enabled = 'Y' AND email <> ''" - . " AND (" - . " (LOWER(contact_lastname) LIKE LOWER('%s') OR LOWER(lastname) LIKE LOWER('%s'))" - . " OR (LOWER(contact_firstname) LIKE LOWER('%s') OR LOWER(firstname) LIKE LOWER('%s'))" - . " OR LOWER(society) LIKE LOWER('%s')" - . " OR LOWER(society_short) LIKE LOWER('%s')" - . " OR LOWER(email) LIKE LOWER('%s')" - .")" - ."and (is_private = 'N' or ( user_id = '".$_SESSION['user']['UserId']."' and is_private = 'Y'))"; - -$queryParts = array(); - -for ($i=1; $i<3; $i++) { - foreach ($args as $arg) { - if (strlen($arg) == 0) { - continue; - } - # Full match of one given arg - $expr = $arg; - $conf = 100; - $queryParts[] = sprintf($subQuery[$i], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); - - # Partial match (starts with) - $expr = $arg . "%"; - ; - $conf = 34; # If found, partial match contains will also be so score is sum of both confidences, i.e. 67) - $queryParts[] = sprintf($subQuery[$i], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); - - # Partial match (contains) - $expr = "%" . $arg . "%"; - $conf = 33; - $queryParts[] = sprintf($subQuery[$i], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); - } -} - -$query .= implode(' UNION ALL ', $queryParts); -$query .= ") matches" - . " GROUP BY result " - . " ORDER BY score DESC, result ASC"; - -$stmt = $db->query($query); -$nb = $stmt->rowCount(); -$m = 30; -if ($nb >= $m) { - $l = $m; -} else { - $l = $nb; -} - -$timeend=microtime(true); -$time = number_format(($timeend-$timestart), 3); - -$found = false; -echo "<ul title='$l contacts found in " . $time."sec'>"; -for ($i=0; $i<$l; $i++) { - $res = $stmt->fetchObject(); - $score = round($res->score / $num_args); - if ($i%2==1) { - $color = 'LightYellow'; - } else { - $color = 'white'; - } - echo "<li style='font-size: 8pt; background-color:$color;' title='confiance:".$score."%' id='".$res->email."'>". $res->result ."</li>"; -} -if ($nb == 0) { - echo "<li></li>"; -} -echo "</ul>"; -if ($nb == 0) { - echo "<p align='left' style='background-color:LemonChiffon;' title=\"Aucun résultat trouvé, veuillez compléter votre recherche.\" >...</p>"; -} -if ($nb > $m) { - echo "<p align='left' style='background-color:LemonChiffon;' title=\"La liste n'a pas pu être affichée intégralement, veuillez compléter votre recherche.\" >...</p>"; -} diff --git a/modules/sendmail/class/class_email_signatures.php b/modules/sendmail/class/class_email_signatures.php deleted file mode 100755 index 6f82fbb8759c2f702d1a45fe1f30aca46915fc17..0000000000000000000000000000000000000000 --- a/modules/sendmail/class/class_email_signatures.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/* -* Copyright 2008-2016 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -require_once 'modules/sendmail/class/class_email_signatures_Abstract.php'; - -class EmailSignatures extends EmailSignaturesAbstract -{ - // custom -} \ No newline at end of file diff --git a/modules/sendmail/class/class_email_signatures_Abstract.php b/modules/sendmail/class/class_email_signatures_Abstract.php deleted file mode 100755 index a64153f94df6bd77278ff9204a50c56f494ed55c..0000000000000000000000000000000000000000 --- a/modules/sendmail/class/class_email_signatures_Abstract.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/* -* Copyright 2008-2016 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -abstract class EmailSignaturesAbstract extends Database -{ - - protected function rawToHtml($text) { - $text = str_replace("\r\n", PHP_EOL, $text); - $text = str_replace("\r", PHP_EOL, $text); - $text = str_replace('###', ';', $text); - $text = str_replace('___', '--', $text); - - return $text; - } - - public function getForCurrentUser() { - $db = new Database(); - - $stmt = $db->query('SELECT * FROM users_email_signatures WHERE user_id = ? order by title', - [$_SESSION['user']['UserId']] - ); - $mailSignatures = []; - while($res = $stmt->fetchObject()) - $mailSignatures[] = ['id' => $res->id, 'title' => $res->title, 'signature' => $this->rawToHtml($res->html_body)]; - - return $mailSignatures; - } -} \ No newline at end of file diff --git a/modules/sendmail/class/class_modules_tools_Abstract.php b/modules/sendmail/class/class_modules_tools_Abstract.php index 7425600b29fca03ae4caaf1ff98463909891c835..6a32f5c1bf31e0b6fa09731608b1439bdfb402ef 100755 --- a/modules/sendmail/class/class_modules_tools_Abstract.php +++ b/modules/sendmail/class/class_modules_tools_Abstract.php @@ -57,132 +57,6 @@ abstract class SendmailAbstract extends Database $_SESSION['history']['maildel'] = (string) $hist->maildel; } - public function CheckEmailAdress($adress) - { - $error = ''; - if (!empty($adress)) { - $adressArray = explode(',', trim($adress)); - for ($i=0; $i < count($adressArray); $i++) { - if (!empty($adressArray[$i])) { - $this->wash($adressArray[$i], 'mail', _EMAIL.": ".$adressArray[$i], 'yes', 0, 255); - if (!empty($_SESSION['error'])) { - $error .= $_SESSION['error']; - $_SESSION['error']=''; - } - } - } - $error = str_replace("<br />", "###", $error); - } - return $error; - } - - public function getJoinedFiles($coll_id, $table, $id, $from_res_attachment = false) - { - // $joinedFiles = array(); - // $db = new Database(); - // if ($from_res_attachment === false) { - // $stmt = $db->query( - // "select res_id, description, subject, title, format, filesize, relation from " - // . $table . " where res_id = ? and status <> 'DEL'", - // array($id) - // ); - // } else { - // include_once 'modules/attachments/attachments_tables.php'; - // $stmt = $db->query( - // "SELECT rva.res_id, rva.res_id_version, rva.description, rva.subject, rva.title, rva.format, rva.filesize, rva.res_id_master, rva.attachment_type, rva.identifier, cv2.society, cv2.firstname, cv2.lastname, rva.filename, rva.path - // FROM res_view_attachments rva LEFT JOIN contacts_v2 cv2 ON rva.dest_contact_id = cv2.contact_id WHERE rva.res_id_master = ? and rva.coll_id = ? and rva.status <> 'DEL' and rva.status <> 'OBS' and rva.attachment_type NOT IN ('converted_pdf','print_folder') ORDER BY rva.attachment_type, rva.description", - // array($id, $coll_id) - // ); - // } - - // while ($res = $stmt->fetchObject()) { - // $pdf_exist = true; - // if ($from_res_attachment) { - // require_once 'modules/attachments/class/attachments_controler.php'; - // $ac = new attachments_controler(); - // if ($res->res_id != 0) { - // $idFile = $res->res_id; - // $isVersion = false; - // } else { - // $idFile = $res->res_id_version; - // $isVersion = true; - // } - // $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'type' => 'PDF', 'resId' => $idFile, 'collId' => 'attachments_coll', 'isVersion' => $isVersion]); - // $viewLink = $_SESSION['config']['businessappurl'] - // .'index.php?display=true&module=attachments&page=view_attachment&res_id_master=' - // .$id.'&id='.$res->res_id; - - // if (!empty($convertedDocument)) { - // $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - // $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - - // if (!file_exists($pathToDocument)) { - // $pdf_exist = false; - // } - // } else { - // $pdf_exist = false; - // } - // } else { - // $idFile = $res->res_id; - // $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'type' => 'PDF', 'resId' => $idFile, 'collId' => 'letterbox_coll', 'isVersion' => $isVersion]); - // $viewLink = $_SESSION['config']['businessappurl'] - // .'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id=' - // .$id; - // if (!empty($convertedDocument)) { - // $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - // $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - // if (!file_exists($pathToDocument)) { - // $pdf_exist = false; - // } - // } else { - // $pdf_exist = false; - // } - // } - // $label = ''; - // //Tile, or subject or description - // if (strlen(trim($res->title)) > 0) { - // $label = $res->title; - // } elseif (strlen(trim($res->subject)) > 0) { - // $label = $res->subject; - // } elseif (strlen(trim($res->description)) > 0) { - // $label = $res->description; - // } - - // array_push( - // $joinedFiles, - // array('id' => $idFile, //ID - // 'label' => $this->show_string($label), //Label - // 'format' => $res->format, //Format - // 'filesize' => $res->filesize, //Filesize - // 'is_version' => $isVersion, - // 'pdf_exist' => $pdf_exist, - // 'version' => '', - // 'attachment_type' => $res->attachment_type, - // 'identifier' => $res->identifier, - // 'society' => $res->society, - // 'firstname' => $res->firstname, - // 'lastname' => $res->lastname, - // ) - // ); - // } - - // return $joinedFiles; - } - - public function rawToHtml($text) - { - //... - $text = str_replace("\r\n", PHP_EOL, $text); - $text = str_replace("\r", PHP_EOL, $text); - // - - //$text = str_replace(PHP_EOL, "<br />", $text); - // - return $text; - } - public function htmlToRaw($text) { // @@ -194,57 +68,11 @@ abstract class SendmailAbstract extends Database return $text; } - public function updateAdressInputField($ajaxPath, $adressArray, $inputField, $readOnly = false) - { - $content = ''; - //Init with loading div - $content .= '<div id="loading_'.$inputField.'" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></i></div>'; - //Get info from session array and display tag - if (isset($adressArray[$inputField]) && count($adressArray[$inputField]) > 0) { - foreach ($adressArray[$inputField] as $key => $adress) { - if (!empty($adress)) { - $content .= '<div class="email_element" id="'.$key.'_'.$adress.'">'.$adress; - if ($readOnly === false) { - $content .= ' <div class="email_delete_button" id="'.$key.'"' - . 'onclick="updateAdress(\''.$ajaxPath - .'&mode=adress\', \'del\', \''.$adress.'\', \'' - .$inputField.'\', this.id);" alt="'._DELETE.'" title="' - ._DELETE.'">x</div>'; - } - $content .= '</div>'; - } - } - } - return $content; - } - - public function updateContactInputField($ajaxPath, $adressArray, $inputField, $readOnly = false) - { - $content = '<div id="loading_'.$inputField.'" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></i></div>'; - //Get info from session array and display tag - if (isset($adressArray[$inputField]) && count($adressArray[$inputField]) > 0) { - foreach ($adressArray[$inputField] as $key => $adress) { - if (!empty($adress)) { - $content .= '<div class="email_element" id="'.$key.'_'.$adress.'">'.$adress; - if ($readOnly === false) { - $content .= ' <div class="email_delete_button" id="'.$key.'"' - . 'onclick="updateDestUser(\''.$ajaxPath - .'&mode=destUser\', \'del\', this.id, \'' - .$inputField.'\', this.id);" alt="'._DELETE.'" title="' - ._DELETE.'">x</div>'; - } - $content .= '</div>'; - } - } - } - return $content; - } - public function getResource($collectionArray, $coll_id, $res_id) { $viewResourceArr = array(); - for ($i=0;$i<count($collectionArray);$i++) { + for ($i=0; $i<count($collectionArray); $i++) { if ($collectionArray[$i]['id'] == $coll_id) { //Get table $table = $collectionArray[$i]['table']; @@ -387,131 +215,6 @@ abstract class SendmailAbstract extends Database return $viewAttachmentArr; } - public function getVersion($collectionArray, $coll_id, $res_id_master, $res_version) - { - $viewVersionArr = array(); - - //Parse collection - for ($i=0;$i<count($collectionArray);$i++) { - if ($collectionArray[$i]['id'] == $coll_id) { - //Get table - $table = $collectionArray[$i]['table']; - //Get adress - $adrTable = $collectionArray[$i]['adr']; - //Get versions table - $versionTable = $collectionArray[$i]['version_table']; - break; - } - } - - //Have version table - if ($versionTable <> '') { - $db = new Database(); - $stmt = $db->query( - "select res_id, description, subject, title, docserver_id, " - . "path, filename,format, filesize, relation from " - . $versionTable . " where res_id = ? and res_id_master = ? and status <> 'DEL'", - array($res_version, $res_id_master) - ); - //$db->show(); - //Have new version - if ($stmt->rowCount() > 0) { - $line = $stmt->fetchObject(); - //Tile, or subject or description - if (strlen(trim($line->title)) > 0) { - $label = $line->title; - } elseif (strlen(trim($line->subject)) > 0) { - $label = $line->subject; - } elseif (strlen(trim($line->description)) > 0) { - $label = $line->description; - } - - //Get file from docserver - include_once 'core/core_tables.php'; - include_once 'core/docservers_tools.php'; - - $docserver = $line->docserver_id; - $path = $line->path; - $filename = $line->filename; - $format = $line->format; - $stmt = $db->query( - "select path_template from " . _DOCSERVERS_TABLE_NAME - . " where docserver_id = ? ", - array($docserver) - ); - //$db->show(); - $lineDoc = $stmt->fetchObject(); - $docserver = $lineDoc->path_template; - $file = $docserver . $path . $filename; - $file = str_replace("#", DIRECTORY_SEPARATOR, $file); - - //Is there a corresponding file? - if (file_exists($file)) { - $mimeType = Ds_getMimeType($file); - - $fileNameOnTmp = 'tmp_file_' . rand() - . '.' . strtolower($format); - $filePathOnTmp = $_SESSION['config'] - ['tmppath'] . DIRECTORY_SEPARATOR - . $fileNameOnTmp; - copy($file, $filePathOnTmp); - - $viewVersionArr = array( - 'status' => 'ok', - 'label' => $this->show_string($label), - 'mime_type' => $mimeType, - 'ext' => $format, - 'file_content' => '', - 'tmp_path' => $_SESSION['config'] - ['tmppath'], - 'file_path' => $filePathOnTmp, - 'called_by_ws' => '', - 'error' => '' - ); - } else { - $viewVersionArr = array( - 'status' => 'ko', - 'label' => '', - 'mime_type' => '', - 'ext' => '', - 'file_content' => '', - 'tmp_path' => '', - 'file_path' => '', - 'called_by_ws' => '', - 'error' => _FILE_NOT_EXISTS_ON_THE_SERVER - ); - } - } else { - $viewVersionArr = array( - 'status' => 'ko', - 'label' => '', - 'mime_type' => '', - 'ext' => '', - 'file_content' => '', - 'tmp_path' => '', - 'file_path' => '', - 'called_by_ws' => '', - 'error' => _NO_RIGHT_ON_RESOURCE_OR_RESOURCE_NOT_EXISTS - ); - } - } else { - $viewVersionArr = array( - 'status' => 'ko', - 'label' => '', - 'mime_type' => '', - 'ext' => '', - 'file_content' => '', - 'tmp_path' => '', - 'file_path' => '', - 'called_by_ws' => '', - 'error' => _NO_VERSION_TABLE_FOR_THIS_COLLECTION - ); - } - // $this->show_array($viewVersionArr); - - return $viewVersionArr; - } - public function createFilename($label, $extension) { $search = array( @@ -597,26 +300,6 @@ abstract class SendmailAbstract extends Database return $arrayEntitiesMails; } - public function checkAttachedEntitiesMails() - { - $db = new Database; - $core_tools = new core_tools(); - - $entitiesMails = array(); - if ($core_tools->test_service('use_mail_services', 'sendmail', false)) { - $entitiesMails = $this->getAttachedEntitiesMails($_SESSION['user']['UserId']); - } - - $stmt = $db->query("SELECT mail FROM users WHERE user_id = ? ", array($_SESSION['user']['UserId'])); - $res = $stmt->fetchObject(); - - if ($res->mail<>"") { - $entitiesMails[$res->mail] = ""; - } - - return $entitiesMails; - } - public function explodeSenderEmail($senderEmail) { if (strpos($senderEmail, ",") === false) { @@ -626,17 +309,4 @@ abstract class SendmailAbstract extends Database return $explode[1]; } } - - public function emailStatus(array $args) - { - if ($args['status'] == 'SENT') { - return _EMAIL_SENT; - } elseif ($args['status'] == 'ERROR') { - return _EMAIL_ERROR; - } elseif ($args['status'] == 'WAITING') { - return _EMAIL_WAIT; - } else { - return _EMAIL_DRAFT; - } - } } diff --git a/modules/sendmail/contact_autocompletion.php b/modules/sendmail/contact_autocompletion.php deleted file mode 100755 index 4c69f5cbe9be655d6ba8c3c726dd8c4dd2c1d7a4..0000000000000000000000000000000000000000 --- a/modules/sendmail/contact_autocompletion.php +++ /dev/null @@ -1,105 +0,0 @@ -<?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 List of contact informations for autocompletion -* -* @file contact_autocompletion.php -* @date $date$ -* @version $Revision$ -* @ingroup sendmail -*/ - -$db = new Database(); - -$args = explode(' ', $_REQUEST['what']); -$args[] = $_REQUEST['what']; -$num_args = count($args); -if ($num_args == 0) { - return "<ul></ul>"; -} - -$query = "SELECT result, SUM(confidence) AS score, ca_id FROM ("; - -$subQuery[1]= - "SELECT CASE WHEN is_corporate_person = 'Y' THEN UPPER(society) ELSE COALESCE(contact_firstname, '') || ' ' || UPPER(COALESCE(contact_lastname, '')) END || " - . " ' - ' || CAST (external_id->>'m2m' as VARCHAR) || ' - ' || COALESCE(contact_purpose_label, '') || ' : ' || " - . " COALESCE(firstname, '') || ' ' || UPPER(COALESCE(lastname, ''))|| ' ' || COALESCE(address_num, '') || ' ' || COALESCE(address_street, '') || ' ' || COALESCE(address_postal_code, '')|| ' ' || COALESCE(address_town, '')|| ' ' || UPPER(COALESCE(address_country, ''))" - ." || '(Moyen de communication : ' || cc.value || ')' AS result, " - . ' %d AS confidence, ca_id' - . " FROM view_contacts left join contact_communication cc on view_contacts.contact_id = cc.contact_id" - . " WHERE " - . " enabled = 'Y' AND cc.value <> '' AND external_id->>'m2m' <> '' AND external_id->>'m2m' IS NOT NULL" - . " AND (" - . " (LOWER(contact_lastname) LIKE LOWER('%s') OR LOWER(lastname) LIKE LOWER('%s'))" - . " OR (LOWER(contact_firstname) LIKE LOWER('%s') OR LOWER(firstname) LIKE LOWER('%s'))" - . " OR LOWER(society) LIKE LOWER('%s')" - . " OR LOWER(society_short) LIKE LOWER('%s')" - . " OR LOWER(email) LIKE LOWER('%s')" - .")" - ."and (is_private = 'N' or ( user_id = '".$_SESSION['user']['UserId']."' and is_private = 'Y'))"; - -$queryParts = array(); - -foreach ($args as $arg) { - if (strlen($arg) == 0) { - continue; - } - # Full match of one given arg - $expr = $arg; - $conf = 100; - $queryParts[] = sprintf($subQuery[1], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); - - # Partial match (starts with) - $expr = $arg . "%"; - $conf = 34; # If found, partial match contains will also be so score is sum of both confidences, i.e. 67) - $queryParts[] = sprintf($subQuery[1], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); - - # Partial match (contains) - $expr = "%" . $arg . "%"; - $conf = 33; - $queryParts[] = sprintf($subQuery[1], $conf, $expr, $expr, $expr, $expr, $expr, $expr, $expr); -} - -$query .= implode(' UNION ALL ', $queryParts); -$query .= ") matches" - . " GROUP BY result, ca_id " - . " ORDER BY score DESC, result ASC"; - -$stmt = $db->query($query); -$nb = $stmt->rowCount(); -$m = 30; -if ($nb >= $m) { - $l = $m; -} else { - $l = $nb; -} - -echo "<ul title='$l contacts found'>"; -for ($i=0; $i<$l; $i++) { - $res = $stmt->fetchObject(); - $score = round($res->score / $num_args); - if ($i%2==1) { - $color = 'LightYellow'; - } else { - $color = 'white'; - } - echo "<li style='font-size: 8pt; background-color:$color;' title='confiance:".$score."%' id='".$res->ca_id."'>". $res->result ."</li>"; -} -if ($nb == 0) { - echo "<li></li>"; -} -echo "</ul>"; - -if ($nb == 0) { - echo "<p align='left' style='background-color:LemonChiffon;' title=\"Aucun résultat trouvé, veuillez compléter votre recherche.\" >...</p>"; -} -if ($nb > $m) { - echo "<p align='left' style='background-color:LemonChiffon;' title=\"La liste n'a pas pu être affichée intégralement, veuillez compléter votre recherche.\" >...</p>"; -} diff --git a/modules/sendmail/css/module.css b/modules/sendmail/css/module.css index 542f6c29c7dc700b8bd00783fd724acffdac00c3..248169ea3e1bf505a4d604884298acdd45511996 100755 --- a/modules/sendmail/css/module.css +++ b/modules/sendmail/css/module.css @@ -1,51 +1 @@ /* Sendmail module */ -/* menu */ -.emailInput { - -moz-appearance: textfield; - -webkit-appearance: textfield; - background-color: white; - background-color: -moz-field; - border: 1px solid darkgray; - box-shadow: 1px 1px 1px 0 lightgray inset; - font: -moz-field; - font: -webkit-small-control; - margin-top: 2px; - padding: 2px 2px; - width: 700px; - min-height: 13px; -} - -textarea.emailInput { - width: 770px; -} - -input.emailInput { - width: 700px; -} - -input.emailSelect { - width: 250px; -} - -.email_element { - display:inline-block; - margin:3px; - padding: 1px 3px 2px 3px; - /*color:white;*/ - font-size: .9em; - background-color: #BAD1E2; - border-radius: 5px; -} - -.email_delete_button { - color:grey; - display:inline; - padding: 1px 1px 2px 1px; - background-color:#BAD1E2; - font-weight:bold; - font-size: 1.2em; - cursor: pointer; -} -.email_delete_button:hover { - background-image: url(static.php?filename=black_0.1.png); -} \ No newline at end of file diff --git a/modules/sendmail/js/functions.js b/modules/sendmail/js/functions.js index 0614a7fb7829260481b794a27353dfe940677821..362c159c986e8f26d4d8f9a311528b85bc9cadb8 100755 --- a/modules/sendmail/js/functions.js +++ b/modules/sendmail/js/functions.js @@ -24,240 +24,6 @@ var addEmailAdress = function (idField, idList, theUrlToListScript, paramNameSrv }); }; -function addTemplateToEmail(templateMails, path){ - - new Ajax.Request(path, - { - method :'post', - parameters :{ - templateId : templateMails, - mode : mode - }, - onSuccess :function(answer){ - eval("response = " + answer.responseText); - if (response.status == 0) { - var strContent = response.content; - if(mode == 'html'){ - var strContentReplace = strContent.replace(/\\n/g, ''); - tinyMCE.execCommand('mceSetContent', false, strContentReplace); - } else { - var strContentReplace = strContent.replace(/\\n/g, '\n'); - $j("textarea#body_from_raw").html(strContentReplace); - } - } - } - }); -} - -function changeSignature(selected, mailSignaturesJS){ - var nb = selected.getAttribute('data-nb'); - var body = $('body_from_html_ifr').contentWindow.document.getElementById("tinymce"); - var customTag = body.getElementsByTagName("mailSignature"); - - if (mode == 'html' && customTag.length == 0) { - body.innerHTML += "<mailSignature>t</mailSignature>"; - customTag = body.getElementsByTagName("mailSignature"); - } - - if (nb >= 0) { - var strContent = mailSignaturesJS[nb].signature; - if(mode == 'html'){ - customTag[0].innerHTML = strContent; - } else { - var text = $j(strContent).text(); - $j("textarea#body_from_raw").append(text); - } - - } else { - customTag[0].innerHTML = ""; - } -} - -function showEmailForm(path, width, height, iframe_container_id) { - - if(typeof(width)==='undefined'){ - width = '820px'; - } - - if(typeof(height)==='undefined'){ - height = '545px'; - } - - if(typeof(iframe_container_id)==='undefined'){ - iframe_container_id = ''; - } - new Ajax.Request(path, - { - method:'post', - parameters: { url : path - }, - onSuccess: function(answer) { - eval("response = "+answer.responseText); - - if(response.status == 0){ - console.log('Height = '+height); - console.log('Width = '+width); - var modal_content = convertToTextVisibleNewLine(response.content); - createModal(modal_content, 'form_email', height, width,'',iframe_container_id); - } else { - window.top.$('main_error').innerHTML = response.error; - } - } - }); -} - -function updateAdress(path, action, adress, target, array_index, email_format_text_error) { - - if (validateEmail(adress) === true) { - - new Ajax.Request(path, - { - method:'post', - parameters: { url : path, - 'for': action, - email: adress, - field: target, - index: array_index - }, - onLoading: function(answer) { - $('loading_' + target).style.display='inline'; - }, - onSuccess: function(answer) { - eval("response = "+answer.responseText); - if(response.status == 0){ - $(target).innerHTML = response.content; - if (action == 'add') {$('email').value = '';} - } else { - alert(response.error); - eval(response.exec_js); - } - } - }); - } else { - if(typeof(email_format_text_error) == 'undefined'){ - email_format_text_error = 'Email format is not available!'; - } - alert(email_format_text_error); - } -} - -function updateDestUser(path, action, adress, target, array_index) { - - new Ajax.Request(path, - { - method:'post', - parameters: { url : path, - 'for': action, - contactAddress: adress, - field: target, - index: array_index - }, - onLoading: function(answer) { - $('loading_' + target).style.display='inline'; - }, - onSuccess: function(answer) { - eval("response = "+answer.responseText); - if(response.status == 0){ - $(target).innerHTML = response.content; - if (action == 'add') {$('user').value = '';} - } else { - alert(response.error); - eval(response.exec_js); - } - } - }); -} - -function validEmailForm(path, form_id) { - - var attachments = $j("#joined_files input.check"); - - if (attachments.length > 0 && (path.includes("for=send") || path.includes("formContent=messageExchange"))) { - var hasOneChecked = false; - for (var i = 0; i < attachments.length; i++) { - if (attachments[i].checked == true) { - hasOneChecked = true; - break; - } - } - - if (!hasOneChecked) { - if(path.includes("formContent=messageExchange")){ - alert('Aucune pièce jointe sélectionnée'); - return; - } else if(path.includes("for=send")){ - var cfm = confirm('Aucune pièce jointe sélectionnée. Voulez-vous quand même envoyer le mail ?'); - if (!cfm) { - return; - } - } - } - } - - if (typeof($j('input[name=main_exchange_doc]:checked', '#formEmail').val()) === 'undefined' && path.includes("formContent=messageExchange")) { - alert('Aucun document principal sélectionné'); - return; - } - - $j("input#valid.button").prop("disabled", true).css("opacity", "0.5"); - - tinyMCE.triggerSave(); - new Ajax.Request(path, - { - asynchronous:false, - method:'post', - parameters: Form.serialize(form_id), - encoding: 'UTF-8', - onSuccess: function(answer){ - eval("response = "+answer.responseText); - if(response.status == 0){ - eval(response.exec_js); - window.parent.destroyModal('form_email'); - } else { - $j("input#valid.button").prop("disabled", false).css("opacity", "1"); - alert(response.error); - eval(response.exec_js); - } - } - }); -} - -function validEmailFormForSendToContact(path, form_id, path2, status) { - tinyMCE.triggerSave(); - new Ajax.Request(path, - { - asynchronous:false, - method:'post', - parameters: Form.serialize(form_id), - encoding: 'UTF-8', - onSuccess: function(answer){ - eval("response = "+answer.responseText); - if(response.status == 0){ - eval(response.exec_js); - changeStatusForActionSendToContact(path2, status); - window.parent.destroyModal('form_email'); - } else { - alert(response.error); - eval(response.exec_js); - } - } - }); -} - -function changeStatusForActionSendToContact(path, status){ - console.log(path); - new Ajax.Request(path, - { - asynchronous:false, - method:'post', - parameters: {status : status}, - encoding: 'UTF-8', - onSuccess : function(){ - parent.document.getElementById('storage').click(); - } - }); -} - function extractEmailAdress(field, item) { var fullAdress = item.innerHTML; field.value = fullAdress.match(/\(([^)]+)\)/)[1]; @@ -268,22 +34,6 @@ function extractDestUser(field, item) { $j('#valid').click(); } -function validateEmail(email) { - var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return re.test(email); -} - -function switchMode(action) { - var div = document.getElementById(mode+"_mode"); - div.style.display = "block"; - if(action == "show") { - div.style.display = "none"; // Hide the current div. - mode = (mode === 'html')? 'raw' : 'html'; // switch the mode - document.getElementById("is_html").value = (mode === 'html')? 'Y' : 'N'; //Update the hidden field - document.getElementById(mode+"_mode").style.display = "block"; // Show the other div. - } -} - var MyAjax = { }; MyAjax.Autocompleter = Class.create(Ajax.Autocompleter, { updateChoices: function(choices) { @@ -313,13 +63,3 @@ MyAjax.Autocompleter = Class.create(Ajax.Autocompleter, { } } }); - -function clickAttachments(id){ - $("join_file_"+id).click(); -} -function clickAttachmentsInput(id){ - $("join_attachment_"+id).click(); -} -function clickAttachmentsNotes(id){ - $("note_"+id).click(); -} diff --git a/modules/sendmail/load_editor.php b/modules/sendmail/load_editor.php deleted file mode 100755 index 704e49583b8036a3699f7a502eaccc5cb183e685..0000000000000000000000000000000000000000 --- a/modules/sendmail/load_editor.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -?> -<!-- tinyMCE --> -<script type="text/javascript"> - tinymce.baseURL = "../../node_modules/tinymce"; - tinymce.suffix = '.min'; - tinymce.init({ - selector: "textarea#body_from_html", - statusbar : false, - language : "fr_FR", - language_url: "tools/tinymce/langs/fr_FR.js", - height : "150", - plugins: [ - "advlist autolink link lists charmap print preview hr", - "searchreplace visualblocks visualchars code fullscreen insertdatetime nonbreaking", - "save table contextmenu directionality paste textcolor" - ], - external_plugins: { - 'bdesk_photo': "../../apps/maarch_entreprise/tools/tinymce/bdesk_photo/plugin.min.js" - }, - toolbar: "undo redo | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | preview fullpage | forecolor backcolor", - //save_callback : "customSave", - paste_data_images: true, - images_upload_handler: function (blobInfo, success, failure) { - success("data:" + blobInfo.blob().type + ";base64," + blobInfo.base64()); - } - }); - - // Custom save callback, gets called when the contents is to be submitted - function customSave(id, content) { - alert(id + "=" + content); - } -</script> -<!-- /tinyMCE --> diff --git a/modules/sendmail/load_toolbar_sendmail.php b/modules/sendmail/load_toolbar_sendmail.php deleted file mode 100755 index ab27719c827a13d2908204585d8abfc76c523de4..0000000000000000000000000000000000000000 --- a/modules/sendmail/load_toolbar_sendmail.php +++ /dev/null @@ -1,54 +0,0 @@ -<?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. -* -*/ - -$targetTab = $_REQUEST['targetTab']; -$res_id = $_REQUEST['resId']; -$coll_id = $_REQUEST['collId']; - -require_once "modules" . DIRECTORY_SEPARATOR . "sendmail" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; - -$sendmail_tools = new sendmail(); - -//Count mails -$nbr_emails = 0; -if ($nbr_emails == 0) { - $class = 'nbResZero'; - $style2 = 'display:none;'; - $style = '0.5'; - $styleDetail = '#9AA7AB'; -} else { - $class = 'nbRes'; - $style = ''; - $style2 = 'display:inherit;'; - $styleDetail = '#666'; -} -if ($_SESSION['req'] == 'details') { - if ($_REQUEST['origin'] == 'parent') { - if ($nbr_emails == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')) { - $nav = 'sendmail_tab'; - $style2 = 'visibility:hidden;'; - } - $js .= 'parent.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbr_emails.'</span>\''; - } else { - if ($nbr_emails == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')) { - $nav = 'sendmail_tab'; - $style2 = 'visibility:hidden;'; - } - $js .= '$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbr_emails.'</span>\''; - } -} else { - if ($_REQUEST['origin'] == 'parent') { - $js .= 'parent.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbr_emails.'</span></sup>\''; - } else { - $js .= '$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbr_emails.'</span></sup>\''; - } -} - -echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}"; -exit(); diff --git a/modules/sendmail/mail_form.php b/modules/sendmail/mail_form.php deleted file mode 100755 index c7128e568db5372709aca008b8946558e353f64e..0000000000000000000000000000000000000000 --- a/modules/sendmail/mail_form.php +++ /dev/null @@ -1,1389 +0,0 @@ -<?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 Script to return ajax result - * - * @file sendmail_ajax_content.php - * - * @author Yves Christian Kpakpo <dev@maarch.org> - * @date $date$ - * - * @version $Revision$ - * @ingroup sendmail - */ - -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php'; -require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'] - .DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR - .'class_indexing_searching_app.php'; -require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'] - .DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR - .'class_users.php'; - -require_once 'modules'.DIRECTORY_SEPARATOR.'sendmail'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'; -require_once 'modules/sendmail/class/class_email_signatures.php'; - -$core_tools = new core_tools(); -$request = new request(); -$sec = new security(); -$is = new indexing_searching_app(); -$users_tools = new class_users(); -$sendmail_tools = new sendmail(); -$db = new Database(); - -$parameters = ''; - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - echo _ERROR_IN_SENDMAIL_FORM_GENERATION; - exit; -} - -//Identifier of the element wich is noted -$identifier = ''; -if (isset($_REQUEST['identifier']) && !empty($_REQUEST['identifier'])) { - $identifier = trim($_REQUEST['identifier']); -} - -//Collection -if (isset($_REQUEST['coll_id']) && !empty($_REQUEST['coll_id'])) { - $collId = trim($_REQUEST['coll_id']); - $parameters .= '&coll_id='.$_REQUEST['coll_id']; - $view = $sec->retrieve_view_from_coll_id($collId); - $table = $sec->retrieve_table_from_coll($collId); -} - -//Keep some origin parameters -if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) { - $parameters .= '&size='.$_REQUEST['size']; -} -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $parameters .= '&order='.$_REQUEST['order']; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $parameters .= '&order_field='.$_REQUEST['order_field']; - } -} -if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $parameters .= '&what='.$_REQUEST['what']; -} -if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) { - $parameters .= '&template='.$_REQUEST['template']; -} -if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { - $parameters .= '&start='.$_REQUEST['start']; -} - -if (isset($_REQUEST['formContent']) && !empty($_REQUEST['formContent'])) { - $formContent = $_GET['formContent']; -} else { - $formContent = 'mail'; -} - -//Keep the origin -$origin = ''; -if (isset($_REQUEST['origin']) && !empty($_REQUEST['origin'])) { - $origin = $_REQUEST['origin']; -} - -//Path to actual script -$path_to_script = $_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content&identifier=' - .$identifier.'&origin='.$origin.'&formContent='.$formContent.$parameters; - -$core_tools->load_lang(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -?> - -<body><?php -$core_tools->load_js(); - -$aUserEntities = \User\models\UserModel::getEntitiesByLogin(['login' => $_SESSION['user']['UserId']]); -$userEntities = []; -foreach ($aUserEntities as $value) { - $userEntities[] = $value['entity_id']; -} - -if (empty($userEntities)) { - $userEntities = ['']; -} - -$userTemplates = \SrcCore\models\DatabaseModel::select([ - 'select' => ['distinct t.template_id', 't.template_label', 't.template_content'], - 'table' => ['templates t', 'templates_association ta'], - 'left_join' => ['t.template_id = ta.template_id'], - 'where' => ['t.template_target = \'sendmail\'', 'value_field in (?)'], - 'data' => [$userEntities], - 'order_by' => ['t.template_label asc'] -]); - -//ADD -if ($mode == 'add') { - $content .= '<div style="padding: 10px;">'; - $content .= '<form name="formEmail" id="formEmail" method="post" action="#">'; - $content .= '<input type="hidden" value="'.$identifier.'" name="identifier" id="identifier">'; - if ($formContent == 'messageExchange') { - $content .= '<input type="hidden" value="N" name="is_html" id="is_html">'; - } else { - $content .= '<input type="hidden" value="Y" name="is_html" id="is_html">'; - } - $content .= '<input type="hidden" value="'.$_GET['formContent'].'" name="formContent" id="formContent">'; - $content .= '<table border="0" align="left" width="100%" cellspacing="5" '; - if ($formContent == 'messageExchange') { - $content .= 'style="margin-left: -30px;" '; - } - $content .= '>'; - $content .= '<tr>'; - $content .= '<td align="right" nowrap width="10%"><b>'.ucfirst(_FROM_SHORT).' </b></td><td>'; - - $content .= '<select name="sender_email" id="sender_email">'; - $userEntitiesMails = array(); - - if ($formContent != 'messageExchange') { - if ($core_tools->test_service('use_mail_services', 'sendmail', false)) { - $userEntitiesMails = $sendmail_tools->getAttachedEntitiesMails($_SESSION['user']['UserId']); - } - - $content .= '<option value="'.$_SESSION['user']['Mail'].'" '; - if (empty($userEntitiesMails)) { - $content .= 'selected="selected"'; - } - $content .= '>'.functions::xssafe($_SESSION['user']['FirstName']).' '.functions::xssafe($_SESSION['user']['LastName']).' ('.$_SESSION['user']['Mail'].')</option>'; - foreach ($userEntitiesMails as $key => $value) { - $primaryentity = explode(',', $key); - if ($primaryentity[0] == $_SESSION['user']['primaryentity']['id']) { - $content .= '<option value="'.$key.'" selected="selected" >'.$value.'</option>'; - } else { - $content .= '<option value="'.$key.'" >'.$value.'</option>'; - } - } - } else { - $userEntitiesMails = \Entity\models\EntityModel::getWithUserEntities(['where' => ['user_id = ?'], 'data' => [$_SESSION['user']['UserId']]]); - if (empty($userEntitiesMails)) { - $content .= '<option value="" >'._NO_SENDER.'</option>'; - } else { - foreach ($userEntitiesMails as $value) { - if (!empty($value['business_id'])) { - if ($value['entity_id'] == $_SESSION['user']['primaryentity']['id']) { - $content .= '<option value="'.$value['entity_id'].'" selected="selected" >'.$value['entity_label'].' ('.$value['business_id'].')</option>'; - } else { - $content .= '<option value="'.$value['entity_id'].'" >'.$value['entity_label'].' ('.$value['business_id'].')</option>'; - } - } - } - } - } - - $content .= '</select>'; - $content .= '</td>'; - $content .= '</tr>'; - if ($formContent != 'messageExchange') { - $content .= '<tr>'; - $content .= '<td align="right" >'._EMAIL.'</label></td>'; - $content .= '<td colspan="2"><input type="text" name="email" id="email" value="" class="emailSelect" />'; - $content .= '<div id="adressList" class="autocomplete"></div>'; - $content .= '<script type="text/javascript">addEmailAdress(\'email\', \'adressList\', \'' - .$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=address_autocompletion\', \'what\', \'2\');</script>'; - $content .= ' <select name="target" id="target">' - .'<option id="target_target_to" value="to">'._SEND_TO_SHORT.'</option>' - .'<option id="target_cc" value="cc">'._COPY_TO_SHORT.'</option>' - .'<option id="target_cci" value="cci">'._COPY_TO_INVISIBLE_SHORT.'</option>' - .'</select>'; - $content .= ' <input type="button" name="add" value=" '._ADD - .' " id="valid" class="button" onclick="updateAdress(\''.$path_to_script - .'&mode=adress\', \'add\', document.getElementById(\'email\').value, ' - .'document.getElementById(\'target\').value, false, \''.(addslashes(_EMAIL_WRONG_FORMAT)).'\');" /> '; - $content .= '</td>'; - $content .= '</tr>'; - } else { - $content .= '<tr>'; - $content .= '<td align="right" >Contact</label></td>'; - $content .= '<td colspan="2"><input type="text" name="user" id="user" style="width:96%" />'; - $content .= '<div id="destUSer" class="autocomplete"></div>'; - $content .= '<script type="text/javascript">addDestUser(\'user\', \'destUSer\', \'index.php?display=true&module=sendmail&page=contact_autocompletion\', \'what\', \'2\');</script>'; - $content .= ' <input type="hidden" id="valid" onclick="updateDestUser(\''.$path_to_script - .'&mode=destUser\', \'add\', document.getElementById(\'user\').value, \'to\', false);" /> '; - $content .= '</td>'; - $content .= '</tr>'; - } - $content .= '<tr>'; - $content .= '<td align="right" nowrap width="10%"><span class="red_asterisk"><i class="fa fa-star"></i></span> <label>' - ._SEND_TO_SHORT.'</label></td>'; - - $exp_user_id = null; - $dest_user_id = null; - $exp_contact_id = null; - $dest_contact_id = null; - $db = new Database(); - $stmt = $db->query('SELECT res_id, category_id, address_id, exp_user_id, dest_user_id, admission_date, exp_contact_id, dest_contact_id - FROM res_letterbox - WHERE (( exp_contact_id is not null - or dest_contact_id is not null - or exp_user_id is not null - or dest_user_id is not null) - and res_id = ?)', array($_SESSION['doc_id'])); - $res = $stmt->fetchObject(); - - $res_id = $res->res_id; - $category_id = $res->category_id; - $address_id = $res->address_id; - $exp_user_id = $res->exp_user_id; - $dest_user_id = $res->dest_user_id; - $admission_date = $res->admission_date; - $exp_contact_id = $res->exp_contact_id; - $dest_contact_id = $res->dest_contact_id; - - if ($res_id != null) { - $stmt = $db->query('SELECT subject FROM res_letterbox WHERE res_id = ?', array($res_id)); - $rawSubject = $stmt->fetchObject(); - $subject = $rawSubject->subject; - } - if ($formContent != 'messageExchange') { - if ($address_id != null) { - $adr = \Contact\models\ContactModel::getById(['select' => ['email'], 'id' => $address_id]); - $adress_mail = $adr['email']; - } elseif ($exp_user_id != null) { - $stmt = $db->query('SELECT mail FROM users WHERE user_id = ?', array($exp_user_id)); - $adr = $stmt->fetchObject(); - $adress_mail = $adr->mail; - } elseif ($dest_user_id != null) { - $stmt = $db->query('SELECT mail FROM users WHERE user_id = ?', array($dest_user_id)); - $adr = $stmt->fetchObject(); - $adress_mail = $adr->mail; - } - } elseif ($address_id != null) { - if ($exp_contact_id != null) { - $contact_id = $exp_contact_id; - } else { - $contact_id = $dest_contact_id; - } - if (!empty($contact_id)) { - $communicationTypeModel = \Contact\models\ContactModel::getContactCommunication(['contactId' => $contact_id]); - $contactInfo = \Contact\models\ContactModel::getByAddressId(['select' => ['external_id'], 'addressId' => $address_id]); - $externalId = (array)json_decode($contactInfo['external_id']); - } - } - if ($adress_mail != null and $_SESSION['user']['UserId'] != $exp_user_id and $_SESSION['user']['UserId'] != $dest_user_id) { - if ($formContent == 'messageExchange') { - $_SESSION['adresses']['to'][$address_id] = $adress_mail; - $onclickfunction = 'updateDestUser'; - $elementToDel = $address_id; - $modeUrl = 'destUser'; - $idToDel = $address_id; - } else { - $_SESSION['adresses']['to'][0] = $adress_mail; - $onclickfunction = 'updateAdress'; - $elementToDel = $adress_mail; - $idToDel = 0; - $modeUrl = 'adress'; - } - $content .= '<td width="90%" colspan="2"><div name="to" id="to" class="emailInput"><div id="loading_to" style="display:none;"></div><div class="email_element" id="0_'.$adress_mail.'">'. - $adress_mail.' <div class="email_delete_button" id="'.$idToDel.'" onclick="'.$onclickfunction.'(\''.$path_to_script - .'&mode='.$modeUrl.'\', \'del\', \''.$elementToDel.'\', \'to\', this.id);" - alt=\"Supprimer\" title=\"Supprimer\">x</div></div></div>' - .'<div id="loading_to" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></div></div></td>'; - } else { - $content .= '<td width="90%" colspan="2"><div name="to" id="to" class="emailInput">' - .'<div id="loading_to" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></div></div></td>'; - } - - $content .= '</tr>'; - - if ($formContent != 'messageExchange') { - $content .= '<tr><td colspan="3"><a href="javascript://" ' - .'onclick="new Effect.toggle(\'tr_cc\', \'blind\', {delay:0.2});' - .'new Effect.toggle(\'tr_cci\', \'blind\', {delay:0.2});">' - ._SHOW_OTHER_COPY_FIELDS.'</a></td></tr>'; - $content .= '<tr id="tr_cc" style="display:none">'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cc" id="cc" class="emailInput">' - .'<div id="loading_cc" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></div></div></td>'; - $content .= '</tr>'; - $content .= '<tr id="tr_cci" style="display:none">'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_INVISIBLE_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cci" id="cci" class="emailInput">' - .'<div id="loading_cci" style="display:none;"><i class="fa fa-spinner fa-spin" title="loading..."></div></div></td>'; - $content .= '</tr>'; - $content .= '<tr>'; - } - $content .= '<td align="right" nowrap><span class="red_asterisk"><i class="fa fa-star"></i></span><label> '._EMAIL_OBJECT.' </label></td>'; - - $content .= '<td colspan="2">'; - - if ($category_id == 'outgoing') { - $content .= '<input name="object" id="object" class="emailInput" type="text" value="'.$subject.'" '.$readOnlyObject.'/>'; - } else { - $content .= '<input name="object" id="object" class="emailInput" type="text" value="'._EMAIL_OBJECT_ANSWER.' '.functions::format_date_db($admission_date).'" '.$readOnlyObject.'/>'; - } - - $content .= '</td></tr>'; - $content .= '</table><br />'; - $content .= '<hr />'; - $content .= '<h4 onclick="new Effect.toggle(\'joined_files\', \'blind\', {delay:0.2});' - .'whatIsTheDivStatus(\'joined_files\', \'divStatus_joined_files\');" ' - .'class="categorie" style="width:90%;" onmouseover="this.style.cursor=\'pointer\';">'; - $content .= ' <span id="divStatus_joined_files" style="color:#1C99C5;"><i class="fa fa-plus-square"></i></span> ' - ._JOINED_FILES; - $content .= '</h4>'; - - $all_joined_files = "\n \n"; - $content .= '<div id="joined_files" style="display:none">'; - //Document - $joined_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier); - if (count($joined_files) > 0) { - $content .= '<br/>'; - $content .= '<div><span style="color:rgb(22, 173, 235);font-weight:bold;">'._DOC.'</span>'; - if ($formContent == 'messageExchange') { - $content .= '<span style="float: right;font-weight:bold">Principal</span>'; - } - $content .= '</div>'; - for ($i = 0; $i < count($joined_files); ++$i) { - //Get data - $id = $joined_files[$i]['id']; - $description = $joined_files[$i]['label']; - $format = $joined_files[$i]['format']; - $format = $joined_files[$i]['format']; - $mime_type = $is->get_mime_type($joined_files[$i]['format']); - $att_type = $joined_files[$i]['format']; - $filesize = $joined_files[$i]['filesize'] / 1024; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = round($filesize, 2).' Octets'; - //Show data - $version = ''; - $content .= '<table cellspacing="3" id="main_document" style="border-collapse:collapse;width:100%;"><tr>'; - if ($joined_files[$i]['is_version'] === true) { - //Version - $version = ' - '._VERSION.' '.$joined_files[$i]['version']; - //Contents - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" id="join_file_'.$id - .'_V'.$joined_files[$i]['version'].'" name="join_version[]"' - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></</td>'; - } else { - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" id="join_file_'.$id.'" name="join_file[]"' - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></td>'; - } - if ($formContent == 'messageExchange') { - $content .= '<td style="width:1%;text-align:center;width: 8%;margin-right: 2px;vertical-align: middle"><input type=radio name="main_exchange_doc" value="res_letterbox__'.$id.'">'; - $content .= '</td>'; - } - $content .= '</tr></table>'; - $filename = $sendmail_tools->createFilename($description.$version, $format); - $all_joined_files .= $description.': '.$filename.PHP_EOL; - } - } - - //Attachments - if ($core_tools->is_module_loaded('attachments')) { - $attachment_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier, true); - if (count($attachment_files) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._ATTACHMENTS.'</div>'; - $content .= '<table cellspacing="3" id="show_pj_mail" style="border-collapse:collapse;width:100%;">'; - - for ($i = 0; $i < count($attachment_files); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $attachment_files[$i]['id']; - $isVersion = $attachment_files[$i]['is_version']; - $description = $attachment_files[$i]['label']; - if (strlen($description) > 73) { - $description = substr($description, 0, 70); - $description .= '...'; - } - $format = $attachment_files[$i]['format']; - $mime_type = $is->get_mime_type($attachment_files[$i]['format']); - $att_type = $attachment_files[$i]['format']; - $filesize = $attachment_files[$i]['filesize'] / 1024; - $attachment_type = $_SESSION['attachment_types'][$attachment_files[$i]['attachment_type']]; - $chrono = $attachment_files[$i]['identifier']; - $dest_society = $attachment_files[$i]['society']; - $dest_firstname = $attachment_files[$i]['firstname']; - $dest_lastname = $attachment_files[$i]['lastname']; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = $filesize.' Octets'; - - if ($isVersion) { - $inputName = 'join_version_attachment[]'; - $mainExchangeDocValue = 'res_version_attachments'; - } else { - $inputName = 'join_attachment[]'; - $mainExchangeDocValue = 'res_attachments'; - } - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input style="margin-left: 3px" type="checkbox" id="join_attachment_'.$i.'" name="'.$inputName.'"' - .' class="check" value="' - .$id.'"'; - - // avec la condition ci-dessous, toutes les réponses signées sont cochées lorsqu'on veut envoyer le courrier par mail - if ($attachment_type == _SIGNED_RESPONSE) { - $content .= ' checked="checked" '; - } - $content .= '/></th>'; - - if (!$attachment_files[$i]['pdf_exist']) { - $content .= '<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsInput('.$i.')" '; - } else { - $content .= '<td style="border: dashed 1px grey;border-left:none;padding:5px;"'; - } - - $content .= '><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$attachment_type.'</span> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span><br/><strong>'.$description.'</strong>'; - if ($attachment_files[$i]['pdf_exist'] && $format != 'pdf' && $formContent != 'messageExchange') { - $content .= ' (<input style="margin: 0px" title="envoyer la version PDF" type="checkbox" id="join_attachment_'.$i.'" name="'.$inputName.'"' - .' class="check" value="' - .$id.'#PDF" />version pdf)'; - } - $content .= '<br/>'; - if ($chrono != '') { - $content .= "<span style='font-size: 10px;color: rgb(22, 173, 235);font-style:italic;'>".$chrono.'</span> - '; - } - $content .= "<span style='font-size: 10px;color: grey;font-style:italic;'>".$dest_firstname.' '.$dest_lastname.' '.$dest_society.'</span>'; - $content .= '</td>'; - if ($formContent == 'messageExchange') { - $content .= '<td style="width:1%;text-align:center;width: 8%;margin-right: 2px;vertical-align: middle"><input type=radio name="main_exchange_doc" value="'.$mainExchangeDocValue.'__'.$id.'">'; - $content .= '</td>'; - } - - $content .= '</tr>'; - - $filename = $sendmail_tools->createFilename($description, $format); - } - $content .= '</table>'; - } - } - //Notes - if ($core_tools->is_module_loaded('notes')) { - require_once 'modules'.DIRECTORY_SEPARATOR.'notes'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR - .'class_modules_tools.php'; - $notes_tools = new notes(); - $user_notes = $notes_tools->getUserNotes($identifier, $collId); - if (count($user_notes) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._NOTES.'</div>'; - $content .= '<table cellspacing="3" style="border-collapse:collapse;width:100%;">'; - for ($i = 0; $i < count($user_notes); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $user_notes[$i]['id']; - $noteShort = functions::xssafe($request->cut_string($user_notes[$i]['label'], 50)); - $note = functions::xssafe($user_notes[$i]['label']); - $userArray = $users_tools->get_user($user_notes[$i]['author']); - $date = $request->dateformat($user_notes[$i]['date']); - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$note - .'" title="'.$note - .'"><input type="checkbox" id="note_'.$id.'" name="notes[]"' - .' class="check" value="' - .$id.'"></th><td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsNotes('.$id.')" '; - $content .= 'title="'.$note.'"><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$userArray['firstname'].' '.$userArray['lastname'].' </span><span style="font-size: 10px;color: grey;">'.$date.'</span><br/>' - .'<strong>'.$noteShort.'</strong></td>'; - - $content .= '</tr>'; - } - - $content .= '</table>'; - } - } - - $content .= '</div>'; - $content .= '<hr />'; - - $content .= '<tr>'; - $content .= '<td><label style="padding-right:10px">'._Label_ADD_TEMPLATE_MAIL.'</label></td>'; - $content .= '<select name="templateMail" id="templateMail" style="width:200px" ' - .'onchange="addTemplateToEmail($(\'templateMail\').value, \'' - .$_SESSION['config']['businessappurl'].'index.php?display=true' - .'&module=templates&page=templates_ajax_content_for_mails&id='.$_REQUEST['identifier'].'\');">'; - - $content .= '<option value="">'._ADD_TEMPLATE_MAIL.'</option>'; - - foreach ($userTemplates as $result) { - $content .= "<option value='".$result['template_id']."'>".$result['template_label'].'</option>'; - } - $content .= '</select>'; - $content .= '<label style="margin-left: 15%;padding-right:10px">'.'Signature : '.'</label>'; - $emailSignaturesClass = new EmailSignatures(); - - $mailSignatures = $emailSignaturesClass->getForCurrentUser(); - $content .= '<script type="text/javascript">var mailSignaturesJS = '.json_encode($mailSignatures).';</script>'; - $content .= '<select style="width: 20%;" name="selectSignatures" id ="selectSignatures" onchange="changeSignature(this.options[this.selectedIndex], mailSignaturesJS)">'; - $content .= '<option value="none" data-nb="-1" selected >Sans signature</option>'; - for ($i = 0; $mailSignatures[$i]; ++$i) { - $content .= '<option value="'.$mailSignatures[$i]['id'].'" data-nb="'.$i.'">'.$mailSignatures[$i]['title'].'</option>'; - } - $content .= '</select>'; - $content .= '</tr></br></br>'; - - //Body - - if ($formContent != 'messageExchange') { - $displayHtml = 'block'; - $displayRaw = 'none'; - $textAreaMode = 'html'; - } else { - $displayHtml = 'none'; - $displayRaw = 'block'; - $textAreaMode = 'raw'; - } - - $content .= '<script type="text/javascript">var mode="'.$textAreaMode.'";</script>'; - - //Show/hide html VS raw mode - if ($formContent != 'messageExchange') { - $content .= '<a href="javascript://" onclick="switchMode(\'show\');"><em>'._HTML_OR_RAW.'</em></a>'; - } - - //load tinyMCE editor - ob_start(); - include 'modules/sendmail/load_editor.php'; - $content .= ob_get_clean(); - ob_end_flush(); - $content .= '<div id="html_mode" style="display:'.$displayHtml.'">'; - $content .= '<textarea name="body_from_html" id="body_from_html" style="width:100%" rows="15" cols="60">' - ._DEFAULT_BODY.$sendmail_tools->rawToHtml($all_joined_files).'</textarea>'; - $content .= '</div>'; - - //raw text arera - $content .= '<div id="raw_mode" style="display:'.$displayRaw.'">'; - $content .= '<textarea name="body_from_raw" id="body_from_raw" class="emailInput" cols="60" rows="14">' - ._DEFAULT_BODY.$sendmail_tools->htmlToRaw($all_joined_files).'</textarea>'; - $content .= '</div>'; - - //Buttons - $content .= '<hr style="margin-top:2px;" />'; - $content .= '<div align="center">'; - //Send - $content .= ' <input type="button" name="valid" value=" '._SEND_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=added&for=send\', \'formEmail\');" /> '; - if ($formContent != 'messageExchange') { - //Save - $content .= ' <input type="button" name="valid" value=" '._SAVE_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=added&for=save\', \'formEmail\');" /> '; - } - //Cancel - $content .= '<input type="button" name="cancel" id="cancel" class="button" value="' - ._CANCEL.'" onclick="window.parent.destroyModal(\'form_email\');"/>'; - $content .= '</div>'; - $content .= '</form>'; - $content .= '</div>'; - -//UPDATE OR TRANSFER -} elseif ($mode == 'up' || $mode == 'transfer') { - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $id = $_REQUEST['id']; - $user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]); - $emailArray = []; - - //Check if mail exists - if (count($emailArray) > 0) { - $content .= '<div>'; - $content .= '<form name="formEmail" id="formEmail" method="post" action="#">'; - $content .= '<input type="hidden" value="'.$identifier.'" name="identifier" id="identifier">'; - $content .= '<input type="hidden" value="'.$id.'" name="id" id="id">'; - $content .= '<input type="hidden" value="'.$emailArray['isHtml'].'" name="is_html" id="is_html">'; - $content .= '<table border="0" align="left" width="100%" cellspacing="5">'; - $content .= '<tr>'; - $content .= '<td align="right" nowrap width="10%"><b>'.ucfirst(_FROM_SHORT).' </b></td><td>'; - - $userEntitiesMails = array(); - - if ($core_tools->test_service('use_mail_services', 'sendmail', false)) { - $userEntitiesMails = $sendmail_tools->getAttachedEntitiesMails($_SESSION['user']['UserId']); - } - - $content .= '<select name="sender_email" id="sender_email"> - <option value="'.$_SESSION['user']['Mail'].'" '; - - if ($emailArray['sender_email'] == $_SESSION['user']['Mail']) { - $content .= ' selected="selected" '; - } - - $content .= '>'.functions::xssafe($_SESSION['user']['FirstName']).' '.functions::xssafe($_SESSION['user']['LastName']).' ('.$_SESSION['user']['Mail'].')</option>'; - foreach ($userEntitiesMails as $key => $value) { - $content .= '<option value="'.$key.'" '; - - if ($emailArray['sender_email'] == $key) { - $content .= ' selected="selected" '; - } - $content .= '>'.$value.'</option>'; - } - $content .= '</select>'; - $content .= '</td>'; - - $content .= '</tr>'; - $content .= '<tr>'; - $content .= '<td align="right">'._EMAIL.'</label></td>'; - $content .= '<td colspan="2"><input type="text" name="email" id="email" value="" class="emailSelect" />'; - $content .= '<div id="adressList" class="autocomplete"></div>'; - $content .= '<script type="text/javascript">addEmailAdress(\'email\', \'adressList\', \'' - .$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=address_autocompletion\', \'what\', \'2\');</script> '; - $content .= '<select name="target" id="target">' - .'<option id="target_target_to" value="to">'._SEND_TO_SHORT.'</option>' - .'<option id="target_cc" value="cc">'._COPY_TO_SHORT.'</option>' - .'<option id="target_cci" value="cci">'._COPY_TO_INVISIBLE_SHORT.'</option>' - .'</select>'; - $content .= ' <input type="button" name="add" value=" '._ADD - .' " id="valid" class="button" onclick="updateAdress(\''.$path_to_script - .'&mode=adress\', \'add\', document.getElementById(\'email\').value, ' - .'document.getElementById(\'target\').value, false, \''.(addslashes(_EMAIL_WRONG_FORMAT)).'\');" /> '; - $content .= '</td>'; - $content .= '</tr>'; - //To - if (count($emailArray['to']) > 0) { - $_SESSION['adresses']['to'] = array(); - $_SESSION['adresses']['to'] = $emailArray['to']; - } - $content .= '<tr>'; - $content .= '<td align="right" nowrap width="10%"><span class="red_asterisk"><i class="fa fa-star"></i></span> <label>' - ._SEND_TO_SHORT.'</label></td>'; - $content .= '<td width="90%" colspan="2"><div name="to" id="to" class="emailInput">'; - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'to'); - $content .= '</div></td>'; - $content .= '</tr>'; - //CC - if (count($emailArray['cc']) > 0) { - $_SESSION['adresses']['cc'] = array(); - $_SESSION['adresses']['cc'] = $emailArray['cc']; - } - $content .= '<tr><td colspan="3"><a href="javascript://" ' - .'onclick="new Effect.toggle(\'tr_cc\', \'blind\', {delay:0.2});' - .'new Effect.toggle(\'tr_cci\', \'blind\', {delay:0.2});">' - ._SHOW_OTHER_COPY_FIELDS.'</a></td></tr>'; - $content .= '<tr id="tr_cc" style="display:none">'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cc" id="cc" class="emailInput">'; - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'cc'); - $content .= '</div></td>'; - $content .= '</tr>'; - //CCI - if (count($emailArray['cci']) > 0) { - $_SESSION['adresses']['cci'] = array(); - $_SESSION['adresses']['cci'] = $emailArray['cci']; - } - $content .= '<tr id="tr_cci" style="display:none">'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_INVISIBLE_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cci" id="cci" class="emailInput">'; - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'cci'); - $content .= '</div></td>'; - $content .= '</tr>'; - //Object - $content .= '<tr>'; - $content .= '<td align="right" nowrap><span class="red_asterisk"><i class="fa fa-star"></i></span> <label>'._EMAIL_OBJECT.' </label></td>'; - $content .= '<td colspan="2"><input name="object" id="object" class="emailInput" type="text" value="' - .(($mode == 'transfer') ? 'Fw: '.$emailArray['object'] : $emailArray['object']).'" /></td>'; - $content .= '</tr>'; - $content .= '</table><br />'; - $content .= '<hr />'; - //Show hide joined info - $content .= '<h4 onclick="new Effect.toggle(\'joined_files\', \'blind\', {delay:0.2});' - .'whatIsTheDivStatus(\'joined_files\', \'divStatus_joined_files\');" ' - .'class="categorie" style="width:90%;" onmouseover="this.style.cursor=\'pointer\';">'; - $content .= ' <span id="divStatus_joined_files" style="color:#1C99C5;"><i class="fa fa-plus-square"></i></span> ' - ._JOINED_FILES; - $content .= '</h4>'; - - $content .= '<div id="joined_files" style="display:none">'; - //Document - $joined_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier); - if (count($joined_files) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._DOC.'</div>'; - for ($i = 0; $i < count($joined_files); ++$i) { - //Get data - $id = $joined_files[$i]['id']; - $description = $joined_files[$i]['label']; - $format = $joined_files[$i]['format']; - $format = $joined_files[$i]['format']; - $mime_type = $is->get_mime_type($joined_files[$i]['format']); - $att_type = $joined_files[$i]['format']; - $filesize = $joined_files[$i]['filesize'] / 1024; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = round($filesize, 2).' Octets'; - - //Show data - $version = ''; - $content .= '<table cellspacing="3" id="main_document" style="border-collapse:collapse;width:100%;"><tr>'; - if ($joined_files[$i]['is_version'] === true) { - //Version - $version = ' - '._VERSION.' '.$joined_files[$i]['version']; - //Contents - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" id="join_file_'.$id - .'_V'.$joined_files[$i]['version'].'" name="join_version[]"'; - //Checked? - (in_array($id, $emailArray['version'])) ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></</td>'; - } else { - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" id="join_file_'.$id.'" name="join_file[]"'; - ($emailArray['resMasterAttached'] == 'Y') ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></td>'; - } - $content .= '</tr></table>'; - //Filename - $filename = $sendmail_tools->createFilename($description.$version, $format); - $all_joined_files .= $description.': '.$filename.PHP_EOL; - } - } - - //Attachments - if ($core_tools->is_module_loaded('attachments')) { - $attachment_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier, true); - if (count($attachment_files) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._ATTACHMENTS.'</div>'; - $content .= '<table cellspacing="3" id="show_pj_mail" style="border-collapse:collapse;width:100%;">'; - for ($i = 0; $i < count($attachment_files); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $attachment_files[$i]['id']; - $isVersion = $attachment_files[$i]['is_version']; - $id_converted = $attachment_files[$i]['converted_pdf']; - $description = $attachment_files[$i]['label']; - if (strlen($description) > 73) { - $description = substr($description, 0, 70); - $description .= '...'; - } - $format = $attachment_files[$i]['format']; - $mime_type = $is->get_mime_type($attachment_files[$i]['format']); - $att_type = $attachment_files[$i]['format']; - $filesize = $attachment_files[$i]['filesize'] / 1024; - $attachment_type = $_SESSION['attachment_types'][$attachment_files[$i]['attachment_type']]; - $chrono = $attachment_files[$i]['identifier']; - $dest_society = $attachment_files[$i]['society']; - $dest_firstname = $attachment_files[$i]['firstname']; - $dest_lastname = $attachment_files[$i]['lastname']; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = $filesize.' Octets'; - - if ($isVersion) { - $inputName = 'join_version_attachment[]'; - } else { - $inputName = 'join_attachment[]'; - } - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input style="margin-left: 3px" type="checkbox" id="join_attachment_'.$id.'" name="'.$inputName.'"'; - - $checked = ''; - if (($isVersion && in_array($id, $emailArray['attachments_version'])) || (!$isVersion && in_array($id, $emailArray['attachments']))) { - $checked = ' checked="checked"'; - } - - $content .= ' '.$checked - .' class="check" value="' - .$id.'"'; - - //avec la condition ci-dessous, toutes les réponses signées sont cochées lorsqu'on veut envoyer le courrier par mail - if ($attachment_type == _SIGNED_RESPONSE && $mode == 'transfer') { - $content .= ' checked="checked" '; - } - $content .= '/></th>'; - - if (!$id_converted) { - $content .= '<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsInput('.$id.')" '; - } else { - $content .= '<td style="border: dashed 1px grey;border-left:none;padding:5px;"'; - } - - $content .= '><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$attachment_type.'</span> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span><br/><strong>'.$description.'</strong>'; - if ($id_converted) { - $content .= ' (<input style="margin: 0px" title="envoyer la version PDF" type="checkbox" id="join_attachment_'.$id_converted.'" name="join_attachment[]"' - .' class="check"'; - - (in_array($id_converted, $emailArray['attachments'])) ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' value="' - .$id_converted.'" />version pdf)'; - } - $content .= "<br/><span style='font-size: 10px;color: rgb(22, 173, 235);font-style:italic;'>"; - if ($chrono != '') { - $content .= "<span style='font-size: 10px;color: rgb(22, 173, 235);font-style:italic;'>".$chrono.'</span> - '; - } - $content .= "<span style='font-size: 10px;color: grey;font-style:italic;'>".$dest_firstname.' '.$dest_lastname.' '.$dest_society.'</span>'; - $content .= '</td>'; - - $content .= '</tr>'; - - //Filename - $filename = $sendmail_tools->createFilename($description, $format); - $all_joined_files .= $description.': '.$filename.PHP_EOL; - } - $content .= '</table>'; - } - } - - //Notes - if ($core_tools->is_module_loaded('notes')) { - require_once 'modules'.DIRECTORY_SEPARATOR.'notes'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR - .'class_modules_tools.php'; - $notes_tools = new notes(); - $user_notes = $notes_tools->getUserNotes($identifier, $collId); - if (count($user_notes) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._NOTES.'</div>'; - $content .= '<table cellspacing="3" style="border-collapse:collapse;width:100%;">'; - for ($i = 0; $i < count($user_notes); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $user_notes[$i]['id']; - $noteShort = functions::xssafe($request->cut_string($user_notes[$i]['label'], 50)); - $note = functions::xssafe($user_notes[$i]['label']); - $userArray = $users_tools->get_user($user_notes[$i]['author']); - $date = $request->dateformat($user_notes[$i]['date']); - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$note - .'" title="'.$note - .'"><input type="checkbox" id="note_'.$id.'" name="notes[]"'; - - if (!empty($emailArray['notes']) && in_array($id, $emailArray['notes'])) { - $checked = ' checked="checked"' ; - } else { - $checked = ''; - } - - $content .= ' '.$checked - .' class="check" value="' - .$id.'"></th><td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsNotes('.$id.')" '; - $content .= 'title="'.$note.'"><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$userArray['firstname'].' '.$userArray['lastname'].' </span><span style="font-size: 10px;color: grey;">'.$date.'</span><br/>' - .'<strong>'.$noteShort.'</strong></td>'; - - $content .= '</tr>'; - } - - $content .= '</table>'; - //Filename - $filename = 'notes_'.$identifier.'_'.date('dmY').'.html'; - $all_joined_files .= _NOTES.': '.$filename.PHP_EOL; - } - } - $content .= '</div>'; - $content .= '<hr />'; - - $content .= '<tr>'; - $content .= '<td><label style="padding-right:10px">'._Label_ADD_TEMPLATE_MAIL.'</label></td>'; - $content .= '<select name="templateMail" id="templateMail" style="width:200px" ' - .'onchange="addTemplateToEmail($(\'templateMail\').value, \'' - .$_SESSION['config']['businessappurl'].'index.php?display=true' - .'&module=templates&page=templates_ajax_content_for_mails&id='.$_REQUEST['identifier'].'\');">'; - - $content .= '<option value="">'._ADD_TEMPLATE_MAIL.'</option>'; - - foreach ($userTemplates as $result) { - $content .= "<option value='".$result['template_id']."'>".$result['template_label'].'</option>'; - } - $content .= '</select>'; - $content .= '<label style="margin-left: 15%;padding-right:10px">'.'Signature de mail'.'</label>'; - $emailSignaturesClass = new EmailSignatures(); - - $mailSignatures = $emailSignaturesClass->getForCurrentUser(); - $content .= '<script type="text/javascript">var mailSignaturesJS = '.json_encode($mailSignatures).';</script>'; - $content .= '<select style="width: 20%;" name="selectSignatures" id ="selectSignatures" onchange="changeSignature(this.options[this.selectedIndex], mailSignaturesJS)">'; - $content .= '<option value="none" data-nb="-1" selected >Sans signature</option>'; - for ($i = 0; $mailSignatures[$i]; ++$i) { - $content .= '<option value="'.$mailSignatures[$i]['id'].'" data-nb="'.$i.'">'.$mailSignatures[$i]['title'].'</option>'; - } - $content .= '</select>'; - $content .= '</tr></br></br>'; - - //Body - if ($emailArray['isHtml'] == 'Y') { - $displayRaw = 'none'; - $displayHtml = 'block'; - $textAreaMode = 'html'; - } else { - $displayRaw = 'block'; - $displayHtml = 'none'; - $textAreaMode = 'raw'; - } - $content .= '<script type="text/javascript">var mode="'.$textAreaMode.'";</script>'; - //Show/hide html VS raw mode - $content .= '<a href="javascript://" onclick="switchMode(\'show\');"><em>'._HTML_OR_RAW.'</em></a>'; - - //load tinyMCE editor - ob_start(); - include 'modules/sendmail/load_editor.php'; - $content .= ob_get_clean(); - ob_end_flush(); - $content .= '<div id="html_mode" style="display:'.$displayHtml.'">'; - $content .= '<textarea name="body_from_html" id="body_from_html" style="width:100%" rows="15" cols="60">' - .$sendmail_tools->rawToHtml($emailArray['body']).'</textarea>'; - $content .= '</div>'; - - //raw textarera - $content .= '<div id="raw_mode" style="display:'.$displayRaw.'">'; - $content .= '<textarea name="body_from_raw" id="body_from_raw" class="emailInput" cols="60" rows="14">' - .$sendmail_tools->htmlToRaw($emailArray['body']).'</textarea>'; - $content .= '</div>'; - - //Buttons - $content .= '<hr style="margin-top:5px;margin-bottom:2px;" />'; - $content .= '<div align="center">'; - - if ($emailArray['status'] != 'SENT') { - //Send button - $content .= ' <input type="button" name="valid" value=" '._SEND_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=updated&for=send\', \'formEmail\');" /> '; - //Save button - $content .= ' <input type="button" name="valid" value=" '._SAVE_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=updated&for=save\', \'formEmail\');" /> '; - //Delete button - $content .= ' <input type="button" name="valid" value=" '._REMOVE_EMAIL - .' " id="valid" class="button" onclick="if(confirm(\'' - ._REALLY_DELETE.': '.$request->cut_string($emailArray['object'], 50) - .' ?\')) validEmailForm(\''.$path_to_script - .'&mode=del\', \'formEmail\');" /> '; - } else { - //Re-send button - $content .= ' <input type="button" name="valid" value=" '._RESEND_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=added&for=send\', \'formEmail\');" /> '; - //Save copy button - $content .= ' <input type="button" name="valid" value=" '._SAVE_COPY_EMAIL - .' " id="valid" class="button" onclick="validEmailForm(\'' - .$path_to_script.'&mode=added&for=save\', \'formEmail\');" /> '; - } - - //Cancel button - $content .= '<input type="button" name="cancel" id="cancel" class="button" value="' - ._CANCEL.'" onclick="window.parent.destroyModal(\'form_email\');"/>'; - $content .= '</div>'; - $content .= '</form>'; - $content .= '</div>'; - } else { - $content = $request->wash_html($id.': '._EMAIL_DONT_EXIST.'!', 'NONE'); - } - } else { - $content = $request->wash_html(_ID.' '._IS_EMPTY.'!', 'NONE'); - } -} elseif ($mode == 'read') { - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $id = $_REQUEST['id']; - if ($formContent == 'messageExchange') { - } else { - $user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]); - $emailArray = []; - } - - //Check if mail exists - if (count($emailArray) > 0 && $emailArray['type'] != 'ArchiveTransferReplySent') { - $content .= '<div>'; - $content .= '<table border="0" align="left" width="100%" cellspacing="5">'; - $content .= '<tr>'; - - $content .= '<td width="10%" align="right" nowrap><b>'.ucfirst(_FROM_SHORT).' </b></td><td width="90%" colspan="2">'; - - if ($formContent == 'messageExchange') { - $content .= $emailArray['from']; - } else { - $usermailArray = $users_tools->get_user($emailArray['userId']); - $mailEntities = $sendmail_tools->getAttachedEntitiesMails(); - - if (in_array($emailArray['sender_email'], array_keys($mailEntities))) { - $content .= $mailEntities[$emailArray['sender_email']]; - } elseif ($emailArray['sender_email'] == $usermailArray['mail']) { - $content .= $usermailArray['firstname'].' '.$usermailArray['lastname'].' ('.$emailArray['sender_email'].')'; - } else { - $content .= $sendmail_tools->explodeSenderEmail($emailArray['sender_email']); - } - } - - $content .= '<br/></td>'; - $content .= '</tr>'; - //To - if (!empty($emailArray['to']) && count($emailArray['to']) > 0) { - $_SESSION['adresses']['to'] = array(); - $_SESSION['adresses']['to'] = $emailArray['to']; - } - $content .= '<tr>'; - $content .= '<td align="right" nowrap width="10%"><span class="red_asterisk"><i class="fa fa-star"></i></span> <label>' - ._SEND_TO_SHORT.'</label></td>'; - $content .= '<td width="90%" colspan="2"><div name="to" id="to" class="emailInput">'; - if ($formContent == 'messageExchange') { - $content .= $emailArray['contactInfo']; - } else { - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'to', true); - } - $content .= '</div></td>'; - $content .= '</tr>'; - if ($formContent == 'messageExchange') { - $content .= '<tr><td align="right" nowrap width="10%"></td><td width="90%">'._COMMUNICATION_TYPE.' : '.$emailArray['communicationType'].'</td></tr>'; - } else { - //CC - if (!empty($emailArray['cc']) && count($emailArray['cc']) > 0) { - $_SESSION['adresses']['cc'] = array(); - $_SESSION['adresses']['cc'] = $emailArray['cc']; - } - $content .= '<tr>'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cc" id="cc" class="emailInput">'; - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'cc', true); - $content .= '</div></td>'; - $content .= '</tr>'; - //CCI - if (!empty($emailArray['cci']) && count($emailArray['cci']) > 0) { - $_SESSION['adresses']['cci'] = array(); - $_SESSION['adresses']['cci'] = $emailArray['cci']; - } - $content .= '<tr>'; - $content .= '<td align="right" nowrap><label>'._COPY_TO_INVISIBLE_SHORT.'</label></td>'; - $content .= '<td colspan="2"><div name="cci" id="cci" class="emailInput">'; - $content .= $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], 'cci', true); - $content .= '</div></td>'; - $content .= '</tr>'; - } - //Object - $content .= '<tr>'; - $content .= '<td align="right" nowrap><span class="red_asterisk"><i class="fa fa-star"></i></span> <label>'._EMAIL_OBJECT.' </label></td>'; - $content .= '<td colspan="2"><div name="object" id="object" class="emailInput">' - .$emailArray['object'].'</div></td>'; - $content .= '</tr>'; - if ($formContent == 'messageExchange') { - $content .= '<tr><td width="10%" align="right" nowrap>'._IDENTIFIER.'</td><td><div class="emailInput">'.$emailArray['reference'].'</div></td></tr>'; - } - $content .= '</table><br />'; - - $content .= '<hr />'; - //Show hide joined info - $content .= '<h4 onclick="new Effect.toggle(\'joined_files\', \'blind\', {delay:0.2});' - .'whatIsTheDivStatus(\'joined_files\', \'divStatus_joined_files\');" ' - .'class="categorie" style="width:90%;" onmouseover="this.style.cursor=\'pointer\';">'; - $content .= ' <span id="divStatus_joined_files" style="color:#1C99C5;"><i class="fa fa-plus-square"></i></span> ' - ._JOINED_FILES; - $content .= '</h4>'; - - $content .= '<div id="joined_files" style="display:none">'; - //Document - $joined_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier); - if (count($joined_files) > 0) { - $content .= '<br/>'; - $content .= '<div><span style="color:rgb(22, 173, 235);font-weight:bold;">'._DOC.'</span>'; - if ($formContent == 'messageExchange') { - $content .= '<span style="float: right;font-weight:bold">Principal</span>'; - } - $content .= '</div>'; - for ($i = 0; $i < count($joined_files); ++$i) { - //Get data - $id = $joined_files[$i]['id']; - $description = $joined_files[$i]['label']; - $format = $joined_files[$i]['format']; - $format = $joined_files[$i]['format']; - $mime_type = $is->get_mime_type($joined_files[$i]['format']); - $att_type = $joined_files[$i]['format']; - $filesize = $joined_files[$i]['filesize'] / 1024; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = round($filesize, 2).' Octets'; - - //Show data - $version = ''; - $content .= '<table cellspacing="3" id="main_document" style="border-collapse:collapse;width:100%;"><tr>'; - if ($joined_files[$i]['is_version'] === true) { - //Version - $version = ' - '._VERSION.' '.$joined_files[$i]['version']; - //Contents - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" disabled="disabled" id="join_file_'.$id - .'_V'.$joined_files[$i]['version'].'" name="join_version[]"'; - //Checked? - (in_array($id, $emailArray['version'])) ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></</td>'; - } else { - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input type="checkbox" disabled="disabled" id="join_file_'.$id.'" name="join_file[]"'; - ($emailArray['resMasterAttached'] == 'Y') ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' class="check" value="' - .$id.'" ></th>' - .'<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;text-align:left;"'; - $content .= ' onclick="clickAttachments('.$id.')" '; - $content .= '><strong>'.$description.'</strong> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span></td>'; - } - if ($formContent == 'messageExchange') { - $content .= '<td style="width:1%;text-align:center;width: 8%;margin-right: 2px;vertical-align: middle"><input type=radio name="main_exchange_doc" disabled '; - if ($emailArray['disposition']->tablename == 'res_letterbox' && $emailArray['disposition']->res_id == $id) { - $content .= ' checked '; - } - $content .= '></td>'; - } - $content .= '</tr></table>'; - //Filename - $filename = $sendmail_tools->createFilename($description.$version, $format); - $all_joined_files .= $description.': '.$filename.PHP_EOL; - } - } - - //Attachments - if ($core_tools->is_module_loaded('attachments')) { - $attachment_files = $sendmail_tools->getJoinedFiles($collId, $table, $identifier, true); - if (count($attachment_files) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._ATTACHMENTS.'</div>'; - $content .= '<table cellspacing="3" id="show_pj_mail" style="border-collapse:collapse;width:100%;">'; - for ($i = 0; $i < count($attachment_files); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $attachment_files[$i]['id']; - $isVersion = $attachment_files[$i]['is_version']; - $id_converted = $attachment_files[$i]['converted_pdf']; - $description = $attachment_files[$i]['label']; - if (strlen($description) > 73) { - $description = substr($description, 0, 70); - $description .= '...'; - } - $format = $attachment_files[$i]['format']; - $mime_type = $is->get_mime_type($attachment_files[$i]['format']); - $att_type = $attachment_files[$i]['format']; - $filesize = $attachment_files[$i]['filesize'] / 1024; - $attachment_type = $_SESSION['attachment_types'][$attachment_files[$i]['attachment_type']]; - $chrono = $attachment_files[$i]['identifier']; - $dest_society = $attachment_files[$i]['society']; - $dest_firstname = $attachment_files[$i]['firstname']; - $dest_lastname = $attachment_files[$i]['lastname']; - ($filesize > 1) ? $filesize = ceil($filesize).' Ko' : $filesize = $filesize.' Octets'; - - if ($isVersion) { - $inputName = 'join_version_attachment[]'; - } else { - $inputName = 'join_attachment[]'; - } - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$description - .'" title="'.$description - .'"><input style="margin-left: 3px" disabled="disabled" type="checkbox" id="join_attachment_'.$id.'" name="'.$inputName.'"'; - - $checked = ''; - if (($isVersion && in_array($id, $emailArray['attachments_version'])) || (!$isVersion && in_array($id, $emailArray['attachments']))) { - $checked = ' checked="checked"'; - } - - $content .= ' '.$checked - .' class="check" value="' - .$id.'"'; - - $content .= '/></th>'; - - if (!$id_converted) { - $content .= '<td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsInput('.$id.')" '; - } else { - $content .= '<td style="border: dashed 1px grey;border-left:none;padding:5px;"'; - } - - $content .= '><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$attachment_type.'</span> <span style="font-size: 10px;color: grey;">('.$att_type.' - '.$filesize.')</span><br/><strong>'.$description.'</strong>'; - if ($id_converted) { - $content .= ' (<input style="margin: 0px" title="envoyer la version PDF" disabled="disabled" type="checkbox" id="join_attachment_'.$id_converted.'" name="join_attachment[]"' - .' class="check"'; - - (in_array($id_converted, $emailArray['attachments'])) ? $checked = ' checked="checked"' : $checked = ''; - $content .= ' '.$checked - .' value="' - .$id_converted.'" />version pdf)'; - } - $content .= "<br/><span style='font-size: 10px;color: rgb(22, 173, 235);font-style:italic;'>"; - if ($chrono != '') { - $content .= "<span style='font-size: 10px;color: rgb(22, 173, 235);font-style:italic;'>".$chrono.'</span> - '; - } - $content .= "<span style='font-size: 10px;color: grey;font-style:italic;'>".$dest_firstname.' '.$dest_lastname.' '.$dest_society.'</span>'; - $content .= '</td>'; - if ($formContent == 'messageExchange') { - $content .= '<td style="width:1%;text-align:center;width: 8%;margin-right: 2px;vertical-align: middle"><input type=radio name="main_exchange_doc" disabled '; - if ($emailArray['disposition']->res_id == $id && ($emailArray['disposition']->tablename == 'res_attachments' && !$isVersion) - || ($emailArray['disposition']->tablename == 'res_version_attachments' && $isVersion)) { - $content .= ' checked '; - } - $content .= '></td>'; - } - $content .= '</tr>'; - - //Filename - $filename = $sendmail_tools->createFilename($description, $format); - $all_joined_files .= $description.': '.$filename.PHP_EOL; - } - $content .= '</table>'; - } - } - - //Notes - if ($core_tools->is_module_loaded('notes')) { - require_once 'modules'.DIRECTORY_SEPARATOR.'notes'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'; - $notes_tools = new notes(); - $user_notes = $notes_tools->getUserNotes($identifier, $collId); - if (count($user_notes) > 0) { - $content .= '<br/>'; - $content .= '<div style="color:rgb(22, 173, 235);font-weight:bold;">'._NOTES.'</div>'; - $content .= '<table cellspacing="3" style="border-collapse:collapse;width:100%;">'; - for ($i = 0; $i < count($user_notes); ++$i) { - $content .= '<tr style="vertical-align:top;">'; - - //Get data - $id = $user_notes[$i]['id']; - $noteShort = functions::xssafe($request->cut_string($user_notes[$i]['label'], 50)); - $note = functions::xssafe($user_notes[$i]['label']); - $userArray = $users_tools->get_user($user_notes[$i]['author']); - $date = $request->dateformat($user_notes[$i]['date']); - - $content .= '<th style="width:25px;border: dashed 1px grey;border-right:none;vertical-align:middle;" alt="'.$note - .'" title="'.$note - .'"><input type="checkbox" disabled="disabled" id="note_'.$id.'" name="notes[]"'; - - if (!empty($emailArray['notes']) && in_array($id, $emailArray['notes'])) { - $checked = ' checked="checked"' ; - } else { - $checked = ''; - } - - $content .= ' '.$checked - .' class="check" value="' - .$id.'"></th><td style="cursor:pointer;border: dashed 1px grey;border-left:none;padding:5px;"'; - $content .= ' onclick="clickAttachmentsNotes('.$id.')" '; - $content .= 'title="'.$note.'"><span style="font-size: 10px;color: rgb(22, 173, 235);">'.$userArray['firstname'].' '.$userArray['lastname'].' </span><span style="font-size: 10px;color: grey;">'.$date.'</span><br/>' - .'<strong>'.$noteShort.'</strong></td>'; - - $content .= '</tr>'; - } - - $content .= '</table>'; - //Filename - $filename = 'notes_'.$identifier.'_'.date('dmY').'.html'; - $all_joined_files .= _NOTES.': '.$filename.PHP_EOL; - } - } - $content .= '</div>'; - $content .= '<hr />'; - //Body (html or raw mode) - if ($emailArray['isHtml'] == 'Y') { - $content .= '<script type="text/javascript">var mode="html";</script>'; - //load tinyMCE editor - ob_start(); - include 'modules/sendmail/load_editor.php'; - $content .= ob_get_clean(); - ob_end_flush(); - $content .= '<div id="html_mode" style="display:block">'; - $content .= '<textarea name="body_from_html" id="body_from_html" style="width:100%" ' - .'rows="15" cols="60" readonly="readonly">' - .$sendmail_tools->rawToHtml($emailArray['body']).'</textarea>'; - $content .= '</div>'; - } else { - $content .= '<script type="text/javascript">var mode="raw";</script>'; - //raw textarera - $content .= '<div id="raw_mode" style="display:block">'; - $content .= '<textarea name="body_from_raw" id="body_from_raw" class="emailInput" ' - .'cols="60" rows="14" readonly="readonly">' - .$sendmail_tools->htmlToRaw($emailArray['body']).'</textarea>'; - $content .= '</div>'; - } - - if (!empty($emailArray['receptionDate'])) { - $content .= '<br><hr style="margin-top:2px;" />'; - $content .= '<b>'._RECEPTION_DATE.' : </b>'.$emailArray['receptionDate'].'<br><br>'; - $content .= '<div onclick="new Effect.toggle(\'operationCommentsDiv\', \'blind\', {delay:0.2});" onmouseover="this.style.cursor=\'pointer\';"> - <span id="divStatus_operationComments" style="color:#1C99C5;"><i class="fa fa-plus-square"></i></span> '._MORE_INFORMATIONS.' - </div>'; - $content .= '<div id="operationCommentsDiv" style="display:none">'; - foreach ($emailArray['operationComments'] as $value) { - $content .= $value->value.'<br>'; - } - } - if (!empty($emailArray['operationDate'])) { - $content .= '</div><br>'; - $content .= '<b>'._OPERATION_DATE.' : </b>'.$emailArray['operationDate'].'<br><br>'; - } - if (!empty($emailArray['messageReview'])) { - $content .= '<h4>'._M2M_FOLLOWUP_REQUEST.'</h4>'; - $content .= '<div>'; - foreach ($emailArray['messageReview'] as $value) { - $content .= $value.'<br>'; - } - $content .= '</div>'; - } - //Buttons - $content .= '<br><hr style="margin-top:2px;" />'; - $content .= '<div align="center">'; - //Close button - $content .= '<input type="button" name="cancel" id="cancel" class="button" value="' - ._CLOSE.'" onclick="window.parent.destroyModal(\'form_email\');"/>'; - $content .= '</div>'; - $content .= '</div>'; - } elseif ($emailArray['type'] == 'ArchiveTransferReplySent') { - $content .= '<b>'._REPLY_RESPONSE_SENT.' : </b>'.$emailArray['creationDate'].'<br><br>'; - - foreach ($emailArray['operationComments'] as $value) { - $content .= $value->value.'<br>'; - } - - //Buttons - $content .= '<br><hr style="margin-top:2px;" />'; - $content .= '<div align="center">'; - //Close button - $content .= '<input type="button" name="cancel" id="cancel" class="button" value="' - ._CLOSE.'" onclick="window.parent.destroyModal(\'form_email\');"/>'; - $content .= '</div>'; - } else { - $content = $request->wash_html($id.': '._EMAIL_DONT_EXIST.'!', 'NONE'); - } - } else { - $content = $request->wash_html(_ID.' '._IS_EMPTY.'!', 'NONE'); - } -} -echo $content; - -?> -</body> - -</html> diff --git a/modules/sendmail/sendmail.php b/modules/sendmail/sendmail.php deleted file mode 100755 index 0abda462117e1aecf64d6b3aeab91e750061cb7c..0000000000000000000000000000000000000000 --- a/modules/sendmail/sendmail.php +++ /dev/null @@ -1,366 +0,0 @@ -<?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 sendmail.php -* @author dev <dev@maarch.org> -* @ingroup sendmail -*/ - -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR.'class_lists.php'; -require_once 'modules'.DIRECTORY_SEPARATOR.'sendmail'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'; - -$core_tools = new core_tools(); -$request = new request(); -$list = new lists(); -$sendmail_tools = new sendmail(); - -$identifier = ''; -$origin = ''; -$parameters = ''; - -//Collection ID -if (isset($_REQUEST['coll_id']) && !empty($_REQUEST['coll_id'])) { - $parameters = '&coll_id='.$_REQUEST['coll_id']; -} elseif ((isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice']))) { - $parameters = '&coll_id='.$_SESSION['collection_id_choice']; -} - -//Identifier -if (isset($_REQUEST['identifier']) && !empty($_REQUEST['identifier'])) { - $identifier = $_REQUEST['identifier']; -} elseif (isset($_SESSION['doc_id']) && !empty($_SESSION['doc_id'])) { - $identifier = $_SESSION['doc_id']; -} else { - echo '<span class="error">'._IDENTIFIER.' '._IS_EMPTY.'</span>'; - exit(); -} - -$security = new security(); -$right = $security->test_right_doc('letterbox_coll', $identifier); -if (!$right) { - exit(_NO_RIGHT_TXT); -} - -//Origin -if (isset($_REQUEST['origin']) && !empty($_REQUEST['origin'])) { - $origin = $_REQUEST['origin']; -} else { - $origin = 'document'; -} - -//Extra parameters -if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) { - $parameters .= '&size='.$_REQUEST['size']; -} else { - $parameters .= '&size=full'; -} -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $parameters .= '&order='.$_REQUEST['order']; -} -if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $parameters .= '&order_field='.$_REQUEST['order_field']; -} -if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $parameters .= '&what='.$_REQUEST['what']; -} -if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { - $parameters .= '&start='.$_REQUEST['start']; -} else { - $_REQUEST['start'] = 0; -} - -if (isset($_REQUEST['load'])) { - $core_tools->load_lang(); - $core_tools->load_html(); - $core_tools->load_header('', true, false); - - echo '<body>'; - - $core_tools->load_js(); - - //Load list - if (!empty($identifier)) { - $target = $_SESSION['config']['businessappurl'] - .'index.php?module=sendmail&page=sendmail&identifier=' - .$identifier.'&origin='.$origin.$parameters; - - $listContent = $list->loadList($target); - echo $listContent; - } else { - echo '<span class="error">'._ERROR_IN_PARAMETERS.'</span>'; - } - echo '<div id="container" style="width:100%;min-height:0px;height:0px;"></div>'; - - echo '</body>'; - echo '</html>'; -} else { - //If size is full change some parameters - if (isset($_REQUEST['size']) - && ($_REQUEST['size'] == 'full') - ) { - $sizeUser = '10'; - $sizeObject = '30'; - $css = 'listing spec'; - $cutString = 150; - } elseif (isset($_REQUEST['size']) - && ($_REQUEST['size'] == 'medium') - ) { - $sizeUser = '15'; - $sizeObject = '30'; - $css = 'listingsmall'; - $cutString = 100; - } else { - $sizeUser = '10'; - $sizeObject = '10'; - $css = 'listingsmall'; - $cutString = 20; - } - - //Table or view - $select['emails'] = array(); //Emails - $select[USERS_TABLE] = array(); //Users - - //Fields - array_push( - $select['emails'], - 'id as email_id', - 'document->>\'id\' as res_id', - 'creation_date', - 'user_id', - 'object as email_object_short', - 'sender as sender_email', - 'recipients as email_destinataire', - 'id', - 'status', - 'status as status_label' - ); - - array_push($select[USERS_TABLE], 'user_id', 'firstname', 'lastname', 'mail'); //Users - - //Where clause - $where_tab = array(); - - $where_tab[] = ' document->>\'id\' = \''.$identifier.'\' '; - $where_tab[] = 'emails.user_id = users.id'; - - //Build where - $where = implode(' and ', $where_tab); - - //Order - $order = $order_field = ''; - $order = $list->getOrder(); - $order_field = $list->getOrderField(); - if (!empty($order_field) && !empty($order)) { - $orderstr = 'order by '.$order_field.' '.$order; - } else { - $list->setOrder(); - $list->setOrderField('creation_date'); - $orderstr = 'order by creation_date desc'; - } - - if (isset($_REQUEST['lines'])) { - $limit = $_REQUEST['lines']; - } else { - $limit = 'default'; - } - - //Request - $tab = $request->PDOselect( - $select, - $where, - array(), - $orderstr, - $_SESSION['config']['databasetype'], - $limit, - false, - '', - '', - '', - true, - false, - false, - $_REQUEST['start'] - ); - - //Result Array - if (!empty($tab)) { - for ($i = 0; $i < count($tab); ++$i) { - for ($j = 0; $j < count($tab[$i]); ++$j) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value] == 'email_id') { - $tab[$i][$j]['email_id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = 'ID'; - $tab[$i][$j]['size'] = '1'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = false; - $tab[$i][$j]['order'] = 'id'; - } - if ($tab[$i][$j][$value] == 'creation_date') { - $tab[$i][$j]['value'] = $request->dateformat($tab[$i][$j]['value']); - $tab[$i][$j]['label'] = _CREATION_DATE; - $tab[$i][$j]['size'] = '11'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'creation_date'; - } - if ($tab[$i][$j][$value] == 'user_id') { - $tab[$i][$j]['label'] = _USER_ID; - $tab[$i][$j]['size'] = '5'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = false; - $tab[$i][$j]['order'] = 'user_id'; - } - if ($tab[$i][$j][$value] == 'email_destinataire') { - $tab_dest = (array)json_decode(htmlspecialchars_decode($tab[$i][$j]['value'], ENT_QUOTES | ENT_HTML401)); - $tab[$i][$j]['value'] = implode(', ', $tab_dest); - $tab[$i][$j]['label'] = _RECIPIENT; - $tab[$i][$j]['size'] = $sizeObject; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'email_destinataire'; - } - if ($tab[$i][$j][$value] == 'email_object_short') { - $tab[$i][$j]['value'] = $request->cut_string($request->show_string($tab[$i][$j]['value']), $cutString); - $tab[$i][$j]['label'] = _EMAIL_OBJECT; - $tab[$i][$j]['size'] = $sizeObject; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'email_object_short'; - } - if ($tab[$i][$j][$value] == 'status_label') { - $tab[$i][$j]['value'] = $sendmail_tools->emailStatus(['status' => $tab[$i][$j]['value']]); - $tab[$i][$j]['label'] = _STATUS; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'status_label'; - } - if ($tab[$i][$j][$value] == 'sender_email') { - $senderInfo = (array)json_decode(htmlspecialchars_decode($tab[$i][$j]['value'], ENT_QUOTES | ENT_HTML401)); - $tab[$i][$j]['value'] = $senderInfo['email']; - - $tab[$i][$j]['label'] = _SENDER; - $tab[$i][$j]['size'] = '20'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'sender_email'; - } - if ($tab[$i][$j][$value] == 'id') { - $tab[$i][$j]['value'] = (\Email\models\EmailModel::hasJoinFiles(['id' => $tab[$i][$j]['value']])) ? - '<i class="fa fa-paperclip fa-2x" title="'._JOINED_FILES.'"></i>' : - ''; - $tab[$i][$j]['label'] = false; - $tab[$i][$j]['size'] = '1'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = false; - } - } - } - } - } - - //List - $listKey = 'email_id'; // Cle de la liste - $paramsTab = array(); // Initialiser le tableau de parametres - $paramsTab['bool_sortColumn'] = true; // Affichage Tri - $paramsTab['pageTitle'] = ''; // Titre de la page - $paramsTab['bool_bigPageTitle'] = false; // Affichage du titre en grand - $paramsTab['urlParameters'] = 'identifier='.$identifier - .'&origin='.$origin.'&display=true'.$parameters; // Parametres d'url supplementaires - $paramsTab['filters'] = array(); // Filtres - $paramsTab['listHeight'] = '100%'; // Hauteur de la liste - $paramsTab['start'] = $_REQUEST['start']; - $paramsTab['listCss'] = $css; // CSS - $paramsTab['tools'] = array(); // Icones dans la barre d'outils - - $addMail = array( - 'script' => "showEmailForm('".$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content' - .'&mode=add&identifier='.$identifier.'&origin='.$origin.'&formContent=email' - .$parameters."')", - 'icon' => 'envelope', - 'tooltip' => _NEW_EMAIL, - 'alwaysVisible' => true, - ); - - $addExchangeMessage = array( - 'script' => "showEmailForm('".$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content' - .'&mode=add&identifier='.$identifier.'&origin='.$origin.'&formContent=messageExchange' - .$parameters."')", - 'icon' => 'exchange-alt', - 'tooltip' => _NEW_NUMERIC_PACKAGE, - 'alwaysVisible' => true, - ); - - array_push($paramsTab['tools'], $addMail, $addExchangeMessage); - - //Action icons array - $paramsTab['actionIcons'] = array(); - $read = array( - 'script' => "showEmailForm('".$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content' - .'&mode=read&id=@@email_id@@&identifier='.$identifier.'&origin='.$origin - .$parameters."');", - 'icon' => 'eye', - 'tooltip' => _READ, - ); - array_push($paramsTab['actionIcons'], $read); - $update = array( - 'script' => "showEmailForm('".$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content' - .'&mode=up&id=@@email_id@@&identifier='.$identifier.'&origin='.$origin - .$parameters."');", - 'class' => 'change', - 'tooltip' => _UPDATE, - 'disabledRules' => "@@user_id@@ != '".$_SESSION['user']['UserId']."'", - ); - array_push($paramsTab['actionIcons'], $update); - $transfer = array( - 'script' => "showEmailForm('".$_SESSION['config']['businessappurl'] - .'index.php?display=true&module=sendmail&page=sendmail_ajax_content' - .'&mode=transfer&id=@@email_id@@&identifier='.$identifier.'&origin='.$origin - .$parameters."');", - 'icon' => 'share', - 'tooltip' => _TRANSFER_EMAIL, - 'disabledRules' => "@@user_id@@ != '".$_SESSION['user']['UserId']."' || @@status@@ != 'SENT'", - ); - array_push($paramsTab['actionIcons'], $transfer); - - //Output - $status = 0; - $content = $list->showList($tab, $paramsTab, $listKey); - - $toolbarBagde_script = $_SESSION['config']['businessappurl'].'index.php?display=true&module=sendmail&page=load_toolbar_sendmail&origin=parent&resId='.$identifier.'&collId=letterbox_coll'; - - $content .= '<script>loadToolbarBadge(\'sendmail_tab\',\''.$toolbarBagde_script.'\');</script>'; - - // /********* MESSAGE EXCHANGE PART ***************/ - // include_once 'modules/sendmail/messageExchangeList.php'; - // include_once 'modules/sendmail/acknowledgementReceiptsList.php'; - - echo '{status : '.$status.", content : '".addslashes($debug.$content.$contentMessageExchange.$contentAcknowledgementReceipts)."', error : '".addslashes($error)."'}"; -} diff --git a/modules/sendmail/sendmail_ajax_content.php b/modules/sendmail/sendmail_ajax_content.php deleted file mode 100755 index 059d6a3aafacc49594fab5aca6b4185f48710563..0000000000000000000000000000000000000000 --- a/modules/sendmail/sendmail_ajax_content.php +++ /dev/null @@ -1,612 +0,0 @@ -<?php -/* -* -* Copyright 2013 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Script to return ajax result -* -* @file sendmail_ajax_content.php -* @author Yves Christian Kpakpo <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup sendmail -*/ - -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_db_pdo.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"; -require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR - . 'class_indexing_searching_app.php'; -require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR - . 'class_users.php'; -require_once 'modules/notifications/notifications_tables_definition.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "sendmail" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; -require_once 'modules/sendmail/Controllers/SendMessageExchangeController.php'; - -$core_tools = new core_tools(); -$request = new request(); -$db = new Database(); -$sec = new security(); -$is = new indexing_searching_app(); -$users_tools = new class_users(); -$sendmail_tools = new sendmail(); - -if ($_SESSION['features']['send_to_contact_with_mandatory_attachment'] == true && !isset($_REQUEST['join_attachment']) && $_REQUEST['action'] == 'send_to_contact_with_mandatory_attachment') { - $error = $request->wash_html(_PLEASE_CHOOSE_AN_ATTACHMENT, 'NONE'); - $status = 1; - echo "{status : " . $status . ", content : '" . addslashes(_parse($content)) . "', error : '" . addslashes(_parse_error($error)) . "', exec_js : '".addslashes($js)."'}"; - exit(); -} - - -function _parse($text) -{ - $text = str_replace("\r\n", PHP_EOL, $text); - $text = str_replace("\r", PHP_EOL, $text); - $text = str_replace(PHP_EOL, "\\n ", $text); - return $text; -} -function _parse_error($text) -{ - $text = str_replace("###", "\\n ", $text); - return $text; -} - -$core_tools->load_lang(); - -$status = 0; -$error = $content = $js = $parameters = ''; - -$labels_array = array(); - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - $error = _ERROR_IN_SENDMAIL_FORM_GENERATION; - $status = 1; -} - -//Identifier of the element wich is noted -$identifier = ''; -if (isset($_REQUEST['identifier']) && ! empty($_REQUEST['identifier'])) { - $identifier = trim($_REQUEST['identifier']); -} - -//formContent of the element wich is noted -$formContent = ''; -if (isset($_GET['formContent']) && ! empty($_GET['formContent'])) { - $formContent = trim($_GET['formContent']); -} - -//Collection -if (isset($_REQUEST['coll_id']) && ! empty($_REQUEST['coll_id'])) { - $collId = trim($_REQUEST['coll_id']); - $parameters .= '&coll_id='.$_REQUEST['coll_id']; - $view = $sec->retrieve_view_from_coll_id($collId); - $table = $sec->retrieve_table_from_coll($collId); -} - -//Keep some origin parameters -if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) { - $parameters .= '&size='.$_REQUEST['size']; -} -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $parameters .= '&order='.$_REQUEST['order']; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $parameters .= '&order_field='.$_REQUEST['order_field']; - } -} -if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $parameters .= '&what='.$_REQUEST['what']; -} -if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) { - $parameters .= '&template='.$_REQUEST['template']; -} -if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { - $parameters .= '&start='.$_REQUEST['start']; -} - -//Keep the origin to reload the origin list -$list_origin = $origin = ''; -if (isset($_REQUEST['origin']) && !empty($_REQUEST['origin'])) { - // - $origin = $_REQUEST['origin']; - - if ($_REQUEST['origin'] == "document") { - //From document - $list_origin = "window.parent.loadList('".$_SESSION['config']['businessappurl'] - ."index.php?display=true&module=sendmail&page=sendmail&identifier=" - .$identifier."&origin=document".$parameters."', 'divList', true);"; - } -} - -//Path to actual script -$path_to_script = $_SESSION['config']['businessappurl'] - ."index.php?display=true&module=sendmail&page=sendmail_ajax_content&identifier=" - .$identifier."&origin=".$origin.$parameters; - -switch ($mode) { - case 'up': - case 'read': - case 'transfer': - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $parameters .= '&id='.$_REQUEST['id']; - } else { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - //Close the modal - $js = "window.parent.destroyModal('form_email');"; - break; - } - // no break - case 'add': - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - //Close the modal - $js = "window.parent.destroyModal('form_email');"; - } else { - //Reset arry of adresses - unset($_SESSION['adresses']); - $_SESSION['adresses'] = array(); - //Show iframe - $content .='<iframe name="form_mail" id="form_mail" src="' - . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&module=sendmail&page=mail_form&identifier=' - . $identifier.'&origin=document&coll_id='.$collId.'&mode='.$mode.$parameters.'&formContent='.$_GET['formContent'].'" ' - . 'frameborder="0" width="100%" style="height:540px;padding:0px;overflow-x:hidden;overflow-y: auto;"></iframe>'; - } - break; - - case 'added': - if ($formContent == 'messageExchange') { - $return = SendMessageExchangeController::createMessageExchange($_REQUEST); - if (!empty($return['errors'])) { - if (is_array($return['errors'])) { - $error = implode(", ", $return['errors']); - } else { - $error = $return['errors']; - } - $status = 1; - } - //Reload and show message - $js = $list_origin."window.parent.top.$('main_info').innerHTML = '"._EMAIL_ADDED."';"; - } else { - $userEntitiesMails = array(); - if ($core_tools->test_service('use_mail_services', 'sendmail', false)) { - $userEntitiesMails = $sendmail_tools->checkAttachedEntitiesMails($_SESSION['user']['UserId']); - } - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } elseif (!in_array($_REQUEST['sender_email'], array_keys($userEntitiesMails)) && $core_tools->test_service('use_mail_services', 'sendmail', false)) { - $error = $request->wash_html(_INCORRECT_SENDER, 'NONE'); - $status = 1; - } else { - if (isset($_SESSION['adresses']['to']) && count($_SESSION['adresses']['to']) > 0) { - if (!empty($_REQUEST['object'])) { - - //Check adress for to - $to = join(',', $_SESSION['adresses']['to']); - $error = $sendmail_tools->CheckEmailAdress($to); - - if (empty($error)) { - - //Check adress for cc - (isset($_SESSION['adresses']['cc']) && count($_SESSION['adresses']['cc']) > 0)? - $cc = join(',', $_SESSION['adresses']['cc']) : $cc = ''; - $error = $sendmail_tools->CheckEmailAdress($cc); - - if (empty($error)) { - - //Check adress for cci - (isset($_SESSION['adresses']['cci']) && count($_SESSION['adresses']['cci']) > 0)? - $cci = join(',', $_SESSION['adresses']['cci']) : $cci = ''; - $error = $sendmail_tools->CheckEmailAdress($cci); - - if (empty($error)) { - //Data - ( - isset($_REQUEST['join_file']) - && count($_REQUEST['join_file']) > 0 - )? $res_master_attached = true : $res_master_attached = false; - - $document = ['id' => $identifier, 'isLinked' => $res_master_attached, 'original' => false]; - - $attachments = []; - //attachment - if (isset($_REQUEST['join_attachment']) && count($_REQUEST['join_attachment']) > 0) { - foreach ($_REQUEST['join_attachment'] as $rawAttachment) { - $id = $rawAttachment; - $original = true; - if (strpos($rawAttachment, '#') !== false) { - $id = substr($rawAttachment, 0, strpos($rawAttachment, '#')); - $original = false; - } - $attachments[] = [ - 'id' => (int)$id, - 'isVersion' => false, - 'original' => $original, - ]; - } - } - - //Version attachment - if (isset($_REQUEST['join_version_attachment']) && count($_REQUEST['join_version_attachment']) > 0) { - foreach ($_REQUEST['join_version_attachment'] as $rawAttachment) { - $id = $rawAttachment; - $original = true; - if (strpos($rawAttachment, '#') !== false) { - $id = substr($rawAttachment, 0, strpos($rawAttachment, '#')); - $original = false; - } - $attachments[] = [ - 'id' => (int)$id, - 'isVersion' => true, - 'original' => $original, - ]; - } - } - if (!empty($attachments)) { - $document['attachments'] = $attachments; - } - - //Notes - if (isset($_REQUEST['notes']) && count($_REQUEST['notes']) > 0) { - $document['notes'] = []; - foreach ($_REQUEST['notes'] as $note) { - $document['notes'][] = (int)$note; - } - } - - if (!empty($_REQUEST['is_html']) && $_REQUEST['is_html'] == 'Y') { - $isHtml = true; - $body = $_REQUEST['body_from_html']; - } else { - $isHtml = false; - $body = $_REQUEST['body_from_raw']; - } - - //Status - if ($_REQUEST['for'] == 'save') { - $email_status = 'DRAFT'; - } elseif ($_REQUEST['for'] == 'send') { - $email_status = 'TO_SEND'; - } - - $userInfo = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id', 'mail']]); - - $aSenderInfo = explode(",", $_REQUEST['sender_email']); - if (!empty($aSenderInfo[1]) && !empty($aSenderInfo[0])) { - $entityInfo = \Entity\models\EntityModel::getByEntityId(['entityId' => $aSenderInfo[0], 'select' => ['id']]); - } - $isSent = \Email\controllers\EmailController::createEmail([ - 'userId' => $userInfo['id'], - 'data' => [ - 'sender' => empty($entityInfo) ? ['email' => $userInfo['mail']] : ['email' => $aSenderInfo[1], 'entityId' => $entityInfo['id']], - 'recipients' => explode(",", $to), - 'cc' => explode(",", $cc), - 'cci' => explode(",", $cci), - 'object' => (empty($_REQUEST['object']) ? '' : substr($_REQUEST['object'], 0, 100)), - 'body' => $body, - 'document' => $document, - 'isHtml' => $isHtml, - 'status' => $email_status - ] - ]); - - if (!empty($isSent['errors'])) { - $error = $isSent['errors']; - } - - //Reload and show message - $js = $list_origin."window.parent.top.$('main_info').innerHTML = '"._EMAIL_ADDED."';"; - } else { - $status = 1; - } - } else { - $status = 1; - } - } else { - $status = 1; - } - } else { - $error = $request->wash_html(_EMAIL_OBJECT.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } else { - $error = $request->wash_html(_SEND_TO.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } - } - break; - - case 'updated': - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - //Email ID - $id = $_REQUEST['id']; - $userEntitiesMails = array(); - if ($core_tools->test_service('use_mail_services', 'sendmail', false)) { - $userEntitiesMails = $sendmail_tools->checkAttachedEntitiesMails($_SESSION['user']['UserId']); - } - //Res ID - if (empty($identifier)) { - $error = $request->wash_html(_IDENTIFIER.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } elseif (!in_array($_REQUEST['sender_email'], array_keys($userEntitiesMails)) && $core_tools->test_service('use_mail_services', 'sendmail', false)) { - $error = $request->wash_html(_INCORRECT_SENDER, 'NONE'); - $status = 1; - } else { - if ((isset($_SESSION['adresses']['to']) && count($_SESSION['adresses']['to']) > 0) || $_REQUEST['for'] == 'save') { - if (!empty($_REQUEST['object']) || $_REQUEST['for'] == 'save') { - - //Check adress for to - if (!empty($_SESSION['adresses']['to'])) { - $to = join(',', $_SESSION['adresses']['to']); - $error = $sendmail_tools->CheckEmailAdress($to); - } - - if (empty($error)) { - - //Check adress for cc - (isset($_SESSION['adresses']['cc']) && count($_SESSION['adresses']['cc']) > 0)? - $cc = join(',', $_SESSION['adresses']['cc']) : $cc = ''; - $error = $sendmail_tools->CheckEmailAdress($cc); - - if (empty($error)) { - - //Check adress for cci - (isset($_SESSION['adresses']['cci']) && count($_SESSION['adresses']['cci']) > 0)? - $cci = join(',', $_SESSION['adresses']['cci']) : $cci = ''; - $error = $sendmail_tools->CheckEmailAdress($cci); - - if (empty($error)) { - - //Data - ( - isset($_REQUEST['join_file']) - && count($_REQUEST['join_file']) > 0 - )? $res_master_attached = true : $res_master_attached = false; - - $document = ['id' => $identifier, 'isLinked' => $res_master_attached, 'original' => false]; - - $attachments = []; - //attachment - if (isset($_REQUEST['join_attachment']) && count($_REQUEST['join_attachment']) > 0) { - foreach ($_REQUEST['join_attachment'] as $rawAttachment) { - $id = $rawAttachment; - $original = true; - if (strpos($rawAttachment, '#') !== false) { - $id = substr($rawAttachment, 0, strpos($rawAttachment, '#')); - $original = false; - } - $attachments[] = [ - 'id' => (int)$id, - 'isVersion' => false, - 'original' => $original, - ]; - } - } - - //Version attachment - if (isset($_REQUEST['join_version_attachment']) && count($_REQUEST['join_version_attachment']) > 0) { - foreach ($_REQUEST['join_version_attachment'] as $rawAttachment) { - $id = $rawAttachment; - $original = true; - if (strpos($rawAttachment, '#') !== false) { - $id = substr($rawAttachment, 0, strpos($rawAttachment, '#')); - $original = false; - } - $attachments[] = [ - 'id' => (int)$id, - 'isVersion' => true, - 'original' => $original, - ]; - } - } - if (!empty($attachments)) { - $document['attachments'] = $attachments; - } - - //Notes - if (isset($_REQUEST['notes']) && count($_REQUEST['notes']) > 0) { - $document['notes'] = []; - foreach ($_REQUEST['notes'] as $note) { - $document['notes'][] = (int)$note; - } - } - - if (!empty($_REQUEST['is_html']) && $_REQUEST['is_html'] == 'Y') { - $isHtml = true; - $body = $_REQUEST['body_from_html']; - } else { - $isHtml = false; - $body = $_REQUEST['body_from_raw']; - } - - //Status - if ($_REQUEST['for'] == 'save') { - $email_status = 'DRAFT'; - } elseif ($_REQUEST['for'] == 'send') { - $email_status = 'TO_SEND'; - } - - $userInfo = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id', 'mail']]); - - $aSenderInfo = explode(",", $_REQUEST['sender_email']); - if (!empty($aSenderInfo[1])) { - $entityInfo = \Entity\models\EntityModel::getByEntityId(['entityId' => $aSenderInfo[0], 'select' => ['id']]); - } - - - if (!empty($isSent['errors'])) { - $error = $isSent['errors']; - } - - //Reload and show message - $js = $list_origin."window.parent.top.$('main_info').innerHTML = '"._EMAIL_UPDATED."';"; - } else { - $status = 1; - } - } else { - $status = 1; - } - } else { - $status = 1; - } - } else { - $error = $request->wash_html(_EMAIL_OBJECT.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } else { - $error = $request->wash_html(_SEND_TO.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } - } else { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - //Close the modal - $js = "window.parent.destroyModal('form_email');"; - } - break; - - case 'del': - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $id = $_REQUEST['id']; - - $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'DELETE']); - $request = \Slim\Http\Request::createFromEnvironment($environment); - \Email\controllers\EmailController::delete($request, new \Slim\Http\Response(), ['id' => $id]); - - //Reload and show message - $js = $list_origin."window.parent.top.$('main_info').innerHTML = '"._EMAIL_REMOVED."';"; - } else { - $error = $request->wash_html(_ID.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - //Close the modal - $js = "window.parent.destroyModal('form_email');"; - } - break; - case 'adress': - if (isset($_REQUEST['for']) && isset($_REQUEST['field']) && isset($_REQUEST['email'])) { - if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) { - //Clean up email - $email = trim($_REQUEST['email']); - //Reset session adresses if necessary - if (!isset($_SESSION['adresses'][$_REQUEST['field']])) { - $_SESSION['adresses'][$_REQUEST['field']] = array(); - } - //For ADD - if ($_REQUEST['for'] == 'add') { - array_push($_SESSION['adresses'][$_REQUEST['field']], $email); - //For DEL - } elseif ($_REQUEST['for'] == 'del') { - //unset adress in array - unset($_SESSION['adresses'][$_REQUEST['field']][$_REQUEST['index']]); - //If no adresse for field, unset the entire sub-array - if (count($_SESSION['adresses'][$_REQUEST['field']]) == 0) { - unset($_SESSION['adresses'][$_REQUEST['field']]); - } - } - //Get content - $content = $sendmail_tools->updateAdressInputField($path_to_script, $_SESSION['adresses'], $_REQUEST['field']); - } else { - $error = $request->wash_html(_EMAIL.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } else { - $error = $request->wash_html(_UNKNOW_ERROR.'!', 'NONE'); - $status = 1; - } - break; - case 'destUser': - if (isset($_REQUEST['for']) && isset($_REQUEST['field']) && isset($_REQUEST['contactAddress'])) { - if (isset($_REQUEST['contactAddress']) && !empty($_REQUEST['contactAddress'])) { - $contactAddress = trim($_REQUEST['contactAddress']); - if (!isset($_SESSION['adresses'][$_REQUEST['field']])) { - $_SESSION['adresses'][$_REQUEST['field']] = array(); - } - - if ($_REQUEST['for'] == 'add') { -// $contactLabel = \Contact\models\ContactModel::getContactFullLabel(['addressId' => $contactAddress]); //TODO -// $contactInfo = \Contact\models\ContactModel::getFullAddressById(['addressId' => $contactAddress]); -// $contactCommunication = \Contact\models\ContactModel::getContactCommunication(['contactId' => $contactInfo[0]['contact_id']]); - $_SESSION['adresses'][$_REQUEST['field']][$contactAddress] = $contactLabel.'. ('._COMMUNICATION_TYPE.' : '.$contactCommunication['value'].'))'; - } elseif ($_REQUEST['for'] == 'del') { - unset($_SESSION['adresses'][$_REQUEST['field']][$_REQUEST['index']]); - //If no adresse for field, unset the entire sub-array - if (count($_SESSION['adresses'][$_REQUEST['field']]) == 0) { - unset($_SESSION['adresses'][$_REQUEST['field']]); - } - } - - $content = $sendmail_tools->updateContactInputField($path_to_script, $_SESSION['adresses'], $_REQUEST['field']); - } else { - $error = $request->wash_html(_EMAIL.' '._IS_EMPTY.'!', 'NONE'); - $status = 1; - } - } else { - $error = $request->wash_html(_UNKNOW_ERROR.'!', 'NONE'); - $status = 1; - } - break; - case 'download': - require_once 'modules/export_seda/RequestSeda.php'; - $RequestSeda = new RequestSeda(); - $messageExchangeData = $RequestSeda->getMessageByIdentifierAndResId(['message_id' => $_GET['id'], 'res_id_master' => $_GET['identifier']]); - - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $messageExchangeData->docserver_id]); - $docserverType = \Docserver\models\DocserverTypeModel::getById(['id' => $docserver['docserver_type_id']]); - - $pathDirectory = str_replace('#', DIRECTORY_SEPARATOR, $messageExchangeData->path); - $filePath = $docserver['path_template'] . $pathDirectory . $messageExchangeData->filename; - $fingerprint = \Resource\controllers\StoreController::getFingerPrint([ - 'filePath' => $filePath, - 'mode' => $docserverType['fingerprint_mode'], - ]); - - if ($fingerprint != $messageExchangeData->fingerprint) { - echo _PB_WITH_FINGERPRINT_OF_DOCUMENT; - exit; - } - - if (file_exists($filePath)) { - header('Pragma: public'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Cache-Control: public'); - header('Content-Description: File Transfer'); - header('Content-Type: ' . strtolower(mime_content_type($filePath))); - header("Content-length: " . filesize($filePath)); - header('Content-Disposition: attachment; filename=' . basename($messageExchangeData->reference.'.zip') . ';'); - header("Content-Type: application/force-download"); - header('Content-Transfer-Encoding: binary'); - readfile($filePath); - exit(); - } - exit(); -} -echo "{status : " . $status . ", content : '" . addslashes(_parse($content)) . "', error : '" . addslashes(_parse_error($error)) . "', exec_js : '".addslashes($js)."'}"; -exit(); diff --git a/modules/sendmail/xml/IVS/requests_definitions.xml b/modules/sendmail/xml/IVS/requests_definitions.xml index 5b1b6123d61ccfbbb10c57009fe960c42113c382..eb83ffbbf81ff2b180dc26186795afc43f2102c0 100755 --- a/modules/sendmail/xml/IVS/requests_definitions.xml +++ b/modules/sendmail/xml/IVS/requests_definitions.xml @@ -1,9 +1,4 @@ <requestDefinitions> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="sendmail_ajax_content" > - <parameter name="page" value="sendmail_ajax_content"/> - <parameter name="module" value="sendmail"/> - <parameter name="display" value="true" /> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="mail_form" > <parameter name="page" value="mail_form"/> <parameter name="module" value="sendmail"/> @@ -24,12 +19,6 @@ <parameter name="module" value="sendmail"/> <parameter name="display" value="true" /> </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="adress_comletion" > - <parameter name="page" value="address_autocompletion"/> - <parameter name="module" value="sendmail"/> - <parameter name="display" value="true" /> - </requestDefinition> - </requestDefinitions> diff --git a/modules/sendmail/xml/IVS/validation_rules.xml b/modules/sendmail/xml/IVS/validation_rules.xml index 3f9807cd9762b0e133d201c448afd868cefe67fc..5f0ad04b5209a963d44104779b51537ecad50390 100755 --- a/modules/sendmail/xml/IVS/validation_rules.xml +++ b/modules/sendmail/xml/IVS/validation_rules.xml @@ -1,37 +1,4 @@ <validationRules> - <validationRule name="sendmail_ajax_content" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="base64" /> - <parameter name="identifier" type="integer" /> - <parameter name="origin" type="identifier" /> - <parameter name="coll_id" type="collection_list" /> - <parameter name="size" type="size" /> - <parameter name="url" type="url" /> - <parameter name="for" type="identifier" /> - <parameter name="email" type="string" /> - <parameter name="field" type="identifier" /> - <parameter name="index" type="identifier" /> - <parameter name="is_html" type="YN" /> - <parameter name="add" type="string" /> - <parameter name="target" type="identifier" /> - <parameter name="body_from_html" type="string" /> - <parameter name="body_from_raw" type="string" /> - <parameter name="cancel" type="identifier" /> - <parameter name="join_attachment" type="string" /> - <parameter name="join_version_attachment" type="string" /> - <parameter name="join_file" type="identifier" /> - <parameter name="notes" type="string" /> - <parameter name="object" type="string" /> - <parameter name="valid" type="string" /> - <parameter name="sender_email" type="string" /> - <parameter name="templateMail" type="integer" /> - <parameter name="selectSignatures" type="string" /> - <parameter name="action" type="string" /> - <parameter name="formContent" type="string" /> - <parameter name="main_exchange_doc" type="string" /> - <parameter name="contactAddress" type="integer" /> - </validationRule> - <validationRule name="mail_form" extends="standardForm" mode="error"> <parameter name="module" type="identifier" /> <parameter name="identifier" type="integer" /> diff --git a/modules/templates/class/class_modules_tools_Abstract.php b/modules/templates/class/class_modules_tools_Abstract.php index 05159a8edfe89916139e80e23e6b1ec39e2638f6..63bc1dd3d14522f3dce0291bfd1a8e2e92491e50 100755 --- a/modules/templates/class/class_modules_tools_Abstract.php +++ b/modules/templates/class/class_modules_tools_Abstract.php @@ -79,37 +79,4 @@ abstract class templates_Abstract extends Database return $return; } - - - public function getAllItemsLinkedToModel($template_id, $field ='') - { - $db = new Database(); - $items = array(); - if (empty($template_id)) { - return $items; - } - - if (empty($field)) { - $items['destination'] = []; - foreach (array_keys($items) as $key) { - $stmt2 = $db->query( - "select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? ", - array($template_id) - ); - while ($res = $stmt2->fetchOject()) { - array_push($items[$key], $res->value_field); - } - } - } else { - $items[$field] = []; - $stmt = $db->query( - "select value_field from ".$_SESSION['tablename']['temp_templates_association']." where template_id = ? ", - array($template_id) - ); - while ($res = $stmt->fetchObject()) { - array_push($items[$field], $res->value_field); - } - } - return $items; - } } diff --git a/modules/templates/class/templates_controler_Abstract.php b/modules/templates/class/templates_controler_Abstract.php index ccde9401c8325b246b8d1c79a9c2bf1946add829..90c9c2f7fbdf25ddefd646c96f3cd37072fdf4e8 100755 --- a/modules/templates/class/templates_controler_Abstract.php +++ b/modules/templates/class/templates_controler_Abstract.php @@ -498,41 +498,6 @@ abstract class templates_controler_Abstract extends ObjectControler implements O return $return; } - /** - * Return all templates in an array for an entity - * - * @param $entityId entity identifier - * @return array of templates - */ - public function getAllTemplatesForProcess($entityId) - { - include_once 'core/class/docservers_controler.php'; - - $db = new Database(); - $stmt = $db->query( - 'select * from ' . _TEMPLATES_TABLE_NAME . ' t, ' . _TEMPLATES_ASSOCIATION_TABLE_NAME . ' ta ' - . 'where t.template_id = ta.template_id and ta.value_field = ? ORDER BY t.template_label', - [$entityId] - ); - $docservers_controler = new docservers_controler(); - $docserverTemplate = $docservers_controler->get('TEMPLATES'); - $templates = []; - while ($res = $stmt->fetchObject()) { - array_push( - $templates, - array( - 'ID' => $res->template_id, - 'LABEL' => $res->template_label, - 'TYPE' => $res->template_type, - 'TARGET' => $res->template_target, - 'ATTACHMENT_TYPE' => $res->template_attachment_type, - 'FILE' => $docserverTemplate->path_template.str_replace('#', '/', $res->template_path).$res->template_file_name - ) - ); - } - return $templates; - } - public function updateTemplateEntityAssociation($templateId) { $db = new Database(); @@ -551,65 +516,6 @@ abstract class templates_controler_Abstract extends ObjectControler implements O } } - public function getAllItemsLinkedToModel($templateId, $field ='') - { - $db = new Database(); - $items = array(); - if (empty($templateId)) { - return $items; - } - if (empty($field)) { - $items['destination'] = []; - $stmt = $db->query( - "select value_field from " - . _TEMPLATES_ASSOCIATION_TABLE_NAME - . " where template_id = ?", - array($templateId) - ); - while ($res = $stmt->fetchObject()) { - array_push($items['destination'], $res->value_field); - } - } else { - $items[$field] = []; - $stmt = $db->query( - "select value_field from " - . _TEMPLATES_ASSOCIATION_TABLE_NAME - . " where template_id = ?", - array($templateId) - ); - while ($res = $stmt->fetchObject()) { - array_push($items[$field], $res->value_field); - } - } - return $items; - } - - public function getTemplatesStyles($dir, $stylesArray) - { - $this->stylesArray = $stylesArray; - //Browse all files of the style template dir - $classScan = dir($dir); - while (($filescan = $classScan->read()) != false) { - if ($filescan == '.' || $filescan == '..' || $filescan == '.svn') { - continue; - } elseif (is_dir($dir . $folder . $filescan)) { - $this->getTemplatesStyles($dir . $folder . $filescan . '/', $this->stylesArray); - } else { - $filePath = $dir . $folder . '/' . $filescan; - $info = pathinfo($filePath); - array_push( - $this->stylesArray, - array( - 'fileName' => basename($filePath, '.' . $info['extension']), - 'fileExt' => strtoupper($info['extension']), - 'filePath' => $filePath, - ) - ); - } - } - return $this->stylesArray; - } - public function getTemplatesDatasources($configXml) { $datasources = array(); @@ -634,52 +540,6 @@ abstract class templates_controler_Abstract extends ObjectControler implements O return $datasources; } - public function getTemplatesTargets() - { - $targets = array(); - //attachments - array_push( - $targets, - array( - 'id' => 'attachments', - 'label' => _ATTACHMENTS, - ) - ); - //notifications - array_push( - $targets, - array( - 'id' => 'notifications', - 'label' => _NOTIFICATIONS, - ) - ); - //doctypes - array_push( - $targets, - array( - 'id' => 'doctypes', - 'label' => _DOCTYPES, - ) - ); - //notes - array_push( - $targets, - array( - 'id' => 'notes', - 'label' => _NOTES, - ) - ); - //sendmail - array_push( - $targets, - array( - 'id' => 'sendmail', - 'label' => _SENDMAIL, - ) - ); - return $targets; - } - //returns file ext public function extractFileExt($sFullPath) { diff --git a/modules/templates/js/change_doctype.js b/modules/templates/js/change_doctype.js index e94e1c36da75e16853b7995953dded6e5a5d6726..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 --- a/modules/templates/js/change_doctype.js +++ b/modules/templates/js/change_doctype.js @@ -1,53 +0,0 @@ - -function doctype_template(args) -{ - //alert(print_r(args)); - var choose_file_div = $('choose_file_div'); - var file_iframe = $('file_iframe'); - - var template = ''; - var is_generated = false; - var doc_frame = ''; - var model_frame = ''; - for(var i=0; i< args.length; i++) - { - if(args[i]['id'] == 'template_id') - { - template = args[i]['value']; - } - if(args[i]['id'] == 'is_generated' && args[i]['value'] == 'Y') - { - is_generated = true; - } - if(args[i]['id'] == 'doc_frame') - { - doc_frame = args[i]['value']; - } - if(args[i]['id'] == 'model_frame') - { - model_frame = args[i]['value']; - } - } - - if(is_generated == true) - { - if(choose_file_div != null) - { - choose_file_div.style.display = 'none'; - } - if(file_iframe != null && model_frame!= '' && model_frame != null) - { - file_iframe.src = model_frame; - } - } - else - { - if(file_iframe.src.includes("display=true&module=templates&page=file_iframe&model_id")){ - choose_file_div.style.display = 'block'; - if(file_iframe != null && doc_frame!= '' && doc_frame != null) - { - file_iframe.src = doc_frame; - } - } - } -} diff --git a/modules/templates/templates_ajax_content_for_mails.php b/modules/templates/templates_ajax_content_for_mails.php deleted file mode 100755 index 3b8de783bae0db4e5b34be4299674515750654f3..0000000000000000000000000000000000000000 --- a/modules/templates/templates_ajax_content_for_mails.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* -* Copyright 2008-2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -require_once 'modules/templates/class/templates_controler.php'; -require_once 'core/class/class_security.php'; -$templateController = new templates_controler(); - -if ((! isset($_REQUEST['templateId']) || empty($_REQUEST['templateId']))) { - $error = _TEMPLATE_ID . ' ' . _EMPTY; - echo "{status : 1, error_txt : '" . addslashes($error) . "'}"; - exit(); -} - -$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 - ); - -$template = $templateController->get($_REQUEST['templateId']); -$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') { - $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(); diff --git a/modules/templates/templates_ajax_content_for_notes.php b/modules/templates/templates_ajax_content_for_notes.php deleted file mode 100755 index 1fc9500077ade83e1a083c225eb3530ad71ffaa1..0000000000000000000000000000000000000000 --- a/modules/templates/templates_ajax_content_for_notes.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/* -* Copyright 2008-2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -require_once 'modules/templates/class/templates_controler.php'; -$templateController = new templates_controler(); - -if ((! isset($_REQUEST['templateId']) || empty($_REQUEST['templateId']))) { - $error = _TEMPLATE_ID . ' ' . _EMPTY; - echo "{status : 1, error_txt : '" . addslashes($error) . "'}"; - exit(); -} -$template = $templateController->get($_REQUEST['templateId']); - -$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); - -echo "{status : 0, content : '" . addslashes($template->template_content) . "'}"; -exit(); diff --git a/modules/templates/xml/IVS/requests_definitions.xml b/modules/templates/xml/IVS/requests_definitions.xml index 430ae760b58c6bb5ca0cda467f16c307731321fb..f2489e4e7110dec67f0d3782bbcf12d1713e8573 100755 --- a/modules/templates/xml/IVS/requests_definitions.xml +++ b/modules/templates/xml/IVS/requests_definitions.xml @@ -16,16 +16,6 @@ <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="template_manage_add" > <parameter name="page" value="templates_management_controler"/> <parameter name="module" value="templates"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="templates_ajax_content_for_mails" > - <parameter name="page" value="templates_ajax_content_for_mails"/> - <parameter name="module" value="templates"/> - <parameter name="display" value="true"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="templates_ajax_content_for_notes" > - <parameter name="page" value="templates_ajax_content_for_notes"/> - <parameter name="module" value="templates"/> - <parameter name="display" value="true"/> </requestDefinition> <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="file_iframe" > <parameter name="page" value="file_iframe"/> diff --git a/modules/templates/xml/IVS/validation_rules.xml b/modules/templates/xml/IVS/validation_rules.xml index acfd768e35a0acf6b3b73737ac7be7843b248920..0dd8fea2bed2d5fab81c65208f218768b9a133b8 100755 --- a/modules/templates/xml/IVS/validation_rules.xml +++ b/modules/templates/xml/IVS/validation_rules.xml @@ -22,18 +22,6 @@ <parameter name="template_path" type="docserver_path" /> <parameter name="entitieslist" type="identifier" /> </validationRule> - - <validationRule name="templates_ajax_content_for_mails" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="integer" /> - <parameter name="templateId" type="integer" /> - <parameter name="mode" type="string" /> - </validationRule> - - <validationRule name="templates_ajax_content_for_notes" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="templateId" type="integer" /> - </validationRule> <validationRule name="admin_change_templates" extends="standardForm" mode="error"> <parameter name="template_style" type="string" /> diff --git a/modules/visa/checkAllAnsSigned.php b/modules/visa/checkAllAnsSigned.php deleted file mode 100755 index 363eb140aa2a3fab62eeb5feb4410db0a8ed4f85..0000000000000000000000000000000000000000 --- a/modules/visa/checkAllAnsSigned.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/* -* Copyright 2008 - 2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - - require_once('core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR - . 'class_request.php'); - require_once('core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR - . 'class_db.php'); - - require_once 'modules/attachments/attachments_tables.php'; - - $core_tools = new core_tools(); - $core_tools->test_user(); - - $db = new Database(); - $stmt = $db->query("SELECT status from res_attachments where attachment_type= ? and res_id_master = ? ", array('response_project', $_REQUEST['res_id'])); - while($line = $stmt->fetchObject()){ - if ($line->status == 'TRA' || $line->status == 'A_TRA' ){ - echo "{status:0}"; - exit(); - } - } - - echo "{status:1}"; - exit(); - -?> \ No newline at end of file diff --git a/modules/visa/class/class_modules_tools.php b/modules/visa/class/class_modules_tools.php index e9632003531f321fd320f7b9cad1838da5add904..2664e319f27d07dc9dcfa776118d2a8552dc920e 100755 --- a/modules/visa/class/class_modules_tools.php +++ b/modules/visa/class/class_modules_tools.php @@ -46,141 +46,4 @@ class ConcatPdf extends ConcatPdf_Abstract // custom } -/* EXEMPLE TAB VISA_CIRCUIT - -Array -( - [coll_id] => letterbox_coll - [res_id] => 190 - [difflist_type] => entity_id - [sign] => Array - ( - [users] => Array - ( - [0] => Array - ( - [user_id] => sgros - [lastname] => GROS - [firstname] => Sébastien - [entity_id] => CHEFCABINET - [entity_label] => Chefferie - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - ) - - ) - - [visa] => Array - ( - [users] => Array - ( - [0] => Array - ( - [user_id] => sbes - [lastname] => BES - [firstname] => Stéphanie - [entity_id] => CHEFCABINET - [entity_label] => Chefferie - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - [1] => Array - ( - [user_id] => fbenrabia - [lastname] => BENRABIA - [firstname] => Fadela - [entity_id] => POLESOCIAL - [entity_label] => Pôle social - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - [2] => Array - ( - [user_id] => bpont - [lastname] => PONT - [firstname] => Brieuc - [entity_id] => POLEAFFAIRESETRANGERES - [entity_label] => Pôle affaires étrangères - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - ) - - ) - -) - - - - - -<h3>Document</h3><pre>Array -( - [0] => Array - ( - [id] => 197 - [label] => 123456 - [format] => pdf - [filesize] => 46468 - [attachment_type] => - [is_version] => - [version] => - ) - -) -</pre><h3>Document</h3><pre>Array -( - [0] => Array - ( - [id] => 400 - [label] => reponse 1 v5 - [format] => docx - [filesize] => 36219 - [attachment_type] => response_project - [is_version] => - [version] => - ) - - [1] => Array - ( - [id] => 409 - [label] => Nouvelle PJ - [format] => pdf - [filesize] => 1204460 - [attachment_type] => simple_attachment - [is_version] => - [version] => - ) - - [2] => Array - ( - [id] => 410 - [label] => pj 2 - [format] => pdf - [filesize] => 361365 - [attachment_type] => simple_attachment - [is_version] => - [version] => - ) - -) - -*/ ?> diff --git a/modules/visa/class/class_modules_tools_Abstract.php b/modules/visa/class/class_modules_tools_Abstract.php index 2a909f4c0cc93ca380cbad22d82a1c5975157c8b..857c68e830e57386adf1515c8f8b28840da41fdd 100755 --- a/modules/visa/class/class_modules_tools_Abstract.php +++ b/modules/visa/class/class_modules_tools_Abstract.php @@ -90,938 +90,12 @@ abstract class visa_Abstract extends Database $_SESSION['modules_loaded']['visa']['routing_template'] = $routing_template; } - - public function checkResponseProject($res_id, $coll_id) - { - $this->errorMessageVisa = null; - - $attachmentTypes = \Attachment\models\AttachmentModel::getAttachmentsTypesByXML(); - - $noSignableAttachments = []; - foreach ($attachmentTypes as $key => $value) { - if (!$value['sign']) { - $noSignableAttachments[] = $key; - } - } - - $db = new Database(); - if (empty($noSignableAttachments)) { - $stmt = $db->query("SELECT * FROM res_attachments WHERE res_id_master = ? AND status NOT IN ('DEL','OBS','TMP') AND in_signature_book = ?", [$res_id, true]); - } else { - $stmt = $db->query("SELECT * FROM res_attachments WHERE res_id_master = ? AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN (?) AND in_signature_book = ? ", [$res_id, $noSignableAttachments, true]); - } - if ($stmt->rowCount() <= 0) { - $this->errorMessageVisa = _NO_RESPONSE_PROJECT_VISA; - - return false; - } - - return true; - } - - public function getWorkflow($res_id, $coll_id, $typeList) - { - require_once 'modules/entities/class/class_manage_listdiff.php'; - $listdiff = new diffusion_list(); - $roles = $listdiff->list_difflist_roles(); - $circuit = $listdiff->get_listinstance($res_id, false, $typeList); - if (isset($circuit['copy'])) { - unset($circuit['copy']); - } - - return $circuit; - } - - public function saveWorkflow($res_id, $coll_id, $workflow, $typeList) - { - require_once 'modules/entities/class/class_manage_listdiff.php'; - $diff_list = new diffusion_list(); - - $diff_list->save_listinstance( - $workflow, - $typeList, - $coll_id, - $res_id, - $_SESSION['user']['UserId'], - $_SESSION['user']['primaryentity']['id'] - ); - } - - public function saveModelWorkflow($id_list, $workflow, $typeList, $title) - { - } - - protected function getWorkflowsNumberByTitle($title) - { - $db = new Database(); - $stmt = $db->query('SELECT * FROM listmodels WHERE title = ?', array($title)); - - return $stmt->rowCount(); - } - - public function isWorkflowTitleFree($title) - { - $nb = $this->getWorkflowsNumberByTitle($title); - if ($nb == 0) { - return true; - } else { - return false; - } - } - - public function nbVisa($res_id, $coll_id) - { - $db = new Database(); - $stmt = $db->query('SELECT listinstance_id from listinstance WHERE res_id= ? and coll_id = ? and item_mode = ?', array($res_id, $coll_id, 'visa')); - - return $stmt->rowCount(); - } - - public function getCurrentStep($res_id, $coll_id, $listDiffType) - { - $db = new Database(); - $where = 'res_id= ? and coll_id = ? and difflist_type = ? and process_date IS NULL'; - $order = 'ORDER BY listinstance_id ASC'; - $query = $db->limit_select(0, 1, 'sequence, item_mode', 'listinstance', $where, '', '', $order); - - $stmt = $db->query($query, array($res_id, $coll_id, $listDiffType)); - $res = $stmt->fetchObject(); - if ($res->item_mode == 'sign') { - return $this->nbVisa($res_id, $coll_id); - } - - return $res->sequence; - } - - public function getUsersCurrentVis($res_id) - { - $db = new Database(); - $result = array(); - $stmt = $db->query("SELECT item_id from listinstance WHERE res_id= ? and difflist_type = 'VISA_CIRCUIT' ORDER BY sequence ASC", array($res_id)); - while ($res = $stmt->fetchObject()) { - $result[] = $res->item_id; - } - - return $result; - } - - public function getCurrentUserStep($res_id) - { - $db = new Database(); - $stmt = $db->query('SELECT item_id from listinstance WHERE res_id= ? and coll_id = ? and difflist_type = ? and process_date ISNULL ORDER BY listinstance_id ASC LIMIT 1', array($res_id, 'letterbox_coll', 'VISA_CIRCUIT')); - $res = $stmt->fetchObject(); - - return $res->item_id; - } - - public function getStepDetails($res_id, $coll_id, $listDiffType, $sequence) - { - $stepDetails = array(); - $db = new Database(); - $order = 'ORDER by listinstance_id ASC'; - $where = 'res_id= ? and coll_id = ? and difflist_type = ? and sequence = ? '; - $query = $db->limit_select(0, 1, '*', 'listinstance', $where, '', '', $order); - - $stmt = $db->query($query, array($res_id, $coll_id, $listDiffType, $sequence)); - - $res = $stmt->fetchObject(); - $stepDetails['listinstance_id'] = $res->listinstance_id; - $stepDetails['coll_id'] = $res->coll_id; - $stepDetails['res_id'] = $res->res_id; - $stepDetails['sequence'] = $res->sequence; - $stepDetails['item_id'] = $res->item_id; - $stepDetails['item_type'] = $res->item_type; - $stepDetails['item_mode'] = $res->item_mode; - $stepDetails['added_by_user'] = $res->added_by_user; - $stepDetails['visible'] = $res->visible; - $stepDetails['viewed'] = $res->viewed; - $stepDetails['difflist_type'] = $res->difflist_type; - $stepDetails['process_date'] = $res->process_date; - $stepDetails['process_comment'] = $res->process_comment; - - return $stepDetails; - } - - public function processVisaWorkflow($aArgs = []) - { - $message = []; - $db = new Database(); - //enables to process the visa if i am not the item_id - if ($aArgs['stepDetails']['item_id'] != $_SESSION['user']['UserId']) { - $db->query( - 'UPDATE listinstance SET process_date = CURRENT_TIMESTAMP ' - .' WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?', - array($aArgs['stepDetails']['listinstance_id'], $aArgs['stepDetails']['item_mode'], $aArgs['res_id'], $aArgs['stepDetails']['item_id'], 'VISA_CIRCUIT') - ); - - $stmt = $db->query('SELECT firstname, lastname, user_id FROM users WHERE user_id IN (?)', array([$_SESSION['user']['UserId'], $aArgs['stepDetails']['item_id']])); - foreach ($stmt as $value) { - if ($value['user_id'] == $_SESSION['user']['UserId']) { - $user1 = $value['firstname'].' '.$value['lastname']; - } else { - $user2 = $value['firstname'].' '.$value['lastname']; - } - } - - $message[] = ' '._VISA_BY.' '.$user1.' '._INSTEAD_OF.' '.$user2; - } else { - $db->query( - 'UPDATE listinstance SET process_date = CURRENT_TIMESTAMP ' - .' WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?', - array($aArgs['stepDetails']['listinstance_id'], $aArgs['stepDetails']['item_mode'], $aArgs['res_id'], $_SESSION['user']['UserId'], 'VISA_CIRCUIT') - ); - $message[] = ''; - } - - return $message; - } - - public function getUsersVis($group_id = null) - { - $db = new Database(); - - if ($group_id != null) { - $stmt = $db->query("SELECT users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ? AND group_id = ?) order by users.lastname", array('visa_documents', $group_id)); - } else { - $stmt = $db->query("SELECT distinct on(users.user_id) users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ?) - order by users.user_id,users.lastname", array('visa_documents')); - } - - $tab_users = array(); - - while ($res = $stmt->fetchObject()) { - array_push($tab_users, array('id' => $res->user_id, 'firstname' => $res->firstname, 'lastname' => $res->lastname, 'group_id' => $res->group_id, 'entity_id' => $res->entity_id)); - } - - return $tab_users; - } - - public function getEntityVis() - { - $db = new Database(); - - $stmt = $db->query("SELECT distinct(entities.entity_id) FROM users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and - users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN - (SELECT group_id FROM usergroups_services WHERE service_id = ?) - order by entities.entity_id", array('visa_documents')); - - $tab_userentities = array(); - - while ($res = $stmt->fetchObject()) { - array_push($tab_userentities, array('entity_id' => $res->entity_id)); - } - - return $tab_userentities; - } - - public function setStatusVisa($res_id, $coll_id, $inDetails = false) - { - $curr_visa_wf = $this->getWorkflow($res_id, $coll_id, 'VISA_CIRCUIT'); - - $db = new Database(); - $where = 'res_id= ? and coll_id = ? and difflist_type = ? and process_date IS NULL'; - $order = 'ORDER BY listinstance_id ASC'; - $query = $db->limit_select(0, 1, 'requested_signature', 'listinstance', $where, '', '', $order); - - $stmt = $db->query($query, array($res_id, $coll_id, 'VISA_CIRCUIT')); - $resListDiffVisa = $stmt->fetchObject(); - - // If there is only one step in the visa workflow, we set status to ESIG - if ($resListDiffVisa->requested_signature) { - $mailStatus = 'ESIG'; - } else { - $mailStatus = 'EVIS'; - } - - $db->query('UPDATE res_letterbox SET status = ? WHERE res_id = ? ', array($mailStatus, $res_id)); - } - - public function getList($res_id, $coll_id, $bool_modif = false, $typeList, $isVisaStep = false, $fromDetail = '') - { - $core = new core_tools(); - $circuit = $this->getWorkflow($res_id, $coll_id, $typeList); - $sAllAttachmentSigned = $this->isAllAttachementSigned($res_id); - if ($sAllAttachmentSigned == 'noAttachment') { - $str = '<input type="hidden" id="isAllAttachementSigned" value="false"/>'; - $isAllAttachementSigned = ''; - $isAllAttachementSignedInfo = ''; - } elseif ($sAllAttachmentSigned == 'yes') { - $str = '<input type="hidden" id="isAllAttachementSigned" value="allsigned"/>'; - $isAllAttachementSigned = ''; - $isAllAttachementSignedInfo = _IS_ALL_ATTACHMENT_SIGNED_INFO2; - } else { - $str = '<input type="hidden" id="isAllAttachementSigned" value="false"/>'; - $isAllAttachementSigned = ''; - } - - $str .= '<div class="error" id="divErrorVisa" onclick="this.hide();"></div>'; - $str .= '<div class="info" id="divInfoVisa" onclick="this.hide();"></div>'; - - //VISA USER LIST - if ($bool_modif == true) { - $str .= '<select data-placeholder="'._ADD_VISA_ROLE.'" id="visaUserList" onchange="addVisaUser();">'; - $str .= '<option value="" ></option>'; - - $tab_userentities = $this->getEntityVis(); - $tab_users = $this->getUsersVis(); - /* Order by parent entity **/ - foreach ($tab_userentities as $key => $value) { - $str .= '<optgroup label="'.$tab_userentities[$key]['entity_id'].'">'; - foreach ($tab_users as $user) { - if ($tab_userentities[$key]['entity_id'] == $user['entity_id']) { - $selected = ' '; - if ($user['id'] == $step['user_id']) { - $selected = ' selected'; - } - $str .= '<option value="'.$user['id'].'" '.$selected.'>'.$user['lastname'].' '.$user['firstname'].'</option>'; - } - } - $str .= '</optgroup>'; - } - $str .= '</select>'; - $str .= '<script>'; - $str .= ' $j("#visaUserList").chosen({width: "250px", disable_search_threshold: 10});'; - $str .= '</script>'; - - $str .= ' <select data-placeholder="'._ADD_VISA_MODEL.'" name="modelList" id="modelList" onchange="loadVisaModelUsers();">'; - $str .= '<option value=""></option>'; - $str .= '</select>'; - - $str .= '<script>'; - $str .= ' $j("#modelList").chosen({width: "250px", disable_search_threshold: 10});'; - $str .= '</script>'; - $str .= '<br/><br/>'; - } - if (!empty($isAllAttachementSignedInfo)) { - $str .= '<b style="color:red;">'.$isAllAttachementSignedInfo.'</b>'; - } - $str .= '<div id="visa_content">'; - //VISA USER IN DOCUMENT - $i = 1; - $lastUserVis = true; - - if ((empty($circuit['visa']['users']) || !is_array($circuit['visa']['users']) || count($circuit['visa']['users']) == 0) && (empty($circuit['sign']['users']) || !is_array($circuit['sign']['users']) || count($circuit['sign']['users']) == 0)) { - $str .= '<div id="emptyVisa"><strong><em>'._EMPTY_VISA_WORKFLOW.'</em></strong></div>'; - } else { - $str .= '<div id="emptyVisa" style="display:none;"><strong><em>'._EMPTY_VISA_WORKFLOW.'</em></strong></div>'; - if (!empty($circuit['visa']['users']) && is_array($circuit['visa']['users']) && count($circuit['visa']['users']) > 0) { - $isCurrentVisa = false; - foreach ($circuit['visa']['users'] as $it => $info_userVis) { - if (empty($info_userVis['process_date'])) { - if ($lastUserVis == true && $isVisaStep == true && $isCurrentVisa === false) { - $vised = ' currentVis'; - $disabled = ''; - $link_vis = 'arrow-right '; - $del_vis = '<div class="delete_visa"></div>'; - if ($info_userVis['requested_signature'] && $info_userVis['user_id'] != $_SESSION['user']['UserId']) { - $info_vised = '<p style="color:red;">'._SIGN_USER_COU_DESC.' '.$info_userVis['firstname'].' '.$info_userVis['lastname'].'</p>'; - $dropZone = ''; - } elseif ($info_userVis['requested_signature'] && $info_userVis['user_id'] == $_SESSION['user']['UserId']) { - $info_vised = '<p style="font-weight:normal;">'._SIGN_USER_COU.'</p>'; - $dropZone = ''; - } elseif (!$info_userVis['requested_signature'] && $info_userVis['user_id'] != $_SESSION['user']['UserId']) { - $info_vised = '<p style="color:red;">'._VISA_USER_COU_DESC.' '.$info_userVis['firstname'].' '.$info_userVis['lastname'].'</p>'; - $dropZone = ''; - } else { - $info_vised = '<p style="font-weight:normal;">'._VISA_USER_COU.'</p>'; - $dropZone = ''; - } - if ($core->test_service('modify_visa_in_signatureBook', 'visa', false)) { - $modif = 'true'; - $dropZone = '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true" title="'._DRAG_N_DROP_CHANGE_ORDER.'" style="cursor: pointer"></i>'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - } else { - $modif = 'false'; - } - - $info_vised .= '<select style="display:none;" id="signRequest_'.$i.'" '.$isAllAttachementSigned; - $info_vised .= ' disabled="disabled" '; - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userVis['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } else { - $dropZone = '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true" title="'._DRAG_N_DROP_CHANGE_ORDER.'" style="cursor: pointer"></i>'; - $vised = ''; - if ($bool_modif == true) { - $modif = 'true'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - $disabled = ''; - } else { - $modif = 'false'; - $dropZone = ''; - $del_vis = ''; - $disabled = ' disabled="disabled"'; - } - - $info_vised = '<br/><select id="signRequest_'.$i.'" '.$isAllAttachementSigned; - if (!empty($info_userVis['signatory'])) { - $info_vised .= ' disabled="disabled" '; - } - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userVis['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - $link_vis = 'hourglass-half'; - } - - $lastUserVis = false; - $isCurrentVisa = true; - } else { - $lastUserVis = true; - $modif = 'false'; - - $disabled = ' disabled="disabled"'; - if (preg_match("/\[DEL\]/", $info_userVis['process_comment'])) { - $info_vised = '<br/><select id="signRequest_'.$i.'" '.$isAllAttachementSigned; - if (!empty($info_userVis['signatory'])) { - $info_vised .= ' disabled="disabled" '; - } - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userVis['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - $link_vis = 'times'; - $vised = ' moved vised'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - } else { - if (!empty($info_userVis['signatory'])) { - $info_vised = '<br/><sub>signé le : '.functions::format_date_db($info_userVis['process_date'], '', '', true).'</sub>'; - $info_vised .= '<br/><select id="signRequest_'.$i.'" style="width:auto;display:none;" disabled="disabled" '.$isAllAttachementSigned; - $info_vised .= '>'; - $info_vised .= '<option value="false" selected="selected">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } else { - $info_vised = '<br/><sub>visé le : '.functions::format_date_db($info_userVis['process_date'], '', '', true).'</sub>'; - - $info_vised .= '<br/><select id="signRequest_'.$i.'" style="width:auto;display:none;" disabled="disabled" '.$isAllAttachementSigned; - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true" selected="selected"'; - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } - - $link_vis = 'check'; - $vised = ' vised'; - $del_vis = ''; - } - } - //VISA USER LINE CIRCUIT - $str .= '<div class="droptarget'.$vised.'" id="visa_'.$i.'" draggable="'.$modif.'">'; - $str .= '<span class="visaUserStatus">'; - $str .= '<i class="fa fa-'.$link_vis.'" aria-hidden="true"></i>'; - $str .= '</span>'; - $str .= '<span class="visaUserInfo">'; - $str .= '<sup class="visaUserPos nbResZero">'.$i.'</sup> '; - $str .= '<i class="fa fa-user fa-2x" aria-hidden="true"></i> '.$info_userVis['lastname'].' '.$info_userVis['firstname'].' <sup class="nbRes">'.$info_userVis['entity_id'].'</sup>'; - $str .= ' <sub><i id="signedUser_'.$i.'" title="au moins un document a été signé par cet utilisateur" class="visaUserSign fa fa-certificate" aria-hidden="true" style="color:#F99830;'; - if (empty($info_userVis['signatory'])) { - $str .= 'visibility:hidden'; - } - $str .= '"></i>'.$info_vised; - $str .= '</span>'; - $str .= '<span class="visaUserAction">'; - $str .= $del_vis; - $str .= '</span>'; - $str .= '<span class="visaUserConsigne">'; - $str .= '<input class="userId" type="hidden" value="'.$info_userVis['user_id'].'"/><input class="visaDate" type="hidden" value="'.$info_userVis['process_date'].'"/><input'.$disabled.' class="consigne" type="text" value="'.$info_userVis['process_comment'].'"/>'; - $str .= '</span>'; - - $str .= '<span id="dropZone">'; - $str .= $dropZone; - $str .= '</span>'; - $str .= '</div>'; - - ++$i; - } - } - - //FOR USER SIGN - if (!empty($circuit['sign']['users'])) { - foreach ($circuit['sign']['users'] as $info_userSign) { - if (empty($info_userSign['process_date'])) { - if (($lastUserVis == true && $isVisaStep == true)) { - $vised = ' currentVis'; - $modif = 'false'; - $disabled = ''; - $del_vis = ''; - $link_vis = 'arrow-right '; - if ($info_userSign['requested_signature'] && $info_userSign['user_id'] != $_SESSION['user']['UserId']) { - $dropZone = ''; - $info_vised = '<p style="color:red;">'._SIGN_USER_COU_DESC.' '.$info_userSign['firstname'].' '.$info_userSign['lastname'].'</p>'; - } elseif ($info_userSign['requested_signature'] && $info_userSign['user_id'] == $_SESSION['user']['UserId']) { - $dropZone = ''; - $info_vised = '<p style="font-weight:normal;">'._SIGN_USER_COU.'</p>'; - } elseif (!$info_userSign['requested_signature'] && $info_userSign['user_id'] != $_SESSION['user']['UserId']) { - $dropZone = ''; - $info_vised = '<p style="color:red;">'._VISA_USER_COU_DESC.' '.$info_userSign['firstname'].' '.$info_userSign['lastname'].'</p>'; - } else { - $dropZone = ''; - $info_vised = '<p style="font-weight:normal;">'._VISA_USER_COU.'</p>'; - } - if ($core->test_service('modify_visa_in_signatureBook', 'visa', false)) { - $modif = 'true'; - $dropZone = '<i class="fa -alt fa-2x fa-rotate-90" aria-hidden="true" title="'._DRAG_N_DROP_CHANGE_ORDER.'" style="cursor: pointer"></i>'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - } else { - $modif = 'false'; - } - $info_vised .= '<select style="display:none;" id="signRequest_'.$i.'" '.$isAllAttachementSigned; - $info_vised .= ' disabled="disabled" '; - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userSign['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } else { - $dropZone = '<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true" title="'._DRAG_N_DROP_CHANGE_ORDER.'" style="cursor: pointer"></i>'; - $vised = ''; - if ($bool_modif == true) { - $modif = 'true'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - $disabled = ''; - } else { - $dropZone = ''; - $modif = 'false'; - $del_vis = ''; - $disabled = ' disabled="disabled"'; - } - - $info_vised = '<br/><select id="signRequest_'.$i.'" '.$isAllAttachementSigned; - if (!empty($info_userSign['signatory'])) { - $info_vised .= ' disabled="disabled" '; - } - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userSign['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - $link_vis = 'hourglass-half'; - } - } else { - $modif = 'false'; - if (preg_match("/\[DEL\]/", $info_userSign['process_comment'])) { - $info_vised = '<br/><select id="signRequest_'.$i.'" '.$isAllAttachementSigned; - if (!empty($info_userSign['signatory'])) { - $info_vised .= ' disabled="disabled" '; - } - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - - $info_vised .= '<option value="true"'; - if (!empty($info_userSign['requested_signature'])) { - $info_vised .= ' selected="selected" '; - } - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - - $link_vis = 'hourglass-half'; - $link_vis = 'times'; - $vised = ' moved vised'; - $del_vis = '<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);" title="'._DELETE.'"></i>'; - } else { - $vised = ' vised'; - $link_vis = 'check'; - - if (!empty($info_userSign['signatory'])) { - $info_vised = '<br/><sub>signé le : '.functions::format_date_db($info_userSign['process_date'], '', '', true).'</sub>'; - - $info_vised .= '<br/><select id="signRequest_'.$i.'" style="width:auto;display:none;" '.$isAllAttachementSigned; - $info_vised .= ' disabled="disabled" '; - $info_vised .= '>'; - $info_vised .= '<option value="false">'._VISA_USER_SEARCH.'</option>'; - $info_vised .= '<option value="true"'; - $info_vised .= ' selected="selected" '; - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } else { - $info_vised = '<br/><sub>visé le : '.functions::format_date_db($info_userSign['process_date'], '', '', true).'</sub>'; - - $info_vised .= '<br/><select id="signRequest_'.$i.'" style="width:auto;display:none;" '.$isAllAttachementSigned; - $info_vised .= ' disabled="disabled" '; - $info_vised .= '>'; - $info_vised .= '<option value="false" selected="selected">'._VISA_USER_SEARCH.'</option>'; - $info_vised .= '<option value="true"'; - $info_vised .= '>'._SIGNATORY.'</option>'; - $info_vised .= '</select>'; - } - } - } - //VISA USER LINE CIRCUIT - $str .= '<div class="droptarget'.$vised.'" id="visa_'.$i.'" draggable="'.$modif.'">'; - $str .= '<span class="visaUserStatus">'; - $str .= '<i class="fa fa-'.$link_vis.'" aria-hidden="true"></i>'; - $str .= '</span>'; - $str .= '<span class="visaUserInfo">'; - $str .= '<sup class="visaUserPos nbResZero">'.$i.'</sup> '; - $str .= '<i class="fa fa-user fa-2x" aria-hidden="true"></i> '.$info_userSign['lastname'].' '.$info_userSign['firstname'].' <sup class="nbRes">'.$info_userSign['entity_id'].'</sup>'; - $str .= ' <sub><i id="signedUser_'.$i.'" title="au moins un document a été signé par cet utilisateur" class="visaUserSign fa fa-certificate" aria-hidden="true" style="color:#F99830;'; - if (empty($info_userSign['signatory'])) { - $str .= 'visibility:hidden'; - } - $str .= '"></i>'.$info_vised; - $str .= '</span>'; - $str .= '<span class="visaUserAction">'; - $str .= $del_vis; - $str .= '</span>'; - $str .= '<span class="visaUserConsigne">'; - $str .= '<input class="userId" type="hidden" value="'.$info_userSign['user_id'].'"/><input class="visaDate" type="hidden" value="'.$info_userSign['process_date'].'"/><input'.$disabled.' class="consigne" type="text" value="'.$info_userSign['process_comment'].'"/>'; - $str .= '</span>'; - $str .= '<span id="dropZone">'; - $str .= $dropZone; - $str .= '</span>'; - $str .= '</div>'; - ++$i; - } - } - } - - $str .= '</div>'; - - if ($bool_modif == true) { - //SAVE VISA CIRCUIT - $str .= '<input type="button" name="send" id="send" value="'._SAVE_CHANGES.'" class="button" '; - $str .= 'onclick="updateVisaWorkflow('.$res_id.');" /> '; - - //SAVE AS MODEL - $str .= '<input type="button" name="save" id="save" value="Enregistrer comme modèle" class="button" onclick="$(\'modalSaveVisaModel\').style.display = \'block\';" />'; - $str .= '<div id="modalSaveVisaModel" >'; - $str .= '<h3>'._SAVE_POSITION.' '._VISA_WORKFLOW.'</h3><br/>'; - $str .= '<label for="titleModel">'._TITLE.'</label> '; - $str .= '<input type="text" name="titleModel" id="titleModel"/><br/>'; - $str .= '<input type="button" name="saveModel" id="saveModel" value="'._VALIDATE.'" class="button" onclick="saveVisaWorkflowAsModel();" /> '; - $str .= '<input type="button" name="cancelModel" id="cancelModel" value="'._CANCEL.'" class="button" onclick="$(\'modalSaveVisaModel\').style.display = \'none\';" />'; - $str .= '</div>'; - } - $str .= '<script>initDragNDropVisa();</script>'; - - return $str; - } - - /* DOSSIER IMPRESSION */ - public function getJoinedFiles($coll_id, $table, $id, $from_res_attachment = false, $filter_attach_type = 'all') - { - $joinedFiles = array(); - $db = new Database(); - if ($from_res_attachment === false) { - $stmt = $db->query( - 'select res_id, description, subject, title, format, filesize, relation, creation_date from ' - . " res_letterbox where res_id = ? and status <> 'DEL'", - array($id) - ); - } else { - require_once 'modules/attachments/attachments_tables.php'; - if ($filter_attach_type == 'all') { - $stmt = $db->query( - 'select res_id, description, subject, title, format, filesize, res_id_master, attachment_type, creation_date, typist from ' - ." res_attachments where res_id_master = ? and attachment_type <> 'converted_pdf' and attachment_type <> 'print_folder' and status <> 'DEL' order by attachment_type, creation_date", - array($id) - ); - } else { - $stmt = $db->query( - 'select res_id, description, subject, title, format, filesize, res_id_master, attachment_type, creation_date, typist from ' - .' res_attachments ' - ." where res_id_master = ? and attachment_type = '" - .$filter_attach_type."' and status not in ('DEL', 'OBS') order by creation_date", - array($id) - ); - } - } - - while ($res = $stmt->fetchObject()) { - $pdf_exist = true; - if ($from_res_attachment) { - require_once 'modules/attachments/class/attachments_controler.php'; - $ac = new attachments_controler(); - $idFile = $res->res_id; - $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'type' => 'PDF', 'resId' => $idFile, 'collId' => 'attachments_coll']); - $viewLink = $_SESSION['config']['businessappurl'] - .'index.php?display=true&module=attachments&page=view_attachment&res_id_master=' - .$id.'&id='.$res->res_id; - - if (!empty($convertedDocument)) { - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - - if (!file_exists($pathToDocument)) { - $pdf_exist = false; - } - } else { - $pdf_exist = false; - } - } else { - $idFile = $res->res_id; - $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'type' => 'PDF', 'resId' => $idFile, 'collId' => 'letterbox_coll']); - $viewLink = $_SESSION['config']['businessappurl'] - .'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id=' - .$id; - if (!empty($convertedDocument)) { - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - if (!file_exists($pathToDocument)) { - $pdf_exist = false; - } - } else { - $pdf_exist = false; - } - } - $label = ''; - //Tile, or subject or description - if (strlen(trim($res->title)) > 0) { - $label = $res->title; - } elseif (strlen(trim($res->subject)) > 0) { - $label = $res->subject; - } elseif (strlen(trim($res->description)) > 0) { - $label = $res->description; - } - - if (isset($res->attachment_type) && $res->attachment_type != '') { - $attachment_type = $res->attachment_type; - } else { - $attachment_type = ''; - } - - if (isset($res->typist) && $res->typist != '') { - $typist = $res->typist; - } else { - $typist = ''; - } - - if ($pdf_exist == false) { - $collIdConv = ($from_res_attachment) ? 'attachments_coll' : 'letterbox_coll'; - - $viewLinkHtml = '<a id="gen_'.$idFile.'" style="cursor:pointer;" title="'._GENERATE_PDF .'" target="_blank" onclick="generatePdf(\''.$idFile.'\',\''.$collIdConv.'\')">' - .'<i id="spinner_'.$idFile.'" class="fa fa-sync-alt fa-2x" title="'._GENERATE_PDF.'"></i>' - .'</a>'; - } else { - $viewLinkHtml = ''; - } - array_push( - $joinedFiles, - array('id' => $idFile, //ID - 'label' => $label, //Label - 'format' => $res->format, //Format - 'filesize' => $res->filesize, //Filesize - 'creation_date' => $res->creation_date, //Filesize - 'attachment_type' => $attachment_type, //attachment_type - 'typist' => $typist, //attachment_type - 'pdf_exist' => $pdf_exist, - 'version' => '', - 'viewLink' => $viewLinkHtml, - ) - ); - } - - return $joinedFiles; - } - - public function showPrintFolder($coll_id, $table, $id) - { - require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'] - .DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR - .'class_indexing_searching_app.php'; - $is = new indexing_searching_app(); - - require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'] - .DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR - .'class_users.php'; - - $users_tools = new class_users(); - - require_once 'core/class/class_request.php'; - - $request = new request(); - - require_once 'core/class/class_security.php'; - $sec = new security(); - $view = $sec->retrieve_view_from_coll_id($coll_id); - $stmt = $this->query("select subject, contact_society, category_id from $view where res_id = ?", array($id)); - $res = $stmt->fetchObject(); - $str = ''; - $str .= '<div align="left" class="block">'; - $str .= '<div class="error" id="divErrorPrint" name="divErrorPrint" onclick="this.hide();"></div>'; - - $str .= '<p><b>Requérant</b> : '.$res->contact_society.'</p>'; - $str .= '<p><b>'._SUBJECT.'</b> : '.$res->subject.'</p>'; - $str .= '<hr/>'; - $str .= '<form style="width:99%;" name="print_folder_form" id="print_folder_form" action="#" method="post">'; - $str .= '<table style="width:99%;" name="print_folder" id="print_folder" >'; - $str .= '<thead><tr><th style="width:25%;text-align:left;"></th><th style="width:40%;text-align:left;">Titre</th><th style="width:20%;text-align:left;">Rédacteur</th><th style="width:10%;text-align:left;">Date</th><th style="width:5%;text-align:left;"><input title="'._SELECT_ALL.'" id="allPrintFolder" type="checkbox" onclick="selectAllPrintFolder();"></th></tr></thead>'; - $str .= '<tbody>'; - - if ($res->category_id != 'outgoing') { - $str .= '<tr><td><h3>+ Courrier entrant</h3></td><td></td><td></td><td></td><td></td></tr>'; - $joined_files = $this->getJoinedFiles($coll_id, $table, $id, false); - for ($i = 0; $i < count($joined_files); ++$i) { - //Get data - $id_doc = $joined_files[$i]['id']; - $description = $joined_files[$i]['label']; - $format = $joined_files[$i]['format']; - - $contact = $users_tools->get_user($joined_files[$i]['typist']); - $dateFormat = explode(' ', $joined_files[$i]['creation_date']); - $creation_date = $request->dateformat($dateFormat[0]); - if ($joined_files[$i]['pdf_exist']) { - $check = 'class="check checkPrintFolder" checked="checked"'; - } else { - $check = ' disabled title="'._NO_PDF_FILE.'"'; - } - //Show data - $str .= '<tr><td></td><td>'.$description.'</td><td>'.$res->contact_society - .'</td><td>'.$creation_date.'</td><td><input id="join_file_' - .$id_doc.'" type="checkbox" name="join_file[]" value="'.$id_doc.'" '.$check - .'/>'.$joined_files[$i]['viewLink'].'</td></tr>'; - } - } - //ATTACHMENTS TYPES LOOP - foreach ($_SESSION['attachment_types'] as $attachmentTypeId => $attachmentTypeLabel) { - if ($attachmentTypeId != 'print_folder' && $attachmentTypeId != 'converted_pdf') { - $joined_files = $this->getJoinedFiles($coll_id, $table, $id, true, $attachmentTypeId); - if (count($joined_files) > 0) { - $str .= '<tr><td><h3>+ '.$attachmentTypeLabel.'</h3></td><td></td><td></td><td></td><td></td></tr>'; - for ($i = 0; $i < count($joined_files); ++$i) { - $id_doc = $joined_files[$i]['id']; - $description = $joined_files[$i]['label']; - $format = $joined_files[$i]['format']; - $contact = $users_tools->get_user($joined_files[$i]['typist']); - $dateFormat = explode(' ', $joined_files[$i]['creation_date']); - $creation_date = $request->dateformat($dateFormat[0]); - if ($joined_files[$i]['pdf_exist']) { - $check = 'class="check checkPrintFolder" checked="checked"'; - } else { - $check = ' disabled title="'._NO_PDF_FILE.'"'; - } - - $str .= '<tr><td></td><td>'.$description.'</td><td>'.$contact['firstname'].' ' - .$contact['lastname'].'</td><td>'.$creation_date.'</td><td><input id="join_file_' - .$id_doc.'" type="checkbox" name="join_attachment[]" value="'.$id_doc.'" '.$check - .'/>'.$joined_files[$i]['viewLink'].'</td></tr>'; - } - } - } - } - - //NOTES - $core_tools = new core_tools(); - if ($core_tools->is_module_loaded('notes')) { - require_once 'modules'.DIRECTORY_SEPARATOR.'notes'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'; - - $notes_tools = new notes(); - $user_notes = $notes_tools->getUserNotes($id, $coll_id); - if (count($user_notes) > 0) { - $str .= '<tr><td><h3>+ '._NOTES.'</h3></td><td></td><td></td><td></td><td></td></tr>'; - for ($i = 0; $i < count($user_notes); ++$i) { - //Get data - $idNote = $user_notes[$i]['id']; - //$noteShort = $request->cut_string($user_notes[$i]['label'], 50); - $noteShort = $request->cut_string( - str_replace(array("'", "\r", "\n", '"'), array("'", ' ', ' ', '"'), $user_notes[$i]['label']), - 50 - ); - $noteShort = functions::xssafe($noteShort); - $note = $user_notes[$i]['label']; - $userArray = $users_tools->get_user($user_notes[$i]['author']); - $date = $request->dateformat($user_notes[$i]['date']); - - $check = ' '; - - $str .= '<tr><td></td><td>'.$noteShort.'</td><td>' - .$userArray['firstname'].' '.$userArray['lastname'] - .'</td><td>'.$date.'</td><td><input id="note_'.$idNote.'" class="checkPrintFolder" type="checkbox" name="notes[]" value="' - .$idNote.'" '.$check.'/></td></tr>'; - } - } - } - - $str .= '</body>'; - $str .= '</table>'; - - $path_to_script = $_SESSION['config']['businessappurl'] - .'index.php?display=true&module=visa&page=printFolder_ajax'; - - $str .= '<hr/>'; - $str .= '<input style="margin-left:44%" type="button" name="send" id="send" value="Imprimer" class="button" onclick="printFolder(\''.$id.'\', \''.$coll_id.'\', \'print_folder_form\', \''.$path_to_script.'\');" /> '; - $str .= '</form>'; - $str .= '</div>'; - - return $str; - } - - public function isAllAttachementSigned($res_id) - { - $db = new Database(); - $stmt2 = $db->query("SELECT count(1) as nb from res_attachments WHERE in_signature_book = true AND signatory_user_serial_id IS NULL AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('converted_pdf','print_folder','signed_response') AND res_id_master = ?", array($res_id)); - $res2 = $stmt2->fetchObject(); - $stmt3 = $db->query("SELECT count(1) as nb from res_attachments WHERE in_signature_book = true AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('converted_pdf','print_folder','signed_response') AND res_id_master = ?", array($res_id)); - $res3 = $stmt3->fetchObject(); - if ($res3->nb == 0) { - return 'noAttachment'; - } elseif ($res2->nb == 0) { - return 'yes'; - } else { - return false; - } - } - - public function currentUserSignRequired($res_id) - { - $user_id = $this->getCurrentUserStep($res_id); - if ($_SESSION['user']['UserId'] != $user_id) { - return 'false'; - } - $db = new Database(); - $stmt = $db->query("SELECT count(listinstance_id) as nb from listinstance l where l.res_id=? AND l.item_id=? AND l.difflist_type='VISA_CIRCUIT' AND l.requested_signature='true'", array($res_id, $user_id)); - $res = $stmt->fetchObject(); - $stmt2 = $db->query("SELECT count(1) as nb from res_attachments r where r.res_id_master=? AND r.signatory_user_serial_id = (select id from users where user_id = ?) AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('converted_pdf','print_folder')", array($res_id, $user_id)); - $res2 = $stmt2->fetchObject(); - - if ($res->nb > 0 && $res2->nb == 0) { - return 'true'; - } else { - return 'false'; - } - } } abstract class PdfNotes_Abstract extends FPDI { public function LoadData($tab, $collId) { - require_once 'modules/notes/notes_tables.php'; require_once 'core/class/class_request.php'; $request = new request(); // Lecture des lignes du fichier @@ -1032,7 +106,7 @@ abstract class PdfNotes_Abstract extends FPDI //Check if ID exists $stmt2 = $db2->query( 'SELECT n.identifier, n.creation_date, n.user_id, n.note_text, u.lastname, ' - .'u.firstname FROM '.NOTES_TABLE.' n inner join '.USERS_TABLE + .'u.firstname FROM notes n inner join '.USERS_TABLE .' u on n.user_id = u.user_id WHERE n.id = :Id ', [':Id' => $id] ); @@ -1165,141 +239,3 @@ abstract class ConcatPdf_Abstract extends FPDI } } } - -/* EXEMPLE TAB VISA_CIRCUIT - -Array -( - [coll_id] => letterbox_coll - [res_id] => 190 - [difflist_type] => entity_id - [sign] => Array - ( - [users] => Array - ( - [0] => Array - ( - [user_id] => sgros - [lastname] => GROS - [firstname] => Sébastien - [entity_id] => CHEFCABINET - [entity_label] => Chefferie - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - ) - - ) - - [visa] => Array - ( - [users] => Array - ( - [0] => Array - ( - [user_id] => sbes - [lastname] => BES - [firstname] => Stéphanie - [entity_id] => CHEFCABINET - [entity_label] => Chefferie - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - [1] => Array - ( - [user_id] => fbenrabia - [lastname] => BENRABIA - [firstname] => Fadela - [entity_id] => POLESOCIAL - [entity_label] => Pôle social - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - [2] => Array - ( - [user_id] => bpont - [lastname] => PONT - [firstname] => Brieuc - [entity_id] => POLEAFFAIRESETRANGERES - [entity_label] => Pôle affaires étrangères - [visible] => Y - [viewed] => 0 - [difflist_type] => VISA_CIRCUIT - [process_date] => - [process_comment] => - ) - - ) - - ) - -) - - - - - -<h3>Document</h3><pre>Array -( - [0] => Array - ( - [id] => 197 - [label] => 123456 - [format] => pdf - [filesize] => 46468 - [attachment_type] => - [is_version] => - [version] => - ) - -) -</pre><h3>Document</h3><pre>Array -( - [0] => Array - ( - [id] => 400 - [label] => reponse 1 v5 - [format] => docx - [filesize] => 36219 - [attachment_type] => response_project - [is_version] => - [version] => - ) - - [1] => Array - ( - [id] => 409 - [label] => Nouvelle PJ - [format] => pdf - [filesize] => 1204460 - [attachment_type] => simple_attachment - [is_version] => - [version] => - ) - - [2] => Array - ( - [id] => 410 - [label] => pj 2 - [format] => pdf - [filesize] => 361365 - [attachment_type] => simple_attachment - [is_version] => - [version] => - ) - -) - -*/ diff --git a/modules/visa/create_sep.php b/modules/visa/create_sep.php deleted file mode 100755 index 5b5032505989b49b647404a219bc633eb733a25d..0000000000000000000000000000000000000000 --- a/modules/visa/create_sep.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -$core_path = $_SESSION['config']['corepath']; -$core_path = str_replace("\\", "/", $core_path); -define('FPDF_FONTPATH',$core_path.'apps/maarch_entreprise/tools/pdflib/font/'); -//above line is import to define, otherwise it gives an error : Could not include font metric file -require($core_path.'apps/maarch_entreprise/tools/pdflib/fpdf.php'); - - -if(isset($argv[1])){ - $service = $argv[1]; - $dossier = $argv[2]; - $label = $argv[3]; -} -else { - $service = $_REQUEST['service']; - $dossier = $_REQUEST['path']; - $label = $_REQUEST['label']; -} - - -$pdf = new FPDF(); -$pdf->AddPage(); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->Cell(180,10,'',0,1, 'C'); -$pdf->SetFont('Arial','B',12); -$pdf->Cell(180,10, utf8_decode($label),1,1, 'C'); - -$filename = $dossier."/sep_".$service.".pdf"; -$pdf->Output($filename, 'F'); -?> \ No newline at end of file diff --git a/modules/visa/css/module.css b/modules/visa/css/module.css index cad0c3c9e331a3c87732b69280cc4cc293c6a14e..85371ed27c9db422327ddaf3bf62bbd174deb1fb 100755 --- a/modules/visa/css/module.css +++ b/modules/visa/css/module.css @@ -48,55 +48,10 @@ width:100%; } -#modalPIN{ - padding-top:50px; - z-index: 1050; - width: 300px; - height: 80px; - border: 2px solid #000; - display: none; - position: absolute; - background-color: #F2F2F2; - left: 40%; - top: 40%; - text-align: center; -} - -#modalSaveVisaModel{ - padding-top:20px; - z-index: 1050; - width: 300px; - height: 80px; - border: 2px solid #000; - display: none; - position: absolute; - background-color: #F2F2F2; - left: 40%; - top: 10%; - text-align: center; -} - -.listDocsBasket{ - border-collapse: collapse; - height: 96%; - width: 100%; - overflow-y: scroll; -} - -.listDocsBasket div{ - width:100%; - border-bottom: thin solid black; -} - .selectedId{ background-color:#F99830; } - -.listDocsBasket li{ - padding:5px; -} - #tab_visaSetWorkflow td{ white-space: pre; } diff --git a/modules/visa/getVisaModelByTitle.php b/modules/visa/getVisaModelByTitle.php deleted file mode 100755 index ff41e1636c637c25d5510b81ddbc18dc4fcf1a09..0000000000000000000000000000000000000000 --- a/modules/visa/getVisaModelByTitle.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - /* - * Copyright 2008-2015 Maarch and Document Image Solutions - * - * This file is part of Maarch Framework. - * - * Maarch Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Maarch Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. - */ - -require_once 'modules' . DIRECTORY_SEPARATOR . 'visa' . DIRECTORY_SEPARATOR - . 'class' . DIRECTORY_SEPARATOR . 'class_modules_tools.php'; - -$core = new core_tools(); -$core->test_user(); - -$title = $_REQUEST['title']; - -$visa = new visa(); -$isFree = $visa->isWorkflowTitleFree($title); -$response = ['isWorkflowTitleFree' => $isFree]; - -echo json_encode($response); -exit(); \ No newline at end of file diff --git a/modules/visa/js/functions.js b/modules/visa/js/functions.js index 1ce45cc730575b545c91244920a3de075576f4ad..8b137891791fe96927ad78e64b0aad7bded08bdc 100755 --- a/modules/visa/js/functions.js +++ b/modules/visa/js/functions.js @@ -1,418 +1 @@ -function addVisaUser(users) { - if (!users) { - nb_visa = $j(".droptarget").length; - next_visa = nb_visa + 1; - if(nb_visa == 0){ - $j("#emptyVisa").hide(); - } - selected = ' selected="selected" '; - - if($j("#isAllAttachementSigned").val() == 'allsigned' || $j("#isAllAttachementSigned").val() == 'false'){ - signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>'; - } else { - signRequest = '<br/><sub><select id="signRequest_'+next_visa+'" disabled="disabled"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>'; - } - - $j("#visa_content").append('<div class="droptarget" id="visa_' + next_visa + '" draggable="true">' - +'<span class="visaUserStatus">' - +'<i class="fa fa-hourglass-half" aria-hidden="true"></i>' - +'</span>' - +'<span class="visaUserInfo">' - +'<sup class="visaUserPos nbResZero">'+next_visa+'</sup> ' - +'<i class="fa fa-user fa-2x" aria-hidden="true"></i> '+ $j("select#visaUserList option:selected").text() +' <sup class="nbRes">'+$j("select#visaUserList option:selected").parent().get( 0 ).label+'</sup>' - +'<input class="userId" type="hidden" value="' + $j("select#visaUserList option:selected").val() + '"/><input class="visaDate" type="hidden" value=""/>' - +' <i id="signedUser_'+next_visa+'" title="Personne signataire" class="visaUserSign fa fa-certificate" aria-hidden="true" style="color:#F99830;visibility:hidden;"></i>' - + signRequest - +'</span>' - +'<span class="visaUserAction">' - +'<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);"></i>' - +'</span>' - +'<span class="visaUserConsigne">' - +'<input type="text" class="consigne" value=""/>' - +'</span>' - +'<span id="dropZone" title="Glisser/déposer pour modifier l\'ordre du circuit" style="cursor: pointer">' - +'<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true"></i>' - +'</span>' - +'</div>'); - - //prototype - document.getElementById("visaUserList").selectedIndex = 0; - $j('#visaUserList').trigger("chosen:updated"); - } else { - nb_visa = $j(".droptarget").length; - next_visa = nb_visa + 1; - if(nb_visa == 0){ - $j("#emptyVisa").hide(); - } - - selected = ' selected="selected" '; - - if($j("#isAllAttachementSigned").val() == 'allsigned' || $j("#isAllAttachementSigned").val() == 'false'){ - if (users.requested_signature == true) { - signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false">VISEUR</option><option value="true" '+selected+'>SIGNATAIRE</option></select></sub>'; - } else { - signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>'; - } - } else { - signRequest = '<br/><sub><select id="signRequest_'+next_visa+'" disabled="disabled"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>'; - } - $j("#visa_content").append('<div class="droptarget" id="visa_' + next_visa + '" draggable="true">' - +'<span class="visaUserStatus">' - +'<i class="fa fa-hourglass-half" aria-hidden="true"></i>' - +'</span>' - +'<span class="visaUserInfo">' - +'<sup class="visaUserPos nbResZero">'+next_visa+'</sup> ' - +'<i class="fa fa-user fa-2x" aria-hidden="true"></i> ' + users.lastname + ' ' + users.firstname + ' <sup class="nbRes">'+users.entity_id+'</sup>' - +'<input class="userId" type="hidden" value="' + users.user_id + '"/><input class="visaDate" type="hidden" value=""/>' - +' <i id="signedUser_'+next_visa+'" title="Personne signataire" class="visaUserSign fa fa-certificate" aria-hidden="true" style="color:#F99830;visibility:hidden;"></i>' - + signRequest - +'</span>' - +'<span class="visaUserAction">' - +'<i class="fa fa-trash-alt" aria-hidden="true" onclick="delVisaUser(this.parentElement.parentElement);"></i>' - +'</span>' - +'<span class="visaUserConsigne">' - +'<input type="text" class="consigne" value="' + users.process_comment + '"/>' - +'</span>' - +'<span id="dropZone" title="Glisser/déposer pour modifier l\'ordre du circuit" style="cursor: pointer">' - +'<i class="fa fa-exchange-alt fa-2x fa-rotate-90" aria-hidden="true"></i>' - +'</span>' - +'</div>'); - - } - resetPosVisa(); -} -function delVisaUser(target) { - var id = '#' + target.id; - - if ($j(".droptarget").length == 1) { - $j("#emptyVisa").show(); - } - $j(id).remove(); - - resetPosVisa(); - -} -function resetPosVisa () { - i = 1; - $j(".droptarget").each(function() { - this.id = 'visa_' + i; - $j("#" + this.id).find("select[id^=signRequest_]")[0].id='signRequest_'+i; - $j("#" + this.id).find("[id^=signedUser_]")[0].id='signedUser_'+i; - $j("#" + this.id).find(".visaUserPos").text(i); - i++; - }); - i--; - -} -function updateVisaWorkflow(resId) { - var i = 0; - var userList = []; - var hasSignatory = false; - if (($j("select[id^=signRequest_] option:selected[value=true]").length == 0) && $j(".droptarget").length != 0) { - $j('#signRequest_'+i).val("true"); - } - if ($j(".droptarget").length) { - $j(".droptarget").each(function () { - if ($j("#signRequest_"+(i+1)+" option:selected[value=true]").length) { - userRequestSign=true; - } else { - userRequestSign=false; - } - if ($j("#signedUser_"+(i+1)).css('visibility') == 'visible') { - userSignatory=true; - } else { - userSignatory=false; - } - - userId = $j("#" + this.id).find(".userId").val(); - userConsigne = $j("#" + this.id).find(".consigne").val(); - userVisaDate = $j("#" + this.id).find(".visaDate").val(); - userPos = i; - // last one is signatory if no one selected - if(userRequestSign || userSignatory){ - hasSignatory = true; - } - if ($j("#signRequest_"+(i+2)).length == 0 && !hasSignatory) { - userRequestSign=true; - $j('#signRequest_'+(i+1)).val("true"); - } - userList.push({userId: userId, userPos: userPos, userConsigne: userConsigne, userVisaDate: userVisaDate, userRequestSign: userRequestSign, userSignatory: userSignatory}); - i++; - }); - } - $j.ajax({ - url : 'index.php?display=true&module=visa&page=updateVisaWF', - type : 'POST', - dataType : 'JSON', - data: { - resId: resId, - userList: JSON.stringify(userList) - }, - success : function(response){ - if (response.status == 0) { - var modInfo = $j('<div class="info" id="main_info" onclick="this.remove();">Mise à jour du circuit effectuée</div>'); - modInfo.appendTo('body'); - modInfo.css({'display' : 'table-cell'}); - setTimeout(function() { - modInfo.remove(); - }, 5000); - - if(parent.$j('#visa_tab').length){ - eval(response.exec_js); - } - if(parent.$j('.contentShow iframe').length){ - parent.$j('.contentShow iframe')[0].contentWindow.location.reload(true); - } - } else if (response.status != 1) { - alert(response.error_txt) - } - }, - error : function(error){ - alert(error); - } - - }); - -} -function saveVisaWorkflowAsModel () { - var $i = 0; - var userList = []; - var title = $j("#titleModel").val(); - - if($j(".droptarget").length){ - $j(".droptarget").each(function() { - //console.log('viseur : '+$j("#"+this.id+" .userdId").val()); - userId = $j("#"+this.id).find(".userId").val(); - userConsigne = $j("#"+this.id).find(".consigne").val(); - userVisaDate = $j("#"+this.id).find(".visaDate").val(); - userPos = $i; - userList.push({userId:userId, userPos:userPos, userConsigne:userConsigne, userVisaDate:userVisaDate}); - $i++; - }); - $j.ajax({ - url : 'index.php?display=true&module=visa&page=saveVisaModel', - type : 'POST', - dataType : 'JSON', - data: { - title: title, - userList: JSON.stringify(userList) - }, - success : function(response){ - if (response.status == 0) { - $('divInfoVisa').innerHTML = 'Modèle enregistré'; - $('divInfoVisa').style.display = 'table-cell'; - Element.hide.delay(5, 'divInfoVisa'); - $j('#modalSaveVisaModel').hide(); - eval(response.exec_js); - } else { - alert(response.error_txt) - } - }, - error : function(error){ - alert(error); - } - - }); - - }else{ - alert('Aucun utilisateur dans le circuit !'); - } - -} -function loadVisaModelUsers() { - - var objectId = $j("select#modelList option:selected").val(); - var objectType = 'VISA_CIRCUIT'; - $j.ajax({ - url : 'index.php?display=true&module=visa&page=load_listmodel_visa_users', - type : 'POST', - dataType : 'JSON', - data: { - objectType: objectType, - objectId: objectId - }, - success : function(response){ - if (response.status == 0) { - - var userList = response.result; - if(userList){ - userList.each(function(user, key) { - addVisaUser(user); - }); - } - - - } else { - alert(response.error_txt); - } - }, - error : function(error){ - alert(error); - } - - }); - - //prototype - document.getElementById("modelList").selectedIndex = 0; - $j('#modelList').trigger("chosen:updated"); -} - -function initDragNDropVisa() { - document.getElementById("visa_content").addEventListener("dragstart", function(event) { - $j(".droptarget").not(".vised,.currentVis").css("border","dashed 2px #135F7F33"); - // The dataTransfer.setData() method sets the data type and the value of the dragged data - event.dataTransfer.setData("Text", event.target.id); - - // Output some text when starting to drag the p element - //document.getElementById("demo").innerHTML = "Started to drag the p element."; - - // Change the opacity of the draggable element - event.target.style.opacity = "0.4"; - }); - - // While dragging the p element, change the color of the output text - document.getElementById("visa_content").addEventListener("drag", function(event) { - //document.getElementById("demo").style.color = "red"; - }); - - // Output some text when finished dragging the p element and reset the opacity - document.getElementById("visa_content").addEventListener("dragend", function(event) { - //document.getElementById("demo").innerHTML = "Finished dragging the p element."; - $j(".droptarget").not(".vised,.currentVis").css("border","dashed 2px #135F7F33"); - event.target.style.opacity = "1"; - }); - - - /* Events fired on the drop target */ - - // When the draggable p element enters the droptarget, change the DIVS's border style - document.getElementById("visa_content").addEventListener("dragenter", function(event) { - if ( event.target.className == "droptarget") { - event.target.style.border = "dashed 2px green"; - } - }); - - // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element - document.getElementById("visa_content").addEventListener("dragover", function(event) { - event.preventDefault(); - }); - - // When the draggable p element leaves the droptarget, reset the DIVS's border style - document.getElementById("visa_content").addEventListener("dragleave", function(event) { - if ( event.target.className == "droptarget" ) { - event.target.style.border = "dashed 2px #ccc"; - } - }); - - /* On drop - Prevent the browser default handling of the data (default is open as link on drop) - Reset the color of the output text and DIV's border color - Get the dragged data with the dataTransfer.getData() method - The dragged data is the id of the dragged element ("drag1") - Append the dragged element into the drop element - */ - document.getElementById("visa_content").addEventListener("drop", function(event) { - event.preventDefault(); - if ( event.target.className == "droptarget" ) { - /*event.target.style.border = ""; - var data = event.dataTransfer.getData("Text"); - var oldContent = event.target.innerHTML; - var draggedConsigne = $j('#'+data+' .consigne').val(); - var replaceConsigne = $j('#'+event.target.id+' .consigne').val(); - event.target.innerHTML = document.getElementById(data).innerHTML; - $j('#'+event.target.id+' .consigne').val(draggedConsigne); - document.getElementById(data).innerHTML = oldContent; - $j('#'+data+' .consigne').val(replaceConsigne);*/ - var data = event.dataTransfer.getData("Text"); - var target =event.target.id; - posData = data.split("_"); - posTarget = target.split("_"); - if(posData[1] > posTarget[1]){ - $j('#'+target).before($j('#'+data)); - }else{ - $j('#'+target).after($j('#'+data)); - } - resetPosVisa(); - - - } - }); - $j('#visa_content') - .on('focus', '.consigne', function(e) { - $j(this).closest('.droptarget').attr("draggable", false); - console.log($j(this).closest('.droptarget')); - }) - .on('blur', '.consigne', function(e) { - $j(this).closest('.droptarget').attr("draggable", true); - }); -} - -function setTitle(input) { - input.title = input.value; -} - -//load applet in a modal -function loadAppletSign(url){ - displayModal(url, 'VisaApplet', 300, 300); -} - -function printFolder(res_id, coll_id, form_id, path) { - //console.log("printFolder"); - new Ajax.Request(path, - { - asynchronous: false, - method: 'post', - parameters: Form.serialize(form_id), - encoding: 'UTF-8', - onSuccess: function (answer) { - eval("response = " + answer.responseText); - if (response.status == 0) { - var id_folder = response.id_folder; - var winPrint = window.open('index.php?display=true&module=attachments&page=view_attachment&res_id_master=' + res_id + '&id=' + id_folder, '', 'height=800, width=700,scrollbars=yes,resizable=yes'); - /*winPrint.focus(); - winPrint.print();*/ - } - else if (response.status == 1 || response.status == -1) { - $('divErrorPrint').innerHTML = response.error_txt; - $('divErrorPrint').style.display = 'table-cell'; - Element.hide.delay(5, 'divErrorPrint'); - } - } - }); - -} - -function selectAllPrintFolder() { - console.log($j('#allPrintFolder')[0].checked); - if($j('#allPrintFolder')[0].checked == true){ - $j('.checkPrintFolder').prop('checked', true); - }else{ - $j('.checkPrintFolder').prop('checked', false); - } -} - -function generatePdf(resId, collId) { - $j("#spinner_"+resId).addClass( "fa-spin" ); - $j.ajax({ - url: '?display=true&module=visa&page=generatePdf', - type : 'POST', - dataType : 'json', - data: { - res_id : resId, - coll_id : collId - }, - success: function(result) { - if (result.status == "0") { - parent.document.getElementById('uniqueDetailsIframe').contentWindow.location.reload(); - } else { - $j("#spinner_"+resId).removeClass( "fa-spin" ); - $j("#spinner_"+resId).removeClass( "fa-sync-alt" ); - $j("#spinner_"+resId).addClass( "fa-exclamation-triangle" ); - $j("#spinner_"+resId).css({"cursor":"initial"}) - $j("#spinner_"+resId).prop('title', result.error_txt); - $j("#gen_"+resId).prop("onclick", null).off("click"); - alert(result.error_txt); - } - } - }); -} diff --git a/modules/visa/lang/en.php b/modules/visa/lang/en.php index baac6cf3358778f4448a2a3aa4c401369783e681..5a1eb2e39f87caa739cb99cb597a43c415d6214e 100755 --- a/modules/visa/lang/en.php +++ b/modules/visa/lang/en.php @@ -1,13 +1,5 @@ <?php -if (!defined('_PRINTFOLDER')) { - define('_PRINTFOLDER', 'Print folder'); -} - -if (!defined('_NO_PDF_FILE')) { - define('_NO_PDF_FILE', 'No pdf file for this file'); -} - // CIRCUIT DE VISA if (!defined('_VISA_WORKFLOW')) { define('_VISA_WORKFLOW', 'Visa workflow'); @@ -18,18 +10,6 @@ if (!defined('_INTERRUPT_WORKFLOW')) { if (!defined('_VISA_WORKFLOW_COMMENT')) { define('_VISA_WORKFLOW_COMMENT', 'Visa workflow management'); } -if (!defined('_VIEW_VISA_WORKFLOW')) { - define('_VIEW_VISA_WORKFLOW', 'Visa workflow view'); -} -if (!defined('_VIEW_VISA_WORKFLOW_DESC')) { - define('_VIEW_VISA_WORKFLOW_DESC', 'Allows to view the visa workflow in the parts of diffusion list and in those of progress.'); -} -if (!defined('_EMPTY_USER_LIST')) { - define('_EMPTY_USER_LIST', 'Users list is empty'); -} -if (!defined('_EMPTY_VISA_WORKFLOW')) { - define('_EMPTY_VISA_WORKFLOW', 'No set visa flow'); -} if (!defined('_NO_VISA')) { define('_NO_VISA', 'No designed person on visa'); @@ -37,12 +17,6 @@ if (!defined('_NO_VISA')) { if (!defined('_NO_RESPONSE_PROJECT_VISA')) { define('_NO_RESPONSE_PROJECT_VISA', 'Please, integrate at least one attachment to signature book'); } -if (!defined('_NO_CONVERTED_PDF_VISA')) { - define('_NO_CONVERTED_PDF_VISA', 'Please edit your attachment(s)'); -} -if (!defined('_PLEASE_CONVERT_PDF_VISA')) { - define('_PLEASE_CONVERT_PDF_VISA', 'Please edit the following attachments : '); -} // CIRCUIT D"AVIS if (!defined('_AVIS_WORKFLOW')) { diff --git a/modules/visa/lang/fr.php b/modules/visa/lang/fr.php index 0d6cab89f501c729d54034bd122824304803f9e4..3a13f44f118a46aa4fa03674df6b86d0c4ee9e5d 100755 --- a/modules/visa/lang/fr.php +++ b/modules/visa/lang/fr.php @@ -1,13 +1,5 @@ <?php -if (!defined('_PRINTFOLDER')) { - define('_PRINTFOLDER', "Dossier d'impression"); -} - -if (!defined('_NO_PDF_FILE')) { - define('_NO_PDF_FILE', 'Aucun PDF présent pour ce fichier'); -} - // CIRCUIT DE VISA if (!defined('_VISA_WORKFLOW')) { define('_VISA_WORKFLOW', 'Circuit de visa'); @@ -18,18 +10,6 @@ if (!defined('_INTERRUPT_WORKFLOW')) { if (!defined('_VISA_WORKFLOW_COMMENT')) { define('_VISA_WORKFLOW_COMMENT', 'Gestion du circuit de visa'); } -if (!defined('_VIEW_VISA_WORKFLOW')) { - define('_VIEW_VISA_WORKFLOW', 'Visualisation du circuit de visa'); -} -if (!defined('_VIEW_VISA_WORKFLOW_DESC')) { - define('_VIEW_VISA_WORKFLOW_DESC', "Permet de visualiser le circuit de visa dans les parties de liste de diffusion et dans celles d'avancement."); -} -if (!defined('_EMPTY_USER_LIST')) { - define('_EMPTY_USER_LIST', 'La liste des utilisateurs est vide'); -} -if (!defined('_EMPTY_VISA_WORKFLOW')) { - define('_EMPTY_VISA_WORKFLOW', 'Aucun circuit de visa paramétré'); -} if (!defined('_NO_VISA')) { define('_NO_VISA', 'Aucune personne désignée en visa'); @@ -37,12 +17,6 @@ if (!defined('_NO_VISA')) { if (!defined('_NO_RESPONSE_PROJECT_VISA')) { define('_NO_RESPONSE_PROJECT_VISA', 'Veuillez intégrer au moins une pièce jointe au parapheur.'); } -if (!defined('_NO_CONVERTED_PDF_VISA')) { - define('_NO_CONVERTED_PDF_VISA', 'Veuillez éditer votre/vos pièce(s) jointe(s)'); -} -if (!defined('_PLEASE_CONVERT_PDF_VISA')) { - define('_PLEASE_CONVERT_PDF_VISA', 'Veuillez éditer les pièces jointes suivantes : '); -} // CIRCUIT D"AVIS if (!defined('_AVIS_WORKFLOW')) { diff --git a/modules/visa/lang/nl.php b/modules/visa/lang/nl.php index 5474d5dd5fcc1eace20b8798f980dc90aad0e3e4..29d7385e74c343b642dea8a8a11f841f22ea33d6 100755 --- a/modules/visa/lang/nl.php +++ b/modules/visa/lang/nl.php @@ -4,12 +4,7 @@ * See LICENCE.txt file at the root folder for more details. * This file is part of Maarch software. */ -if (!defined('_PRINTFOLDER')) { - define('_PRINTFOLDER', 'Afdrukmap'); -} -if (!defined('_NO_PDF_FILE')) { - define('_NO_PDF_FILE', 'Geen PDF voor dit bestand aanwezig'); -} + if (!defined('_VISA_WORKFLOW')) { define('_VISA_WORKFLOW', 'Goedkeuringscircuit'); } @@ -19,30 +14,12 @@ if (!defined('_INTERRUPT_WORKFLOW')) { if (!defined('_VISA_WORKFLOW_COMMENT')) { define('_VISA_WORKFLOW_COMMENT', 'Beheer van het goedkeuringscircuit'); } -if (!defined('_VIEW_VISA_WORKFLOW')) { - define('_VIEW_VISA_WORKFLOW', 'Weergave van het goedkeuringscircuit'); -} -if (!defined('_VIEW_VISA_WORKFLOW_DESC')) { - define('_VIEW_VISA_WORKFLOW_DESC', 'Om het goedkeuringscircuit weer te geven in de delen van de verdelingslijst en in de vooruitgangslijsten.'); -} -if (!defined('_EMPTY_USER_LIST')) { - define('_EMPTY_USER_LIST', 'De lijst van gebruikers is leeg'); -} -if (!defined('_EMPTY_VISA_WORKFLOW')) { - define('_EMPTY_VISA_WORKFLOW', 'Geen ingesteld berichtencircuit'); -} if (!defined('_NO_VISA')) { define('_NO_VISA', 'Geen persoon aangeduid in de goedkeuring'); } if (!defined('_NO_RESPONSE_PROJECT_VISA')) { define('_NO_RESPONSE_PROJECT_VISA', 'Gelieve minstens één bijlage in de parafeerder te integreren.'); } -if (!defined('_NO_CONVERTED_PDF_VISA')) { - define('_NO_CONVERTED_PDF_VISA', 'Bewerk uw bijlage(n)'); -} -if (!defined('_PLEASE_CONVERT_PDF_VISA')) { - define('_PLEASE_CONVERT_PDF_VISA', 'Bewerk de volgende bijlagen:'); -} if (!defined('_AVIS_WORKFLOW')) { define('_AVIS_WORKFLOW', 'Berichtencircuit'); } diff --git a/modules/visa/load_listmodel_visa.php b/modules/visa/load_listmodel_visa.php deleted file mode 100755 index 4fe6c6a5bebc1505df97a0f0271a5b0970cfa5e3..0000000000000000000000000000000000000000 --- a/modules/visa/load_listmodel_visa.php +++ /dev/null @@ -1,199 +0,0 @@ -<?php -/** -* File : change_doctype.php. -* -* Script called by an ajax object to process the document type change during -* indexing (index_mlb.php) -* -* @version 1 -* -* @since 10/2005 -* -* @license GPL v3 -* @author Cyril Vazquez <dev@maarch.org> -*/ -require_once 'modules/entities/class/class_manage_listdiff.php'; -require_once 'modules'.DIRECTORY_SEPARATOR.'visa'.DIRECTORY_SEPARATOR - .'class'.DIRECTORY_SEPARATOR - .'class_modules_tools.php'; - - $db = new Database(); - $core = new core_tools(); - $core->load_lang(); - $diffList = new diffusion_list(); - - $objectType = $_REQUEST['objectType']; - $objectId = $_REQUEST['objectId']; - $origin = 'visa'; - - // Get listmodel_parameters - $_SESSION[$origin]['difflist_type'] = $diffList->get_difflist_type($objectType); - - if ($objectId != '') { - $_SESSION[$origin]['difflist_object']['object_id'] = $objectId; - if ($objectType == 'entity_id') { - $stmt = $db->query('select entity_label from entities where entity_id = ?', array($objectId)); - $res = $stmt->fetchObject(); - if ($res->entity_label != '') { - $_SESSION[$origin]['difflist_object']['object_label'] = $res->entity_label; - } - } - } - - $roles = $diffList->list_difflist_roles(); - $circuit = $_SESSION[$origin]['diff_list']; - if (!isset($circuit['visa']['users']) && !isset($circuit['sign']['users'])) { - echo "{status : 1, error_txt : 'Modèle inexistant'}"; - exit(); - } - if ($circuit['object_type'] == 'VISA_CIRCUIT') { - $id_tab = 'tab_visaSetWorkflow'; - $id_form = 'form_visaSetWorkflow'; - } else { - $id_tab = 'tab_avisSetWorkflow'; - $id_form = 'form_avisSetWorkflow'; - } - - $content = ''; - - $content .= '<thead><tr>'; - $content .= '<th style="width:40%;" align="left" valign="bottom"><span>Visa</span></th>'; - $content .= '<th style="width:5%;"></th>'; - $content .= '<th style="width:5%;"></th>'; - $content .= '<th style="width:5%;"></th>'; - $content .= '<th style="width:5%;"></th>'; - $content .= '<th style="width:45%;" align="left" valign="bottom"><span>Consigne</span></th>'; - $content .= '<th style="width:0;display:none" align="left" valign="bottom"></th>'; - $content .= '<th style="width:0;display:none" align="center" valign="bottom"></th>'; - - $content .= '</tr></thead>'; - $content .= '<tbody>'; - $color = ''; - $visa = new visa(); - if (isset($circuit['visa']['users'])) { - foreach ($circuit['visa']['users'] as $seq => $step) { - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - - $content .= '<tr '.$color.'>'; - $content .= '<td>'; - - $content .= '<span id="rank_'.$seq.'"> <span class="nbResZero" style="font-weight:bold;opacity:0.5;">'.($seq + 1).'</span> </span>'; - $content .= '<select id="conseiller_'.$seq.'" name="conseiller_'.$seq.'" >'; - $content .= '<option value="" >Sélectionnez un utilisateur</option>'; - - $tab_userentities = $visa->getEntityVis(); - $tab_users = $visa->getUsersVis(); - - /* Order by parent entity **/ - foreach ($tab_userentities as $key => $value) { - $content .= '<optgroup label="'.$tab_userentities[$key]['entity_id'].'">'; - foreach ($tab_users as $user) { - if ($tab_userentities[$key]['entity_id'] == $user['entity_id']) { - $selected = ' '; - if ($user['id'] == $step['user_id']) { - $selected = ' selected'; - } - $content .= '<option value="'.$user['id'].'" '.$selected.'>'.$user['lastname'].', '.$user['firstname'].'</option>'; - } - } - $content .= '</optgroup>'; - } - $content .= '</select>'; - - $content .= '</select>'; - $content .= '<span id="signatory_'.$seq.'">'; - if (empty($circuit['sign']['users']) && $seq == count($circuit['visa']['users']) - 1) { - $content .= ' <i title="Signataire" style="color : #F99830" class="fa fa-certificate fa-lg fa-fw"></i>'; - } - $content .= '</span></td>'; - - $up = ' style="visibility:visible"'; - $down = ' style="visibility:visible"'; - if (empty($circuit['sign']['users']) && $seq == count($circuit['visa']['users']) - 1) { - $add = ' style="visibility:visible"'; - $down = ' style="visibility:hidden"'; - } else { - $add = ' style="visibility:hidden"'; - } - if ($seq == 0) { - $up = ' style="visibility:hidden"'; - } - - $content .= '<td><a href="javascript://" '.$down.' id="down_'.$seq.'" name="down_'.$seq.'" onclick="deplacerLigne(this.parentNode.parentNode.rowIndex, this.parentNode.parentNode.rowIndex+2,\''.$id_tab.'\')" ><i class="fa fa-arrow-down fa-2x"></i></a></td>'; - $content .= '<td><a href="javascript://" '.$up.' id="up_'.$seq.'" name="up_'.$seq.'" onclick="deplacerLigne(this.parentNode.parentNode.rowIndex, this.parentNode.parentNode.rowIndex-1,\''.$id_tab.'\')" ><i class="fa fa-arrow-up fa-2x"></i></a></td>'; - $content .= '<td><a href="javascript://" onclick="delRow(this.parentNode.parentNode.rowIndex,\''.$id_tab.'\')" id="suppr_'.$j.'" name="suppr_'.$j.'" style="visibility:visible;" ><i class="fa fa-user-times fa-2x"></i></a></td>'; - $content .= '<td><a href="javascript://" '.$add.' id="add_'.$seq.'" name="add_'.$seq.'" onclick="addRow(\''.$id_tab.'\')" ><i class="fa fa-user-plus fa-2x"></i></a></td>'; - $content .= '<td><input type="text" id="consigne_'.$seq.'" name="consigne_'.$seq.'" value="'.$step['process_comment'].'" onmouseover="setTitle(this);" style="width:95%;"/></td>'; - $content .= '<td style="display:none"><input type="hidden" value="'.$step['process_date'].'" id="date_'.$seq.'" name="date_'.$seq.'"/></td>'; - $content .= '<td style="display:none"><input type="checkbox" style="visibility:hidden" id="isSign_'.$seq.'" name="isSign_'.$seq.'" /></td>'; - $content .= '<td><i class="fa fa-plus fa-lg" title="Nouvel utilisateur ajouté"></i></td>'; - $content .= '</tr>'; - } - } - -//ajout signataire - if (!empty($circuit['sign']['users'])) { - $seq = count($circuit['visa']['users']); - - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - - $content .= '<tr '.$color.'>'; - - $content .= '<td>'; - $content .= '<span id="rank_'.$seq.'"> <span class="nbResZero" style="font-weight:bold;opacity:0.5;">'.($seq + 1).'</span> </span>'; - $content .= '<select id="conseiller_'.$seq.'" name="conseiller_'.$seq.'" >'; - $content .= '<option value="" >Sélectionnez un utilisateur</option>'; - - $tab_users = $visa->getUsersVis(); - $tab_userentities = $visa->getEntityVis(); - - /* Order by parent entity **/ - foreach ($tab_userentities as $key => $value) { - $content .= '<optgroup label="'.$tab_userentities[$key]['entity_id'].'">'; - foreach ($tab_users as $user) { - if ($tab_userentities[$key]['entity_id'] == $user['entity_id']) { - $selected = ' '; - if ($user['id'] == $circuit['sign']['users'][0]['user_id']) { - $selected = ' selected'; - } - $content .= '<option value="'.$user['id'].'" '.$selected.'>'.$user['lastname'].', '.$user['firstname'].'</option>'; - } - } - $content .= '</optgroup>'; - } - $content .= '</select>'; - $content .= "<span id=\"signatory_' . $j . '\"> <i title=\"Signataire\" style=\"color : #F99830\" class=\"fa fa-certificate fa-lg fa-fw\"></i></span>"; - $content .= '</td>'; - - $up = 'style="visibility:visible"'; - $down = 'style="visibility:hidden"'; - $add = 'style="visibility:visible"'; - $del = 'style="visibility:visible"'; - if (count($circuit['visa']['users']) == 0) { - $up = 'style="visibility:hidden"'; - $del = 'style="visibility:hidden"'; - } - - $content .= '<td><a href="javascript://" '.$down." id=\"down_$seq\" name=\"down_$seq\"".' onclick="deplacerLigne(this.parentNode.parentNode.rowIndex, this.parentNode.parentNode.rowIndex+2,\''.$id_tab.'\')" ><i class="fa fa-arrow-down fa-2x"></i></a></td>'; - $content .= '<td><a href="javascript://" '.$up." id=\"up_$seq\" name=\"up_$seq\"".' onclick="deplacerLigne(this.parentNode.parentNode.rowIndex, this.parentNode.parentNode.rowIndex-1,\''.$id_tab.'\')" ><i class="fa fa-arrow-up fa-2x"></i></a></td>'; - $content .= '<td><a href="javascript://" '.$del." id=\"suppr_$seq\" name=\"suppr_$seq\"".' onclick="delRow(this.parentNode.parentNode.rowIndex,\''.$id_tab."')\" ><i class='fa fa-user-times fa-2x'></i></a></td>"; - $content .= '<td><a href="javascript://" '.$add." id=\"add_$seq\" name=\"add_$seq\"".' onclick="addRow(\''.$id_tab.'\')" ><i class="fa fa-user-plus fa-2x"></i></a></td>'; - $content .= '<td><input type="text" id="consigne_'.$seq.'" name="consigne_'.$seq.'" value="'.$circuit['sign']['users'][0]['process_comment'].'" onmouseover="setTitle(this);" style="width:95%;"/></td>'; - $content .= '<td style="display:none"><input type="hidden" id="date_'.$seq.'" name="date_'.$seq.'" value="'.$circuit['sign']['users'][0]['process_date'].'" /></td>'; - $content .= '<td style="display:none"><input type="checkbox" style="visibility:hidden" id="isSign_'.$seq.'" name="isSign_'.$seq.'" checked/></td>'; - $content .= '<td><i class="fa fa-plus fa-lg" title="Nouvel utilisateur ajouté"></i></td>'; - $content .= '</tr>'; - } - - $content .= '</tbody>'; - - echo "{status : 0, div_content : '".addslashes($content.'<br>')."'}"; - exit(); diff --git a/modules/visa/load_listmodel_visa_users.php b/modules/visa/load_listmodel_visa_users.php deleted file mode 100755 index 22b9930e838f960ecf7124757eb7a3a8bb264544..0000000000000000000000000000000000000000 --- a/modules/visa/load_listmodel_visa_users.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** -* File : load_listmodel_visa_users.php -* -* Script called by an ajax object to retrieve users in visa circuit -* -* -* @package maarch -* @version 1 -* @since 10/2005 -* @license GPL v3 -* @author Alex ORLUC <dev@maarch.org> -*/ -require_once 'modules/entities/class/class_manage_listdiff.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - - -$db = new Database(); -$core = new core_tools(); -$core->load_lang(); -$diffList = new diffusion_list(); - -$objectType = $_REQUEST['objectType']; -$objectId = $_REQUEST['objectId']; -$origin = 'visa'; - -// Get listmodel_parameters -$contentListModel = $diffList->get_listmodel($objectType, $objectId); - -if(!$contentListModel['visa']['users']){ - $contentListModel['visa']['users'] = array(); -} - -if(!$contentListModel['sign']['users']){ - $contentListModel['sign']['users'] = array(); -} - -$userList = array_merge($contentListModel['visa']['users'],$contentListModel['sign']['users']); - -$userList = json_encode($userList); - - -echo "{\"status\" : 0, \"result\" :" . $userList . "}"; -exit(); diff --git a/modules/visa/load_toolbar_visa.php b/modules/visa/load_toolbar_visa.php deleted file mode 100755 index 3a0e06869018a597c7bf270986b76c343af5d643..0000000000000000000000000000000000000000 --- a/modules/visa/load_toolbar_visa.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -$targetTab = $_REQUEST['targetTab']; -$res_id = $_REQUEST['resId']; -$coll_id = $_REQUEST['collId']; - -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; - -$db = new Database(); -$stmt = $db->query("SELECT listinstance_id from listinstance WHERE res_id= ? and coll_id = ? and (item_mode = ? OR item_mode = ?)", array($res_id, $coll_id, 'visa', 'sign')); -$nbVisa = $stmt->rowCount(); - -if ($nbVisa == 0){ - $class = 'nbResZero'; - $style2 = 'display:none;'; - $style = '0.5'; - $styleDetail = '#9AA7AB'; -} -else{ - $class = 'nbRes'; - $style = ''; - $style2 = 'display:inherit;'; - $styleDetail = '#666'; -} -if($_SESSION['req'] == 'details'){ - if($nbVisa == 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')){ - $nav = 'visa_tab'; - $style2 = 'visibility:hidden;'; - - } - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbVisa.'</span>\''; - - }else { - $js .= '$(\''.$targetTab.'\').style.color=\''.$styleDetail.'\';$(\''.$targetTab.'_badge\').innerHTML = \'<span id="nb_'.$targetTab.'" style="'.$style2.'font-size: 10px;" class="'.$class.'">'.$nbVisa.'</span>\''; - - } -}else{ - if($_REQUEST['origin'] == 'parent'){ - $js .= 'parent.$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';parent.$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbVisa.'</span></sup>\''; - - }else { - $js .= '$(\''.$targetTab.'_img\').style.opacity=\''.$style.'\';$(\''.$targetTab.'_badge\').innerHTML = \' <sup><span id="nb_'.$targetTab.'" style="'.$style2.'" class="'.$class.'">'.$nbVisa.'</span></sup>\''; - - } -} - -echo "{status : 0, nav : '".$nav."',content : '', error : '', exec_js : '".addslashes($js)."'}"; -exit (); \ No newline at end of file diff --git a/modules/visa/printFolder_ajax.php b/modules/visa/printFolder_ajax.php deleted file mode 100755 index eb7cd3e415820e1bb3aff604d870993f1feda140..0000000000000000000000000000000000000000 --- a/modules/visa/printFolder_ajax.php +++ /dev/null @@ -1,316 +0,0 @@ -<?php - -/* -* Copyright 2015 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -function createPdfNotes($list_notes, $coll_id) -{ - require_once("modules".DIRECTORY_SEPARATOR."visa".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); - $pdf = new PdfNotes(); - $pdf->addPage(); - $data = $pdf->LoadData($list_notes, $coll_id); - $header = array('Nom', 'Consigne', 'Date'); - $pdf->SetFont('Arial', 'B', 12); - $pdf->SetY(30); - //$pdf->Table($header, $data); - $pdf->SetWidths(array(40,30,100)); - $pdf->SetAligns(array('C','C','C')); - $pdf->Row(array('Nom', 'Date', 'Note')); - $pdf->SetAligns(array('L','C','L')); - $pdf->SetFont('Arial', '', 10); - foreach ($data as $d) { - $pdf->Row($d); - } - - $filePathOnTmp = $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR . "listNotes".$_SESSION['user']['UserId'].".pdf"; - $pdf->Output($filePathOnTmp, 'F'); - return $filePathOnTmp; -} - - -function concat_files($folder) -{ - $tmpFileName = 'tmp_print_folder_' . rand() . '.pdf'; - $filePathOnTmp = $_SESSION['config']['tmppath'] . $tmpFileName; - - $command = "pdfunite " . implode(" ", $folder) . ' ' . $filePathOnTmp; - - - exec($command.' 2>&1', $output, $return); - - if (!file_exists($filePathOnTmp)) { - return $output[0]; - } else { - return $filePathOnTmp; - } -} - -function ajout_bdd($tmpFolderFile, $res_id_master) -{ - require_once 'modules/attachments/attachments_tables.php'; - require_once 'core/class/docservers_controler.php'; - require_once "core/class/class_security.php"; - - $sec = new security(); - $docserverControler = new docservers_controler(); - if (! isset($_SESSION['collection_id_choice']) - || empty($_SESSION['collection_id_choice']) - ) { - $_SESSION['collection_id_choice'] = $_SESSION['user']['collections'][0]; - } - - $docserver = $docserverControler->getDocserverToInsert( - $_SESSION['collection_id_choice'] - ); - if (empty($docserver)) { - $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' - . _NO_AVAILABLE_DOCSERVER . ". " . _MORE_INFOS . "."; - $location = ""; - } else { - $filesize = filesize($tmpFolderFile); - $newSize = $docserverControler->checkSize( - $docserver, - $filesize - ); - if ($newSize == 0) { - $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' - . _NOT_ENOUGH_DISK_SPACE . ". " . _MORE_INFOS . "."; - } else { - $basename = pathinfo($tmpFolderFile, PATHINFO_BASENAME); - $fileInfos = array( - "tmpDir" => $_SESSION['config']['tmppath'], - "size" => $filesize, - "format" => 'pdf', - "tmpFileName" => $basename - ); - - $storeResult = array(); - $storeResult = $docserverControler->storeResourceOnDocserver( - $_SESSION['collection_id_choice'], - $fileInfos - ); - - if (isset($storeResult['error']) && $storeResult['error'] <> '') { - $_SESSION['error'] = $storeResult['error']; - } else { - $resAttach = new resource(); - $title = "Dossier du document n°".$_SESSION['doc_id']; - $_SESSION['data'] = array(); - array_push( - $_SESSION['data'], - array( - 'column' => "typist", - 'value' => $_SESSION['user']['UserId'], - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "format", - 'value' => 'pdf', - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "docserver_id", - 'value' => $storeResult['docserver_id'], - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "status", - 'value' => 'TRA', - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "offset_doc", - 'value' => ' ', - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "title", - 'value' => $title, - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "attachment_type", - 'value' => 'print_folder', - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "coll_id", - 'value' => $_SESSION['collection_id_choice'], - 'type' => "string", - ) - ); - array_push( - $_SESSION['data'], - array( - 'column' => "res_id_master", - 'value' => $_SESSION['doc_id'], - 'type' => "integer", - ) - ); - - - array_push( - $_SESSION['data'], - array( - 'column' => "type_id", - 'value' => 0, - 'type' => "int", - ) - ); - - array_push( - $_SESSION['data'], - array( - 'column' => "relation", - 'value' => 1, - 'type' => "int", - ) - ); - - $id = $resAttach->load_into_db( - RES_ATTACHMENTS_TABLE, - $storeResult['destination_dir'], - $storeResult['file_destination_name'], - $storeResult['path_template'], - $storeResult['docserver_id'], - $_SESSION['data'], - $_SESSION['config']['databasetype'] - ); - - if ($id == false) { - $_SESSION['error'] = $resAttach->get_error(); - } else { - /*if ($_SESSION['history']['attachadd'] == "true") { - $hist = new history(); - $view = $sec->retrieve_view_from_coll_id( - $_SESSION['collection_id_choice'] - ); - $hist->add( - $view, $_SESSION['doc_id'], "ADD", 'attachadd', - ucfirst(_DOC_NUM) . $id . ' ' - . _NEW_ATTACH_ADDED . ' ' . _TO_MASTER_DOCUMENT - . $_SESSION['doc_id'], - $_SESSION['config']['databasetype'], - 'apps' - ); - $_SESSION['info'] = _NEW_ATTACH_ADDED; - $hist->add( - RES_ATTACHMENTS_TABLE, $id, "ADD",'attachadd', - $_SESSION['info'] . " (" . $title - . ") ", - $_SESSION['config']['databasetype'], - 'attachments' - ); - }*/ - return $id; - } - } - } - } -} - -require_once "core/class/class_security.php"; -require_once 'modules/attachments/class/attachments_controler.php'; -require_once 'core/class/class_request.php'; -require_once 'core/class/class_resource.php'; - -$sec = new security(); -$ac = new attachments_controler(); -$resource = new resource(); -( - isset($_REQUEST['join_file']) - && count($_REQUEST['join_file']) > 0 -)? $res_master_attached = 'Y' : $res_master_attached = 'N'; -//Version attached -if (isset($_REQUEST['join_attachment']) && count($_REQUEST['join_attachment']) > 0) { - $attachment_list = join(',', $_REQUEST['join_attachment']); -} -//Attachments -if (isset($_REQUEST['join_version']) && count($_REQUEST['join_version']) > 0) { - $version_list = join(',', $_REQUEST['join_version']); -} -//Notes -if (isset($_REQUEST['notes']) && count($_REQUEST['notes']) > 0) { - $note_list = join(',', $_REQUEST['notes']); -} -$list_path_folder = array(); -if ($res_master_attached == 'Y') { - $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => (int)$_REQUEST['join_file'][0], 'type' => 'PDF', 'collId' => 'letterbox_coll']); - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - array_push($list_path_folder, $pathToDocument); -} -if (isset($_REQUEST['join_attachment']) && count($_REQUEST['join_attachment']) > 0) { - foreach ($_REQUEST['join_attachment'] as $id_attach) { - $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $id_attach, 'type' => 'PDF', 'collId' => 'attachments_coll']); - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - array_push($list_path_folder, $pathToDocument); - } -} -if (isset($_REQUEST['join_version']) && count($_REQUEST['join_version']) > 0) { - foreach ($_REQUEST['join_version'] as $id_attach) { - $convertedDocument = \Convert\models\AdrModel::getConvertedDocumentById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $id_attach, 'type' => 'PDF', 'collId' => 'attachments_coll']); - $docserver = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $convertedDocument['docserver_id'], 'select' => ['path_template']]); - $pathToDocument = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $convertedDocument['path']) . $convertedDocument['filename']; - - array_push($list_path_folder, $pathToDocument); - } -} -if (isset($_REQUEST['notes']) && count($_REQUEST['notes']) > 0) { - $path_file_notes = createPdfNotes($_REQUEST['notes'], $_SESSION['user']['collections'][0]); - array_push($list_path_folder, $path_file_notes); -} - -if (count($list_path_folder) == 0) { - echo "{status : 1, error_txt : '"._NO_FILE_PRINT."'}"; - exit(); -} else { - $out_file = concat_files($list_path_folder); - 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}"; - } - exit(); -} diff --git a/modules/visa/saveVisaModel.php b/modules/visa/saveVisaModel.php deleted file mode 100755 index c6d6eb1783961f6c06443b0a6a3badecfd3bb030..0000000000000000000000000000000000000000 --- a/modules/visa/saveVisaModel.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -/* - * Copyright 2008-2015 Maarch and Document Image Solutions - * - * This file is part of Maarch Framework. - * - * Maarch Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Maarch Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. - */ - -/** - * @brief Save the visa diffusion list - * - * Save the visa diffusion list - * - * @file - * @author Nicolas Couture <couture@docimsol.com> - * @date $date$ - * @version $Revision$ - * @ingroup apps - */ -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - - -$title = $_REQUEST['title']; -$id_list = 'VISA_CIRCUIT_'. strtoupper(base_convert(date('U'), 10, 36)); - - -$userList = json_decode($_REQUEST['userList']); - -$visa = new visa(); -$_SESSION['visa_wf']['diff_list']['visa']['users'] = array(); -$_SESSION['visa_wf']['diff_list']['sign']['users'] = array(); - -$i = 0; -foreach ($userList as $user) { - if (++$i === count($userList)) { - array_push( - $_SESSION['visa_wf']['diff_list']['sign']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userVisaDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'VISA_CIRCUIT' - ) - ); - } else { - array_push( - $_SESSION['visa_wf']['diff_list']['visa']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userVisaDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'VISA_CIRCUIT' - ) - ); - } -} -$visa->saveModelWorkflow($id_list, $_SESSION['visa_wf']['diff_list'], 'VISA_CIRCUIT', $title); - -echo "{\"status\" : 0}"; - -exit(); -?> \ No newline at end of file diff --git a/modules/visa/show_printFolder_tab.php b/modules/visa/show_printFolder_tab.php deleted file mode 100755 index fa16ac066859c9d692c600b24bd6d92b8c9d716b..0000000000000000000000000000000000000000 --- a/modules/visa/show_printFolder_tab.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_security.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - -$res_id = $_REQUEST["resId"]; -$coll_id = $_REQUEST["collId"]; -$table = $_REQUEST["table"]; - -$security = new security(); -$right = $security->test_right_doc($coll_id, $res_id); - -if(!$right){ - exit(_NO_RIGHT_TXT); -} - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$core_tools->load_js(); - -$print_folder = new visa(); -$frm_str .= $print_folder->showPrintFolder($coll_id, $table, $res_id); - -echo $frm_str; \ No newline at end of file diff --git a/modules/visa/show_visa_tab.php b/modules/visa/show_visa_tab.php deleted file mode 100755 index 1363636bbe49d35ec808acbf3c7c07d053978ec7..0000000000000000000000000000000000000000 --- a/modules/visa/show_visa_tab.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php'; -require_once 'modules'.DIRECTORY_SEPARATOR.'visa'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'; - -$res_id = $_REQUEST['resId']; -$coll_id = $_REQUEST['collId']; -$destination = $_REQUEST['destination']; - -$security = new security(); -$right = $security->test_right_doc($coll_id, $res_id); - -if (!$right) { - exit(_NO_RIGHT_TXT); -} - -if (isset($_REQUEST['fromDetail']) && $_REQUEST['fromDetail'] == true) { - $from_detail = true; -} else { - $from_detail = false; -} - -if (isset($_REQUEST['visaStep']) && $_REQUEST['visaStep'] == true) { - $visaStep = true; -} else { - $visaStep = false; -} - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$core_tools->load_js(); - -$modifVisaWorkflow = false; -if ($from_detail == true) { - if ($core_tools->test_service('config_visa_workflow_in_detail', 'visa', false)) { - $modifVisaWorkflow = true; - } -} else { - if ($core_tools->test_service('config_visa_workflow', 'visa', false)) { - $modifVisaWorkflow = true; - } -} - -$frm_str .= '<div class="error" id="divError" name="divError"></div>'; -$frm_str .= '<div style="text-align:center;">'; -$visa = new visa(); -$frm_str .= $visa->getList($res_id, $coll_id, $modifVisaWorkflow, 'VISA_CIRCUIT', $visaStep, $from_detail); - -$frm_str .= '</div><br>'; -/* Historique diffusion visa */ -$frm_str .= '<br/>'; -$frm_str .= '<br/>'; -$frm_str .= '<span class="diff_list_visa_history" style="width: 90%; cursor: pointer;" onmouseover="this.style.cursor=\'pointer\';" onclick="new Effect.toggle(\'diff_list_visa_history_div\', \'blind\', {delay:0.2});whatIsTheDivStatus(\'diff_list_visa_history_div\', \'divStatus_diff_list_visa_history_div\');return false;">'; -$frm_str .= '<span id="divStatus_diff_list_visa_history_div" style="color:#1C99C5;"><i class="fa fa-plus-square"></i></span>'; -$frm_str .= '<b> <small>'._DIFF_LIST_VISA_HISTORY.'</small></b>'; -$frm_str .= '</span>'; - -$frm_str .= '<div id="diff_list_visa_history_div" style="display:none">'; - -$s_id = $res_id; -$return_mode = true; -$diffListType = 'VISA_CIRCUIT'; -require_once 'modules/entities/difflist_visa_history_display.php'; - -$frm_str .= '</div>'; - -//script -$curr_visa_wf = $visa->getWorkflow($res_id, $coll_id, 'VISA_CIRCUIT'); -if ((empty($curr_visa_wf['visa']) || !is_array($curr_visa_wf['visa']) || count($curr_visa_wf['visa']) == 0) && (empty($curr_visa_wf['sign']) || !is_array($curr_visa_wf['sign']) || count($curr_visa_wf['sign']) == 0)) { - $frm_str .= '<script>'; - $frm_str .= '$j("#modelList").val(\''.$destination.'\');$j("#modelList").change();'; - $frm_str .= '</script>'; -} - -echo $frm_str; diff --git a/modules/visa/updateVisaWF.php b/modules/visa/updateVisaWF.php deleted file mode 100755 index d79fb32e14d72b7eac1005f3b9604d64cae5e8bb..0000000000000000000000000000000000000000 --- a/modules/visa/updateVisaWF.php +++ /dev/null @@ -1,72 +0,0 @@ -<?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 updateVisaWF -* @author dev <dev@maarch.org> -* @ingroup visa -*/ - -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - -$res_id = $_REQUEST['resId']; -$coll_id = 'letterbox_coll'; - -$userList = json_decode($_REQUEST['userList']); - -$visa = new visa(); -$_SESSION['visa_wf']['diff_list']['visa']['users'] = array(); -$_SESSION['visa_wf']['diff_list']['sign']['users'] = array(); - -$i = 0; -if ($userList) { - foreach ($userList as $user) { - if (++$i === count($userList)) { - array_push( - $_SESSION['visa_wf']['diff_list']['sign']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userVisaDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'VISA_CIRCUIT', - 'signatory' => $user->userSignatory, - 'requested_signature' => $user->userRequestSign - ) - ); - } else { - array_push( - $_SESSION['visa_wf']['diff_list']['visa']['users'], array( - 'user_id' => $user->userId, - 'process_comment' => $user->userConsigne, - 'process_date' => $user->userVisaDate, - 'viewed' => 0, - 'visible' => 'Y', - 'difflist_type' => 'VISA_CIRCUIT', - 'signatory' => $user->userSignatory, - 'requested_signature' => $user->userRequestSign - ) - ); - } - } -} -$visa->saveWorkflow($res_id, $coll_id, $_SESSION['visa_wf']['diff_list'], 'VISA_CIRCUIT'); - -$db = new Database(); -$stmt = $db->query("SELECT status FROM res_letterbox WHERE res_id = ?", array($res_id)); -$res = $stmt->fetchObject(); -if ($res->status == 'EVIS' || $res->status == 'ESIG') { - $visa->setStatusVisa($res_id, $coll_id, true); -} - -//LOAD TOOLBAR BADGE -$toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=visa&page=load_toolbar_visa&origin=parent&resId=' . $res_id . '&collId=' . $coll_id; -$js ='loadToolbarBadge(\'visa_tab\',\'' . $toolbarBagde_script . '\');'; - - -echo "{\"status\" : 0, \"exec_js\" : \"" . $js . "\"}"; -exit(); diff --git a/modules/visa/xml/IVS/requests_definitions.xml b/modules/visa/xml/IVS/requests_definitions.xml index 7979de938ee4e9f7b57af0ddf8f1899c863b837c..65262b9ffaec21a6b079ea301f2b63425799fe37 100755 --- a/modules/visa/xml/IVS/requests_definitions.xml +++ b/modules/visa/xml/IVS/requests_definitions.xml @@ -15,14 +15,6 @@ <parameter name="page" value="checkSignFile"/> <parameter name="module" value="visa"/> </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="vi_create_sep" > - <parameter name="page" value="create_sep"/> - <parameter name="module" value="visa"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="vi_create_sep" > - <parameter name="page" value="create_sep"/> - <parameter name="module" value="visa"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="vi_encodePinCode" > <parameter name="page" value="encodePinCode"/> <parameter name="module" value="visa"/> @@ -31,27 +23,6 @@ <parameter name="page" value="encodePinCode"/> <parameter name="module" value="visa"/> </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="vi_load_listmodel_visa" > - <parameter name="page" value="load_listmodel_visa"/> - <parameter name="module" value="visa"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="vi_load_listmodel_visa" > - <parameter name="page" value="load_listmodel_visa"/> - <parameter name="module" value="visa"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="vi_saveVisaModel" > - <parameter name="page" value="saveVisaModel"/> - <parameter name="module" value="visa"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="vi_saveVisaModel" > - <parameter name="page" value="saveVisaModel"/> - <parameter name="module" value="visa"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="vi_getVisaModelByTitle" > - <parameter name="display" value="true"/> - <parameter name="module" value="visa"/> - <parameter name="page" value="getVisaModelByTitle"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="vi_saveVisaWF" > <parameter name="page" value="saveVisaWF"/> <parameter name="module" value="visa"/> diff --git a/modules/visa/xml/IVS/validation_rules.xml b/modules/visa/xml/IVS/validation_rules.xml index 249b2d6e95dbc073ebe89229095daaee4aa717bb..2233f56fdce27077e8e0ab11a48aca66ce92aad0 100755 --- a/modules/visa/xml/IVS/validation_rules.xml +++ b/modules/visa/xml/IVS/validation_rules.xml @@ -23,25 +23,9 @@ <validationRule name="vi_checkSignFile" extends="standardForm" mode="error"> <parameter name="res_id" type="integer" /> </validationRule> - <validationRule name="vi_create_sep" extends="standardForm" mode="error"> - <parameter name="service" type="string" /> - <parameter name="path" type="string" /> - <parameter name="label" type="string" /> - </validationRule> <validationRule name="vi_encodePinCode" extends="standardForm" mode="error"> <parameter name="pinCode" type="string" /> </validationRule> - <validationRule name="vi_load_listmodel_visa" extends="standardForm" mode="error"> - <parameter name="objectType" type="identifier" /> - <parameter name="objectId" type="identifier" /> - </validationRule> - <validationRule name="vi_getVisaModelByTitle" extends="standardForm" mode="error"> - <parameter name="title" type="string" /> - </validationRule> - <validationRule name="vi_saveVisaModel" extends="standardForm" mode="error"> - <parameter name="title" type="string" /> - <parameter name="userList" type="string" /> - </validationRule> <validationRule name="vi_saveVisaWF" extends="standardForm" mode="error"> <parameter name="res_id" type="integer" /> <parameter name="coll_id" type="collection_list" /> diff --git a/src/frontend/app/signature-book.component.scss b/src/frontend/app/signature-book.component.scss index bc2f681531d938509e006cea62c04dab90c25c5c..619e6d7cbe5521ed35bb9388a6bbbc42744cb9d1 100755 --- a/src/frontend/app/signature-book.component.scss +++ b/src/frontend/app/signature-book.component.scss @@ -1,19 +1,5 @@ @import "../css/vars.scss"; -#modalSaveVisaModel{ - padding-top:20px; - z-index: 1050; - width: 300px; - height: 80px; - border: 2px solid #000; - display: none; - position: absolute; - background-color: #fbfbfb; - left: 40%; - top: 10%; - text-align: center; -} - .selectedId{ background-color:$secondary; }