Koha: fix copy selection in reserveMode single
(previously thought that copy selection only existed in
reserveMode multi)
@@ -363,20 +363,13 @@ open class Koha : OkHttpBaseApi() {
val body = FormBody.Builder()
body.add("place_reserve", "1")
- if (doc.select("input[name=reserve_mode]").`val`() == "single") {
- // reserve_mode "single" - seems to only appear for staff accounts in Heilbronn
- body.add("biblionumbers", "")
- body.add("selecteditems", "")
- body.add("reserve_mode", "single")
- body.add("single_bib", item.id)
- body.add("expiration_date_${item.id}", "")
- } else {
- body.add("biblionumbers", "${item.id}/")
- body.add("reserve_mode", "multi")
+ val reserveMode = doc.select("input[name=reserve_mode]").`val`()
+ body.add("reserve_mode", reserveMode) // can be "single" or "multi"
body.add("single_bib", item.id)
body.add("expiration_date_${item.id}", "")
val checkboxes = doc.select("input[name=checkitem_${item.id}]")
if (checkboxes.size > 0) {
+ body.add("biblionumbers", "${item.id}/")
if (checkboxes.first()["value"] == "any") {
body.add("reqtype_${item.id}", "any")
body.add("checkitem_${item.id}", "any")
@@ -412,11 +405,13 @@ open class Koha : OkHttpBaseApi() {
}
}
}
+ } else if (reserveMode == "single") {
+ body.add("biblionumbers", "")
+ body.add("selecteditems", "")
} else if (doc.select(".holdrow .alert").size > 0) {
return OpacApi.ReservationResult(OpacApi.MultiStepResult.Status.ERROR,
doc.select(".holdrow .alert").text().trim())
}
- }
doc = httpPost("$baseurl/cgi-bin/koha/opac-reserve.pl", body.build(), ENCODING).html
