fixes #1929 add parameter search on pwg.categories.getList (and use it)

This commit is contained in:
plegall 2023-06-27 14:41:28 +02:00
parent d50d7ba620
commit fdabd4a988
3 changed files with 13 additions and 2 deletions

View file

@ -23,6 +23,7 @@ function linked_albums_search(searchText) {
cat_id: 0, cat_id: 0,
recursive: true, recursive: true,
fullname: true, fullname: true,
search: searchText,
} }
} else { } else {
api_params = { api_params = {
@ -64,4 +65,4 @@ function linked_albums_search(searchText) {
console.log(e.message); console.log(e.message);
} }
}) })
} }

View file

@ -279,7 +279,16 @@ SELECT
FROM '. CATEGORIES_TABLE .' FROM '. CATEGORIES_TABLE .'
'.$join_type.' JOIN '. USER_CACHE_CATEGORIES_TABLE .' '.$join_type.' JOIN '. USER_CACHE_CATEGORIES_TABLE .'
ON id=cat_id AND user_id='.$join_user.' ON id=cat_id AND user_id='.$join_user.'
WHERE '. implode("\n AND ", $where) .' WHERE '. implode("\n AND ", $where);
if (isset($params["search"]) and $params['search'] != "")
{
$query .= '
AND name LIKE \'%'.pwg_db_real_escape_string($params["search"]).'%\'
LIMIT '.$conf["linked_album_search_limit"];
}
$query.= '
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);

1
ws.php
View file

@ -157,6 +157,7 @@ function ws_addDefaultMethods( $arr )
'default' => IMG_THUMB, 'default' => IMG_THUMB,
'info' => implode(',', array_keys(ImageStdParams::get_defined_type_map())) 'info' => implode(',', array_keys(ImageStdParams::get_defined_type_map()))
), ),
'search' => array('default' => null),
), ),
'Returns a list of categories.', 'Returns a list of categories.',
$ws_functions_root . 'pwg.categories.php' $ws_functions_root . 'pwg.categories.php'