[open-ils-commits] r14676 - in trunk/Open-ILS: src/perlmods/OpenILS/Application src/perlmods/OpenILS/Application/Circ web/opac/locale/en-US xul/staff_client/server/patron xul/staff_client/server/skin (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 29 11:29:38 EDT 2009


Author: erickson
Date: 2009-10-29 11:29:35 -0400 (Thu, 29 Oct 2009)
New Revision: 14676

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/CreditCard.pm
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul
   trunk/Open-ILS/xul/staff_client/server/patron/bills.js
   trunk/Open-ILS/xul/staff_client/server/skin/patron_display.css
Log:
combined patch from Lebbeous Fogle-Weekley to add option of overriding the default billing address and first/last when creating CC payments and converts a pile of tabs to 4-char spaces

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-10-29 15:29:35 UTC (rev 14676)
@@ -50,6 +50,12 @@
                         number          (for call to payment processor)
                         expire_month    (for call to payment processor)
                         expire_year     (for call to payment processor)
+                        billing_first   (for call to payment processor)
+                        billing_last    (for call to payment processor)
+                        billing_address (for call to payment processor)
+                        billing_city    (for call to payment processor)
+                        billing_state   (for call to payment processor)
+                        billing_zip     (for call to payment processor)
                         note            (if payments->{note} is blank, use this)
                     },
                     check_number
@@ -208,7 +214,13 @@
                         $cc_args->{expire_month},
                         $cc_args->{expire_year}
                     ),
-                    "ou" => $this_ou
+                    "ou" => $this_ou,
+                    "first_name" => $cc_args->{billing_first},
+                    "last_name" => $cc_args->{billing_last},
+                    "address" => $cc_args->{billing_address},
+                    "city" => $cc_args->{billing_city},
+                    "state" => $cc_args->{billing_state},
+                    "zip" => $cc_args->{billing_zip},
                 }
             );
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/CreditCard.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/CreditCard.pm	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/CreditCard.pm	2009-10-29 15:29:35 UTC (rev 14676)
@@ -95,7 +95,7 @@
                    action: optional (default: Normal Authorization)
                first_name: optional (default: patron's first_given_name field)
                 last_name: optional (default: patron's family_name field)
-                  address: optional (default: patron's street1 field)
+                  address: optional (default: patron's street1 field + street2)
                      city: optional (default: patron's city field)
                     state: optional (default: patron's state field)
                       zip: optional (default: patron's zip field)
@@ -201,6 +201,9 @@
     # mapping of fields for different payment processors, particularly ones
     # in other countries?
     $content{address}    ||= $patron->mailing_address->street1;
+    $content{address} .= ", " . $patron->mailing_address->street2
+        if $patron->mailing_address->street2;
+
     $content{city}       ||= $patron->mailing_address->city;
     $content{state}      ||= $patron->mailing_address->state;
     $content{zip}        ||= $patron->mailing_address->post_code;

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-10-29 15:29:35 UTC (rev 14676)
@@ -2428,6 +2428,12 @@
 <!ENTITY staff.patron.bill_cc_info.month_expire.value "Expire Month">
 <!ENTITY staff.patron.bill_cc_info.year_expire.value "Expire Year">
 <!ENTITY staff.patron.bill_cc_info.approval_code.value "Approval Code">
+<!ENTITY staff.patron.bill_cc_info.billing_first.value "Billing name (first)">
+<!ENTITY staff.patron.bill_cc_info.billing_last.value "Billing name (last)">
+<!ENTITY staff.patron.bill_cc_info.billing_address.value "Address">
+<!ENTITY staff.patron.bill_cc_info.billing_city.value "City, town or village">
+<!ENTITY staff.patron.bill_cc_info.billing_state.value "State or province">
+<!ENTITY staff.patron.bill_cc_info.billing_zip.value "ZIP or postal code">
 <!ENTITY staff.patron.bill_cc_info.note.value "Note">
 <!ENTITY staff.patron.bill_cc_info.cancel.label "Cancel">
 <!ENTITY staff.patron.bill_cc_info.cancel.accesskey "C">

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul	2009-10-29 15:29:35 UTC (rev 14676)
@@ -19,20 +19,20 @@
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
 
 <window id="patron_bill" title="&staff.patron.bill_cc_info.title;"
-	orient="vertical" style="overflow: auto"
-	onload="try{info_init(); font_helper();refresh_fields();}catch(E){alert(E);}"
-	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+    orient="vertical" style="overflow: auto"
+    onload="try{info_init(); font_helper();refresh_fields();}catch(E){alert(E);}"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
     <!-- BEHAVIOR -->
-        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
-        <scripts id="openils_util_scripts"/>
+    <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
+    <scripts id="openils_util_scripts"/>
 
-	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+    <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
 
-	<script>
-	<![CDATA[
-		function $(id) { return document.getElementById(id); }
+    <script>
+    <![CDATA[
+        function $(id) { return document.getElementById(id); }
 
         XULElement.prototype.hide = function() {
             this.style.display = "none";
@@ -41,12 +41,19 @@
             this.style.display = "";
         }
 
+        var patron = {};
         var show = {'int': 1, 'ext': 2}; // tied to Application::Circ::Money
         var fields_of_interest = {
             "cc_type":          show['ext'],
             "cc_number":        show['int'],
             "expire_month":     show['int'],
             "expire_year":      show['int'],
+            "billing_first":    show['int'],
+            "billing_last":     show['int'],
+            "billing_address":  show['int'],
+            "billing_city":     show['int'],
+            "billing_state":    show['int'],
+            "billing_zip":      show['int'],
             "approval_code":    show['ext'],
             "note":             show['ext'] + show['int'],
             "where_process":    show['ext'] + show['int']
@@ -69,23 +76,48 @@
             }
         }
 
-		function info_init() {
-			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-			if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
-			JSAN.errorLevel = "die"; // none, warn, or die
-			JSAN.addRepository('/xul/server/');
-			JSAN.use('util.error'); g.error = new util.error();
-			g.error.sdump('D_TRACE','my_init() for patron_display.xul');
-			g.OpenILS = {}; JSAN.use('OpenILS.data'); g.OpenILS.data = new OpenILS.data();
-			g.OpenILS.data.init({'via':'stash'});
+        function populate_address_fields() {
+            $('billing_first').value = patron.first_given_name();
+            $('billing_last').value = patron.family_name();
+            $('billing_address').value = patron.billing_address().street1();
+            var street2 = patron.billing_address().street2();
+            if (street2) {
+                $('billing_address').value += (' ' + street2);
+            }
+            $('billing_city').value = patron.billing_address().city();
+            $('billing_state').value = patron.billing_address().state();
+            $('billing_zip').value = patron.billing_address().post_code();
+        }
+
+        function info_init() {
+            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+            if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
+            JSAN.errorLevel = "die"; // none, warn, or die
+            JSAN.addRepository('/xul/server/');
+            JSAN.use('util.error'); g.error = new util.error();
+            JSAN.use('util.network'); g.network = new util.network();
+            g.error.sdump('D_TRACE','my_init() for patron_display.xul');
+            g.OpenILS = {}; JSAN.use('OpenILS.data'); g.OpenILS.data = new OpenILS.data();
+            g.OpenILS.data.init({'via':'stash'});
             /* 'true' as a string matches the expectations in bills.js */
             g.payment_blob = { 'cc_args' : {}, 'cancelled' : 'true' };
-			g.OpenILS.data.temp = js2JSON( g.payment_blob );
-			g.OpenILS.data.stash('temp');
+            g.OpenILS.data.temp = js2JSON( g.payment_blob );
+            g.OpenILS.data.stash('temp');
 
-			document.getElementById('cc_number').focus();
-		}
+            try {
+                patron = g.network.simple_request(
+                    'FM_AU_FLESHED_RETRIEVE_VIA_ID',
+                    [ses(), xul_param('patron_id', {'modal_xulG': true})]
+                );
+            } catch (e) {
+                alert ("Patron retrieval failed");
+                throw(e);
+            }
 
+            populate_address_fields();
+            document.getElementById('cc_number').focus();
+        }
+
         function sanity_check() {
             if ($('where_process').value == show['int']) { // internal process
                 if ($('cc_number').value.match(/^\s*$/)) {
@@ -102,8 +134,8 @@
             return true;
         }
 
-		function info_finish() {
-			/* FIXME -- need unique temp space name */
+        function info_finish() {
+            /* FIXME -- need unique temp space name */
 
             /* The following for loop gathers our payment_blob values from
             the widgets in this window.  This is better than the method of
@@ -119,70 +151,102 @@
                     g.payment_blob.cc_args[target_key] = $(field).value;
                 }
             }
-			delete( g.payment_blob.cancelled );
-			g.OpenILS.data.temp = js2JSON( g.payment_blob );
-			g.OpenILS.data.stash('temp');
-		}
+            delete( g.payment_blob.cancelled );
+            g.OpenILS.data.temp = js2JSON( g.payment_blob );
+            g.OpenILS.data.stash('temp');
+        }
 
-	]]>
-	</script>
+    ]]>
+    </script>
 
-	<messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
+    <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
 
-	<groupbox>
-		<caption label="&staff.patron.bill_cc_info.info.label;"/>
-		<grid>
-			<columns> <column flex="0" /> <column flex="0" /> </columns>
-			<rows>
-				<row id="row_where_process">
-					<label value="&staff.patron.bill_cc_info.where_process.label;"/>
-					<menulist id="where_process" oncommand="refresh_fields();">
-						<menupopup>
-							<menuitem label="&staff.patron.bill_cc_info.process_int.label;" value="1"/>
-							<menuitem label="&staff.patron.bill_cc_info.process_ext.label;" value="2"/>
-						</menupopup>
-					</menulist>
-				</row>
-				<row id="row_cc_type">
-					<label value="&staff.patron.bill_cc_info.type.label;"/>
-					<menulist id="cc_type">
-						<menupopup>
+    <groupbox>
+        <caption label="&staff.patron.bill_cc_info.info.label;"/>
+        <grid>
+            <columns> <column flex="0" /> <column flex="0" /> </columns>
+            <rows>
+                <row id="row_where_process">
+                    <label value="&staff.patron.bill_cc_info.where_process.label;"/>
+                    <menulist id="where_process" oncommand="refresh_fields();">
+                        <menupopup>
+                            <menuitem label="&staff.patron.bill_cc_info.process_int.label;" value="1"/>
+                            <menuitem label="&staff.patron.bill_cc_info.process_ext.label;" value="2"/>
+                        </menupopup>
+                    </menulist>
+                </row>
+                <row id="row_cc_type">
+                    <label value="&staff.patron.bill_cc_info.type.label;"/>
+                    <menulist id="cc_type">
+                        <menupopup>
                             <menuitem label="&staff.patron.bill_cc_info.visa.label;" value="VISA"/><!-- capitalization to match CC processors' output -->
                             <menuitem label="&staff.patron.bill_cc_info.mastercard.label;" value="MasterCard"/><!-- capitalization to match CC processors' output -->
-							<menuitem label="&staff.patron.bill_cc_info.american_express.label;" value="American Express"/>
-							<menuitem label="&staff.patron.bill_cc_info.discover.label;" value="Discover"/>
-							<menuitem label="&staff.patron.bill_cc_info.other.label;" value="Other"/>
-						</menupopup>
-					</menulist>
-				</row>
-				<row id="row_approval_code">
-					<label value="&staff.patron.bill_cc_info.approval_code.value;"/>
-					<textbox id="approval_code" context="clipboard"/>
-				</row>
-				<row id="row_cc_number">
-					<label value="&staff.patron.bill_cc_info.cc_number.value;"/>
-					<textbox id="cc_number" context="clipboard"/>
-				</row>
-				<row id="row_expire_month">
-					<label value="&staff.patron.bill_cc_info.month_expire.value;"/>
-					<textbox id="expire_month" context="clipboard"/>
-				</row>
-				<row id="row_expire_year">
-					<label value="&staff.patron.bill_cc_info.year_expire.value;"/>
-					<textbox id="expire_year" context="clipboard"/>
-				</row>
-				<row id="row_note">
-					<label value="&staff.patron.bill_cc_info.note.value;"/>
-					<textbox id="note" multiline="true" context="clipboard"/>
-				</row>
-			</rows>
-		</grid>
-		<hbox>
-			<spacer flex="1"/>
-			<button label="&staff.patron.bill_cc_info.cancel.label;" oncommand="window.close()" accesskey="&staff.patron.bill_cc_info.cancel.accesskey;"/>
+                            <menuitem label="&staff.patron.bill_cc_info.american_express.label;" value="American Express"/>
+                            <menuitem label="&staff.patron.bill_cc_info.discover.label;" value="Discover"/>
+                            <menuitem label="&staff.patron.bill_cc_info.other.label;" value="Other"/>
+                        </menupopup>
+                    </menulist>
+                </row>
+                <row id="row_approval_code">
+                    <label value="&staff.patron.bill_cc_info.approval_code.value;"/>
+                    <textbox id="approval_code" context="clipboard"/>
+                </row>
+                <row id="row_cc_number">
+                    <label value="&staff.patron.bill_cc_info.cc_number.value;"/>
+                    <textbox id="cc_number" context="clipboard"/>
+                </row>
+                <row id="row_expire_month">
+                    <label value="&staff.patron.bill_cc_info.month_expire.value;"/>
+                    <textbox id="expire_month" context="clipboard"/>
+                </row>
+                <row id="row_expire_year">
+                    <label value="&staff.patron.bill_cc_info.year_expire.value;"/>
+                    <textbox id="expire_year" context="clipboard"/>
+                </row>
+            </rows>
+        </grid>
+    </groupbox>
+    <groupbox>
+        <caption label="Optional fields"/>
+        <grid>
+            <columns><column flex="0" /><column flex="1" /></columns>
+            <rows>
+                <row id="row_billing_first">
+                    <label value="&staff.patron.bill_cc_info.billing_first.value;"/>
+                    <textbox id="billing_first" context="clipboard"/>
+                </row>
+                <row id="row_billing_last">
+                    <label value="&staff.patron.bill_cc_info.billing_last.value;"/>
+                    <textbox id="billing_last" context="clipboard"/>
+                </row>
+                <row id="row_billing_address">
+                    <label value="&staff.patron.bill_cc_info.billing_address.value;"/>
+                    <textbox id="billing_address" context="clipboard"/>
+                </row>
+                <row id="row_billing_city">
+                    <label value="&staff.patron.bill_cc_info.billing_city.value;"/>
+                    <textbox id="billing_city" context="clipboard"/>
+                </row>
+                <row id="row_billing_state">
+                    <label value="&staff.patron.bill_cc_info.billing_state.value;"/>
+                    <textbox id="billing_state" context="clipboard"/>
+                </row>
+                <row id="row_billing_zip">
+                    <label value="&staff.patron.bill_cc_info.billing_zip.value;"/>
+                    <textbox cols="12" maxlength="11" id="billing_zip" context="clipboard"/>
+                </row>
+                <row id="row_note">
+                    <label value="&staff.patron.bill_cc_info.note.value;"/>
+                    <textbox id="note" multiline="true" context="clipboard"/>
+                </row>
+            </rows>
+        </grid>
+        <hbox>
+            <spacer flex="1"/>
+            <button label="&staff.patron.bill_cc_info.cancel.label;" oncommand="window.close()" accesskey="&staff.patron.bill_cc_info.cancel.accesskey;"/>
             <button label="&staff.patron.bill_cc_info.submit.label;" oncommand="if (sanity_check()) { info_finish(); window.close(); }" accesskey="&staff.patron.bill_cc_info.submit.accesskey;"/>
-		</hbox>
-	</groupbox>
+        </hbox>
+    </groupbox>
 
 </window>
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bills.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bills.js	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bills.js	2009-10-29 15:29:35 UTC (rev 14676)
@@ -459,7 +459,8 @@
                         var my_xulG = win.open(
                             urls.XUL_PATRON_BILL_CC_INFO,
                             'billccinfo',
-                            'chrome,resizable,modal'
+                            'chrome,resizable,modal',
+                            {'patron_id': obj.patron_id}
                         );
                         obj.OpenILS.data.stash_retrieve();
                         //payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );

Modified: trunk/Open-ILS/xul/staff_client/server/skin/patron_display.css
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/skin/patron_display.css	2009-10-29 15:09:48 UTC (rev 14675)
+++ trunk/Open-ILS/xul/staff_client/server/skin/patron_display.css	2009-10-29 15:29:35 UTC (rev 14676)
@@ -9,6 +9,8 @@
 deck#patron_deck { border-left: solid thin black; }
 .patronNameLarge { font-weight: bold; }
 
+row#row_billing_first { padding-top: 10px; }
+row#row_billing_zip { padding-bottom: 10px; }
 .NO_PENALTIES .patronNameLarge { border: solid thick lime; padding: 10px; }
 /*
 .ONE_PENALTY .patronNameLarge { background-color: fuchsia; }



More information about the open-ils-commits mailing list