From 5d31958386fc15d591e10d92f13866a1d9f39ef1 Mon Sep 17 00:00:00 2001
From: Thomas Berezansky <tsbere@mvlc.org>
Date: Thu, 26 Jan 2012 13:05:16 -0500
Subject: [PATCH] Hook up default phone/pickup in JSPac

Because why not? Note that you can't set them with JSPac.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
---
 Open-ILS/web/opac/common/js/config.js      | 2 ++
 Open-ILS/web/opac/skin/default/js/holds.js | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js
index c70bbae5bb..1a622321fe 100644
--- a/Open-ILS/web/opac/common/js/config.js
+++ b/Open-ILS/web/opac/common/js/config.js
@@ -165,6 +165,8 @@ var PREF_DEF_FONT		= 'opac.default_font';
 var PREF_HOLD_NOTIFY = 'opac.hold_notify';
 var PREF_DEF_LOCATION = 'opac.default_search_location';
 var PREF_DEF_DEPTH	= 'opac.default_search_depth';
+var PREF_DEF_PICKUP = 'opac.default_pickup_location';
+var PREF_DEF_PHONE = 'opac.default_phone'; 
 
 
 /** If enabled, added content attribution links will be 
diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js
index 5c4a32467e..bb643afba5 100644
--- a/Open-ILS/web/opac/skin/default/js/holds.js
+++ b/Open-ILS/web/opac/skin/default/js/holds.js
@@ -469,6 +469,11 @@ function __holdsDrawWindow() {
 	
 	}
 
+	var pref = holdArgs.recipient.prefs[PREF_DEF_PICKUP];
+	if(pref) {
+		setSelector(selector, pref);
+	}
+
 	/*
 	if(isXUL()) {
 		var dsel = $('holds_depth_selector');
@@ -609,9 +614,11 @@ function __holdsDrawWindow() {
 
 
 	$('holds_phone').value = holdArgs.recipient.day_phone();
+	var pref = holdArgs.recipient.prefs[PREF_DEF_PHONE];
+	if(pref) $('holds_phone').value = pref;
 	appendClear( $('holds_email'), text(holdArgs.recipient.email()));
 
-	var pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY];
+	pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY];
 
 	if(pref) {
 		if( ! pref.match(/email/i) ) {
-- 
2.11.0