Omeka icon indicating copy to clipboard operation
Omeka copied to clipboard

Batch-edit redirects

Open luku opened this issue 8 years ago • 4 comments

There's a problem with $this->_helper->redirector('browse', 'items', null, $params); and multidimensional $params array, such as advanced search criteria, so this pull is fixing it. Besides, it redirects back to selected items, or to same search params for batchAll style of batch-edit. It's practical for direct review of performed changes. So maybe not that useful for _batchEditAllSave() action, but definitely for standard batch edit.

luku avatar Mar 05 '17 17:03 luku

What is the problem with multidimensional arrays that this fixes?

zerocrates avatar Mar 06 '17 23:03 zerocrates

Ok, here comes example: Let's say you search all items, where DC:Title is not empty. It will produce query like: search=&advanced[0][element_id]=50&advanced[0][type]=is not empty&range=....

Now try to reproduce some error in batch edit, for example delete all items. You will be redirected to URL similar to this one: items/browse/search//advanced//range//... As you can see, the whole advanced condition got lost.

In errors.log you then see warning and the problem is in Zend\Controller\Router\Route\Module.php

It works fine with multiple one-dimensional queries like range=0-50&user=1 which produces URL: items/browse/range/0-50/user/1/...

luku avatar Mar 07 '17 17:03 luku

Ah okay, I see. So the heart of the issue is that it tries to use the router to express those params instead of just a query string (as we usually do).

zerocrates avatar Mar 07 '17 17:03 zerocrates

Yes, in one way. I found out about it, when I tried to redirect back to the selected items, which was the actual heart of this pull request:) Btw. is there some better way to pass to some redirector method the query params as array? Or perhaps using url() instead of manual http_build_query(). I'm open for improvements

luku avatar Mar 07 '17 17:03 luku