tweaks to Patron Summary
authorJason Etheridge <jason@esilibrary.com>
Mon, 16 Sep 2013 18:52:44 +0000 (14:52 -0400)
committerJason Etheridge <jason@esilibrary.com>
Tue, 27 May 2014 20:02:10 +0000 (16:02 -0400)
This commit re-uses the same template for the Patron Summary in both display and
search contexts.  The original one for the display context was the one kept and
is the base for these additional changes:

* Card: has been repositioned
* DOB: and EXP: have been added
* only one phone number is displayed, the order of precedence being Day,
  Evening, and Other.  In other words, if the Day phone is not set, then the
  Evening phone is displayed instead.  And if Evening phone is not set, then
  Other phone is displayed
* Bills: is styled in red and bold, if the amount is greater than $0.00
* If an email address is not set, then the text "Confirm the email address" is
  displayed in the alerts/messages column
* Card: is hyperlinked and copies the barcode to the clipboard if clicked

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/templates/base_nodojo.tt2
Open-ILS/src/templates/opac/PatronSearchSummary.tt2 [changed from file to symlink]
Open-ILS/src/templates/opac/PatronSummary.tt2
Open-ILS/src/templates/opac/css/PatronSummary.css.tt2
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/xuljs.tt2 [new file with mode: 0644]

index dc2197d..619630e 100644 (file)
@@ -6,6 +6,7 @@
         <style type="text/css">
             @import "[% extracss %]";
         </style>
+        [% INCLUDE "opac/parts/xuljs.tt2" IF ctx.page == 'patron_summary' AND ctx.is_staff %]
     </head>
     <body class="[% class %]">
         [% content %]
deleted file mode 100644 (file)
index 14cc52a981d788ff88a0491a73290930a7a1eef7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,135 +0,0 @@
-[%  PROCESS "opac/parts/header.tt2";
-    WRAPPER "base_nodojo.tt2"
-        extracss="/eg/opac/css/PatronSummary.css";
-    ctx.page_title = l("Patron Summary") %]
-    <div id="content-wrapper">
-        <div id="main-content" class="[% ctx.css_classnames %]">
-            <div class="common-full-pad" style="float:none"></div>
-            [% IF NOT ctx.error %]
-            <div class="table patronSummaryDiv">
-                <div class="row"><div class="cell">
-                    <div class="textBackground">
-                        <span class="patronNameLarge">
-                            [% l(
-                                HUMAN_NAME_FORMAT,
-                                ctx.user.prefix, ctx.user.first_given_name,
-                                ctx.user.second_given_name, ctx.user.family_name,
-                                ctx.user.suffix
-                            ) | html %]
-                        </span><br/>
-                        <span>
-                            [% l(
-                                'Card: [_1]',
-                                ctx.user.card.barcode
-                            ) | html %]
-                        </span><br/>
-                        [% IF ctx.user.mailing_address %]
-                        <span>
-                            [% ctx.user.mailing_address.street1 | html %]<br/>
-                            [% ctx.user.mailing_address.street2 | html %]<br/>
-                            [% ctx.user.mailing_address.city | html %],
-                            [% ctx.user.mailing_address.state | html %]
-                            [% ctx.user.mailing_address.post_code | html %]
-                        </span><br/>
-                        [% END %]
-                    </div>
-                </div><div class="cell">
-                    <div class="textBackground">
-                        <span>
-                            [% ctx.user.email OR ' ' | html %]
-                        </span></br>
-                        <span>
-                            [% l(
-                                'OPAC: [_1]',
-                                ctx.user.usrname
-                            ) | html %]
-                        </span><br/>
-                        [% IF ctx.user.billing_address %]
-                        <span>
-                            [% ctx.user.billing_address.street1 | html %]<br/>
-                            [% ctx.user.billing_address.street2 | html %]<br/>
-                            [% ctx.user.billing_address.city | html %],
-                            [% ctx.user.billing_address.state | html %]
-                            [% ctx.user.billing_address.post_code | html %]
-                        </span><br/>
-                        [% END %]
-                    </div>
-                </div><div class="cell">
-                    <div class="textBackground">
-                        <span>
-                            [% l('D: [_1] ', ctx.user.day_phone) | html %]<br/>
-                            [% l('E: [_1] ', ctx.user.evening_phone) | html %]<br/>
-                            [% l('O: [_1] ', ctx.user.other_phone) | html %]<br/>
-                        </span>
-                        [% IF ctx.user.ident_value %]
-                        <span>
-                            [% l(
-                                '[_1]: [_2]',
-                                ctx.user.ident_type.name,
-                                ctx.user.ident_value
-                            ) | html %]
-                        </span><br/>
-                        [% END %]
-                        [% IF ctx.user.ident_value2 %]
-                        <span>
-                            [% l(
-                                '[_1]: [_2]',
-                                ctx.user.ident_type2.name,
-                                ctx.user.ident_value2
-                            ) | html %]
-                        </span><br/>
-                        [% END %]
-                    </div>
-                </div><div class="cell">
-                    <div class="textBackground">
-                        <span>[% ctx.user.profile.name | html %]</span><br/>
-                        <span>[% ctx.user.home_ou.shortname | html %]</span><br/>
-                        <span>
-                            [% l(
-                                'Items Overdue: [_1] Total: [_2]',
-                                ctx.checked_out_count.overdue + ctx.checked_out_count.long_overdue,
-                                ctx.checked_out_count.out
-                            ) | html %]
-                        <span><br/>
-                        <span>
-                            [% l(
-                                'Holds Ready: [_1] Total: [_2]',
-                                ctx.holds_count.ready,
-                                ctx.holds_count.total
-                            ) | html %]
-                        </span><br/>
-                        <span>
-                        [% IF ctx.money_open_user_summary %]
-                            [% l(
-                                'Bills: [_1]',
-                                ctx.money_open_user_summary.balance_owed
-                            ) | html %]
-                        [% ELSE %]
-                            [% l(
-                                'Bills: [_1]',
-                                '0.00'
-                            ) | html %]
-                        [% END %]
-                        </span><br/>
-                    </div>
-                </div></div>
-            </div>
-            [% ELSE %]
-            <div>
-                <span style="font-weight: bold; font-size: xx-large">
-                    Error loading user with database id = [% ctx.au_id | html %]
-                </span><br/>
-                <span style="font-weight: bold;">
-                    Description: [% ctx.error.desc | html %]
-                </span><br/>
-                <span>Server Time: [% ctx.error.servertime | html %]</span><br/>
-                <span>Text Code: [% ctx.error.textcode | html %]</span><br/>
-                <span>ILS Event: [% ctx.error.ilsevent | html %]</span><br/>
-                <span>PID: [% ctx.error.pid | html %]</span><br/>
-                <span>Stack Trace: [% ctx.error.stacktrace | html %]</span><br/>
-            </div>
-            [% END %]
-            <div class="common-full-pad" style="float:none"></div>
-        </div>
-    </div>
-[% END %]
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..04db751be1faa6c9f2d64ea3f6d70857c2dac1f2
--- /dev/null
@@ -0,0 +1 @@
+PatronSummary.tt2
\ No newline at end of file
index ccae83f..36c932c 100644 (file)
                                 ctx.user.suffix
                             ) | html %]
                         </span><br/>
+                        <span class="click_link" onclick="copy_to_clipboard('[% ctx.user.card.barcode | html %]')">
+                            [% l(
+                                'Card: [_1]',
+                                ctx.user.card.barcode
+                            ) | html %]
+                        </span><br/>
                         [% IF ctx.addr %]
                         <span>
                             [% ctx.addr.street1 | html %]<br/>
@@ -40,6 +46,9 @@
                             [% l('Account has EXPIRED') | html %]
                         </span><br/>
                         [% END %]
+                        [% IF NOT ctx.user.email %]
+                            [% l('Confirm the email address') | html %]
+                        [% END %]
                         [% IF ctx.holds_count.ready > 0 %]
                         <span>
                             [% IF ctx.holds_count.ready == 1 %]
                 </div><div class="cell">
                     <div class="textBackground">
                         <span>
-                            [% l('D: [_1] ', ctx.user.day_phone) | html %]<br/>
-                            [% l('E: [_1] ', ctx.user.evening_phone) | html %]<br/>
-                            [% l('O: [_1] ', ctx.user.other_phone) | html %]<br/>
+                            [% IF ctx.user.day_phone %]
+                                [% l('D: [_1] ', ctx.user.day_phone) | html %]<br/>
+                            [% ELSIF ctx.user.evening_phone %]
+                                [% l('E: [_1] ', ctx.user.evening_phone) | html %]<br/>
+                            [% ELSIF ctx.user.other_phone %]
+                                [% l('O: [_1] ', ctx.user.other_phone) | html %]<br/>
+                            [% END %]
                         </span>
                         <span>
+                            [% ctx.user.email OR ' ' | html %]
+                        </span></br>
+                        <span>
                             [% l(
-                                'Card: [_1]',
-                                ctx.user.card.barcode
+                                'OPAC: [_1]',
+                                ctx.user.usrname
                             ) | html %]
                         </span><br/>
                         <span>
                             [% l(
-                                'OPAC: [_1]',
-                                ctx.user.usrname
+                                'DOB: [_1]',
+                                ctx.user.dob
+                                    ? date.format( ctx.parse_datetime(ctx.user.dob), DATE_FORMAT)
+                                    : ''
+                            ) | html %]
+                        </span><br/>
+                        <span>
+                            [% l(
+                                'EXP: [_1]',
+                                ctx.user.expire_date
+                                    ? date.format( ctx.parse_datetime(ctx.user.expire_date), DATE_FORMAT)
+                                    : ''
                             ) | html %]
                         </span><br/>
+
                     </div>
                 </div><div class="cell">
                     <div class="textBackground">
                                 ctx.holds_count.total
                             ) | html %]
                         </span><br/>
-                        <span>
                         [% IF ctx.money_open_user_summary %]
+                        <span class="bills_line">
                             [% l(
                                 'Bills: [_1]',
                                 ctx.money_open_user_summary.balance_owed
                             ) | html %]
                         [% ELSE %]
+                        <span>
                             [% l(
                                 'Bills: [_1]',
                                 '0.00'
index 0ccccdd..b1b46d9 100644 (file)
@@ -33,6 +33,7 @@ body {
     font-weight: bold;
     overflow: auto;
 }
+.click_link { text-decoration: underline; color: blue; -moz-user-focus: normal; cursor: pointer; }
 .patronNameLarge { font-weight: bold; }
 .patronSummaryDiv { border: solid thick transparent; padding: 10px; }
 .NO_PENALTIES .patronSummaryDiv { border-color: lime; }
@@ -40,6 +41,7 @@ body {
 .MULTIPLE_PENALTIES .patronSummaryDiv { border-color: #FF6633; }
 .PATRON_HAS_STAFF_ALERT .patronSummaryDiv { border-color: blue; }
 .PATRON_HAS_BILLS .patronSummaryDiv { border-color: #FFC266; }
+.PATRON_HAS_BILLS .bills_line { font-weight: bold; color: red; }
 .PATRON_HAS_OVERDUES .patronSummaryDiv { border-color: #FFC266; }
 .PATRON_EXCEEDS_CHECKOUT_COUNT .patronSummaryDiv { border-color: #C99DFF; }
 .PATRON_EXCEEDS_OVERDUE_COUNT .patronSummaryDiv { border-color: #C99DFF; }
index ed68480..529aff8 100644 (file)
@@ -38,6 +38,7 @@
         </script>
         [% END %]
     [% END %]
+    [% INCLUDE "opac/parts/xuljs.tt2" IF ctx.page == 'patron_summary' %]
 [%- END %]
 
 [%- IF ENV.OILS_NOVELIST_URL AND ctx.page == 'record';
diff --git a/Open-ILS/src/templates/opac/parts/xuljs.tt2 b/Open-ILS/src/templates/opac/parts/xuljs.tt2
new file mode 100644 (file)
index 0000000..a1baf1a
--- /dev/null
@@ -0,0 +1,16 @@
+
+<script type="text/javascript">
+
+    function copy_to_clipboard(text) {
+        try {
+            const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
+                .getService(Components.interfaces.nsIClipboardHelper);
+            gClipboardHelper.copyString(text);
+            // FIXME: I18N, and consistency with other staff client clipboard/alert behavior
+            alert('Copied ' + text + ' to clipboard');
+        } catch(E) {
+            alert('Error copying ' + text + ' to clipboard: ' + E);
+        }
+    }
+
+</script>