create, update and cancel holds functionality finished
authordrizea <danielrizea27@gmail.com>
Sat, 7 Jul 2012 13:33:02 +0000 (16:33 +0300)
committerdrizea <danielrizea27@gmail.com>
Sat, 7 Jul 2012 13:33:02 +0000 (16:33 +0300)
16 files changed:
Open-ILS/src/Android/bin/EvergreenApp.apk
Open-ILS/src/Android/bin/classes.dex
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class
Open-ILS/src/Android/bin/resources.ap_
Open-ILS/src/Android/gen/org/evergreen/android/R.java
Open-ILS/src/Android/res/layout/fines_list_item.xml
Open-ILS/src/Android/res/layout/hold_details.xml
Open-ILS/src/Android/res/values/strings.xml
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/HoldDetails.java
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/HoldItem.java [deleted file]
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/HoldRecord.java
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/PlaceHold.java

index 1aaaa86..58cfa1e 100644 (file)
Binary files a/Open-ILS/src/Android/bin/EvergreenApp.apk and b/Open-ILS/src/Android/bin/EvergreenApp.apk differ
index bd41d17..0f3dfb8 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes.dex and b/Open-ILS/src/Android/bin/classes.dex differ
index 159dac7..5ddab95 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class differ
index 41d235c..3db9cbf 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class differ
index b2eb689..45fa5b8 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class differ
index 4ee964d..ea386b3 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class differ
index cf641d1..f828339 100644 (file)
Binary files a/Open-ILS/src/Android/bin/resources.ap_ and b/Open-ILS/src/Android/bin/resources.ap_ differ
index d55ba86..62d223c 100644 (file)
@@ -55,7 +55,7 @@ public final class R {
         public static final int account_btn_holds=0x7f090008;
         public static final int action_bar=0x7f090018;
         public static final int back_button=0x7f090019;
-        public static final int cancel_hold=0x7f090029;
+        public static final int cancel_hold=0x7f09002a;
         public static final int cancel_hold_button=0x7f09001a;
         public static final int checkout_due_date=0x7f090005;
         public static final int checkout_items_list=0x7f090001;
@@ -81,16 +81,16 @@ public final class R {
         public static final int hold_physical_description=0x7f09001f;
         public static final int hold_pickup_location=0x7f090023;
         public static final int hold_recipient=0x7f09001c;
-        public static final int hold_status=0x7f090028;
+        public static final int hold_status=0x7f090029;
         public static final int hold_suspend_hold=0x7f090025;
-        public static final int hold_thaw_date=0x7f09002b;
+        public static final int hold_thaw_date=0x7f090026;
         public static final int hold_title=0x7f09001d;
-        public static final int holds_item_list=0x7f090027;
-        public static final int holds_number=0x7f090026;
+        public static final int holds_item_list=0x7f090028;
+        public static final int holds_number=0x7f090027;
         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 place_hold=0x7f09002a;
+        public static final int place_hold=0x7f09002b;
         public static final int record_details_info_author=0x7f09002d;
         public static final int record_details_info_publisher=0x7f09002e;
         public static final int record_details_info_title=0x7f09002c;
@@ -135,7 +135,7 @@ public final class R {
         public static final int app_name=0x7f070001;
         public static final int author=0x7f07000d;
         public static final int back=0x7f070019;
-        public static final int balance_owed=0x7f07001f;
+        public static final int balance_owed=0x7f070022;
         public static final int cancel=0x7f070017;
         public static final int cancel_hold=0x7f070018;
         public static final int cancel_hold_dialog_message=0x7f07001b;
@@ -145,7 +145,10 @@ public final class R {
         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 overdue_materials=0x7f070020;
+        public static final int hold_expire_time_hint=0x7f07001e;
+        public static final int hold_phone_hint=0x7f07001d;
+        public static final int hold_thaw_date_hint=0x7f07001f;
+        public static final int overdue_materials=0x7f070023;
         public static final int physical_description=0x7f07000e;
         public static final int pickup_location=0x7f070013;
         public static final int place_hold=0x7f070016;
@@ -166,8 +169,8 @@ public final class R {
         public static final int title_search=0x7f070002;
         /**  Fines Activity 
          */
-        public static final int total_owned=0x7f07001d;
-        public static final int total_paid=0x7f07001e;
+        public static final int total_owned=0x7f070020;
+        public static final int total_paid=0x7f070021;
         public static final int update_hold=0x7f07001a;
     }
     public static final class style {
index 860067d..85ad58f 100644 (file)
             <TextView 
      android:id="@+id/fines_title" 
      android:layout_width="fill_parent"   
-     android:layout_height="wrap_content"
+     android:layout_height="fill_parent"
      android:layout_weight="10"
      
      
         />
             
-                         <TextView 
+      <TextView 
      android:id="@+id/fines_balance_owed"
      android:layout_width="fill_parent"   
      android:layout_height="fill_parent"
      android:textColor="@color/red"   
      android:textStyle="bold" 
-     android:layout_weight="4"
+     android:layout_weight="2"
      android:layout_gravity="right"  
         />  
         
index 2c71f78..5871df6 100644 (file)
                            android:text="@string/contact_telephone"
                            />
                        
-                       <TextView 
+                       <EditText
                            android:id="@+id/hold_contact_telephone"
                            android:layout_width="0dip"
                            android:layout_height="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="4"
                            android:gravity="center"
+                           android:hint="@string/hold_expire_time_hint"
                            />
                        
                        
                            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/thaw_date"
+                           />
+                       
+                       <EditText 
+                           android:id="@+id/hold_thaw_date"
+                           android:layout_width="0dip"
+                           android:layout_height="wrap_content"
+                           android:layout_weight="4"
+                           android:gravity="center"
+                           android:hint="@string/hold_thaw_date_hint"
+                           />
+                       
+                       
+           </LinearLayout>
             
        </LinearLayout>
     
index 4c4d804..b405472 100644 (file)
@@ -34,8 +34,9 @@
     <string name="update_hold">Update Hold</string>
     <string name="cancel_hold_dialog_message">Are you sure you want to cancel this hold?</string>
     <string name="thaw_date">Automatically activate hold one</string>
-    
-    
+    <string name="hold_phone_hint">Contact phone number</string>
+    <string name="hold_expire_time_hint">Hold expire time</string>
+    <string name="hold_thaw_date_hint">Date when the hold is frozen</string>
     <!-- Fines Activity -->
     <string name="total_owned">Total Owned </string>
     <string name="total_paid">Total Paid</string>
index fd89ddc..bfcf2ce 100644 (file)
@@ -812,9 +812,19 @@ public class AccountAccess {
                
        }
        
-       public Object updateHold(OSRFObject newHoldObject){
+       public Object updateHold(OSRFObject ahr,Integer pickup_lib, boolean email_notify, boolean phone_notify, String phone, boolean suspendHold, String expire_time,String thaw_date){
                //TODO verify that object is correct passed to the server
-               Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_UPDATE_HOLD, new Object[]{authToken,newHoldObject});
+
+               ahr.put("pickup_lib", pickup_lib); //pick-up lib
+               ahr.put("phone_notify", phone);
+               ahr.put("email_notify", email_notify);
+               ahr.put("expire_time",expire_time);
+               //frozen set, what this means ? 
+               ahr.put("frozen", suspendHold);
+               //only if it is frozen
+           ahr.put("thaw_date",thaw_date);
+               
+               Object response = Utils.doRequest(conn,SERVICE_CIRC, METHOD_UPDATE_HOLD, new Object[]{authToken,ahr});
                
                return response;
        }
index 1aafada..56c932c 100644 (file)
 package org.evergreen.android.accountAccess.holds;
 
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Date;
 
 import org.evergreen.android.R;
 import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.globals.GlobalConfigs;
 
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.ProgressDialog;
 import android.app.AlertDialog.Builder;
 import android.app.DatePickerDialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.text.format.DateFormat;
 import android.text.format.Time;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
 import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
 import android.widget.DatePicker;
 import android.widget.EditText;
+import android.widget.Spinner;
 import android.widget.TextView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.Toast;
 
-public class HoldDetails extends Activity{
+public class HoldDetails extends Activity {
 
-       
        public static final int RESULT_CODE_DELETE_HOLD = 0;
-       
+
        public static final int RESULT_CODE_UPDATE_HOLD = 1;
-       
+
        public static final int RESULT_CODE_CANCEL = 2;
-       
+
        private TextView recipient;
-       
+
        private TextView title;
-       
+
        private TextView author;
-       
+
        private TextView physical_description;
-       
+
        private TextView screen_title;
-       
+
        private AccountAccess accountAccess;
-       
+
        private EditText expiration_date;
-       
+
        private Button updateHold;
-       
+
        private Button cancelHold;
-       
+
        private Button back;
-       
+
+       private EditText phone_number;
+
+       private CheckBox phone_notification;
+
+       private CheckBox email_notification;
+
        private DatePickerDialog datePicker = null;
-       
+
+       private CheckBox suspendHold;
+
+       private Spinner orgSelector;
+
+       private DatePickerDialog thaw_datePicker = null;
+
+       private EditText thaw_date_edittext;
+
+       private Date expire_date = null;
+
+       private Date thaw_date = null;
+
        private Context context;
+
+       private int selectedOrgPos = 0;
+
+       public Runnable updateHoldRunnable;
        
+       private ProgressDialog progressDialog;
+
+       private GlobalConfigs globalConfigs;
+
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                context = this;
                setContentView(R.layout.hold_details);
-               
-               final HoldRecord record = (HoldRecord) getIntent().getSerializableExtra("holdRecord");
-               
-               System.out.println("Record " + record + " " + record.title + " " + record.ahr);
-               
+               globalConfigs = GlobalConfigs.getGlobalConfigs(this);
+
+               final HoldRecord record = (HoldRecord) getIntent()
+                               .getSerializableExtra("holdRecord");
+
+               System.out.println("Record " + record + " " + record.title + " "
+                               + record.ahr);
+
                accountAccess = AccountAccess.getAccountAccess();
-               
+
                recipient = (TextView) findViewById(R.id.hold_recipient);
                title = (TextView) findViewById(R.id.hold_title);
                author = (TextView) findViewById(R.id.hold_author);
@@ -74,19 +115,52 @@ public class HoldDetails extends Activity{
                cancelHold = (Button) findViewById(R.id.cancel_hold_button);
                updateHold = (Button) findViewById(R.id.update_hold_button);
                back = (Button) findViewById(R.id.back_button);
-               
+
+               phone_number = (EditText) findViewById(R.id.hold_contact_telephone);
+               phone_notification = (CheckBox) findViewById(R.id.hold_enable_phone_notification);
+               email_notification = (CheckBox) findViewById(R.id.hold_enable_email_notification);
+               suspendHold = (CheckBox) findViewById(R.id.hold_suspend_hold);
+
+               orgSelector = (Spinner) findViewById(R.id.hold_pickup_location);
                expiration_date = (EditText) findViewById(R.id.hold_expiration_date);
-               
+               thaw_date_edittext = (EditText) findViewById(R.id.hold_thaw_date);
+
                screen_title.setText("Place Hold");
-               
+
+
+
                recipient.setText(accountAccess.userName);
                title.setText(record.title);
                author.setText(record.author);
-               if(record.recordInfo != null)
-                       physical_description.setText(record.recordInfo.physical_description);
+               if (record.recordInfo != null)
+                       physical_description
+                                       .setText(record.recordInfo.physical_description);
+
+               // set record info
+               phone_notification.setChecked(record.phone_notification);
+               email_notification.setChecked(record.email_notification);
+               suspendHold.setChecked(record.suspended);
                
-               System.out.println(record.title + " " + record.author);
+               if (record.thaw_date != null) {
+                       thaw_date = record.thaw_date;
+                       thaw_date_edittext.setText(DateFormat.format("MMMM dd, yyyy",
+                                       thaw_date));
+               }
+               if (record.expire_time != null) {
+                       expire_date = record.expire_time;
+                       expiration_date.setText(DateFormat.format("MMMM dd, yyyy",
+                                       expire_date));
+               }
+
+               // hide edit text
+               if( record.thaw_date == null)
+                       disableView(thaw_date_edittext);
                
+               if(!record.phone_notification)
+                       disableView(phone_number);
+               
+               System.out.println(record.title + " " + record.author);
+
                back.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
@@ -95,65 +169,213 @@ public class HoldDetails extends Activity{
                });
                
                cancelHold.setOnClickListener(new OnClickListener() {
-                       
+
                        @Override
                        public void onClick(View v) {
-                       
-
-                               Builder confirmationDialogBuilder = new AlertDialog.Builder(context);
-                           confirmationDialogBuilder.setMessage(R.string.cancel_hold_dialog_message);
-                           
-                           confirmationDialogBuilder.setNegativeButton(android.R.string.no, null);
-                           confirmationDialogBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
-                             @Override
-                             public void onClick(DialogInterface dialog, int which) {
-                               
-                                 System.out.println("Remove hold with id" + record.ahr.getInt("id"));
-                                 
-                                 //TODO put into thread
-                                 accountAccess.cancelHold(record.ahr);
-                                 
-                                 setResult(RESULT_CODE_DELETE_HOLD);
-                                 
-                                 finish();
-                             }
-                           });
-                           confirmationDialogBuilder.create().show();
-                               
+
+                               Builder confirmationDialogBuilder = new AlertDialog.Builder(
+                                               context);
+                               confirmationDialogBuilder
+                                               .setMessage(R.string.cancel_hold_dialog_message);
+
+                               confirmationDialogBuilder.setNegativeButton(
+                                               android.R.string.no, null);
+                               confirmationDialogBuilder.setPositiveButton(
+                                               android.R.string.yes,
+                                               new DialogInterface.OnClickListener() {
+                                                       @Override
+                                                       public void onClick(DialogInterface dialog,
+                                                                       int which) {
+
+                                                               System.out.println("Remove hold with id"
+                                                                               + record.ahr.getInt("id"));
+
+                                                               progressDialog = ProgressDialog.show(context, "Please wait", "Canceling hold");
+                                                               Thread cancelHoldThread = new Thread(new Runnable() {
+                                                                       
+                                                                       @Override
+                                                                       public void run() {
+                                                                               accountAccess.cancelHold(record.ahr);
+                                                                       
+                                                                               runOnUiThread(new Runnable() {
+                                                                                       @Override
+                                                                                       public void run() {
+                                                                                               progressDialog.dismiss();
+                                                                                               setResult(RESULT_CODE_DELETE_HOLD);
+
+                                                                                               finish();       
+                                                                                       }
+                                                                               });
+                                                                       }
+                                                               });
+                                                               cancelHoldThread.start();
+                                                               
+                                                                                                                       }
+                                               });
+                               confirmationDialogBuilder.create().show();
+
                        }
                });
+
+               updateHoldRunnable = new Runnable() {
+                       @Override
+                       public void run() {
+                               // update new values
+                               String expire_date_s = null;
+                               String thaw_date_s = null;
+                               if (expire_date != null)
+                                       expire_date_s = GlobalConfigs.getStringDate(expire_date);
+                               if (thaw_date != null)
+                                       thaw_date_s = GlobalConfigs.getStringDate(thaw_date);
+
+                               accountAccess.updateHold(record.ahr, selectedOrgPos,
+                                               email_notification.isChecked(), phone_notification
+                                                               .isChecked(),
+                                               phone_number.getText().toString(), suspendHold
+                                                               .isChecked(), expire_date_s, thaw_date_s);
+                               
+                               runOnUiThread(new Runnable() {
+                                       @Override
+                                       public void run() {
+                                               progressDialog.dismiss();
+                                               Toast.makeText(context, "Hold updated", Toast.LENGTH_SHORT);
+                                               setResult(RESULT_CODE_UPDATE_HOLD);
+                                               finish();
+                                       }
+                               });
+                       }
+               };
                
                updateHold.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
+                               progressDialog = ProgressDialog.show(context, "Please wait", "Updating hold");
+                               Thread updateHoldThread = new Thread(updateHoldRunnable);
+                               updateHoldThread.start();
+                       }
+               });
+
+               phone_notification
+                               .setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+                                       @Override
+                                       public void onCheckedChanged(CompoundButton buttonView,
+                                                       boolean isChecked) {
+
+                                               if (isChecked) {
+                                                       enableView(phone_number);
+                                               } else
+                                                       disableView(phone_number);
+                                       }
+                               });
+
+               suspendHold.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+                       @Override
+                       public void onCheckedChanged(CompoundButton buttonView,
+                                       boolean isChecked) {
 
-                               //update new values
-                               accountAccess.updateHold(record.ahr);
+                               if (isChecked) {
+                                       enableView(thaw_date_edittext);
+                               } else {
+                                       disableView(thaw_date_edittext);
+                               }
                        }
                });
-               
                Calendar cal = Calendar.getInstance();
+
                datePicker = new DatePickerDialog(this,
-                        new DatePickerDialog.OnDateSetListener() {
-                
-                        public void onDateSet(DatePicker view, int year,
-                                                            int monthOfYear, int dayOfMonth)
-                        {
-                                   Time chosenDate = new Time();
-                                   chosenDate.set(dayOfMonth, monthOfYear, year);
-                                   long dtDob = chosenDate.toMillis(true);
-                                   CharSequence strDate = DateFormat.format("MMMM dd, yyyy", dtDob);
-                                   expiration_date.setText(strDate);
-                                   //set current date          
-                       }}, cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
-       
+                               new DatePickerDialog.OnDateSetListener() {
+
+                                       public void onDateSet(DatePicker view, int year,
+                                                       int monthOfYear, int dayOfMonth) {
+
+                                               Date chosenDate = new Date(year - 1900, monthOfYear,
+                                                               dayOfMonth);
+                                               expire_date = chosenDate;
+                                               CharSequence strDate = DateFormat.format(
+                                                               "MMMM dd, yyyy", chosenDate);
+                                               expiration_date.setText(strDate);
+                                               // set current date
+                                       }
+                               }, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
+                               cal.get(Calendar.DAY_OF_MONTH));
+
                expiration_date.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                                datePicker.show();
                        }
                });
-               
+
+               thaw_datePicker = new DatePickerDialog(this,
+                               new DatePickerDialog.OnDateSetListener() {
+
+                                       public void onDateSet(DatePicker view, int year,
+                                                       int monthOfYear, int dayOfMonth) {
+
+                                               Date chosenDate = new Date(year - 1900, monthOfYear,
+                                                               dayOfMonth);
+                                               thaw_date = chosenDate;
+                                               CharSequence strDate = DateFormat.format(
+                                                               "MMMM dd, yyyy", chosenDate);
+                                               thaw_date_edittext.setText(strDate);
+                                               // set current date
+                                       }
+                               }, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
+                               cal.get(Calendar.DAY_OF_MONTH));
+
+               thaw_date_edittext.setOnClickListener(new OnClickListener() {
+
+                       @Override
+                       public void onClick(View v) {
+                               thaw_datePicker.show();
+                       }
+               });
+
+               ArrayList<String> list = new ArrayList<String>();
+               for (int i = 0; i < globalConfigs.organisations.size(); i++) {
+                       list.add(globalConfigs.organisations.get(i).padding
+                                       + globalConfigs.organisations.get(i).name);
+
+                       if (globalConfigs.organisations.get(i).id == record.pickup_lib)
+                               selectedOrgPos = i;
+               }
+               ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
+                               android.R.layout.simple_spinner_item, list);
+               orgSelector.setAdapter(adapter);
+
+               orgSelector.setSelection(selectedOrgPos);
+
+               orgSelector.setOnItemSelectedListener(new OnItemSelectedListener() {
+                       @Override
+                       public void onItemSelected(AdapterView<?> arg0, View arg1, int ID,
+                                       long arg3) {
+
+                               selectedOrgPos = ID;
+
+                       }
+
+                       public void onNothingSelected(android.widget.AdapterView<?> arg0) {
+                       }
+               });
        }
-       
+
+       public void disableView(View view) {
+
+               // view.setFocusable(false);
+               view.setFocusable(false);
+
+               view.setBackgroundColor(Color.argb(255, 100, 100, 100));
+               // view.setVisibility(View.INVISIBLE);
+       }
+
+       public void enableView(View view) {
+               // view.setVisibility(View.VISIBLE);
+
+               view.setFocusableInTouchMode(true);
+
+               view.setBackgroundColor(Color.argb(255, 255, 255, 255));
+       }
+
 }
diff --git a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/HoldItem.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/holds/HoldItem.java
deleted file mode 100644 (file)
index 744b2b9..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.evergreen.android.accountAccess.holds;
-
-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 
-       */
-       
-       //only for P types
-       public String part_label = null; 
-       
-       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"));
-                                               
-       }
-       //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;
-       }
-       
-}
index f99f122..ebd4350 100644 (file)
@@ -55,6 +55,16 @@ public class HoldRecord implements Serializable{
        public RecordInfo recordInfo = null;
        
        
+       public boolean email_notification = false;
+       
+       public boolean phone_notification = false;
+       
+       public boolean suspended = false;
+       
+       public Date thaw_date;
+       
+       public int pickup_lib;
+       
        public HoldRecord(OSRFObject ahr){
                
                this.target = ahr.getInt("target");
@@ -81,7 +91,22 @@ public class HoldRecord implements Serializable{
                                                                holdType = P;
        
                this.expire_time = GlobalConfigs.parseDate(ahr.getString("expire_time"));
-                                               
+       
+               this.thaw_date = GlobalConfigs.parseDate(ahr.getString("thaw_date"));
+               String res = ahr.getString("email_notify");
+               
+               if(res.equals("t"))
+                       this.email_notification = true;
+               res = ahr.getString("phone_notify");
+               if(res.equals("t"))
+                       this.phone_notification = true;
+               
+               res = ahr.getString("frozen");
+               if(res.equals("t"))
+                       this.suspended = true;
+               pickup_lib = ahr.getInt("pickup_lib");
+               
+               
        }
        //based on status integer field retreive hold status in text
        public String getHoldStatus(){
index df4e77f..ecd366e 100644 (file)
@@ -145,11 +145,11 @@ public class PlaceHold extends Activity{
                                
                                String expire_date_s = null;
                                String thaw_date_s = null;
-                               if(expire_date != null)
+                               if (expire_date != null)
                                        expire_date_s = GlobalConfigs.getStringDate(expire_date);
-                               if(thaw_date != null)
+                               if (thaw_date != null)
                                        thaw_date_s = GlobalConfigs.getStringDate(thaw_date);
-                               
+
                                System.out.println("date expire: " + expire_date_s + " " + expire_date);
                                int selectedOrgID = -1;
                                if(globalConfigs.organisations.size() > selectedOrgPos)