Commit 272db9d5 authored by Damien's avatar Damien

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchCourrier!183
parents 85354ebc af4236c3
This diff is collapsed.
This diff is collapsed.
......@@ -162,28 +162,18 @@ function check_form($form_id, $values)
return false;
} else {
foreach ($aResources as $resId) {
$attachments = \Attachment\models\AttachmentModel::getOnView([
$attachments = \Attachment\models\AttachmentModel::get([
'select' => [
'res_id', 'res_id_version', 'title', 'identifier', 'attachment_type',
'res_id', 'title', 'identifier', 'attachment_type',
'status', 'typist', 'docserver_id', 'path', 'filename', 'creation_date',
'validation_date', 'relation', 'attachment_id_master'
'validation_date', 'relation'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
'data' => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
]);
foreach ($attachments as $value) {
if (!empty($value['res_id'])) {
$resIdAttachment = $value['res_id'];
$collId = 'attachments_coll';
$is_version = false;
} else {
$resIdAttachment = $value['res_id_version'];
$collId = 'attachments_version_coll';
$is_version = true;
}
$adrInfo = \Convert\controllers\ConvertPdfController::getConvertedPdfById(['resId' => $resIdAttachment, 'collId' => $collId, 'isVersion' => $is_version]);
$adrInfo = \Convert\controllers\ConvertPdfController::getConvertedPdfById(['resId' => $value['res_id'], 'collId' => 'attachments_coll']);
$docserverInfo = \Docserver\models\DocserverModel::getByDocserverId(['docserverId' => $adrInfo['docserver_id']]);
$filePath = $docserverInfo['path_template'] . str_replace('#', '/', $adrInfo['path']) . $adrInfo['filename'];
if (!is_file($filePath)) {
......@@ -280,15 +270,6 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
]);
}
}
if (!empty($attachmentToFreeze['attachments_version_coll'])) {
foreach ($attachmentToFreeze['attachments_version_coll'] as $resId => $externalId) {
\Attachment\models\AttachmentModel::freezeAttachment([
'resId' => $resId,
'table' => 'res_version_attachments',
'externalId' => $externalId
]);
}
}
}
}
......@@ -346,7 +327,7 @@ function hasAttachmentError()
$noAttachment = [];
foreach ($resIds as $resId) {
$attachments = \Attachment\models\AttachmentModel::getOnView([
$attachments = \Attachment\models\AttachmentModel::get([
'select' => [
'count(1) as nb'
],
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
require_once('core/class/class_core_tools.php');
$Core_Tools = new core_tools;
$Core_Tools->load_lang();
$db = new Database();
$return = '';
$arrayPDO = array();
if ($_REQUEST['society_label'] <> '') {
$selectDuplicates = "SELECT contact_id, user_id, society, lower(society) as lowsoc, society_short,"
. "is_corporate_person, lastname, firstname "
. "from contacts_v2 "
. "WHERE lower(society) in ("
. "SELECT lower(society) FROM contacts_v2 GROUP BY lower(society) "
. " HAVING Count(lower(society)) > 1 and lower(society) <> '' ) and contact_id <> ? and lower(society) = lower(?) "
. "order by lower(society)";
$arrayPDO = array($_REQUEST['contact_id'], $_REQUEST['society_label']);
}
if ($_REQUEST['name'] <> '') {
$selectDuplicates = "SELECT contact_id, lower(lastname||' '||firstname) as lastname_firstname, society, society_short,"
. "is_corporate_person, lastname, firstname, title "
. "from contacts_v2 "
. "WHERE lower(lastname||' '||firstname) in ("
. "SELECT lower(lastname||' '||firstname) as lastname_firstname FROM contacts_v2 GROUP BY lastname_firstname "
. " HAVING Count(lower(lastname||' '||firstname)) > 1 and lower(lastname||' '||firstname) <> ' ') and contact_id <> ? and lower(lastname||' '||firstname) = ? "
. "order by lower(lastname||' '||firstname)";
$arrayPDO = array($_REQUEST['contact_id'], $_REQUEST['name']);
}
if (isset($_REQUEST['contact_id'])) {
//test if res attached to the contact
$query = "SELECT res_id FROM res_view_letterbox WHERE (exp_contact_id = ? or dest_contact_id = ?) and status <> 'DEL'";
$stmt = $db->query($query, array($_REQUEST['contact_id'], $_REQUEST['contact_id']));
$flagResAttached = false;
$return_db = $stmt->fetchObject();
if ($return_db->res_id <> '') {
$flagResAttached = true;
$stmt = $db->query($selectDuplicates, $arrayPDO);
$contactList = array();
array_push($contactList, "Selectionner un contact");
while($lineDoubl = $stmt->fetchObject()) {
$stmt2 = $db->query("SELECT id FROM contact_addresses WHERE contact_id = ?", array($lineDoubl->contact_id));
$result_address = $stmt2->fetchObject();
if ($result_address->id <> '') {
array_push($contactList, $lineDoubl->contact_id);
}
}
}
if ($flagResAttached) {
$return .= _RES_ATTACHED . '. ' . _SELECT_CONTACT_TO_REPLACE;
$return .= ' : <br/>'._NEW_CONTACT.' : <select onchange="loadAddressAttached(this.options[this.selectedIndex].value, '.$_REQUEST['contact_id'].')" id="selectContact_'
. $_REQUEST['contact_id'] . '" name="selectContact_'
. $_REQUEST['contact_id'] . '">"';
for ($cpt=0;$cpt<count($contactList);$cpt++) {
$return .= '<option value="' . $contactList[$cpt] . '">'
. $contactList[$cpt] . '</option>';
}
$return .= '</select>';
$return .= '<br/>' . _NEW_ADDRESS. ' : <select id="selectContactAddress_'
. $_REQUEST['contact_id'] . '" name="selectContactAddress_'
. $_REQUEST['contact_id'] . '">"';
$return .= '</select>';
$return .= '<br/>';
}
$return .= _ARE_YOU_SURE_TO_DELETE_CONTACT;
if ($flagResAttached) {
$return .= '&nbsp;<input type="button" class="button" value="' . _YES . '"'
. ' onclick="deleteContact(' . $_REQUEST['contact_id']
. ', $(\'selectContact_' . $_REQUEST['contact_id'] . '\').value, $(\'selectContactAddress_' . $_REQUEST['contact_id'] . '\').value);" />';
} else {
$return .= '&nbsp;<input type="button" class="button" value="' . _YES . '"'
. ' onclick="deleteContact(' . $_REQUEST['contact_id']
. ', false, false);" />';
}
$return .= '&nbsp;<input type="button" class="button" value="' . _NO . '"'
. ' onclick="new Effect.toggle(\'deleteContactDiv_\'+'
. $_REQUEST['contact_id'] . ', \'blind\' , {delay:0.2});" />';
$status = 0;
} else {
$status = 1;
$return .= '<td colspan="8" style="background-color: red;">';
$return .= '<p style="padding: 10px; color: black;">';
$return .= 'Error loading documents';
$return .= '</p>';
$return .= '</td>';
}
echo "{status : " . $status . ", toShow : '" . addslashes($return) . "'}";
exit ();
......@@ -216,7 +216,6 @@ if (isset($_REQUEST['valid'])) {
exit();
} else {
if($mode <> 'popup'){
$core->start_page_stat();
?>
<div id="header">
<div id="nav">
......
......@@ -205,7 +205,6 @@ if (isset($_REQUEST['valid'])) {
}
exit();
} else {
$core->start_page_stat();
?>
<div id="header">
<div id="nav">
......
......@@ -30,11 +30,6 @@ foreach ($contacts_id as $key => $value) {
$arrayPDO = array($master_contact_id,$value);
$db->query($query, $arrayPDO);
//mise à jour des pièces jointes versionnée
$query = "UPDATE res_version_attachments SET dest_contact_id = ? WHERE dest_contact_id = ?";
$arrayPDO = array($master_contact_id,$value);
$db->query($query, $arrayPDO);
//deplace adresse au master
$query = "UPDATE contact_addresses SET contact_id = ? WHERE contact_id = ?";
$arrayPDO = array($master_contact_id,$value);
......@@ -58,11 +53,6 @@ foreach ($del_address_id as $key => $value) {
$arrayPDO = array($master_address_id,$value);
$db->query($query, $arrayPDO);
//mise à jour des pièces jointes versionnée
$query = "UPDATE res_version_attachments SET dest_address_id = ? WHERE dest_address_id = ?";
$arrayPDO = array($master_address_id,$value);
$db->query($query, $arrayPDO);
//supression de l'adresse
$query = "DELETE FROM contact_addresses WHERE id = ?";
$arrayPDO = array($value);
......
......@@ -91,7 +91,7 @@ if (in_array($loginRequestArray['CAS_VERSION'], ['CAS_VERSION_2_0', 'CAS_VERSION
}
$db = new Database();
$query = "SELECT user_id FROM users WHERE user_id = ?";
$query = "SELECT user_id FROM users WHERE lower(user_id) = lower(?)";
$stmt = $db->query($query, array($userId));
if ($stmt->rowCount() == 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 change_pass
*
* @author dev <dev@maarch.org>
* @ingroup apps
*/
$core_tools = new core_tools();
$core_tools->load_lang();
$core_tools->load_html();
//here we building the header
$core_tools->load_header(_MODIFICATION_PSW);
$time = $core_tools->get_session_time_expire();
$html = "<body onload='setTimeout(window.close, {$time}*60*1000);'>";
$html .= "<div id='container'>";
$html .= "<div id='content'>";
if (!empty($_SESSION['error'])) {
$html .= "<div class='error' style='display:block;'>{$_SESSION['error']}</div>";
}
$_SESSION['error'] = '';
$html .= '<div id="inner_content" class="clearfix">';
$html .= '<h2 class="tit">';
$html .= "<img src='{$_SESSION['config']['businessappurl']}static.php?filename=logo.svg' style='height:130px;'>";
$html .= '<br/><br/>';
if ($_SESSION['user']['cookie_date']) {
$html .= _MODIFICATION_PSW;
} else {
$html .= _FIRST_CONN;
}
$html .= '</h2>';
$html .= '<div class="block">';
if (!$_SESSION['user']['cookie_date']) {
$html .= '<h3>'._YOUR_FIRST_CONNEXION.', '._PLEASE_CHANGE_PSW.'<br/>'._ASKED_ONLY_ONCE.'</h3>';
} else {
$html .= '<h3>'._PSW_REINI.'</h3>';
}
$html .= '<div class="blank_space">&nbsp;</div>';
$html .= "<form name='frmuser' method='post' action='{$_SESSION['config']['businessappurl']}index.php?display=true&page=verif_pass' class='forms' >";
$html .= '<input type="hidden" name="display" value="true" />';
$html .= '<input type="hidden" name="page" value="verif_pass" />';
$html .= '<p>';
$html .= '<label>'._ID.' : </label>';
$html .= "<input type='text' readonly='readonly' class='readonly' value='{$_SESSION['user']['UserId']}'/>";
$html .= '</p>';
$html .= '<p>';
$html .= '<label>'._PASSWORD.' : </label>';
$html .= '<input name="pass1" type="password" id="pass1" value="" /> <span class="red_asterisk"><i class="fa fa-star"></i></span>';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>'._REENTER_PSW.' : </label>';
$html .= '<input name="pass2" type="password" id="pass2" value="" /> <span class="red_asterisk"><i class="fa fa-star"></i></span>';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>'._LASTNAME.' : </label>';
$html .= "<input name='LastName' type='text' id='LastName' value='{$_SESSION['user']['LastName']}' /> <span class='red_asterisk'><i class='fa fa-star'></i></span>";
$html .= '</p>';
$html .= '<p>';
$html .= '<label>'._FIRSTNAME.' : </label>';
$html .= "<input name='FirstName' type='text' id='FirstName' value='{$_SESSION['user']['FirstName']}' /> <span class='red_asterisk'><i class='fa fa-star'></i></span>";
$html .= '</p>';
if (!$core_tools->is_module_loaded('entities')) {
$html .= '<p>';
$html .= '<label>'._DEPARTMENT.' : </label>';
$html .= "<input name='Department' type='text' id='Department' value='{$_SESSION['user']['department']}' />";
$html .= '</p>';
}
$html .= '<p>';
$html .= '<label>'._PHONE_NUMBER.' : </label>';
$html .= "<input name='Phone' type='text' id='Phone' value='{$_SESSION['user']['Phone']}' />";
$html .= '</p>';
$html .= '<p>';
$html .= '<label>'._MAIL.' : </label>';
$html .= "<input name='Mail' type='text' id='Mail' value='{$_SESSION['user']['Mail']}'/> <span class='red_asterisk'><i class='fa fa-star'></i></span>";
$html .= '</p>';
$html .= '<p class="buttons">';
$html .= '<input type="submit" name="Submit" value="'._VALIDATE.'" class="button" />';
$html .= ' <input type="button" name="cancel" value="'._CANCEL.'" class="button" onclick="window.location.href=\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=login\';" />';
$html .= '</p>';
$html .= '</form>';
$html .= '</div>';
$html .= '<div class="block_end">&nbsp;</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div id="footer">&nbsp;</div>';
$html .= '</div>';
$html .= '</body>';
$html .= '</html>';
echo $html;
......@@ -447,18 +447,6 @@ abstract class business_app_tools_Abstract extends Database
. DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR
. $_SESSION['config']['lang'] . '.php';
$_SESSION['processing_modes'] = array();
$processingModes = $xmlfile->process_modes;
if(count($processingModes) > 0) {
foreach ($processingModes->process_mode as $process ) {
$label = (string) $process->label;
$_SESSION['processing_modes'][(string) $process->label] = $label;
$process_mode_priority = (string) $process->process_mode_priority;
$_SESSION['process_mode_priority'][(string) $process->label] = $process_mode_priority;
}
}
$_SESSION['attachment_types'] = array();
$_SESSION['attachment_types_with_chrono'] = array();
$_SESSION['attachment_types_show'] = array();
......
......@@ -1250,43 +1250,6 @@ abstract class lists_Abstract extends Database
}
}
protected function _tmplt_showActionBasketsFA($parameter, $resultTheLine)
{
$my_explode = explode('|', $parameter);
if (!$my_explode[1]) {
return _WRONG_PARAM_FOR_LOAD_VALUE;
} else {
if (count($my_explode) >= 4) {
//Init
$actionIsDisabled = false;
//Check if action is disabled
if (isset($my_explode[4]) && !empty($my_explode[4])) {
$actionIsDisabled = $this->_checkDisabledRules($my_explode[4], $resultTheLine);
}
//If disabled, return blank
if ($actionIsDisabled) {
return '&nbsp;';
} else {
$db = new Database();
$stmt = $db->query("SELECT res_id_master FROM res_view_attachments WHERE status = 'EXP_RTURN' AND validation_date < CURRENT_TIMESTAMP AND res_id_master = ?",
[$resultTheLine[0]['res_id']]);
$color = '';
if ($stmt->rowCount() >= 1) {
$color = 'style="color: red"';
}
//return action icon
return '<a href="javascript://" onClick="'.$my_explode[3]
.'" title="'.$my_explode[1].'"><i class="fa fa-'
.$my_explode[2].' fa-2x" '.$color.' title="'.$my_explode[1].'"></i></a>';
}
} else {
return _WRONG_PARAM_FOR_LOAD_VALUE;
}
}
}
protected function _tmplt_func_isConfidential($resultTheLine)
{
$db = new Database();
......@@ -1326,7 +1289,7 @@ abstract class lists_Abstract extends Database
}
$db = new Database();
$stmt = $db->query(
"SELECT count(*) as total FROM res_view_attachments WHERE res_id_master = ? and status not in ('DEL','OBS','TMP') and lower(translate(title,'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ','aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr')) like lower(?)", array($resultTheLine[0]['res_id'], $_SESSION['searching']['where_request_parameters'][':subject'])
"SELECT count(1) as total FROM res_attachments WHERE res_id_master = ? and status not in ('DEL','OBS','TMP') and lower(translate(title,'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ','aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr')) like lower(?)", array($resultTheLine[0]['res_id'], $_SESSION['searching']['where_request_parameters'][':subject'])
);
$res_attach = $stmt->fetchObject();
if ($res_attach->total > 0) {
......@@ -1562,12 +1525,6 @@ abstract class lists_Abstract extends Database
$inSendAttach = $value['value'];
}
}
$isVersion = 'false';
if ($resultTheLine[1]['value'] > 1) {
$isVersion = 'true';
}
$return = '<div>';
......@@ -1586,7 +1543,7 @@ abstract class lists_Abstract extends Database
$return .= 'disabled ';
}
$return .= 'onclick="setSendAttachment('.$resultTheLine[0]['value'].', '.$isVersion.');"/><label';
$return .= 'onclick="setSendAttachment('.$resultTheLine[0]['value'].');"/><label';
if (!$mailevaEnabled) {
$return .= ' style="opacity: 0.5; cursor: default" ';
}
......@@ -1602,7 +1559,7 @@ abstract class lists_Abstract extends Database
$return .= 'checked ';
}
$return .= 'onclick="setAttachmentInSignatureBook('.$resultTheLine[0]['value'].', '.$isVersion.');"/><label for="final'. $count .'">'._PUT_IN_SIGNATORY_BOOK.'</label>';
$return .= 'onclick="setAttachmentInSignatureBook('.$resultTheLine[0]['value'].');"/><label for="final'. $count .'">'._PUT_IN_SIGNATORY_BOOK.'</label>';
$return .= '</div>';
......@@ -1736,9 +1693,6 @@ abstract class lists_Abstract extends Database
//#showActionFA## : show action Font Awesome
} elseif (preg_match("/^showActionFA\|/", $parameter)) {
$var = $this->_tmplt_showActionFA($parameter, $resultTheLine);
//#showActionBasketsFA## : show action Font Awesome
} elseif (preg_match("/^showActionBasketsFA\|/", $parameter)) {
$var = $this->_tmplt_showActionBasketsFA($parameter, $resultTheLine);
//#showActionAdvResultFA## : show action Font Awesome
} elseif (preg_match("/^showActionAdvResultFA\|/", $parameter)) {
$var = $this->_tmplt_showActionAdvResultFA($parameter, $resultTheLine);
......
......@@ -354,22 +354,6 @@ a:hover {
display: block;
}
/*admin docservers CSS*/
#admin_docservers {
background: url(static.php?filename=maarch_box_tmp.gif) no-repeat 2px top;
width: 315px;
min-height: 110px;
float: left;
padding-top: 0px;
padding-right: 18px;
padding-bottom: 0px;
padding-left: 0px;
margin: 0px 0px 15px;
position: relative;
display: block;
}
/* floated blocks */
.clear {
......@@ -435,7 +419,6 @@ acronym, abbr {
a.next, a.change, a.suspend, a.delete, a.authorize, a.prev, a.up, a.down, a.view {
padding-left: 20px;
/*background: transparent url(static.php?filename=puce_prev.gif) 10px center no-repeat;*/
background: transparent 10px center no-repeat;
color: #135F7F;
}
......@@ -452,13 +435,6 @@ a.prev {
padding-left: 10px;
}
/*a.next {
background-image: url(static.php?filename=puce_next.gif);
background-position: center right;
padding-left: 0;
padding-right: 10px;
}*/
a.change, a.suspend, a.delete, a.authorize, a.up, a.down, a.view {
padding: 5px 0 5px 20px;
background-position: center left;
......@@ -1306,27 +1282,6 @@ th.ref {
left: 262px;
}
#quicksearchform #search {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: .9em;
color: #666;
border: none;
padding: .2em .6em .4em .6em;
width: 10.7em;
background: transparent url(static.php?filename=bg_inputsearch.gif) top left no-repeat;
}
#quicksearchform label {
clear: right;
padding-left: 15px;
padding-bottom: 12px;
}
#quicksearchform input {
float: left;
margin: 0 5px 0 0;
}
#help {
text-align: right;
padding-right: 12px;
......
......@@ -127,16 +127,16 @@ $_ENV['categories']['incoming']['departure_date'] = array (
'modify' => true,
'form_show' => 'date'
);
$_ENV['categories']['incoming']['description'] = array (
'type_form' => 'string',
'type_field' => 'string',
'mandatory' => false,
'label' => _OTHERS_INFORMATIONS,
'table' => 'res',
'img' => 'info-circle',
'modify' => true,
'form_show' => 'textarea'
);
// $_ENV['categories']['incoming']['description'] = array (
// 'type_form' => 'string',
// 'type_field' => 'string',
// 'mandatory' => false,
// 'label' => _OTHERS_INFORMATIONS,
// 'table' => 'res',
// 'img' => 'info-circle',
// 'modify' => true,
// 'form_show' => 'textarea'