Skip to content

Batch-edit redirects#789

Open
luku wants to merge 2 commits intoomeka:masterfrom
luku:batch-redirect
Open

Batch-edit redirects#789
luku wants to merge 2 commits intoomeka:masterfrom
luku:batch-redirect

Conversation

@luku
Copy link
Copy Markdown
Contributor

@luku luku commented Mar 5, 2017

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.

@zerocrates
Copy link
Copy Markdown
Member

What is the problem with multidimensional arrays that this fixes?

@luku
Copy link
Copy Markdown
Contributor Author

luku commented Mar 7, 2017

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/...

@zerocrates
Copy link
Copy Markdown
Member

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).

@luku
Copy link
Copy Markdown
Contributor Author

luku commented Mar 7, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants