diff --git a/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt b/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
index af5d41cfc..d173a475c 100644
--- a/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
+++ b/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
@@ -203,7 +203,18 @@ open class SLUB : OkHttpBaseApi() {
branch = it.getString("location")
department = Parser.unescapeEntities(it.getString("sublocation"), false)
shelfmark = it.getString("shelfmark")
- status = Jsoup.parse(it.getString("statusphrase")).text()
+ it.getString("statusphrase").run {
+ if (isNotEmpty()) {
+ status = Parser.unescapeEntities(this, false)
+ } else {
+ it.getString("link").run {
+ if(isNotEmpty()){
+ status = stringProvider.getFormattedString(
+ StringProvider.INQUIRE_AVAILABILITY, this )
+ }
+ }
+ }
+ }
statusCode = colorcodes.getOrElse(it.getString("colorcode")) { SearchResult.Status.UNKNOWN }
it.getString("duedate").run {
if (isNotEmpty()) {
diff --git a/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/i18n/StringProvider.java b/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/i18n/StringProvider.java
index 4bf5d07eb..812053a50 100644
--- a/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/i18n/StringProvider.java
+++ b/opacclient/libopac/src/main/java/de/geeksfactory/opacclient/i18n/StringProvider.java
@@ -2,21 +2,21 @@
* Copyright (C) 2013 by Johan von Forstner under the MIT license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software
+ * of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in
+ * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package de.geeksfactory.opacclient.i18n;
@@ -97,6 +97,7 @@ public interface StringProvider {
String RENEWED = "renewed";
String NOT_YET_RENEWABLE = "not_yet_renewable";
String RENEW_ILL_SEPARATELY = "renew_ill_separately";
+ String INQUIRE_AVAILABILITY = "inquire_availability";
/**
* Returns the translated string identified by identifier
diff --git a/opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt b/opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt
index 09eec204d..65fd41673 100644
--- a/opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt
+++ b/opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt
@@ -204,6 +204,10 @@ class SLUBAccountTest : BaseHtmlTest() {
class SLUBSearchTest : BaseHtmlTest() {
private var slub = SLUB()
+ init {
+ slub.stringProvider = DummyStringProvider()
+ }
+
@Test
fun testParseEmptySearchResults() {
val json = JSONObject(readResource("/slub/search/empty-search.json"))
@@ -284,6 +288,43 @@ class SLUBSearchTest : BaseHtmlTest() {
assertThat(HashSet(item.details), sameBeanAs(HashSet(expected.details)))
}
+ @Test
+ fun testParseResultByIdWithoutStatusphrase() {
+ val json = JSONObject(readResource("/slub/search/item_inquery_availability.json"))
+ val expected = DetailedItem().apply {
+ addDetail(Detail("Medientyp", "Buch"))
+ addDetail(Detail("Titel", "Astronomie: die kosmische Perspektive"))
+ title = "Astronomie: die kosmische Perspektive"
+ addDetail(Detail("Beteiligte",
+ "Bennett, Jeffrey O. [Sonstige Person, Familie und Körperschaft]; Lesch, Harald [Hrsg.]"))
+ addDetail(Detail("Erschienen", "München [u.a.] Pearson 2010 "))
+ addDetail(Detail("Erschienen in", "Always learning"))
+ addDetail(Detail("ISBN", "9783827373601; 3827373603"))
+ addDetail(Detail("Sprache", "Deutsch; Englisch"))
+ addDetail(Detail("Schlagwörter", "Astronomie"))
+ addDetail(Detail("Beschreibung",
+ "CD-ROM-Beil. enth.: Planetariumssoftware SkyGazer Educational-Edition; " +
+ "Hier auch später erschienene, unveränderte Nachdrucke; " +
+ "Auflagenzählung bezieht sich auf die engl. Orig.-Ausg"))
+ addDetail(Detail("Inhaltsverzeichnis", "http://d-nb.info/992365538/04"))
+ addDetail(Detail("Cover", "http://swbplus.bsz-bw.de/bsz304732311cov.htm"))
+ id = "id/0-590996231"
+ copies = arrayListOf(Copy().apply {
+ barcode = "34163775"
+ department = ""
+ branch = "Zentralbibliothek"
+ status = "inquire_availability https://tu-dresden.de/bu/umwelt/geo/ipg/astro"
+ statusCode = SearchResult.Status.UNKNOWN
+ shelfmark = "US 1020 B471(5)"
+ })
+ }
+
+ val item = slub.parseResultById(json)
+
+ assertThat(item, sameBeanAs(expected).ignoring("details"))
+ assertThat(HashSet(item.details), sameBeanAs(HashSet(expected.details)))
+ }
+
@Test
fun testParseResultByIdCoverAsMaterial() {
val json = JSONObject(readResource("/slub/search/detaill-cover-jpg-as-material.json"))
diff --git a/opacclient/libopac/src/test/resources/slub/search/item_inquery_availability.json b/opacclient/libopac/src/test/resources/slub/search/item_inquery_availability.json
new file mode 100644
index 000000000..f1645bd03
--- /dev/null
+++ b/opacclient/libopac/src/test/resources/slub/search/item_inquery_availability.json
@@ -0,0 +1,89 @@
+{
+ "record": {
+ "format": "Buch",
+ "title": "Astronomie: die kosmische Perspektive",
+ "contributor": [
+ "Bennett, Jeffrey O. [Sonstige Person, Familie und Körperschaft]",
+ "Lesch, Harald [Hrsg.]"
+ ],
+ "publisher": [
+ "München [u.a.] Pearson 2010 "
+ ],
+ "ispartof": [
+ {
+ "title": "Always learning"
+ }
+ ],
+ "identifier": [
+ "9783827373601",
+ "3827373603"
+ ],
+ "language": [
+ "Deutsch",
+ "Englisch"
+ ],
+ "subject": [
+ "Astronomie"
+ ],
+ "description": [
+ "CD-ROM-Beil. enth.: Planetariumssoftware SkyGazer Educational-Edition",
+ "Hier auch später erschienene, unveränderte Nachdrucke",
+ "Auflagenzählung bezieht sich auf die engl. Orig.-Ausg"
+ ],
+ "status": "",
+ "rvk": ""
+ },
+ "id": "0-590996231",
+ "oa": 0,
+ "thumbnail": "",
+ "links": [
+ {
+ "uri": "http://d-nb.info/992365538/04",
+ "note": "",
+ "material": "Inhaltsverzeichnis"
+ },
+ {
+ "uri": "http://swbplus.bsz-bw.de/bsz304732311cov.htm",
+ "note": "",
+ "material": "Cover"
+ }
+ ],
+ "linksRelated": [
+ {
+ "uri": "http://d-nb.info/992365538/04",
+ "hostLabel": "",
+ "note": "",
+ "material": "Inhaltsverzeichnis"
+ },
+ {
+ "uri": "http://swbplus.bsz-bw.de/bsz304732311cov.htm",
+ "hostLabel": "",
+ "note": "",
+ "material": "Cover"
+ }
+ ],
+ "linksAccess": [],
+ "linksGeneral": [],
+ "references": [],
+ "copies": [
+ {
+ "barcode": "34163775",
+ "location": "Zentralbibliothek",
+ "location_code": "zell1",
+ "sublocation": "",
+ "shelfmark": "US 1020 B471(5)",
+ "mediatype": "B",
+ "3d": "",
+ "3d_link": "",
+ "issue": "",
+ "colorcode": "0",
+ "statusphrase": "",
+ "link": "https://tu-dresden.de/bu/umwelt/geo/ipg/astro",
+ "status": "H",
+ "duedate": "",
+ "vormerken": "0",
+ "bestellen": "0"
+ }
+ ],
+ "parts": {}
+}
diff --git a/opacclient/opacapp/src/main/java/de/geeksfactory/opacclient/frontend/CopiesAdapter.java b/opacclient/opacapp/src/main/java/de/geeksfactory/opacclient/frontend/CopiesAdapter.java
index 8dc96f488..43e18a747 100644
--- a/opacclient/opacapp/src/main/java/de/geeksfactory/opacclient/frontend/CopiesAdapter.java
+++ b/opacclient/opacapp/src/main/java/de/geeksfactory/opacclient/frontend/CopiesAdapter.java
@@ -1,6 +1,8 @@
package de.geeksfactory.opacclient.frontend;
import android.content.Context;
+import android.text.Html;
+import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -67,7 +69,8 @@ public void onBindViewHolder(ViewHolder holder, int position) {
private void setTextOrHide(String text, TextView tv) {
if (notEmpty(text)) {
- tv.setText(text);
+ tv.setText(Html.fromHtml(text));
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
tv.setVisibility(View.VISIBLE);
} else {
tv.setVisibility(View.GONE);
diff --git a/opacclient/opacapp/src/main/res/values-de/strings_api_errors.xml b/opacclient/opacapp/src/main/res/values-de/strings_api_errors.xml
index 757f00b0a..36fdaecc6 100644
--- a/opacclient/opacapp/src/main/res/values-de/strings_api_errors.xml
+++ b/opacclient/opacapp/src/main/res/values-de/strings_api_errors.xml
@@ -98,4 +98,5 @@
%dx verlängert
noch nicht verlängerbar
Fernleihmedien bitte einzeln verlängern.
+ Verfügbarkeit bitte <a href="%s">hier</a> erfragen
diff --git a/opacclient/opacapp/src/main/res/values/strings_api_errors.xml b/opacclient/opacapp/src/main/res/values/strings_api_errors.xml
index 9a5a25808..be2d7569f 100644
--- a/opacclient/opacapp/src/main/res/values/strings_api_errors.xml
+++ b/opacclient/opacapp/src/main/res/values/strings_api_errors.xml
@@ -99,4 +99,5 @@
%dx renewed
not yet renewable
Please renew interlibrary loan items separately.
+ Please inquire about availability <a href="%s">here</a>
diff --git a/opacclient/opacapp/src/test/java/de/geeksfactory/opacclient/frontend/CopiesAdapterTest.java b/opacclient/opacapp/src/test/java/de/geeksfactory/opacclient/frontend/CopiesAdapterTest.java
index df5b1d61a..e7ab3ddc6 100644
--- a/opacclient/opacapp/src/test/java/de/geeksfactory/opacclient/frontend/CopiesAdapterTest.java
+++ b/opacclient/opacapp/src/test/java/de/geeksfactory/opacclient/frontend/CopiesAdapterTest.java
@@ -17,7 +17,6 @@
import org.junit.runner.RunWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
-import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
import de.geeksfactory.opacclient.R;