Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
Koha: Fix parsing error with mixed names in checkbox groups
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Feb 26, 2021
1 parent a0dc24d commit 9c17b5b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ open class Koha : OkHttpBaseApi() {
builder.addQueryParameter("idx", q.key)
builder.addQueryParameter("q", q.value)
} else if (q.searchField is DropdownSearchField) {
builder.addQueryParameter(q.searchField.data!!.getString("id"), q.value)
if (q.value.contains('=')) {
val parts = q.value.split("=")
builder.addQueryParameter(parts[0], parts[1])
} else {
builder.addQueryParameter(q.searchField.data!!.getString("id"), q.value)
}
} else if (q.searchField is CheckboxSearchField) {
if (q.value!!.toBoolean()) {
builder.addQueryParameter("limit", q.key)
Expand Down Expand Up @@ -169,7 +174,7 @@ open class Koha : OkHttpBaseApi() {
dropdownValues = listOf(DropdownSearchField.Option("", "")) +
checkboxes.map { checkbox ->
DropdownSearchField.Option(
checkbox["value"],
checkbox["name"] + "=" + checkbox["value"],
checkbox.nextElementSibling().text.trim())
}
data = JSONObject().apply {
Expand Down

0 comments on commit 9c17b5b

Please sign in to comment.