https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36930

--- Comment #6 from Pedro Amorim <pedro.amo...@ptfs-europe.com> ---
(In reply to Janusz Kaczmarek from comment #2)
> Certainly there is an explanation--any hint would be appreciated.

This patch (I believe a follow-up to the datatables upgrade from 1.10.18 to
1.13.6):
https://github.com/Koha-Community/Koha/commit/63183059dd975c2f5265fa4c7d2bc59b6ad1a252#diff-20d8383af8b7699632bc26d50203158fc58acbfad77efdbe6134017a1a1d1ec7R482

(link goes directly to the line we're addressing here)
This changed the payload data from an array of JSON objects to a single JSON
object.
This caused a problem, because a JSON object can only have one instance of a
property and this scenario was not considered for more than 1 arg for the same
filter.
Using Janusz's use-case, this is what the request payload looked like:
[
  ...,
  {name: 'f', value: 'publishercode'},
  {name: 'op', value: 'like'},
  {name: 'q', value: '%University of California%'},
  {name: 'c', value: 'and'},
  {name: 'f', value: 'publicationyear'},
  {name: 'op', value: 'like'},
  {name: 'q', value: '1988'},
  ...
]

But after that patch, this is what we had (same use-case - notice the absence
of the first query parameters set):
{
  ...
  c: 'and',
  f: 'publicationyear',
  op: 'like',
  q: '1988',
  ...
}

This is because the following line:
d[params[i].name] = params[i].value;
Was effectivelly doing:
d['f'] = 'publishercode';
d['f'] = 'publicationyear';

The end result is you only get the last property value in the final object.

You can test this yourself:
Rest your branch to the commit directly before the datatables upgrade:
git reset --hard b54da05c73c9ea5b04d3552b34fcc636b0a71851
reset_all
And console.log(aoData) in itemsearch.tt

Then, reset your branch to the commit directly before bug 36563:
git reset --hard 903a8685c661ddde61335a08e126506120345abc
reset_all
And console.log(d) after the for loop

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to