mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 09:22:21 +02:00
fixes #1735 new API method pwg.images.setCategory to associate/dissociate/move a list of images
This commit is contained in:
@@ -207,31 +207,10 @@ DELETE
|
||||
|
||||
else if ('dissociate' == $action)
|
||||
{
|
||||
// physical links must not be broken, so we must first retrieve image_id
|
||||
// which create virtual links with the category to "dissociate from".
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
INNER JOIN '.IMAGES_TABLE.' ON image_id = id
|
||||
WHERE category_id = '.$_POST['dissociate'].'
|
||||
AND id IN ('.implode(',', $collection).')
|
||||
AND (
|
||||
category_id != storage_category_id
|
||||
OR storage_category_id IS NULL
|
||||
)
|
||||
;';
|
||||
$dissociables = array_from_query($query, 'id');
|
||||
$nb_dissociated = dissociate_images_from_category($collection, $_POST['dissociate']);
|
||||
|
||||
if (!empty($dissociables))
|
||||
if ($nb_dissociated > 0)
|
||||
{
|
||||
$query = '
|
||||
DELETE
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id = '.$_POST['dissociate'].'
|
||||
AND image_id IN ('.implode(',', $dissociables).')
|
||||
';
|
||||
pwg_query($query);
|
||||
|
||||
$_SESSION['page_infos'] = array(
|
||||
l10n('Information data registered in database')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user