receipt template editor
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Jul 2005 01:06:43 +0000 (01:06 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Jul 2005 01:06:43 +0000 (01:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1401 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/auth/auth.js
Evergreen/staff_client/chrome/content/evergreen/circ/receipt_template_editor.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/main/app_shell_menus_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/app_shell_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/util/print.js
Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js
Evergreen/staff_client/chrome/locale/en-US/evergreen/OpenILS.properties

index 36b08f1..6411f7f 100644 (file)
@@ -32,6 +32,11 @@ G['asc_list'] = []; // asset::stat_cat
 G['actsc_list'] = []; // actor::stat_cat
 G['actsc_hash']; // actor::stat_cat
 
+G['itemsout_header'] = 'Welcome %PATRON_FIRSTNAME%, to %LIBRARY%! <br /> Today is %TODAY_D%<br /> <ol>';
+G['itemsout_line_item'] = '<li>%TITLE: 40% <br />Barcode: %COPY_BARCODE% Due: %DUE_D%<br />';
+G['itemsout_footer'] = '</ol> Thanks!';
+
+
 var mw = G['main_window'];
 var auth_meter_incr = 10;
 
diff --git a/Evergreen/staff_client/chrome/content/evergreen/circ/receipt_template_editor.xul b/Evergreen/staff_client/chrome/content/evergreen/circ/receipt_template_editor.xul
new file mode 100644 (file)
index 0000000..367dc5c
--- /dev/null
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: About -->
+
+<!-- Stylesheets -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
+
+<window id="itemsout_receipt_template_win" 
+       onload="try { my_init(); } catch(E) { alert(E); }"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <script>mw.sdump('D_TRACE','Loading itemsout_receipt_template.xul\n');</script>
+
+       <script>
+       <![CDATA[
+               var test_patron = mw.JSON2js('/*--S au --*/[null,null,null,[/*--S aua --*/[null,null,null,"work","CITY","USA","Fulton","13","30043","GA","123 street road","#AR54","18","1"]/*--E aua --*/,/*--S aua --*/[null,null,null,"Vacation","PC Beach","USA","PC County","42","01010","FL","111 A Street","Unit #12A","18","1"]/*--E aua --*/],[/*--S ac --*/[null,null,null,"1","21099000006699","14","18"]/*--E ac --*/],[{"circ":/*--S aoc --*/[null,null,null,"212","2005-07-05 04:58:02-04","14 days","2wk_default","1 day","134","50.00","books","0.10","books","1","1",null,"11","18",null,"2005-07-19 10:38:25.211964-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"31041005404709","11",null,"212",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-05-06 11:13:05.063398-04","1","2","1","11","2","1","1","0.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Albrand, Martha.",[],null,"3",null,null,"",[],"1959","Random House",null,[],[],null,"PIN01000004 ","A  day in Monte Carlo",["text"]]/*--E mvr --*/},{"circ":/*--S aoc --*/[null,null,null,"12","2005-08-04 11:31:02-04","14 days","2wk_default","1 day","171","50.00","books","0.10","books","0","2",null,"2139800","18",null,"2005-07-21 17:11:44.203345-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"33207000838641","1938753",null,"10",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-07-21 17:08:53.504341-04","1","2","1","2139800","2","1","1","10.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Sproule, Anna.",[],null,"330278",null,null,"0531182150 (lib. bdg.)",[],"1988","Bookwright Press",null,["Know your pet"],[["Dogs"],["Dog breeds"]],"Discusses how to choose and care for a pet dog and provides information on various breeds.","PIN03092988 ","Dogs",["text"]]/*--E mvr --*/},{"circ":/*--S aoc --*/[null,null,null,"1","2005-08-05 14:36:02-04","14 days","2wk_default","1 day","173","50.00","books","0.10","books","0","2",null,"1329873","18",null,"2005-07-22 20:17:07.199888-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"34520000676111","1187974",null,"182",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-05-06 11:13:05.063398-04","1","2","1","1329873","2","1","1","0.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Margolis, Matthew.",[],null,"97448",null,"1st Vintage Books ed.","0394711742 (pbk.) :",[],"1982, c1979","Vintage Books",null,[],[["Dogs"]],null,"PIN02040633 ","The  dog in your life a complete guide to choosing, raising, feeding, training, and caring for your dog plus sections on show dogs, hunting dogs, coursing dogs, herd dogs, sled dogs, guard dogs, guide dogs, and a discussion of common canine illnesses",["text"]]/*--E mvr --*/}],[/*--S ahr --*/[null,null,null,"Copy found, waiting for capture",null,"3601016","email2@somewheres.info",null,null,"T",null,"45","800.555.0000","12","2005-07-24 15:47:42.091479-04","2005-07-21 16:35:16.026892-04","18","0","847314","18"]/*--E ahr --*/,/*--S ahr --*/[null,null,null,"Copy found, waiting for capture",null,"1386122","email2@somewheres.info",null,null,"T",null,"46","800.555.0000","12","2005-07-24 15:47:45.240195-04","2005-07-21 16:40:12.783469-04","18","0","152833","18"]/*--E ahr --*/,/*--S ahr --*/[null,null,null,"Available","2005-07-21 17:04:11.853992-04","548582","email2@somewheres.info",null,null,"T",null,"47","800.555.0000","12","2005-07-21 17:03:49.248665-04","2005-07-21 17:03:10.523049-04","18","0","23932","18"]/*--E ahr --*/],null,[/*--S actscecm --*/[null,null,null,"40","17","Yes","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"14","2","Yes","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"46","18","test2","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"42","16","","18"]/*--E actscecm --*/],null,"1",null,/*--S aua --*/[null,null,null,"Vacation","PC Beach","USA","PC County","42","01010","FL","111 A Street","Unit #12A","18","1"]/*--E aua --*/,/*--S ac --*/[null,null,null,"1","21099000006699","14","18"]/*--E ac --*/,"0","2005-05-13","0.00","800.555.0000","1900-01-02","email2@somewheres.info",null,"2008-05-13","Erickson","Bill","10","18","5","2","345","365","1122211188.708583190.17503114108",/*--S aua --*/[null,null,null,"work","CITY","USA","Fulton","13","30043","GA","123 street road","#AR54","18","1"]/*--E aua --*/,"0","1",null,null,null,"Councilperson","3",null,"1","Jr","0","18","erickson"]/*--E au --*/');
+
+               function my_init() {
+                       document.getElementById('itemsout_header_tb').value = mw.G.itemsout_header;
+                       document.getElementById('itemsout_line_item_tb').value = mw.G.itemsout_line_item;
+                       document.getElementById('itemsout_footer_tb').value = mw.G.itemsout_footer;
+                       document.getElementById('checkout_header_tb').value = mw.G.checkout_header;
+                       document.getElementById('checkout_line_item_tb').value = mw.G.checkout_line_item;
+                       document.getElementById('checkout_footer_tb').value = mw.G.checkout_footer;
+                       document.getElementById('checkin_header_tb').value = mw.G.checkin_header;
+                       document.getElementById('checkin_line_item_tb').value = mw.G.checkin_line_item;
+                       document.getElementById('checkin_footer_tb').value = mw.G.checkin_footer;
+                       document.getElementById('holds_header_tb').value = mw.G.holds_header;
+                       document.getElementById('holds_line_item_tb').value = mw.G.holds_line_item;
+                       document.getElementById('holds_footer_tb').value = mw.G.holds_footer;
+               }
+
+               function test_itemsout() {
+                       var params = { 
+                               'au' : test_patron, 
+                               'lib' : mw.G.user_ou,
+                               'header' : document.getElementById('itemsout_header_tb').value,
+                               'line_item' : document.getElementById('itemsout_line_item_tb').value,
+                               'footer' : document.getElementById('itemsout_footer_tb').value
+                       };
+                       mw.print_itemsout_receipt( params );
+               }
+
+               function save_itemsout() {
+                       mw.G.itemsout_header = document.getElementById('itemsout_header_tb').value;
+                       mw.G.itemsout_line_item = document.getElementById('itemsout_line_item_tb').value;
+                       mw.G.itemsout_footer = document.getElementById('itemsout_footer_tb').value;
+               }
+
+               function test_checkout() {
+                       var params = { 
+                               'au' : test_patron, 
+                               'lib' : mw.G.user_ou,
+                               'header' : document.getElementById('checkout_header_tb').value,
+                               'line_item' : document.getElementById('checkout_line_item_tb').value,
+                               'footer' : document.getElementById('checkout_footer_tb').value
+                       };
+                       mw.print_checkout_receipt( params );
+               }
+
+               function save_checkout() {
+                       mw.G.checkout_header = document.getElementById('checkout_header_tb').value;
+                       mw.G.checkout_line_item = document.getElementById('checkout_line_item_tb').value;
+                       mw.G.checkout_footer = document.getElementById('checkout_footer_tb').value;
+               }
+
+               function test_checkin() {
+                       var params = { 
+                               'au' : test_patron, 
+                               'lib' : mw.G.user_ou,
+                               'header' : document.getElementById('checkin_header_tb').value,
+                               'line_item' : document.getElementById('checkin_line_item_tb').value,
+                               'footer' : document.getElementById('checkin_footer_tb').value
+                       };
+                       mw.print_checkin_receipt( params );
+               }
+
+               function save_checkin() {
+                       mw.G.checkin_header = document.getElementById('checkin_header_tb').value;
+                       mw.G.checkin_line_item = document.getElementById('checkin_line_item_tb').value;
+                       mw.G.checkin_footer = document.getElementById('checkin_footer_tb').value;
+               }
+
+               function test_holds() {
+                       var params = { 
+                               'au' : test_patron, 
+                               'lib' : mw.G.user_ou,
+                               'header' : document.getElementById('holds_header_tb').value,
+                               'line_item' : document.getElementById('holds_line_item_tb').value,
+                               'footer' : document.getElementById('holds_footer_tb').value
+                       };
+                       mw.print_holds_receipt( params );
+               }
+
+               function save_holds() {
+                       mw.G.holds_header = document.getElementById('holds_header_tb').value;
+                       mw.G.holds_line_item = document.getElementById('holds_line_item_tb').value;
+                       mw.G.holds_footer = document.getElementById('holds_footer_tb').value;
+               }
+
+       ]]>
+       </script>
+
+       <vbox flex="1" class="my_overflow">
+               <groupbox orient="vertical" flex="1">
+                       <caption label="Receipt Template Editor"/>
+                       <hbox flex="1">
+                               <groupbox orient="vertical" flex="1">
+                                       <caption label="DESCRIPTION" />
+                                       <hbox flex="1">
+                                               <iframe flex="1" src="data:text/html,&lt;html&gt;&lt;p&gt;Please note that this interface is for testing purposes, and that modifications you make here will not persist between different invocations of the staff client.  In future versions of the software, you will be able to save and share named templates.&lt;/p&gt;&lt;p&gt;The following macros get evaluated and substituted for each receipt printed: %LIBRARY% %PINES_CODE% %PATRON_LASTNAME% %PATRON_FIRSTNAME% %PATRON_MIDDLENAME% %PATRON_BARCODE% %TODAY% %OUT% %DUE% %DURATION% %COPY_BARCODE% %TITLE% %AUTHOR% %PUBLISHER% %PUBDATE% %NUMBER%&lt;/p&gt;&lt;p&gt;If there's a specific macro you would like to see, please let us know.  There will be variations on these for handling truncation and date formats.  See the examples.&lt;/p&gt;&lt;/html&gt;" />;
+                                       </hbox>
+                               </groupbox>
+                               <groupbox orient="vertical" flex="1">
+                                       <caption label="TEMPLATES" />
+                               <tabbox flex="1">
+                                       <tabs>
+                                               <tab label="Items Out"/>
+                                               <tab label="Holds"/>
+                                               <tab label="Check Out"/>
+                                               <tab label="Check In"/>
+                                       </tabs>
+                                       <tabpanels flex="1">
+                                               <tabpanel>
+                                                       <vbox flex="1">
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Header"/>
+                                                                       <textbox id="itemsout_header_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Line Item"/>
+                                                                       <textbox id="itemsout_line_item_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Footer"/>
+                                                                       <textbox id="itemsout_footer_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <hbox>
+                                                                       <spacer flex="1"/>
+                                                                       <button label="Test" accesskey="T" oncommand="test_itemsout();"/>
+                                                                       <button label="Save" accesskey="S" oncommand="save_itemsout();"/>
+                                                               </hbox>
+                                                       </vbox>
+                                               </tabpanel>
+                                               <tabpanel>
+                                                       <vbox flex="1">
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Header"/>
+                                                                       <textbox id="checkout_header_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Line Item"/>
+                                                                       <textbox id="checkout_line_item_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Footer"/>
+                                                                       <textbox id="checkout_footer_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <hbox>
+                                                                       <spacer flex="1"/>
+                                                                       <button label="Test" accesskey="T" oncommand="test_checkout();"/>
+                                                                       <button label="Save" accesskey="S" oncommand="save_checkout();"/>
+                                                               </hbox>
+                                                       </vbox>
+                                               </tabpanel>
+                                               <tabpanel>
+                                                       <vbox flex="1">
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Header"/>
+                                                                       <textbox id="checkin_header_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Line Item"/>
+                                                                       <textbox id="checkin_line_item_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Footer"/>
+                                                                       <textbox id="checkin_footer_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <hbox>
+                                                                       <spacer flex="1"/>
+                                                                       <button label="Test" accesskey="T" oncommand="test_checkin();"/>
+                                                                       <button label="Save" accesskey="S" oncommand="save_checkin();"/>
+                                                               </hbox>
+                                                       </vbox>
+                                               </tabpanel>
+                                               <tabpanel>
+                                                       <vbox flex="1">
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Header"/>
+                                                                       <textbox id="holds_header_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Line Item"/>
+                                                                       <textbox id="holds_line_item_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <groupbox orient="vertical" flex="1">
+                                                                       <caption label="Footer"/>
+                                                                       <textbox id="holds_footer_tb" multiline="true" flex="1"/>
+                                                               </groupbox>
+                                                               <hbox>
+                                                                       <spacer flex="1"/>
+                                                                       <button label="Test" accesskey="T" oncommand="test_holds();"/>
+                                                                       <button label="Save" accesskey="S" oncommand="save_holds();"/>
+                                                               </hbox>
+                                                       </vbox>
+                                               </tabpanel>
+                                       </tabpanels>
+                               </tabbox>
+                               </groupbox>
+                       </hbox>
+               </groupbox>
+       </vbox>
+
+</window>
+
index 6d7c05d..1db0c29 100644 (file)
 <!-- The Help menu on the main menu -->
 <menu id="main.menu.admin" label="&main.menu.admin.label;" accesskey="&main.menu.admin.key;">
        <menupopup id="main.menu.admin.popup">
+               <menuitem label="Receipt Template Editor" accesskey="R" command="cmd_receipt_template_editor"/>
                <menuitem label="Survey Wizard" accesskey="S" command="cmd_survey_wizard"/>
                <menuitem label="Copy Stat-Cat Editor" accesskey="C" command="cmd_copy_stat_cat_edit"/>
                <menuitem label="Patron Stat-Cat Editor" accesskey="P" command="cmd_patron_stat_cat_edit"/>
index 4efc89a..ec474ff 100644 (file)
@@ -54,6 +54,9 @@
        <command id="cmd_patron_stat_cat_edit" oncommand="
                mw.spawn_patron_stat_cat_edit(document,'replace_tab','main_tabbox',{}); "/>     
 
+       <command id="cmd_receipt_template_editor" oncommand="
+               mw.spawn_receipt_template_editor(document,'replace_tab','main_tabbox',{}); "/>  
+
        <command id="cmd_z39_50_import_old" oncommand="
                mw.spawn_z3950_import(document,'replace_tab','main_tabbox',{}); "/>     
 
index 58aabea..6507939 100644 (file)
@@ -4,9 +4,9 @@ var print_crlf = '<br />\r\n';
 
 // Higher-level
 
-function print_checkout_receipt(params) {
+function print_itemsout_receipt(params) {
        sdump('D_PRINT',arg_dump(arguments));
-       var s = '';
+       var s = ''; params.current_circ = new circ(); params.current_copy = new acp(); params.current_mvr = new mvr();
        if (params.header) { s += print_template_replace(params.header, params); }
        for (var i = 0; i < params.au.checkouts().length; i++) {
                params.current_circ = params.au.checkouts()[i].circ;
@@ -61,62 +61,103 @@ function print_template_replace(s,params) {
                var b = s.match( /%TRUNC.{0,3}:\s*(\d+)%/ );
                if (b) params.truncate = b[1];
 
-               try{s=s.replace(/%TRUNC.{0,3}:\s*\d+%/g,'');}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%LIBRARY%/g,trunc(params.lib.name()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PINES_CODE%/g,trunc(params.lib.shortname()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-
-               try{s=s.replace(/%PATRON_LASTNAME%/g,trunc(params.au.family_name()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PATRON_FIRSTNAME%/g,trunc(params.au.first_given_name()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PATRON_MIDDLENAME%/g,trunc(params.au.second_given_name()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PATRON_BARCODE%/g,trunc(params.au.card().barcode()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-
-               try{s=s.replace(/%TODAY%/g,trunc(new Date()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_m%/g,trunc(formatted_date(new Date(),'%m')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_d%/g,trunc(formatted_date(new Date(),'%d')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_Y%/g,trunc(formatted_date(new Date(),'%Y')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_H%/g,trunc(formatted_date(new Date(),'%H')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_I%/g,trunc(formatted_date(new Date(),'%I')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_M%/g,trunc(formatted_date(new Date(),'%M')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_D%/g,trunc(formatted_date(new Date(),'%D')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%TODAY_F%/g,trunc(formatted_date(new Date(),'%F')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%TRUNC.{0,3}:\s*\d+%/g,'');}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%LIBRARY%/g,trunc(params.lib.name()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PINES_CODE%/g,trunc(params.lib.shortname()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+
+               try{s=s.replace(/%PATRON_LASTNAME%/g,trunc(params.au.family_name()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PATRON_FIRSTNAME%/g,trunc(params.au.first_given_name()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PATRON_MIDDLENAME%/g,trunc(params.au.second_given_name()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PATRON_BARCODE%/g,trunc(params.au.card().barcode()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+
+               try{s=s.replace(/%TODAY%/g,trunc(new Date()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_m%/g,trunc(formatted_date(new Date(),'%m')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_d%/g,trunc(formatted_date(new Date(),'%d')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_Y%/g,trunc(formatted_date(new Date(),'%Y')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_H%/g,trunc(formatted_date(new Date(),'%H')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_I%/g,trunc(formatted_date(new Date(),'%I')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_M%/g,trunc(formatted_date(new Date(),'%M')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_D%/g,trunc(formatted_date(new Date(),'%D')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%TODAY_F%/g,trunc(formatted_date(new Date(),'%F')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
                
-               try{s=s.replace(/%OUT%/g,trunc(params.current_circ.xact_start()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_m%/g,trunc(formatted_date(params.current_circ.xact_start(),'%m')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_d%/g,trunc(formatted_date(params.current_circ.xact_start(),'%d')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_Y%/g,trunc(formatted_date(params.current_circ.xact_start(),'%Y')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_H%/g,trunc(formatted_date(params.current_circ.xact_start(),'%H')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_I%/g,trunc(formatted_date(params.current_circ.xact_start(),'%I')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_M%/g,trunc(formatted_date(params.current_circ.xact_start(),'%M')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_D%/g,trunc(formatted_date(params.current_circ.xact_start(),'%D')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%OUT_F%/g,trunc(formatted_date(params.current_circ.xact_start(),'%F')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-
-               try{s=s.replace(/%DUE%/g,trunc(params.current_circ.due_date()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_m%/g,trunc(formatted_date(params.current_circ.due_date(),'%m')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_d%/g,trunc(formatted_date(params.current_circ.due_date(),'%d')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_Y%/g,trunc(formatted_date(params.current_circ.due_date(),'%Y')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_H%/g,trunc(formatted_date(params.current_circ.due_date(),'%H')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_I%/g,trunc(formatted_date(params.current_circ.due_date(),'%I')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_M%/g,trunc(formatted_date(params.current_circ.due_date(),'%M')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_D%/g,trunc(formatted_date(params.current_circ.due_date(),'%D')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%DUE_F%/g,trunc(formatted_date(params.current_circ.due_date(),'%F')));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-
-               try{s=s.replace(/%DURATION%/g,trunc(params.current_circ.duration()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT%/g,trunc(params.current_circ.xact_start()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_m%/g,trunc(formatted_date(params.current_circ.xact_start(),'%m')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_d%/g,trunc(formatted_date(params.current_circ.xact_start(),'%d')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_Y%/g,trunc(formatted_date(params.current_circ.xact_start(),'%Y')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_H%/g,trunc(formatted_date(params.current_circ.xact_start(),'%H')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_I%/g,trunc(formatted_date(params.current_circ.xact_start(),'%I')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_M%/g,trunc(formatted_date(params.current_circ.xact_start(),'%M')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_D%/g,trunc(formatted_date(params.current_circ.xact_start(),'%D')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%OUT_F%/g,trunc(formatted_date(params.current_circ.xact_start(),'%F')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+
+               try{s=s.replace(/%DUE%/g,trunc(params.current_circ.due_date()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_m%/g,trunc(formatted_date(params.current_circ.due_date(),'%m')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_d%/g,trunc(formatted_date(params.current_circ.due_date(),'%d')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_Y%/g,trunc(formatted_date(params.current_circ.due_date(),'%Y')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_H%/g,trunc(formatted_date(params.current_circ.due_date(),'%H')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_I%/g,trunc(formatted_date(params.current_circ.due_date(),'%I')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_M%/g,trunc(formatted_date(params.current_circ.due_date(),'%M')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_D%/g,trunc(formatted_date(params.current_circ.due_date(),'%D')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%DUE_F%/g,trunc(formatted_date(params.current_circ.due_date(),'%F')));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+
+               try{s=s.replace(/%DURATION%/g,trunc(params.current_circ.duration()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
                
-               try{s=s.replace(/%COPY_BARCODE%/g,trunc(params.current_copy.barcode()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%COPY_BARCODE%/g,trunc(params.current_copy.barcode()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
                
                var tb = s.match( /%TITLE:?\s*(\d*)%/ );
                if (tb) params.title_truncate = tb[1];
 
-               try{s=s.replace(/%TITLE:?\s*\d*%/g,ttrunc(params.current_mvr.title()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%TITLE:?\s*\d*%/g,ttrunc(params.current_mvr.title()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
                var ab = s.match( /%AUTHOR:?\s*(\d*)%/ );
                if (ab) params.author_truncate = ab[1];
 
-               try{s=s.replace(/%AUTHOR%/g,atrunc(params.current_mvr.author()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PUBLISHER%/g,trunc(params.current_mvr.publisher()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
-               try{s=s.replace(/%PUBDATE%/g,trunc(params.current_mvr.pubdate()));}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%AUTHOR%/g,atrunc(params.current_mvr.author()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PUBLISHER%/g,trunc(params.current_mvr.publisher()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
+               try{s=s.replace(/%PUBDATE%/g,trunc(params.current_mvr.pubdate()));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
-               try{s=s.replace(/%NUMBER%/g,params.current_index);}catch(E){sdump('D_ERROR',js2JSON(E)+'\n');}
+               try{s=s.replace(/%NUMBER%/g,(params.current_index+1));}
+                       catch(E){sdump('D_ERROR','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
                return s;
 }
@@ -147,6 +188,7 @@ function NSPrint(w)
                        .getInterface(Components.interfaces.nsIWebBrowserPrint);
                if (webBrowserPrint) {
                        var gPrintSettings = GetPrintSettings();
+                       /*
                        gPrintSettings.printSilent = true;
                         gPrintSettings.marginTop = 0;
                         gPrintSettings.marginLeft = 0;
@@ -158,6 +200,7 @@ function NSPrint(w)
                         gPrintSettings.footerStrLeft = '';
                         gPrintSettings.footerStrCenter = '';
                         gPrintSettings.footerStrRight = '';
+                       */
                        webBrowserPrint.print(gPrintSettings, null);
                        //alert('Should be printing\n');
                } else {
index e0e00b9..7db30e9 100644 (file)
@@ -119,6 +119,11 @@ function spawn_patron_search(d,placement,place,passthru_params,clone) {
        return spawn_interface(d,placement,place,chrome,getString('patron_search_interface_label'),passthru_params,clone);
 }
 
+function spawn_receipt_template_editor(d,placement,place,passthru_params,clone) {
+       var chrome = 'chrome://evergreen/content/circ/receipt_template_editor.xul';
+       return spawn_interface(d,placement,place,chrome,getString('receipt_template_editor_interface_label'),passthru_params,clone);
+}
+
 /* legacy code, may be removed or refactored */
 
 function spawn_batch_copy_editor(d,placement,place,passthru_params,clone) {
index 9547cfa..97823ce 100644 (file)
@@ -13,6 +13,7 @@ patron_editor_interface_label=PATRON EDIT
 patron_search_interface_label=PATRON SEARCH
 patron_register_interface_label=NEW PATRON
 patron_interface_label=PATRON 
+receipt_template_editor_interface_label=RECEIPTS
 survey_admin_interface_label=SURVEY ADMIN
 copy_stat_cat_editor_interface_label=COPY STAT-CATS
 patron_stat_cat_editor_interface_label=PATRON STAT-CATS