Fixed edge case where checked out item record ID was -1 (for an item checked out...
authorkenstir <kenstir@gmail.com>
Fri, 23 Oct 2015 00:59:23 +0000 (20:59 -0400)
committerkenstir <kenstir@gmail.com>
Fri, 23 Oct 2015 00:59:23 +0000 (20:59 -0400)
Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/AccountAccess.java
Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/CircRecord.java
Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/holds/HoldsListView.java
Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java
Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchFormat.java
Open-ILS/src/Android/core/src/org/evergreen_ils/utils/ui/BasicDetailsFragment.java

index 2893e7d..0cc1683 100644 (file)
@@ -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 });
 
index d071b04..3e0d02e 100644 (file)
@@ -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 "";
     }
index 81c7ccf..0b0b491 100644 (file)
@@ -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;
index 9815a87..c5a996f 100644 (file)
@@ -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;
index 312eaea..3a1cf0f 100644 (file)
@@ -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;
index 96e5070..91ca957 100644 (file)
@@ -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);