<activity android:name=".accountAccess.ItemsCheckOutListView"></activity>
<!-- Holds Activities -->
- <activity android:name=".accountAccess.HoldsListView"></activity>
+ <activity android:name=".accountAccess.holds.HoldsListView"></activity>
+ <activity android:name=".accountAccess.holds.PlaceHold"></activity>
+
<activity android:name=".searchCatalog.RecordDetails_Info"></activity>
<activity android:name=".searchCatalog.RecordDetails_Content"></activity>
public static final int account_btn_check_out=0x7f090007;
public static final int account_btn_fines=0x7f090009;
public static final int account_btn_holds=0x7f090008;
+ public static final int action_bar=0x7f090015;
+ public static final int cancel_hold=0x7f090016;
public static final int checkout_due_date=0x7f090005;
public static final int checkout_items_list=0x7f090001;
public static final int checkout_record_author=0x7f090003;
public static final int checkout_record_title=0x7f090002;
public static final int checkout_renewals_remaining=0x7f090004;
- public static final int chose_organisation=0x7f090027;
- public static final int hold_active=0x7f090013;
+ public static final int chose_organisation=0x7f090032;
+ public static final int header=0x7f090013;
+ public static final int header_title=0x7f090014;
public static final int hold_author=0x7f090011;
- public static final int hold_expiration_date=0x7f090014;
+ public static final int hold_contact_telephone=0x7f09001a;
+ public static final int hold_enable_email_notification=0x7f09001c;
+ public static final int hold_enable_phone_notification=0x7f09001b;
+ public static final int hold_expiration_date=0x7f09001e;
+ public static final int hold_physical_description=0x7f090019;
+ public static final int hold_pickup_location=0x7f09001d;
+ public static final int hold_recipient=0x7f090018;
public static final int hold_status=0x7f090012;
+ public static final int hold_suspend_hold=0x7f09001f;
public static final int hold_title=0x7f090010;
public static final int holds_item_list=0x7f09000f;
public static final int holds_number=0x7f09000e;
public static final int main_btn_account=0x7f09000c;
public static final int main_btn_app_settings=0x7f09000d;
public static final int main_btn_search=0x7f09000b;
- public static final int record_details_info_author=0x7f090016;
- public static final int record_details_info_publisher=0x7f090017;
- public static final int record_details_info_title=0x7f090015;
- public static final int record_details_simple_author=0x7f090019;
- public static final int record_details_simple_isbn=0x7f09001e;
- public static final int record_details_simple_publisher=0x7f09001a;
- public static final int record_details_simple_series=0x7f09001c;
- public static final int record_details_simple_subject=0x7f09001b;
- public static final int record_details_simple_synopsis=0x7f09001d;
- public static final int record_details_simple_title=0x7f090018;
+ public static final int place_hold=0x7f090017;
+ public static final int record_details_info_author=0x7f090021;
+ public static final int record_details_info_publisher=0x7f090022;
+ public static final int record_details_info_title=0x7f090020;
+ public static final int record_details_simple_author=0x7f090024;
+ public static final int record_details_simple_isbn=0x7f090029;
+ public static final int record_details_simple_publisher=0x7f090025;
+ public static final int record_details_simple_series=0x7f090027;
+ public static final int record_details_simple_subject=0x7f090026;
+ public static final int record_details_simple_synopsis=0x7f090028;
+ public static final int record_details_simple_title=0x7f090023;
public static final int renew_button=0x7f090006;
- public static final int searchButton=0x7f090025;
- public static final int searchText=0x7f090024;
- public static final int search_more_items_button=0x7f09001f;
- public static final int search_record_author=0x7f090022;
- public static final int search_record_img=0x7f090020;
- public static final int search_record_publishing=0x7f090023;
- public static final int search_record_title=0x7f090021;
+ public static final int searchButton=0x7f090030;
+ public static final int searchText=0x7f09002f;
+ public static final int search_more_items_button=0x7f09002a;
+ public static final int search_record_author=0x7f09002d;
+ public static final int search_record_img=0x7f09002b;
+ public static final int search_record_publishing=0x7f09002e;
+ public static final int search_record_title=0x7f09002c;
public static final int search_result_number=0x7f090000;
- public static final int search_results_list=0x7f090026;
+ public static final int search_results_list=0x7f090031;
}
public static final class layout {
public static final int checkout_list=0x7f030000;
public static final int holds_list=0x7f030004;
public static final int holds_list_item=0x7f030005;
public static final int main=0x7f030006;
- public static final int record_details_info=0x7f030007;
- public static final int record_details_simple=0x7f030008;
- public static final int search_result_footer_view=0x7f030009;
- public static final int search_result_item=0x7f03000a;
- public static final int search_result_list=0x7f03000b;
+ public static final int place_hold=0x7f030007;
+ public static final int record_details_info=0x7f030008;
+ public static final int record_details_simple=0x7f030009;
+ public static final int search_result_footer_view=0x7f03000a;
+ public static final int search_result_item=0x7f03000b;
+ public static final int search_result_list=0x7f03000c;
}
public static final class string {
public static final int app_name=0x7f070001;
+ public static final int author=0x7f07000d;
+ public static final int cancel=0x7f070017;
+ public static final int contact_email_address=0x7f070011;
+ public static final int contact_telephone=0x7f07000f;
+ public static final int enable_email_notification=0x7f070012;
+ public static final int enable_phone_notification=0x7f070010;
+ public static final int expiration_date=0x7f070014;
public static final int hello=0x7f070000;
+ public static final int physical_description=0x7f07000e;
+ public static final int pickup_location=0x7f070013;
+ public static final int place_hold=0x7f070016;
+ /** Place Hold Activity View
+ */
+ public static final int recipient=0x7f07000b;
public static final int renew_button=0x7f07000a;
public static final int search_result_text=0x7f070009;
+ public static final int suspend_hold=0x7f070015;
+ public static final int title=0x7f07000c;
public static final int title_application_settings=0x7f070004;
public static final int title_book_bags=0x7f070008;
public static final int title_check_out=0x7f070005;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
+ android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:id="@+id/hold_author"
android:layout_below="@+id/hold_title"
/>
-
<TextView
android:layout_width="wrap_content"
android:layout_below="@+id/hold_author"
/>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/hold_active"
- android:layout_below="@+id/hold_status"
- />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/hold_expiration_date"
- android:layout_below="@+id/hold_active"
- />
-
-
</RelativeLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+
+ <LinearLayout
+ android:id="@+id/header"
+ android:layout_width="fill_parent"
+ android:layout_height="40dip"
+ android:background="@color/blue"
+ android:layout_alignParentTop="true"
+ >
+ <TextView
+ android:id="@+id/header_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="5dip"
+ android:paddingTop="5dip"
+ android:textColor="@color/white"
+ android:textStyle="bold"
+ android:textSize="16dip"
+ />
+
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/action_bar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true"
+ >
+ <Button
+ android:id="@+id/cancel_hold"
+ android:layout_width="100dip"
+ android:layout_height="wrap_content"
+ android:text="@string/cancel"
+ />
+
+ <Button
+ android:id="@+id/place_hold"
+ android:layout_width="100dip"
+ android:layout_height="wrap_content"
+ android:text="@string/place_hold"
+ />
+ </LinearLayout>
+
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:fillViewport="true"
+ android:layout_above="@id/action_bar"
+ android:layout_below="@id/header"
+ >
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ >
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/recipient"
+ />
+
+ <TextView
+ android:id="@+id/hold_recipient"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/title"
+ />
+
+ <TextView
+ android:id="@+id/hold_title"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/author"
+ />
+
+ <TextView
+ android:id="@+id/hold_author"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/physical_description"
+ />
+
+ <TextView
+ android:id="@+id/hold_physical_description"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/contact_telephone"
+ />
+
+ <TextView
+ android:id="@+id/hold_contact_telephone"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/enable_phone_notification"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_enable_phone_notification"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/enable_email_notification"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_enable_email_notification"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/pickup_location"
+ />
+
+ <Spinner
+ android:id="@+id/hold_pickup_location"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/expiration_date"
+ />
+
+ <TextView
+ android:id="@+id/hold_expiration_date"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/suspend_hold"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_suspend_hold"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+
+</RelativeLayout>
\ No newline at end of file
<string name="search_result_text"> Search result :</string>
<string name="renew_button">renew</string>
+ <!-- Place Hold Activity View -->
+
+ <string name="recipient">Recipient</string>
+ <string name="title">Title</string>
+ <string name="author">Author</string>
+ <string name="physical_description">Physical Description</string>
+ <string name="contact_telephone">Contact tel</string>
+ <string name="enable_phone_notification"> Phone notification</string>
+ <string name="contact_email_address">Contact email address </string>
+ <string name="enable_email_notification"></string>
+ <string name="pickup_location">Pickup location</string>
+ <string name="expiration_date">Expiration Date</string>
+ <string name="suspend_hold">Suspend Hold</string>
+ <string name="place_hold">Place hold</string>
+ <string name="cancel">Cancel</string>
+
+
</resources>
\ No newline at end of file
package org.evergreen.android.accountAccess;
+import java.lang.annotation.Target;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.evergreen.android.accountAccess.holds.HoldRecord;
import org.evergreen.android.globals.Utils;
import org.opensrf.Method;
import org.opensrf.net.http.GatewayRequest;
// if holdtype == M return mvr OSRFObject
public static String METHOD_FETCH_MRMODS = "open-ils.search.biblio.metarecord.mods_slim.retrieve";
// if holdtype == T return mvr OSRFObject
- public static String METHOD_FETCH_RMODS = "open-ils.search.biblio.records.mods_slim.retrieve";
- //if hold type V
+ public static String METHOD_FETCH_RMODS = "open-ils.search.biblio.record.mods_slim.retrieve";
+ //if hold type V
public static String METHOD_FETCH_VOLUME = "open-ils.search.asset.call_number.retrieve";
//if hold type I
public static String METHOD_FETCH_ISSUANCE = "open-ils.serial.issuance.pub_fleshed.batch.retrieve";
* description :
* @param : authtoken , hashmap {"titleid":38,"mrid":35,"volume_id":null,"issuanceid":null,
* "copy_id":null,"hold_type":"T","holdable_formats":null,"patronid":2,"depth":0,"pickup_lib":"8","partid":null}
+ * parameters : (desc in OpenILS::Application::Circ::holds perldoc)
+ * patron_id ID of hold recipient
+ * depth (hold range depth, default 0)
+ * pickup_lib destination for hold, fallback value for selection_ou
+ * selection_ou
+ * issuanceid
+ * partid
+ * titleid
+ * volume_id
+ * copy_id
+ * mrid
+ * hold_type
+ *
* @returns : hashmap with "success" : 1 field or
*/
public static String METHOD_VERIFY_HOLD_POSSIBLE = "open-ils.circ.title_hold.is_possible";
public static String METHOD_FLESH_PUBLIC_CONTAINER = "open-ils.actor.container.flesh";
-
-
/** The conn. */
public HttpConnection conn;
/** The auth token.
* Sent with every request that needs authentication
* */
- private String authToken = null;
+ public static String authToken = null;
/** The auth time. */
private Integer authTime = null;
if(queryResult.equals("SUCCESS")){
Object payload = ((Map<String,String>) resp).get("payload");
- authToken = ((Map<String,String>)payload).get("authtoken");
+ accountAccess.authToken = ((Map<String,String>)payload).get("authtoken");
try{
- System.out.println(((Map<String,Integer>)payload).get("authtoken"));
- authTime = ((Map<String,Integer>)payload).get("authtime");
+ System.out.println(authToken);
+ accountAccess.authTime = ((Map<String,Integer>)payload).get("authtime");
}catch(Exception e){
System.err.println("Error in parsing authtime " + e.getMessage());
- public List<HoldItem> getHolds(){
+ public List<HoldRecord> getHolds(){
- ArrayList<HoldItem> holds = new ArrayList<HoldItem>();
+ ArrayList<HoldRecord> holds = new ArrayList<HoldRecord>();
//fields of interest : expire_time
List<OSRFObject> listHoldsAhr = null;
-
- // holds description for each hold
- List<OSRFObject> listHoldsMvr = null;
-
- //status of holds, fields like : potential_copies, status, total_holds, queue_position, estimated_wait
- List<HashMap<String,Integer>> listHoldsStatus = null;
-
+
listHoldsAhr = (List<OSRFObject>) Utils.doRequest(conn, SERVICE_CIRC, METHOD_FETCH_HOLDS, new Object[]{authToken,userID});
- //for(int i=0;i<listHoldsAhr.size();i++){
+ for(int i=0;i<listHoldsAhr.size();i++){
//create hold item
- HoldItem hold = new HoldItem(listHoldsAhr.get(0));
+ HoldRecord hold = new HoldRecord(listHoldsAhr.get(i));
//get title
- fetchHoldTitleInfo(listHoldsAhr.get(0), hold);
+ fetchHoldTitleInfo(listHoldsAhr.get(i), hold);
//get status
- fetchHoldStatus(listHoldsAhr.get(0),hold);
+ fetchHoldStatus(listHoldsAhr.get(i),hold);
holds.add(hold);
- //}
+ }
return holds;
}
* P - pat
*/
- private Object fetchHoldTitleInfo(OSRFObject holdArhObject, HoldItem hold){
+ private Object fetchHoldTitleInfo(OSRFObject holdArhObject, HoldRecord hold){
String holdType = (String)holdArhObject.get("hold_type");
String method = null;
+
+
Object response;
Object holdInfo = null;
if(holdType.equals("T") || holdType.equals("M")){
- if(holdType.equals("T"))
+ if(holdType.equals("M"))
method = METHOD_FETCH_MRMODS;
- if(holdType.equals("M"))
+ if(holdType.equals("T"))
method = METHOD_FETCH_RMODS;
-
+ System.out.println();
holdInfo = Utils.doRequest(conn,SERVICE_SEARCH, method, new Object[]{holdArhObject.get("target")});
- System.out.println("Hold here " + holdInfo);
- ((OSRFObject)holdInfo).getString("title");
- ((OSRFObject)holdInfo).getString("author");
+ //System.out.println("Hold here " + holdInfo);
+ hold.title = ((OSRFObject)holdInfo).getString("title");
+ hold.author = ((OSRFObject)holdInfo).getString("author");
}
else{
//multiple objects per hold ????
- holdInfo = holdFetchObjects(holdArhObject);
+ holdInfo = holdFetchObjects(holdArhObject, hold);
}
return holdInfo;
}
- private Object holdFetchObjects(OSRFObject hold){
+ private Object holdFetchObjects(OSRFObject hold, HoldRecord holdObj){
String type = (String)hold.get("hold_type");
+ System.out.println("Hold Type " + type);
if(type.equals("C")){
+
+ /* steps
+ * asset.copy'->'asset.call_number'->'biblio.record_entry'
+ * or, in IDL ids, acp->acn->bre
+ */
+
//fetch_copy
OSRFObject copyObject = fetchAssetCopy(hold.getInt("target"));
//fetch_volume from copyObject.call_number field
Integer call_number = copyObject.getInt("call_number");
if(call_number != null){
- OSRFObject volume = (OSRFObject) Utils.doRequest(conn,SERVICE_CIRC, METHOD_FETCH_VOLUME, new Object[]{copyObject.getInt("call_number")});
+
+ OSRFObject volume = (OSRFObject) Utils.doRequest(conn,SERVICE_SEARCH, METHOD_FETCH_VOLUME, new Object[]{copyObject.getInt("call_number")});
//in volume object : record
+ Integer record = volume.getInt("record");
+
+ //part label
+ holdObj.part_label = volume.getString("label");
+
+ System.out.println("Record " + record);
+ OSRFObject holdInfo = (OSRFObject)Utils.doRequest(conn,SERVICE_SEARCH, METHOD_FETCH_RMODS, new Object[]{record});
+
+ holdObj.title = holdInfo.getString("title");
+ holdObj.author = holdInfo.getString("author");
}
+
+
return copyObject;
}
else
if(type.equals("V")){
+ //must test
+
//fetch_volume
- OSRFObject volume = (OSRFObject) Utils.doRequest(conn,SERVICE_CIRC, METHOD_FETCH_VOLUME, new Object[]{hold.getInt("target")});
+ OSRFObject volume = (OSRFObject) Utils.doRequest(conn,SERVICE_SEARCH, METHOD_FETCH_VOLUME, new Object[]{hold.getInt("target")});
//in volume object : record
+
+ //in volume object : record
+ Integer record = volume.getInt("record");
+
+ //part label
+ holdObj.part_label = volume.getString("label");
+
+ System.out.println("Record " + record);
+ OSRFObject holdInfo = (OSRFObject)Utils.doRequest(conn,SERVICE_SEARCH, METHOD_FETCH_RMODS, new Object[]{record});
+
+ holdObj.title = holdInfo.getString("title");
+ holdObj.author = holdInfo.getString("author");
}
else
if(type.equals("I")){
OSRFObject issuance = (OSRFObject) Utils.doRequest(conn,SERVICE_SERIAL, METHOD_FETCH_ISSUANCE, new Object[]{hold.getInt("target")});
+ //TODO
+
}
else
if(type.equals("P")){
- HashMap<String, Object> param = new HashMap<String, Object>(0);
+ HashMap<String, Object> param = new HashMap<String, Object>();
param.put("cache", 1);
- param.put("fields", new String[]{"label","record"});
+
+ ArrayList<String> fieldsList = new ArrayList<String>();
+ fieldsList.add("label");
+ fieldsList.add("record");
+
+ param.put("fields", fieldsList);
HashMap<String, Integer> queryParam = new HashMap<String, Integer>();
//PART_ID use "target field in hold"
queryParam.put("id", hold.getInt("target"));
param.put("query",queryParam);
- //returns mvr object
- OSRFObject part = (OSRFObject) Utils.doRequest(conn,SERVICE_FIELDER,"open-ils.fielder.bmp.atomic",new Object[]{});
+ //returns [{record:id, label=part label}]
+
+ List<Object> part = (List<Object>)Utils.doRequest(conn,SERVICE_FIELDER,"open-ils.fielder.bmp.atomic",new Object[]{param});
+
+ Map<String,?> partObj =(Map<String,?>)part.get(0);
+
+ Integer recordID = (Integer)partObj.get("record");
+ String part_label = (String)partObj.get("label");
+
+ OSRFObject holdInfo = (OSRFObject)Utils.doRequest(conn,SERVICE_SEARCH, METHOD_FETCH_RMODS, new Object[]{recordID});
+
+ holdObj.part_label = part_label;
+ holdObj.title = holdInfo.getString("title");
+ holdObj.author = holdInfo.getString("author");
}
return null;
}
- public Object fetchHoldStatus(OSRFObject hold, HoldItem holdObj){
+ public Object fetchHoldStatus(OSRFObject hold, HoldRecord holdObj){
Integer hold_id = hold.getInt("id");
// MAP : potential_copies, status, total_holds, queue_position, estimated_wait
return response;
}
- public Object createHold(OSRFObject newHoldObject){
+ public Object createHold(Integer recordID){
- Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_CREATE_HOLD, new Object[]{authToken,newHoldObject});
+ OSRFObject ahr = new OSRFObject("ahr");
+ ahr.put("target", recordID);
+ ahr.put("usr", userID);
+ ahr.put("requestor", userID);
+ ahr.put("hold_type", "T");
+ ahr.put("pickup_lib", 4);
+ ahr.put("selection_ou",8);
+
+ //selection_ou from where it was selected
+ //pick_up lib
+ //type
+
+ Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_CREATE_HOLD, new Object[]{authToken,ahr});
return response;
}
// ?? return boolean
- public Object isHoldPossible(HashMap<String,?> valuesHold){
+ public Object isHoldPossible(Integer pickup_lib,Integer recordID){
- Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_VERIFY_HOLD_POSSIBLE, new Object[]{authToken,valuesHold});
+ HashMap<String,Integer> mapAsk = getHoldPreCreateInfo(recordID, pickup_lib);
+ mapAsk.put("pickup_lib", pickup_lib);
+ mapAsk.put("hold_type", null);
+ mapAsk.put("patronid", userID);
+ mapAsk.put("volume_id", null);
+ mapAsk.put("issuanceid", null);
+ mapAsk.put("copy_id", null);
+ mapAsk.put("depth", 0);
+ mapAsk.put("part_id", null);
+ mapAsk.put("holdable_formats", null);
+ //{"titleid":63,"mrid":60,"volume_id":null,"issuanceid":null,"copy_id":null,"hold_type":"T","holdable_formats":null,
+ //"patronid":2,"depth":0,"pickup_lib":"8","partid":null}
+
+
+ Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_VERIFY_HOLD_POSSIBLE, new Object[]{authToken,mapAsk});
return response;
}
+ //return
+ public HashMap<String,Integer> getHoldPreCreateInfo(Integer recordID, Integer pickup_lib){
+
+
+ HashMap<String, Integer> param = new HashMap<String, Integer>();
+
+ param.put("pickup_lib",pickup_lib);
+ param.put("record", recordID);
+
+ Map<String,?> response = (Map<String,?>)Utils.doRequest(conn, SERVICE_SEARCH, "open-ils.search.metabib.record_to_descriptors", new Object[]{param});
+
+ Integer metarecordID = Integer.parseInt((String)response.get("metarecord"));
+
+
+ HashMap<String,Integer> map = new HashMap<String, Integer>();
+ map.put("titleid", recordID);
+ map.put("mrid", metarecordID);
+
+ return map;
+ /* Methods to get necessary info on hold
+ open-ils.search.metabib.record_to_descriptors
+
+ open-ils.search.biblio.record_hold_parts
+ */
+ }
+
//----------------------------Fines Summary------------------------------------//
+++ /dev/null
-package org.evergreen.android.accountAccess;
-
-import java.util.Date;
-
-import org.evergreen.android.globals.GlobalConfigs;
-import org.opensrf.util.OSRFObject;
-
-public class HoldItem {
-
- //metarecord
- public static final int M = 0;
- //record
- public static final int T = 1;
- //volume
- public static final int V = 2;
- //issuance
- public static final int I = 3;
- //copy
- public static final int C = 4;
- //part
- public static final int P = 5;
-
- private Integer requestLibID = null;
-
- private Integer pickupLibID = null;
-
- public Integer holdType = null;
- //id for target object
- public Integer target = null;
- public Date expire_time = null;
-
- public String title = null;
-
- public String author = null;
-
-
- /* Hold status
- * holdStatus == 4 => AVAILABLE
- * holdStatus == 3 => WAITING
- * holdStatus <= 3 => TRANSIT
- */
-
- public Integer status = null;
-
- public Boolean active = null;
-
- public HoldItem(OSRFObject ahr){
-
- this.target = ahr.getInt("target");
- String type = ahr.getString("hold_type");
-
- if(type.equals("M")){
- holdType = M;
- }else
- if(type.equals("T")){
- holdType = T;
- }else
- if(type.equals("V")){
- holdType = V;
- }else
- if(type.equals("I")){
- holdType = I;
- }else
- if(type.equals("C")){
- holdType = C;
- }else
- if(type.equals("P"))
- holdType = P;
-
- this.expire_time = GlobalConfigs.parseDate(ahr.getString("expire_time"));
-
- }
-
-
-}
+++ /dev/null
-package org.evergreen.android.accountAccess;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.ItemsCheckOutListView.CheckOutArrayAdapter;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class HoldsListView extends Activity{
-
- private String TAG = "HoldsListView";
-
- private AccountAccess accountAccess = null;
-
- private ListView lv;
-
- private HoldsArrayAdapter listAdapter = null;
-
- private ArrayList<CircRecord> holdRecords = null;
-
- private Context context;
-
- private ProgressDialog progressDialog;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.holds_list);
-
- context = this;
- accountAccess = AccountAccess.getAccountAccess();
-
- accountAccess.getHolds();
- /*
- lv = (ListView) findViewById(R.id.checkout_items_list);
-
- holdRecords = new ArrayList<CircRecord>();
- listAdapter = new HoldsArrayAdapter(context, R.layout.holds_list_item, holdRecords);
- lv.setAdapter(listAdapter);
- */
-
-
- }
-
-
- class HoldsArrayAdapter extends ArrayAdapter<CircRecord> {
- private static final String tag = "CheckoutArrayAdapter";
-
- private TextView holdTitle;
- private TextView holdAuthor;
- private TextView expirationDate;
- private TextView status;
- private TextView active;
-
- private List<CircRecord> records = new ArrayList<CircRecord>();
-
- public HoldsArrayAdapter(Context context, int textViewResourceId,
- List<CircRecord> objects) {
- super(context, textViewResourceId, objects);
- this.records = objects;
- }
-
- public int getCount() {
- return this.records.size();
- }
-
- public CircRecord getItem(int index) {
- return this.records.get(index);
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- View row = convertView;
-
- // Get item
- final CircRecord record = getItem(position);
-
-
- if(record == null)
- {
- Log.d(tag, "Starting XML view more infaltion ... ");
- LayoutInflater inflater = (LayoutInflater) this.getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = inflater.inflate(R.layout.search_result_footer_view, parent, false);
- Log.d(tag, "Successfully completed XML view more Inflation!");
-
-
- }
- else{
-
- //if it is the right type of view
- if (row == null ) {
-
- Log.d(tag, "Starting XML Row Inflation ... ");
- LayoutInflater inflater = (LayoutInflater) this.getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = inflater.inflate(R.layout.checkout_list_item, parent, false);
- Log.d(tag, "Successfully completed XML Row Inflation!");
-
- }
-
- // Get reference to TextView - title
- holdTitle = (TextView) row.findViewById(R.id.hold_title);
-
- // Get reference to TextView author
- holdAuthor = (TextView) row.findViewById(R.id.hold_author);
-
- //Get hold expiration date
- expirationDate = (TextView) row.findViewById(R.id.hold_expiration_date);
-
- //Get hold status
- status = (TextView) row.findViewById(R.id.hold_status);
-
- active = (TextView) row.findViewById(R.id.hold_active);
-
-
- //set text
- /*
- System.out.println("Row" + record.getTitle() + " " + record.getAuthor() + " " + record.getDueDate() + " " + record.getRenewals());
- recordTitle.setText(record.getTitle());
- recordAuthor.setText(record.getAuthor());
- recordDueDate.setText(record.getDueDate());
- recordRenewals.setText(record.getRenewals()+"");
- */
- }
-
- return row;
- }
- }
-}
--- /dev/null
+package org.evergreen.android.accountAccess.holds;
+
+import java.util.Date;
+
+import org.evergreen.android.globals.GlobalConfigs;
+import org.opensrf.util.OSRFObject;
+
+public class HoldRecord {
+
+ //metarecord
+ public static final int M = 0;
+ //record
+ public static final int T = 1;
+ //volume
+ public static final int V = 2;
+ //issuance
+ public static final int I = 3;
+ //copy
+ public static final int C = 4;
+ //part
+ public static final int P = 5;
+
+ private Integer requestLibID = null;
+
+ private Integer pickupLibID = null;
+
+ public Integer holdType = null;
+ //id for target object
+ public Integer target = null;
+ public Date expire_time = null;
+
+ public String title = null;
+
+ public String author = null;
+
+
+ /* Hold status
+ * holdStatus == 4 => AVAILABLE
+ * holdStatus == 3 => WAITING
+ * holdStatus <= 3 => TRANSIT
+ */
+
+ //only for P types
+ public String part_label = null;
+
+ public Integer status = null;
+
+ public Boolean active = null;
+
+ public HoldRecord(OSRFObject ahr){
+
+ this.target = ahr.getInt("target");
+ String type = ahr.getString("hold_type");
+
+ if(type.equals("M")){
+ holdType = M;
+ }else
+ if(type.equals("T")){
+ holdType = T;
+ }else
+ if(type.equals("V")){
+ holdType = V;
+ }else
+ if(type.equals("I")){
+ holdType = I;
+ }else
+ if(type.equals("C")){
+ holdType = C;
+ }else
+ if(type.equals("P"))
+ holdType = P;
+
+ this.expire_time = GlobalConfigs.parseDate(ahr.getString("expire_time"));
+
+ }
+ //based on status integer field retreive hold status in text
+ public String getHoldStatus(){
+
+ String holdStatus = "";
+
+ if(holdType == 7)
+ return "Suspended";
+ if(holdType == 4)
+ return "Available";
+ if(holdType == 3)
+ return "Waiting";
+ if(holdType < 3)
+ return "Transit";
+
+ return holdStatus;
+ }
+
+}
--- /dev/null
+package org.evergreen.android.accountAccess.holds;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class HoldsListView extends Activity{
+
+ private String TAG = "HoldsListView";
+
+ private AccountAccess accountAccess = null;
+
+ private ListView lv;
+
+ private HoldsArrayAdapter listAdapter = null;
+
+ private List<HoldRecord> holdRecords = null;
+
+ private Context context;
+
+ private ProgressDialog progressDialog;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.holds_list);
+
+
+ lv = (ListView)findViewById(R.id.holds_item_list);
+ context = this;
+ accountAccess = AccountAccess.getAccountAccess();
+
+ holdRecords = new ArrayList<HoldRecord>();
+ listAdapter = new HoldsArrayAdapter(context, R.layout.holds_list_item, holdRecords);
+ lv.setAdapter(listAdapter);
+
+ Thread getHoldsThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+
+ holdRecords = accountAccess.getHolds();
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ listAdapter.clear();
+
+ for(int i=0;i<holdRecords.size();i++)
+ listAdapter.add(holdRecords.get(i));
+
+ progressDialog.dismiss();
+ listAdapter.notifyDataSetChanged();
+
+ }
+ });
+ }
+ });
+
+ if(accountAccess.isAuthenticated()){
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setMessage("Loading holds");
+ progressDialog.show();
+ getHoldsThread.start();
+
+ }
+ else
+ Toast.makeText(context, "You must be authenticated to retrieve circ records", Toast.LENGTH_LONG);
+
+ }
+
+
+ class HoldsArrayAdapter extends ArrayAdapter<HoldRecord> {
+ private static final String tag = "CheckoutArrayAdapter";
+
+ private TextView holdTitle;
+ private TextView holdAuthor;
+ private TextView status;
+
+ private List<HoldRecord> records = new ArrayList<HoldRecord>();
+
+ public HoldsArrayAdapter(Context context, int textViewResourceId,
+ List<HoldRecord> objects) {
+ super(context, textViewResourceId, objects);
+ this.records = objects;
+ }
+
+ public int getCount() {
+ return this.records.size();
+ }
+
+ public HoldRecord getItem(int index) {
+ return this.records.get(index);
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View row = convertView;
+
+ // Get item
+ final HoldRecord record = getItem(position);
+
+ if(row == null){
+
+ Log.d(tag, "Starting XML view more infaltion ... ");
+ LayoutInflater inflater = (LayoutInflater) this.getContext()
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ row = inflater.inflate(R.layout.holds_list_item, parent, false);
+ Log.d(tag, "Successfully completed XML view more Inflation!");
+
+
+ }
+ // Get reference to TextView - title
+ holdTitle = (TextView) row.findViewById(R.id.hold_title);
+
+ // Get reference to TextView author
+ holdAuthor = (TextView) row.findViewById(R.id.hold_author);
+
+ //Get hold status
+ status = (TextView) row.findViewById(R.id.hold_status);
+
+ //set text
+
+ System.out.println("Row" + record.title + " " + record.author + " " + record.getHoldStatus());
+ //set raw information
+ holdTitle.setText(record.title);
+ holdAuthor.setText(record.author);
+ status.setText(record.getHoldStatus());
+
+
+ return row;
+ }
+ }
+}
--- /dev/null
+package org.evergreen.android.accountAccess.holds;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.searchCatalog.RecordInfo;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class PlaceHold extends Activity{
+
+
+ private TextView recipient;
+
+ private TextView title;
+
+ private TextView author;
+
+ private TextView physical_description;
+
+ private TextView screen_title;
+
+ private AccountAccess accountAccess;
+
+ private Button placeHold;
+
+ private Button cancel;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.place_hold);
+
+ RecordInfo record = (RecordInfo) getIntent().getSerializableExtra("recordInfo");
+
+ accountAccess = AccountAccess.getAccountAccess();
+
+ recipient = (TextView) findViewById(R.id.hold_recipient);
+ title = (TextView) findViewById(R.id.hold_title);
+ author = (TextView) findViewById(R.id.hold_author);
+ physical_description = (TextView) findViewById(R.id.hold_physical_description);
+ screen_title = (TextView) findViewById(R.id.header_title);
+ cancel = (Button) findViewById(R.id.cancel_hold);
+ placeHold = (Button) findViewById(R.id.place_hold);
+
+ screen_title.setText("Place Hold");
+
+ recipient.setText(accountAccess.userName);
+ title.setText(record.title);
+ author.setText(record.author);
+ physical_description.setText(record.physical_description);
+
+ System.out.println(record.title + " " + record.author);
+
+ cancel.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+
+ final Integer record_id = record.doc_id;
+
+ placeHold.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ accountAccess.createHold(record_id);
+ }
+ });
+ }
+
+}
{
//TODO check params and throw errors
Method method = new Method(methodName);
- System.out.println();
+
+ System.out.println("Method :" + methodName + " param:");
for(int i=0;i<params.length;i++){
method.addParam(params[i]);
System.out.print("Param "+i+":" + params[i]);
}
- System.out.println("Request to method " + methodName + " service " + service + " conn " + conn);
+ //need space
+ System.out.println();
+
//sync request
HttpRequest req = new GatewayRequest(conn, service, method).send();
Object resp;
String textcode = ((Map<String,String>)response).get("textcode");
if(textcode != null){
if(textcode.equals("NO_SESSION")){
+ System.out.println("REQUIRE NEW SESSION");
response = requireNewSession(conn, service, methodName, params);
}
public String subject = null;
+ public String doc_type = null;
+
public String online_loc = null;
public String synopsis = null;
this.publisher = info.getString("publisher");
this.doc_id = info.getInt("doc_id");
this.image = info.getString("tcn");
-
+ this.doc_type = info.getString("doc_type");
}
catch(Exception e){System.out.println("Exception basic info " + e.getMessage());};
import java.util.List;
import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.holds.PlaceHold;
import org.evergreen.android.globals.GlobalConfigs;
import com.google.android.maps.ItemizedOverlay;
AdapterView.AdapterContextMenuInfo menuArrayItem = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
int menuItemIndex = item.getItemId();
+ RecordInfo info = (RecordInfo)lv.getItemAtPosition(menuArrayItem.position);
+ //start activity with book details
+
+
switch(item.getItemId()){
case DETAILS : {
- RecordInfo info = (RecordInfo)lv.getItemAtPosition(menuArrayItem.position);
- //start activity with book details
-
+
Intent intent = new Intent(getBaseContext(),RecordDetails_Simple.class);
//serialize object and pass it to next activity
intent.putExtra("recordInfo", info);
}
break;
case PLACE_HOLD : {
- //TODO
+
+ Intent intent = new Intent(getBaseContext(),PlaceHold.class);
+
+ intent.putExtra("recordInfo", info);
+
+ startActivity(intent);
}
break;
}
package org.evergreen.android.views;
import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.HoldsListView;
import org.evergreen.android.accountAccess.ItemsCheckOutListView;
+import org.evergreen.android.accountAccess.holds.HoldsListView;
import android.app.Activity;
import android.content.Intent;