From: kenstir Date: Fri, 23 Oct 2015 00:59:23 +0000 (-0400) Subject: Fixed edge case where checked out item record ID was -1 (for an item checked out... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a89c1b1a360e599b565b800cf0e01136b97e16d3;p=working%2FEvergreen.git Fixed edge case where checked out item record ID was -1 (for an item checked out from a non-member library), causing view to be mislabelled "All Formats". If we don't know the format just leave it blank. --- diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/AccountAccess.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/AccountAccess.java index 2893e7d3c0..0cc1683837 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/AccountAccess.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/AccountAccess.java @@ -486,6 +486,10 @@ public class AccountAccess { } public String fetchFormat(String id) { + // This can happen when looking up checked out item borrowed from another system. + if (id.equals("-1")) + return ""; + OSRFObject resp = (OSRFObject) Utils.doRequestSimple(conn, PCRUD_SERVICE, PCRUD_METHOD_RETRIEVE_MRA, new Object[] { "ANONYMOUS", id }); diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/CircRecord.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/CircRecord.java index d071b04f92..3e0d02efd3 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/CircRecord.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/CircRecord.java @@ -19,8 +19,6 @@ */ package org.evergreen_ils.accountAccess.checkout; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Date; import org.evergreen_ils.globals.GlobalConfigs; @@ -141,7 +139,7 @@ public class CircRecord { public String getFormatLabel() { if (format != null) { - return SearchFormat.getLabelFromSearchFormat(format); + return SearchFormat.getItemLabelFromSearchFormat(format); } return ""; } diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/holds/HoldsListView.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/holds/HoldsListView.java index 81c7ccf33c..0b0b491161 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/holds/HoldsListView.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/holds/HoldsListView.java @@ -221,7 +221,7 @@ public class HoldsListView extends ActionBarActivity { holdTitle.setText(record.title); holdAuthor.setText(record.author); - holdFormat.setText(SearchFormat.getLabelFromSearchFormat(record.format)); + holdFormat.setText(SearchFormat.getItemLabelFromSearchFormat(record.format)); status.setText(record.getHoldStatus(getResources())); return row; diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java index 9815a8789a..c5a996fe90 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java @@ -19,7 +19,6 @@ */ package org.evergreen_ils.searchCatalog; -import java.io.*; import java.util.*; import android.support.v7.app.ActionBar; @@ -714,7 +713,7 @@ public class SearchCatalogListView extends ActionBarActivity { // set text recordTitle.setText(record.title); recordAuthor.setText(record.author); - recordFormat.setText(SearchFormat.getLabelFromSearchFormat(record.search_format)); + recordFormat.setText(SearchFormat.getItemLabelFromSearchFormat(record.search_format)); recordPublisher.setText(record.pubdate + " " + record.publisher); return row; diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchFormat.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchFormat.java index 312eaea434..3a1cf0f5d5 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchFormat.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchFormat.java @@ -99,7 +99,9 @@ public class SearchFormat { } /// get label "CD Music recording" from search format "cdmusic" - public static String getLabelFromSearchFormat(String search_format) { + public static String getItemLabelFromSearchFormat(String search_format) { + if (search_format.equalsIgnoreCase("")) + return ""; for (SearchFormatItem i : searchFormats) { if (i.searchFormat.equalsIgnoreCase(search_format)) { return (i.displayLabel != null) ? i.displayLabel : i.spinnerLabel; diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/utils/ui/BasicDetailsFragment.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/utils/ui/BasicDetailsFragment.java index 96e5070e37..91ca957448 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/utils/ui/BasicDetailsFragment.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/utils/ui/BasicDetailsFragment.java @@ -262,7 +262,7 @@ public class BasicDetailsFragment extends Fragment { record_header.setText(String.format(getString(R.string.record_of), position, total)); titleTextView.setText(record.title); - formatTextView.setText(SearchFormat.getLabelFromSearchFormat(record.search_format)); + formatTextView.setText(SearchFormat.getItemLabelFromSearchFormat(record.search_format)); authorTextView.setText(record.author); publisherTextView.setText(record.pubdate + " " + record.publisher);