mirror of https://github.com/itflow-org/itflow
search in all folders when in root
Enable search recursive/all folders when in / (root). In the future will be nice to have this as an advanced search. reference: https://forum.itflow.org/d/850-search-documents-recursive
This commit is contained in:
parent
bd12319422
commit
cdf4767590
|
|
@ -33,17 +33,31 @@ if (!empty($_GET['folder_id'])) {
|
|||
// Set Folder Location Var used when creating folders
|
||||
$folder_location = 0;
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
LEFT JOIN users ON document_created_by = user_id
|
||||
WHERE document_client_id = $client_id
|
||||
AND document_template = 0
|
||||
AND document_folder_id = $folder
|
||||
AND document_archived_at IS NULL
|
||||
$query_snippet
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
if ($folder == 0) {
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
LEFT JOIN users ON document_created_by = user_id
|
||||
WHERE document_client_id = $client_id
|
||||
AND document_template = 0
|
||||
|
||||
AND document_archived_at IS NULL
|
||||
$query_snippet
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
}else{
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
LEFT JOIN users ON document_created_by = user_id
|
||||
WHERE document_client_id = $client_id
|
||||
AND document_template = 0
|
||||
AND document_folder_id = $folder
|
||||
AND document_archived_at IS NULL
|
||||
$query_snippet
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
}
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
|
|||
|
|
@ -39,16 +39,29 @@ if ($view == 1) {
|
|||
// Set Folder Location Var used when creating folders
|
||||
$folder_location = 1;
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||
WHERE file_client_id = $client_id
|
||||
AND file_folder_id = $folder_id
|
||||
AND file_archived_at IS NULL
|
||||
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||
$query_images
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
if ($folder == 0) {
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||
WHERE file_client_id = $client_id
|
||||
|
||||
AND file_archived_at IS NULL
|
||||
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||
$query_images
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
}else{
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM files
|
||||
WHERE file_client_id = $client_id
|
||||
AND file_folder_id = $folder_id
|
||||
AND file_archived_at IS NULL
|
||||
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
|
||||
$query_images
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
}
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue