gather credit card/check info. Use stash for getting data from a modal window
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Dec 2005 17:39:38 +0000 (17:39 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Dec 2005 17:39:38 +0000 (17:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2504 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/evergreen/main/constants.js
Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js
Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/bill_check_info.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/bills.js

index f3dffc5..241405e 100644 (file)
@@ -14,6 +14,8 @@ OpenILS.data.prototype = {
        'list' : {},
        'hash' : {},
 
        'list' : {},
        'hash' : {},
 
+       'temp' : '',
+
        'init' : function (params) {
 
                try {
        'init' : function (params) {
 
                try {
index 779a2ef..3d8be6a 100644 (file)
@@ -45,6 +45,8 @@ var urls = {
        'remote_menu_frame' : '/xul/server/main/menu_frame.xul',
        'remote_patron_barcode_entry' : '/xul/server/patron/barcode_entry.xul',
        'remote_patron_bills' : '/xul/server/patron/bills.xul',
        'remote_menu_frame' : '/xul/server/main/menu_frame.xul',
        'remote_patron_barcode_entry' : '/xul/server/patron/barcode_entry.xul',
        'remote_patron_bills' : '/xul/server/patron/bills.xul',
+       'remote_patron_bill_cc_info' : '/xul/server/patron/bill_cc_info.xul',
+       'remote_patron_bill_check_info' : '/xul/server/patron/bill_check_info.xul',
        'remote_patron_bill_details' : '/xul/server/patron/bill_details.xul',
        'remote_patron_bill_wizard' : '/xul/server/patron/bill_wizard.xul',
        'remote_patron_display' : '/xul/server/patron/display.xul',
        'remote_patron_bill_details' : '/xul/server/patron/bill_details.xul',
        'remote_patron_bill_wizard' : '/xul/server/patron/bill_wizard.xul',
        'remote_patron_display' : '/xul/server/patron/display.xul',
index eb19103..37b5031 100644 (file)
@@ -50,7 +50,7 @@ function main_init() {
                        G.OpenILS.data.session = G.auth.session.key;
                        G.OpenILS.data.on_complete = function () {
                                
                        G.OpenILS.data.session = G.auth.session.key;
                        G.OpenILS.data.on_complete = function () {
                                
-                               G.OpenILS.data.stash('list','hash');
+                               G.OpenILS.data.stash('list','hash','temp');
                                G.OpenILS.data._debug_stash();
 
                                G.window.open(urls.remote + urls.remote_menu_frame 
                                G.OpenILS.data._debug_stash();
 
                                G.window.open(urls.remote + urls.remote_menu_frame 
diff --git a/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul b/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul
new file mode 100644 (file)
index 0000000..80850bd
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Patron Display -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/evergreen.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="patron_bill" title="CC Info"
+       orient="vertical" style="overflow: auto"
+       onload="try{info_init();}catch(E){alert(E);}"
+       onunload="try{info_finish();}catch(E){alert(E);}"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+
+       <script>
+       <![CDATA[
+
+               function info_init() {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                       if (typeof JSAN == 'undefined') { throw( "The JSAN library object is 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'});
+                       g.payment_blob = {};
+
+                       document.getElementById('cc_number').focus();
+               }
+
+               function info_finish() {
+                       g.OpenILS.data.temp = js2JSON( g.payment_blob );
+                       g.OpenILS.data.stash('temp');
+               }
+
+       ]]>
+       </script>
+
+
+       <groupbox>
+               <caption label="Credit Card Info"/>
+               <grid>
+                       <columns> <column flex="0" /> <column flex="0" /> </columns>
+                       <rows>
+                               <row>
+                                       <label value="CC Number"/>
+                                       <textbox id="cc_number" onchange="g.payment_blob.cc_number = event.target.value"/>
+                               </row>
+                               <row>
+                                       <label value="Expire Month"/>
+                                       <textbox id="expire_month" onchange="g.payment_blob.expire_month = event.target.value"/>
+                               </row>
+                               <row>
+                                       <label value="Expire Year"/>
+                                       <textbox id="expire_year" onchange="g.payment_blob.expire_year = event.target.value"/>
+                               </row>
+                               <row>
+                                       <label value="Approval Code"/>
+                                       <textbox id="approval_code" onchange="g.payment_blob.approval_code = event.target.value"/>
+                               </row>
+                               <row>
+                                       <label value="Note"/>
+                                       <textbox id="note" onchange="g.payment_blob.note = event.target.value" multiline="true"/>
+                               </row>
+                       </rows>
+               </grid>
+               <hbox>
+                       <spacer flex="1"/>
+                       <button label="Cancel" oncommand="g.payment_blob.cancelled = true; window.close()" accesskey="C"/>
+                       <button label="Submit this Info" oncommand="window.close();" accesskey="S"/>
+               </hbox>
+       </groupbox>
+
+</window>
+
+
diff --git a/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul b/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul
new file mode 100644 (file)
index 0000000..c63334b
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Patron Display -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/evergreen.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="patron_bill" title="Check Info"
+       orient="vertical" style="overflow: auto"
+       onload="try{info_init();}catch(E){alert(E);}"
+       onunload="try{info_finish();}catch(E){alert(E);}"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+
+       <script>
+       <![CDATA[
+
+               function info_init() {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                       if (typeof JSAN == 'undefined') { throw( "The JSAN library object is 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'});
+                       g.payment_blob = {};
+
+                       document.getElementById('check_number').focus();
+               }
+
+               function info_finish() {
+                       g.OpenILS.data.temp = js2JSON( g.payment_blob );
+                       g.OpenILS.data.stash('temp');
+               }
+
+       ]]>
+       </script>
+
+
+       <groupbox>
+               <caption label="Credit Card Info"/>
+               <grid>
+                       <columns> <column flex="0" /> <column flex="0" /> </columns>
+                       <rows>
+                               <row>
+                                       <label value="Check Number"/>
+                                       <textbox id="check_number" onchange="g.payment_blob.check_number = event.target.value"/>
+                               </row>
+                               <row>
+                                       <label value="Note"/>
+                                       <textbox id="note" onchange="g.payment_blob.note = event.target.value" multiline="true"/>
+                               </row>
+                       </rows>
+               </grid>
+               <hbox>
+                       <spacer flex="1"/>
+                       <button label="Cancel" oncommand="g.payment_blob.cancelled = true; window.close()" accesskey="C"/>
+                       <button label="Submit this Info" oncommand="window.close();" accesskey="S"/>
+               </hbox>
+       </groupbox>
+
+</window>
+
+
index a6f0115..8c583c3 100644 (file)
@@ -97,7 +97,7 @@ patron.bills.prototype = {
                                        'cmd_bill_apply_payment' : [
                                                ['command'],
                                                function() {
                                        'cmd_bill_apply_payment' : [
                                                ['command'],
                                                function() {
-                                                       obj.apply_payment();
+                                                       try { obj.apply_payment(); } catch(E) { alert(E); }
                                                }
                                        ],
                                        'bill_total_owed' : [
                                                }
                                        ],
                                        'bill_total_owed' : [
@@ -201,8 +201,31 @@ patron.bills.prototype = {
        'apply_payment' : function() {
                var obj = this;
                var payment_blob = {};
        'apply_payment' : function() {
                var obj = this;
                var payment_blob = {};
+               JSAN.use('util.window');
+               var win = new util.window();
+               switch(obj.controller.view.payment_type.value) {
+                       case 'credit_card_payment' :
+                               var w = win.open(
+                                       urls.remote_patron_bill_cc_info,
+                                       'billccinfo',
+                                       'chrome,resizable,modal'
+                               );
+                               obj.OpenILS.data.stash_retrieve();
+                               payment_blob = JSON2js( obj.OpenILS.data.temp );
+                       break;
+                       case 'check_payment' :
+                               var w = win.open(
+                                       urls.remote_patron_bill_check_info,
+                                       'billccinfo',
+                                       'chrome,resizable,modal'
+                               );
+                               obj.OpenILS.data.stash_retrieve();
+                               payment_blob = JSON2js( obj.OpenILS.data.temp );
+                       break;
+               }
+               if (payment_blob.cancelled == 'true') { alert('cancelled'); return; }
                payment_blob.userid = obj.patron_id;
                payment_blob.userid = obj.patron_id;
-               payment_blob.note = '';
+               payment_blob.note = payment_blob.note || '';
                payment_blob.cash_drawer = 1; // FIXME: get new Config() to work
                payment_blob.payment_type = obj.controller.view.payment_type.value;
                payment_blob.payments = [];
                payment_blob.cash_drawer = 1; // FIXME: get new Config() to work
                payment_blob.payment_type = obj.controller.view.payment_type.value;
                payment_blob.payments = [];
@@ -235,6 +258,7 @@ patron.bills.prototype = {
        },
 
        'pay' : function(payment_blob) {
        },
 
        'pay' : function(payment_blob) {
+               alert('payment_blob = ' + payment_blob);
                var obj = this;
                try {
                        var robj = obj.network.request(
                var obj = this;
                try {
                        var robj = obj.network.request(