FEAT #11422 TIME 1:15 delete folder elements

parent 1d51a69f
......@@ -34,9 +34,6 @@ $contacts_v2 = new contacts_v2();
if ($core->is_module_loaded('entities')) {
require_once 'modules/entities/entities_tables.php';
}
if ($core->is_module_loaded('folder')) {
require_once 'modules/folder/folder_tables.php';
}
require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id']
.DIRECTORY_SEPARATOR.'apps_tables.php';
/**
......@@ -904,37 +901,6 @@ function get_form_txt($values, $pathManageAction, $actionId, $table, $module, $c
.'style="display:inline;"><i class="fa fa-star"></i></span>&nbsp;</td>';
$frmStr .= '</tr>';
/*** Folder ***/
if ($core->is_module_loaded('folder') && ($core->test_service('associate_folder', 'folder', false) == 1)) {
require_once 'modules'.DIRECTORY_SEPARATOR.'folder'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
$folders = new folder();
$folder_info = $folders->get_folders_tree('0');
$frmStr .= '<tr id="folder_tr" style="display:'.$displayValue.';">';
$frmStr .= '<td><label for="folder" class="form_title" >'._FOLDER_OR_SUBFOLDER.'</label></td>';
$frmStr .= '<td class="indexing_field" style="text-align:right;"><select id="folder" name="folder" onchange="displayFatherFolder(\'folder\')"><option value="">'._SELECT_FOLDER_TITLE.'</option>';
foreach ($folder_info as $key => $value) {
$frmStr .= '<option value="'.$value['folders_system_id'].'" parent="'.$value['parent_id'].'">'.$value['folder_name'].'</option>';
}
$frmStr .= '</select></td>';
if ($core->test_service('create_folder', 'folder', false) == 1) {
$pathScriptTab = $_SESSION['config']['businessappurl']
.'index.php?page=create_folder_form_iframe&module=folder&display=false';
$frmStr .= '<td style="width:5%;"> <a href="#" id="create_folder" title="'._CREATE_FOLDER
.'" onclick="loadTab(\''.$res_id.'\',\''.$coll_id.'\',\''._CREATE_FOLDER.'\',\''.$pathScriptTab.'\',\'folders\');return false;" '
.'style="display:inline;" ><i class="fa fa-plus-circle" title="'
._CREATE_FOLDER.'"></i></a></td>';
}
$frmStr .= '<td><span class="red_asterisk" id="folder_mandatory" style="display:inline;"><i class="fa fa-star"></i></span>&nbsp;</td>';
$frmStr .= '</tr>';
$frmStr .= '<tr id="parentFolderTr" style="display: none;text-align:center;"><td>&nbsp;</td><td colspan="2"><span id="parentFolderSpan" style="font-style: italic;font-size: 10px"></span></td></tr>';
$frmStr .= '<script>$j("#folder").chosen({width: "226px", disable_search_threshold: 10, search_contains: true});</script>';
}
/*** Thesaurus ***/
if ($core->is_module_loaded('thesaurus') && $core->test_service('thesaurus_view', 'thesaurus', false)) {
require_once 'modules'.DIRECTORY_SEPARATOR.'thesaurus'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
......@@ -1427,46 +1393,6 @@ function process_category_check($catId, $values)
}
}
}
if ($core->is_module_loaded('folder')) {
$folderId = '';
$foldertypeId = '';
$folderId = get_value_fields($values, 'folder');
if (isset($_ENV['categories'][$catId]['other_cases']['folder'])
&& $_ENV['categories'][$catId]['other_cases']['folder']['mandatory'] == true
) {
if (empty($folderId)) {
$_SESSION['action_error'] = $_ENV['categories'][$catId]['other_cases']['folder']['label']
.' '._IS_EMPTY;
return false;
}
}
if (!empty($typeId) && !empty($folderId)) {
$stmt = $db->query(
'SELECT foldertype_id FROM '.FOLD_FOLDERS_TABLE
.' WHERE folders_system_id = ?',
array($folderId)
);
$res = $stmt->fetchObject();
$foldertypeId = $res->foldertype_id;
$stmt = $db->query(
'SELECT fdl.foldertype_id FROM '
.FOLD_FOLDERTYPES_DOCTYPES_LEVEL1_TABLE.' fdl, '
.DOCTYPES_TABLE.' d WHERE d.doctypes_first_level_id = '
.'fdl.doctypes_first_level_id and fdl.foldertype_id = ? and d.type_id = ?',
array($foldertypeId, $typeId)
);
if ($stmt->rowCount() == 0) {
$_SESSION['action_error'] .= _ERROR_COMPATIBILITY_FOLDER;
return false;
}
}
}
//For specific case => chrono number
$chronoOut = get_value_fields($values, 'chrono_number');
......@@ -1796,21 +1722,6 @@ function manage_form($arrId, $history, $actionId, $label_action, $status, $collI
}
}
if ($core->is_module_loaded('folder')) {
$folderId = get_value_fields($formValues, 'folder');
if (!empty($folderId)) {
array_push(
$_SESSION['data'],
array(
'column' => 'folders_system_id',
'value' => $folderId,
'type' => 'integer',
)
);
}
}
if ($core->is_module_loaded('entities')) {
// Diffusion list
$loadListDiff = false;
......@@ -2005,20 +1916,6 @@ function manage_form($arrId, $history, $actionId, $label_action, $status, $collI
.' values '.$queryExtValues;
$db->query($queryExt, $arrayPDO);
if ($core->is_module_loaded('folder') && !empty($folderId)
&& $_SESSION['history']['folderup']
) {
$hist = new history();
$hist->add(
$_SESSION['tablename']['fold_folders'],
$folderId,
'UP',
'folderup',
_DOC_NUM.$resId._ADDED_TO_FOLDER,
$_SESSION['config']['databasetype'],
'apps'
);
}
if ($core->is_module_loaded('entities')) {
if ($loadListDiff) {
......
......@@ -276,7 +276,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$frm_str .= '<table width="95%" align="left" border="0">';
// Displays the document indexes
foreach (array_keys($data) as $key) {
if (!in_array($key, ['is_multicontacts', 'barcode', 'external_id','folder']) || ($key == 'is_multicontacts' && $data[$key]['show_value'] == 'Y') || (in_array($key, ['barcode', 'external_id']) && !empty($data[$key]['value']))) {
if (!in_array($key, ['is_multicontacts', 'barcode', 'external_id']) || ($key == 'is_multicontacts' && $data[$key]['show_value'] == 'Y') || (in_array($key, ['barcode', 'external_id']) && !empty($data[$key]['value']))) {
$frm_str .= '<tr>';
$frm_str .= '<td width="50%" align="left"><span class="form_title_process">'
.$data[$key]['label'].' :</span>';
......@@ -443,59 +443,6 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
include_once 'modules'.DIRECTORY_SEPARATOR.'tags'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'process'.DIRECTORY_SEPARATOR.'index.php';
}
//FOLDERS
if ($core_tools->is_module_loaded('folder') && ($core->test_service('view_folder_tree', 'folder', false))) {
require_once 'modules'.DIRECTORY_SEPARATOR.'folder'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
$folders = new folder();
$folder_info = $folders->get_folders_tree('0');
$folder = '';
$folder_id = '';
if (isset($data['folder']) && !empty($data['folder'])) {
$folder = $data['folder']['show_value'];
$folder_id = str_replace(')', '', substr($folder, strrpos($folder, '(') + 1));
}
$frm_str .= '<tr>';
$frm_str .= '<td colspan="2">'._FOLDER.'</td>';
$frm_str .= '</tr>';
$frm_str .= '<tr>';
$frm_str .= '<td class="indexing_field"><select id="folder" name="folder"';
if (!$core->test_service('associate_folder', 'folder', false)) {
$frm_str .= ' disabled="disabled"';
}
$frm_str .= ' onchange="displayFatherFolder(\'folder\')" style="width:95%;"><option value="">'._SELECT_FOLDER_TITLE.'</option>';
foreach ($folder_info as $key => $value) {
if ($value['folders_system_id'] == $folder_id) {
$frm_str .= '<option selected="selected" value="'.$value['folders_system_id'].'" parent="'.$value['parent_id'].'">'.$value['folder_name'].'</option>';
} else {
$frm_str .= '<option value="'.$value['folders_system_id'].'" parent="'.$value['parent_id'].'">'.$value['folder_name'].'</option>';
}
}
$frm_str .= '</select></td>';
if ($core->test_service('create_folder', 'folder', false) == 1 && $core->test_service('associate_folder', 'folder', false)) {
$pathScriptTab = $_SESSION['config']['businessappurl']
.'index.php?page=create_folder_form_iframe&module=folder&display=false';
$frm_str .= '<td style="width:5px;"> <a href="#" id="create_folder" title="'._CREATE_FOLDER
.'" onclick="loadTab(\''.$res_id.'\',\''.$coll_id.'\',\''._CREATE_FOLDER.'\',\''.$pathScriptTab.'\',\'folders\');return false;" '
.'style="display:inline;" ><i class="fa fa-plus-circle" title="'
._CREATE_FOLDER.'"></i></a></td>';
}
$frm_str .= '</tr>';
$frm_str .= '<tr id="parentFolderTr" style="display: none"><td colspan="2"><span id="parentFolderSpan" style="font-style: italic;font-size: 10px"></span></td></tr>';
$frm_str .= '<input type="hidden" name="res_id_to_process" id="res_id_to_process" value="'.$res_id.'" />';
//script
$frm_str .= '<script>';
$frm_str .= '$j("#folder").chosen({width: "100%", disable_search_threshold: 10, search_contains: true});displayFatherFolder(\'folder\');';
$frm_str .= '</script>';
}
//AUTRES INFORMATIONS
$frm_str .= '<tr id="description_tr" style="display:'.$display_value.';">';
$frm_str .= '<td colspan="2">' . _OTHERS_INFORMATIONS . '</td>';
......@@ -806,43 +753,6 @@ function check_form($form_id, $values)
$folder_id = '';
$foldertype_id = '';
if ($core->is_module_loaded('folder')) {
if (!empty($folder)) {
$folder_id = $folder;
$stmt = $db->query('SELECT folders_system_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ?', array($folder_id));
if ($stmt->rowCount() == 0) {
$_SESSION['action_error'] = _FOLDER.' '.$folder_id.' '._UNKNOWN;
return false;
}
}
if (!empty($res_id) && !empty($coll_id) && !empty($folder_id)) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php';
$sec = new security();
$table = $sec->retrieve_table_from_coll($coll_id);
if (empty($table)) {
$_SESSION['action_error'] .= _COLLECTION.' '._UNKNOWN;
return false;
}
$stmt = $db->query('SELECT type_id FROM '.$table.' WHERE res_id = ?', array($res_id));
$res = $stmt->fetchObject();
$type_id = $res->type_id;
$stmt = $db->query('SELECT foldertype_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ?', array($folder_id));
$res = $stmt->fetchObject();
$foldertype_id = $res->foldertype_id;
$stmt = $db->query('SELECT fdl.foldertype_id FROM '.$_SESSION['tablename']['fold_foldertypes_doctypes_level1']
.' fdl, '.$_SESSION['tablename']['doctypes']
.' d WHERE d.doctypes_first_level_id = fdl.doctypes_first_level_id and fdl.foldertype_id = ? and d.type_id = ?', array($foldertype_id, $type_id));
if ($stmt->rowCount() == 0) {
$_SESSION['action_error'] .= _ERROR_COMPATIBILITY_FOLDER;
return false;
}
}
}
return $check;
}
......@@ -880,9 +790,6 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
$thesaurusList = '';
for ($j = 0; $j < count($values_form); ++$j) {
if ($values_form[$j]['ID'] == 'folder') {
$folder = $values_form[$j]['VALUE'];
}
if ($values_form[$j]['ID'] == "description") {
$description = $values_form[$j]['VALUE'];
}
......@@ -915,35 +822,6 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
$thesaurus->updateResThesaurusList($thesaurusList, $arr_id[0]);
}
//FOLDERS
if ($core->is_module_loaded('folder') && ($core->test_service('associate_folder', 'folder', false) == 1)) {
$folder_id = '';
$old_folder_id = '';
//get old folder ID
$stmt = $db->query('SELECT folders_system_id FROM '.$res_table.' WHERE res_id = ?', array($arr_id[0]));
$res = $stmt->fetchObject();
$old_folder_id = $res->folders_system_id;
if (!empty($folder)) {
$folder_id = $folder;
if ($folder_id != $old_folder_id && $_SESSION['history']['folderup']) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php';
$hist = new history();
$hist->add($_SESSION['tablename']['fold_folders'], $folder_id, 'UP', 'folderup', _DOC_NUM.$arr_id[0]._ADDED_TO_FOLDER, $_SESSION['config']['databasetype'], 'apps');
if (isset($old_folder_id) && !empty($old_folder_id)) {
$hist->add($_SESSION['tablename']['fold_folders'], $old_folder_id, 'UP', 'folderup', _DOC_NUM.$arr_id[0]._DELETED_FROM_FOLDER, $_SESSION['config']['databasetype'], 'apps');
}
}
$db->query('UPDATE '.$res_table.' SET folders_system_id = ? WHERE res_id = ? ', array($folder_id, $arr_id[0]));
} elseif (empty($folder) && !empty($old_folder_id)) { //Delete folder reference in res_X
$db->query('UPDATE '.$res_table.' SET folders_system_id = NULL WHERE res_id = ?', array($arr_id[0]));
}
}
//DIFFLIST
if ($core->is_module_loaded('entities') && (empty($_SESSION['redirect']['diff_list']) || !is_array($_SESSION['redirect']['diff_list']) || count($_SESSION['redirect']['diff_list']) == 0)) {
require_once 'modules/entities/class/class_manage_listdiff.php';
......
......@@ -1115,50 +1115,6 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$frm_str .= '<table width="100%" align="center" border="0" '
.'id="indexing_fields" style="display:table;">';
/*** Folder ***/
if ($core_tools->is_module_loaded('folder') && ($core->test_service('associate_folder', 'folder', false) == 1)) {
//DECLARATIONS
require_once 'modules'.DIRECTORY_SEPARATOR.'folder'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
//INSTANTIATE
$folders = new folder();
//INITIALIZE
$folder_info = $folders->get_folders_tree('0');
$folder = '';
$folder_id = '';
if (isset($data['folder']) && !empty($data['folder'])) {
$folder = $data['folder'];
$folder_id = str_replace(')', '', substr($folder, strrpos($folder, '(') + 1));
}
$frm_str .= '<tr id="folder_tr" style="display:'.$display_value.';">';
$frm_str .= '<td><label for="folder" class="form_title" >'._FOLDER_OR_SUBFOLDER.'</label></td>';
$frm_str .= '<td class="indexing_field" style="text-align:right;"><select id="folder" name="folder" onchange="displayFatherFolder(\'folder\')"><option value="">'._SELECT_FOLDER_TITLE.'</option>';
foreach ($folder_info as $key => $value) {
if ($value['folders_system_id'] == $folder_id) {
$frm_str .= '<option selected="selected" value="'.$value['folders_system_id'].'" parent="'.$value['parent_id'].'">'.$value['folder_name'].'</option>';
} else {
$frm_str .= '<option value="'.$value['folders_system_id'].'" parent="'.$value['parent_id'].'">'.$value['folder_name'].'</option>';
}
}
$frm_str .= '</select>';
$frm_str .= '</td>';
if ($core->test_service('create_folder', 'folder', false) == 1) {
$pathScriptTab = $_SESSION['config']['businessappurl']
.'index.php?page=create_folder_form_iframe&module=folder&display=false';
$frm_str .= '<td style="width:5%;"> <a href="#" id="create_folder" title="'._CREATE_FOLDER
.'" onclick="loadTab(\''.$res_id.'\',\''.$coll_id.'\',\''._CREATE_FOLDER.'\',\''.$pathScriptTab.'\',\'folders\');return false;" '
.'style="display:inline;" ><i class="fa fa-plus-circle" title="'
._CREATE_FOLDER.'"></i></a></td>';
}
$frm_str .= '</tr>';
$frm_str .= '<tr id="parentFolderTr" style="display: none"><td>&nbsp;</td><td colspan="2"><span id="parentFolderSpan" style="font-style: italic;font-size: 10px"></span></td></tr>';
$frm_str .= '<script>$j("#folder").chosen({width: "226px", disable_search_threshold: 10, search_contains: true});</script>';
}
/*** Thesaurus ***/
if ($core->is_module_loaded('thesaurus') && $core->test_service('thesaurus_view', 'thesaurus', false)) {
//DECLARATIONS
......@@ -1357,7 +1313,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$frm_str .= '</div>';
/*** Extra javascript ***/
$frm_str .= '<script type="text/javascript">$j(\'#validright\').css(\'display\',\'block\');displayFatherFolder(\'folder\');window.scrollTo(0,0);';
$frm_str .= '<script type="text/javascript">$j(\'#validright\').css(\'display\',\'block\');window.scrollTo(0,0);';
$frm_str .= 'init_validation(\''.$_SESSION['config']['businessappurl']
.'index.php?display=true&dir=indexing_searching&page=autocomplete_contacts\', \''
......@@ -1667,33 +1623,6 @@ function process_category_check($cat_id, $values)
}
}
}
if ($core->is_module_loaded('folder')) {
$folder_id = '';
$foldertype_id = '';
$folder_id = get_value_fields($values, 'folder');
if (isset($_ENV['categories'][$cat_id]['other_cases']['folder']) && $_ENV['categories'][$cat_id]['other_cases']['folder']['mandatory'] == true) {
if (empty($folder)) {
$_SESSION['action_error'] = $_ENV['categories'][$cat_id]['other_cases']['folder']['label'].' '._IS_EMPTY;
return false;
}
}
if (!empty($type_id) && !empty($folder_id)) {
$stmt = $db->query('SELECT foldertype_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ?', array($folder_id));
$res = $stmt->fetchObject();
$foldertype_id = $res->foldertype_id;
$stmt = $db->query('SELECT fdl.foldertype_id FROM '
.$_SESSION['tablename']['fold_foldertypes_doctypes_level1'].' fdl, '
.$_SESSION['tablename']['doctypes'].' d WHERE d.doctypes_first_level_id = fdl.doctypes_first_level_id and fdl.foldertype_id = ? and d.type_id = '.$type_id, array($foldertype_id));
if ($stmt->rowCount() == 0) {
$_SESSION['action_error'] .= _ERROR_COMPATIBILITY_FOLDER;
return false;
}
}
}
return true;
}
......@@ -1954,32 +1883,6 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
]);
}
if ($core->is_module_loaded('folder') && ($core->test_service('associate_folder', 'folder', false) == 1)) {
$folder_id = get_value_fields($values_form, 'folder');
$stmt = $db->query('SELECT folders_system_id FROM '.$table.' WHERE res_id = ?', array($res_id));
$res = $stmt->fetchObject();
$old_folder_id = $res->folders_system_id;
if (!empty($folder_id)) {
$query_res .= ', folders_system_id = ?';
$arrayPDOres = array_merge($arrayPDOres, array($folder_id));
} elseif (empty($folder_id) && !empty($old_folder_id)) {
$query_res .= ', folders_system_id = NULL';
}
if ($folder_id != $old_folder_id && $_SESSION['history']['folderup']) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php';
$hist = new history();
$hist->add($_SESSION['tablename']['fold_folders'], $folder_id, 'UP', 'folderup', _DOC_NUM.$res_id._ADDED_TO_FOLDER, $_SESSION['config']['databasetype'], 'apps');
if (isset($old_folder_id) && !empty($old_folder_id)) {
$hist->add($_SESSION['tablename']['fold_folders'], $old_folder_id, 'UP', 'folderup', _DOC_NUM.$res_id._DELETED_FROM_FOLDER, $_SESSION['config']['databasetype'], 'apps');
}
}
}
if ($core->is_module_loaded('entities') && $_SESSION['ListDiffFromRedirect'] == false) {
// Diffusion list
$load_list_diff = false;
......
......@@ -711,35 +711,7 @@ abstract class business_app_tools_Abstract extends Database
if (! isset($name) || empty($name)) {
return false;
}
if ($name == 'structures' || $name == 'structures_list_by_name'
|| $name == 'structure_up' || $name == 'structure_del'
) {
$path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
. DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR
. 'architecture' . DIRECTORY_SEPARATOR . 'structures'
. DIRECTORY_SEPARATOR . $name . '.php';
return $path;
} else if ($name == 'subfolders' || $name == 'subfolders_list_by_name'
|| $name == 'subfolder_up' || $name == 'subfolder_del'
) {
$path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
. DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR
. 'architecture' . DIRECTORY_SEPARATOR . 'subfolders'
. DIRECTORY_SEPARATOR . $name . '.php';
return $path;
} else if ($name == 'types' || $name == 'types_up'
|| $name == 'types_up_db' || $name == 'types_add'
|| $name == 'types_del' || $name == 'get_index'
|| $name == 'choose_index' || $name == 'choose_coll'
|| $name == 'types_list_by_name'
) {
$path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
. DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR
. 'architecture' . DIRECTORY_SEPARATOR . 'types'
. DIRECTORY_SEPARATOR . $name . '.php';
return $path;
} else if ($name == 'contact_types' || $name == 'contact_types_list_by_name'
if ($name == 'contact_types' || $name == 'contact_types_list_by_name'
|| $name == 'contact_types_up' || $name == 'contact_types_del'
) {
$path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
......
......@@ -195,10 +195,6 @@ abstract class chrono_Abstract
$chronoArray[$i]['VALUE'] = $this->execute_chrono_by_res_id(
$phpVar['res_id']
);
} else if ($chronoArray[$i]['VALUE'] == "chr_by_folder") {
$chronoArray[$i]['VALUE'] = $this->execute_chrono_by_folder(
$phpVar['folder_id']
);
}
}
}
......@@ -286,26 +282,6 @@ abstract class chrono_Abstract
}
public function execute_chrono_by_folder($folder)
{
$db = new Database();
$folders_system_id = $_SESSION['folderId'];
//Get the crono key for this folder
$stmt = $db->query(
"SELECT param_value_int FROM " . PARAM_TABLE
. " WHERE id = ? ",
array('chrono_folder_' . $folders_system_id)
);
if ($stmt->rowCount() == 0) {
$chrono = $this->_createNewChronoForFolder($db, $folder);
} else {
$fetch = $stmt->fetchObject();
$chrono = $fetch->param_value_int;
}
$this->_updateChronoForFolder($chrono, $db, $folder);
return $chrono;
}
protected function _executeCategoryChar($phpVar)
{
if (! $phpVar['category_id']) {
......@@ -382,25 +358,6 @@ abstract class chrono_Abstract
return 1;
}
// For specific chrono => folder
protected function _updateChronoForFolder($actualChrono, $db, $folder)
{
$actualChrono++;
$db->query(
"UPDATE " . PARAM_TABLE . " SET param_value_int = ? WHERE id = ? ",
array($actualChrono, 'chrono_folder_' . $folder)
);
}
protected function _createNewChronoForFolder($db, $folder)
{
$db->query(
"INSERT INTO " . PARAM_TABLE . " (id, param_value_int) VALUES "
. "(?, '1')",
array('chrono_folder_' . $folder)
);
return 1;
}
public function generate_chrono($chronoId, $phpVar='false', $form='false')
{
$tmp = $this->get_structure($chronoId);
......
......@@ -298,81 +298,6 @@ abstract class indexing_searching_app_Abstract extends Database
]);
}
if ($core->is_module_loaded('folder')) {
$stmt = $db->query('SELECT folders_system_id FROM '.$table.' WHERE res_id = ?', array($id_to_update));
$res = $stmt->fetchObject();
$old_folder_id = $res->folders_system_id;
$market = '';
if (isset($post['folder'])) {
$market = $post['folder'];
}
$project_id = '';
$market_id = '';
if (isset($_ENV['categories'][$cat_id]['other_cases']['folder']) && $_ENV['categories'][$cat_id]['other_cases']['folder']['mandatory'] == true) {
if (empty($market)) {
$_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['folder']['label'].' '._IS_EMPTY;
}
}
if (!empty($market)) {
if (!preg_match('/\([0-9]+\)$/', $market)) {
$_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['folder']['label'].' '._WRONG_FORMAT.'. '._USE_AUTOCOMPLETION;
} else {
$market_id = str_replace(')', '', substr($market, strrpos($market, '(') + 1));
$stmt = $db->query('SELECT folders_system_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ?', array($market_id));
if ($stmt->rowCount() == 0) {
$_SESSION['error'] .= _MARKET.' '.$market_id.' '._UNKNOWN;
}
}
}
$project = '';
if (isset($post['project'])) {
$project = $post['project'];
}
if (isset($_ENV['categories'][$cat_id]['other_cases']['project']) && $_ENV['categories'][$cat_id]['other_cases']['project']['mandatory'] == true) {
if (empty($project)) {
$_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['project']['label'].' '._IS_EMPTY;
}
}
if (!empty($project)) {
if (!preg_match('/\([0-9]+\)$/', $project)) {
$_SESSION['error'] .= $_ENV['categories'][$cat_id]['other_cases']['project']['label'].' '._WRONG_FORMAT;
}
$project_id = str_replace(')', '', substr($project, strrpos($project, '(') + 1));
$stmt = $db->query('SELECT folders_system_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ?', array($project_id));
if ($stmt->rowCount() == 0) {
$_SESSION['error'] .= _MARKET.' '.$project_id.' '._UNKNOWN;
}
}
if (!empty($project_id) && !empty($market_id)) {
$stmt = $db->query('SELECT folders_system_id FROM '.$_SESSION['tablename']['fold_folders'].' WHERE folders_system_id = ? and parent_id = ?', array($market_id, $project_id));
if ($stmt->rowCount() == 0) {
$_SESSION['error'] .= _INCOMPATIBILITY_MARKET_PROJECT;
}
}
if (empty($_SESSION['error'])) {
$folder_id = '';
if (!empty($market_id)) {
$folder_id = $market_id;
} elseif (!empty($project_id)) {
$folder_id = $project_id;
}
if (!empty($folder_id)) {
array_push($data_res, array('column' => 'folders_system_id', 'value' => $folder_id, 'type' => 'integer'));
} else {
array_push($data_res, array('column' => 'folders_system_id', 'value' => 'NULL', 'type' => 'integer'));
}
if ($folder_id != $old_folder_id && $_SESSION['history']['folderup']) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php';
$hist = new history();
$hist->add($_SESSION['tablename']['fold_folders'], $folder_id, 'UP', 'folderup', _DOC_NUM.$id_to_update._ADDED_TO_FOLDER, $_SESSION['config']['databasetype'], 'apps');
if (isset($old_folder_id) && !empty($old_folder_id)) {
$hist->add($_SESSION['tablename']['fold_folders'], $old_folder_id, 'UP', 'folderup', _DOC_NUM.$id_to_update._DELETED_FROM_FOLDER, $_SESSION['config']['databasetype'], 'apps');
}
}
}
}
if ($core->is_module_loaded('entities') && $_SESSION['details']['diff_list']['key_value'] == md5($res_id)) {
//Mise a jour du dest_user :: seulement sur demande
if (!empty($_SESSION['details']['diff_list']['dest']['user_id'])) {
......
......@@ -360,24 +360,6 @@ abstract class lists_Abstract extends Database
$filters .= '<script> $j("#isViewed").chosen({width:"150px", disable_search: true, allow_single_deselect: true});</script>';
break;
case 'folder':
if (isset($_SESSION['filters']['folder']['VALUE']) && !empty($_SESSION['filters']['folder']['VALUE'])) {
$folder = $_SESSION['filters']['folder']['VALUE'];
} else {
$folder = '['._FOLDER.']';
}
$filters .= '<input type="text" name="folder_id" id="folder_id" placeholder="'.$folder.'" size="40" '
.'onfocus="if(this.value==\'['._FOLDER.']\'){this.value=\'\';}'
.'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13) loadList(\''.$this->link
.'&filter=folder&value=\' + this.value, \''.$this->divListId.'\', '
.$this->modeReturn.');" />&nbsp;';
//Autocompletion script and div
$filters .= '<div id="folderListByName" class="autocomplete"></div>';
$filters .= '<script type="text/javascript">initList(\'folder_id\', \'folderListByName\', \''
.$_SESSION['config']['businessappurl'].'index.php?display=true&module='
.'folder&page=folders_list_by_name\', \'folder\', \'2\');</script>';
break;
case 'contact':
//if(isset($_SESSION['filters']['contact']['VALUE']) && !empty($_SESSION['filters']['contact']['VALUE'])) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php';