CAT-60 Patron editor and item summary print additions
authorVictoria Lewis <vlewis@catalystdevworks.com>
Tue, 2 May 2017 20:59:39 +0000 (13:59 -0700)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
- Add new template item_status_detailed to print
most of the data from quick summary
- Make an array to hold the data to print in alternate_copy_summary.js
- Make a new template called item_status_detailed for the print
additions
- Add print-detailed button to alternate_copy_summary.xul
- Add print functionality to patron edit screen
- Add print functionality to item quick summary
- Add experimental node exploration and testing to copy_status.js
Signed-off-by: Billy Horn <bhorn@catalystdevworks.com>
Signed-off-by: Skye Howard <showard@catalyte.io>
Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/web/js/ui/default/actor/user/register.js
modified:   Open-ILS/xul/staff_client/chrome/content/util/print.js
modified:   Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
modified:   Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul
modified:   Open-ILS/xul/staff_client/server/skin/print_list_templates

Return receipt template file to pretty-printed JSON format to avoid
clobbering the whole file.  -- Bill.

Open-ILS/web/js/ui/default/actor/user/register.js
Open-ILS/xul/staff_client/chrome/content/util/print.js
Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul
Open-ILS/xul/staff_client/server/skin/print_list_templates

index 30a12af..dacdb5a 100644 (file)
@@ -2644,6 +2644,21 @@ function printable_output() {
             }
         } else {
             label = w.idlField.label;
+            // map the patron's home library, profile, and net access level
+            // values to their display names by pulling the objects from
+            // the widget data store.
+            if (w.idlField.name == 'net_access_level' ||
+                w.idlField.name == 'profile' ||
+                w.idlField.name == 'home_ou') {
+
+                w.widget.store.fetch({
+                    onComplete : function(items) {
+                        if (!items[0]) return
+                        val = w.widget.store.getValue(items[0], 'name');
+                    },
+                    query : {id : val+''}
+                });
+            }
         }
         if (temp != w._wtype) {
             temp = w._wtype;
index 372449b..38e834d 100644 (file)
@@ -433,6 +433,8 @@ util.print.prototype = {
 
             try{b = s; s = s.replace(/%patron_barcode%/g,this.escape_html(params.patron_barcode));}
                 catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+                       try{b = s; s = s.replace(/%recurring_fine_rule%/g,this.escape_html(params.row.recurring_fine_rule));}
+                               catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
             try{b = s; s = s.replace(/%LIBRARY%/g,this.escape_html(params.lib.name()));}
                 catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
index ef06cfa..f347dec 100644 (file)
@@ -3,6 +3,11 @@ var network;
 var data;
 var transit_list;
 var hold_list;
+var obj = this;
+var print_list = "";
+var namey = [];
+var value = [];
+var count = 0;
 
 function my_init() {
     try {
@@ -68,6 +73,25 @@ function my_init() {
             function () { xulG.from_item_details_new = false; load_item(); },
             1000
         );
+               JSAN.use('util.controller'); obj.controller = new util.controller();
+        obj.controller.init(
+            {
+                control_map : {
+                    'cmd_alternate_copy_summary_print' : [
+                        ['command'],
+                        function() {
+                            try {
+                                JSAN.use('util.print');
+                                var print = new util.print('default');
+                                print.simple(print_list, {'content_type':'text/plain'});
+                            } catch(E) {
+                                obj.error.standard_unexpected_error_alert('print',E);
+                            }
+                        }
+                    ],
+                }
+            }
+        );
 
     } catch(E) {
         try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
@@ -92,6 +116,127 @@ function set(name,value,data) {
     }
 }
 
+function fill_print(name){
+    var print_item = document.getElementsByAttribute('name',name);
+    var replace;
+    switch(replace = print_item.item(0).getAttribute('name')){
+        case 'barcode':
+            replace = 'Barcode\t\t\t';
+            break;
+        case 'copy_circ_lib':
+            replace = 'Circ Library\t\t';
+            break;
+        case 'call_number':
+            replace = 'Item Call #\t\t';
+            break;
+        case 'copy_status':
+            replace = 'Status\t\t\t';
+            break;
+        case 'price':
+            replace = 'Price\t\t\t';
+            break;
+        case 'owning_lib':
+            replace = 'Owning Library\t\t';
+            break;
+        case 'renewal_type':
+            replace = 'Renewal Type\t\t';
+            break;
+        case 'due_date':
+            replace = 'Due Date\t\t';
+            break;
+        case 'isbn':
+            replace = 'ISBN\t\t\t';
+            break;
+        case 'location':
+            replace = 'Copy Location\t\t';
+            break;
+        case 'total_circ_count':
+            replace = 'Total Circs\t\t';
+            break;
+        case 'xact_start':
+            replace = 'Checkout Date\t\t';
+            break;
+        case 'copy_create_date':
+            replace = 'Date Created\t\t';
+            break;
+        case 'loan_duration':
+            replace = 'Loan Duration\t\t';
+            break;
+        case 'total_circ_count_curr_year':
+            replace = 'Total Circs - Current Year';
+            break;
+        case 'checkout_workstation':
+            replace = 'Checkout Workstation\t';
+            break;
+        case 'copy_active_date':
+            replace = 'Date Active\t\t';
+            break;
+        case 'fine_level':
+            replace = 'Fine Level\t\t';
+            break;
+        case 'total_circ_count_prev_year':
+            replace = 'Total Circs - Prev Year\t';
+            break;
+        case 'duration_rule':
+            replace = 'Duration Rule\t\t';
+            break;
+        case 'status_changed_time':
+            replace = 'Status Changed\t\t';
+            break;
+        case 'ref':
+            replace = 'Reference\t\t';
+            break;
+        case 'renewal_workstation':
+            replace = 'Renewal Workstation\t';
+            break;
+        case 'recurring_fine_rule':
+            replace = 'Recurring Fine Rule\t';
+            break;
+        case 'copy_id':
+            replace = 'Copy ID\t\t\t';
+            break;
+        case 'opac_visible':
+            replace = 'OPAC Visible\t\t';
+            break;
+        case 'renewal_remaining':
+            replace = 'Remaining Renewals\t';
+            break;
+        case 'max_fine_rule':
+            replace = 'Max Fine Rule\t\t';
+            break;
+        case 'tcn':
+            replace = 'TCN\t\t\t';
+            break;
+        case 'holdable':
+            replace = 'Holdable\t\t';
+            break;
+        case 'checkin_time':
+            replace = 'Checkin Time\t\t';
+            break;
+        case 'floating':
+            replace = 'Floating\t\t';
+            break;
+        case 'circulate':
+            replace = 'Circulate\t\t';
+            break;
+        case 'checkin_scan_time':
+            replace = 'Checkin Scan Time\t';
+            break;
+        case 'circ_modifier':
+            replace = 'Circ Modifier\t\t';
+            break;
+        case 'checkin_workstation':
+            replace = 'Checkin Workstation\t';
+            break;
+        default:
+            replace = '';
+    }
+    namey[count] = replace;
+    value[count] = print_item.item(0).getAttribute('value');
+    print_list += namey[count] + '\t: ' + value[count] + "\n";
+    count++;
+}
+
 function set_tooltip(name,value) { 
     if (typeof value == 'undefined' || typeof value == 'null') { return; }
     var nodes = document.getElementsByAttribute('name',name); 
@@ -734,6 +879,46 @@ function load_item() {
             d.reset_iframe( urls.XUL_MARC_VIEW, {}, { 'docid' : details.mvr ? details.mvr.doc_id() : -1 } );
         }
 
+        function fill_prints(){
+            fill_print('barcode');
+            fill_print('price');
+            fill_print('isbn');
+            fill_print('copy_create_date');
+            fill_print('copy_active_date');
+            fill_print('status_changed_time');
+            fill_print('copy_id');
+            fill_print('tcn');
+            fill_print('floating');
+            fill_print('copy_circ_lib');
+            fill_print('owning_lib');
+            fill_print('location');
+            fill_print('loan_duration');
+            fill_print('fine_level');
+            fill_print('ref');
+            fill_print('opac_visible');
+            fill_print('holdable');
+            fill_print('circulate');
+            fill_print('circ_modifier');
+            fill_print('call_number');
+            fill_print('renewal_type');
+            fill_print('total_circ_count');
+            fill_print('total_circ_count_curr_year');
+            fill_print('total_circ_count_prev_year');
+            fill_print('renewal_workstation');
+            fill_print('renewal_remaining');
+            fill_print('copy_status');
+            fill_print('due_date');
+            fill_print('xact_start');
+            fill_print('checkout_workstation');
+            fill_print('duration_rule');
+            fill_print('recurring_fine_rule');
+            fill_print('max_fine_rule');
+            fill_print('checkin_time');
+            fill_print('checkin_scan_time');
+            fill_print('checkin_workstation');
+        }
+        setTimeout(fill_prints, 1000);
+
     } catch(E) {
         alert(E);
     }
index aaf6b56..4c439ac 100644 (file)
     <script type="text/javascript" src="/xul/server/cat/bib_brief.js"/>
     <script type="text/javascript" src="alternate_copy_summary.js"/>
 
+    <commandset id="copy_status_cmds">
+        <command id="cmd_alternate_copy_summary_print" />
+    </commandset>
+
     <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
     <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties"/>
 
@@ -78,7 +82,7 @@
                         </columns>
                         <rows>
                             <row>
-                                <label value="&staff.circ.alternate_copy_summary.Barcode.label;" />
+                                <label value="&staff.circ.alternate_copy_summary.Barcode.label;" control="barcode"/>
                                 <textbox name="barcode" readonly="true" context="clipboard"/>
                                 <label value="&staff.circ.alternate_copy_summary.Circ_Library.label;" />
                                 <textbox name="copy_circ_lib" readonly="true" context="clipboard"/>
                 </tabpanel>
             </tabpanels>
         </tabbox>
+        <hbox>
+            <button id="alternate_copy_summary_print" label="Print Detailed" command="cmd_alternate_copy_summary_print" accesskey=     "&staff.circ.copy_status_overlay.copy_status_print.accesskey;"/>
+        </hbox>
     </groupbox>
 
 </window>
index 7430089..3cee14c 100644 (file)
@@ -7,6 +7,14 @@
         "inherit": null,
         "context": "receipt"
     },
+    "item_status_detailed": {
+        "type": "items",
+        "header": "The following items have been examined:<hr/><ol>",
+        "line_item": "<li>%title%<br/>\nAuthor: %author%<br>\nBarcode: %barcode%<br/>\nPrice: %price%<br/>\nISBN: %isbn%<br>\nDate Created: %acp_create_date%<br>\nDate Active: %acp_copy_active_date%<br>\nStatus Changed: %status_changed_time%<br>\nCopy ID: %acp_id%<br>\nTCN: %tcn%<br>\nFloating: %floating%<br>\nCirc Library: %circ_lib%<br>\nOwning Library: %owning_lib%<br>\nCopy Location: %location%<br>\nLoan Duration: %loan_duration%<br>\nFine Level: %fine_level%<br>\nReference: %ref%<br>\nOPAC Visible: %opac_visible%<br>\nHoldable: %holdable%<br>\nCirculate: %circulate%<br>\nCirc Modifier: %circ_modifier%<br>\nCall #: %call_number% <br/>\nRenewal Type: %renewal_composite_kludge(details.circ)%<br>\nTotal Circs: %acp_total_circ_count%<br>\nTotal Circs-Current Year: %behind_desk%<br>\nTotal Circs-Previous Year: %total_circ_count_prev_year%<br>\nRenewal Workstation: %prev_renewal_workstation%<br>\nRemaining Renewals: %renewal_remaining%<br>\nStatus: %acp_status%<br>\nCheckout Date: %xact_start%<br>\nCheckout Workstation: %checkout_workstation%<br>\nDuration Rule: %ccmm_duration_rule%<br>\nRecurring Fine Rule: %recurring_fine_rule%<br>\nMax Fine Rule: %max_fine_rule%<br>\nCheckin Time: %checkin_time%<br>\nCheckin Scan Time: %checkin_scan_time%<br>\nCheckin Workstation: %checkin_workstation%<br>\nDue: %due_date_EN%<br/>\n<br/>\n",
+        "footer": "</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\n<br/>\n",
+        "inherit": null,
+        "context": "receipt"
+    },
     "transit_list": {
         "type": "transits",
         "header": "Transits:<hr/><ol>",