From 3959d1ad348f4ee51e616fe58cb1dcb5ca11568b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 8 Apr 2021 11:19:08 -0400 Subject: [PATCH] LP1904036 Printing patron data Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../staff/admin/server/print-template.component.ts | 9 +++ .../src/app/staff/circ/patron/edit.component.ts | 8 ++- .../sql/Pg/upgrade/XXXX.data.angular-patron.sql | 64 ++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts index e6542abaf9..5e1361b080 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts @@ -110,6 +110,15 @@ export class PrintTemplateComponent implements OnInit { address: samples.aua[0] }; + const patron = this.idl.clone(samples.au[0]); + patron.addresses = [samples.aua[0]]; + patron.stat_cat_entries = [{ + stat_cat: {name: 'A Stat Cat'}, + stat_cat_entry: 'A Value' + }]; + + this.sampleData.patron_data = {patron: patron}; + this.sampleData.holds_for_bib = wide_holds; // Bills diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts index 5df2571156..100735a1ea 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts @@ -24,6 +24,7 @@ import {PatronSearchFieldSet} from '@eg/staff/share/patron/search.component'; import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; import {HoldNotifyUpdateDialogComponent} from './hold-notify-update.component'; import {BroadcastService} from '@eg/share/util/broadcast.service'; +import {PrintService} from '@eg/share/print/print.service'; const PATRON_FLESH_FIELDS = [ 'cards', @@ -221,6 +222,7 @@ export class EditComponent implements OnInit, AfterViewInit { private serverStore: ServerStoreService, private broadcaster: BroadcastService, private patronService: PatronService, + private printer: PrintService, public context: PatronContextService ) {} @@ -1516,7 +1518,11 @@ export class EditComponent implements OnInit, AfterViewInit { } printPatron() { - // TODO + this.printer.print({ + templateName: 'patron_data', + contextData: {patron: this.patron}, + printContext: 'default' + }); } replaceBarcode() { diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql index 85a9389200..60e0512f2f 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql @@ -219,6 +219,70 @@ UPDATE config.print_template SET template = $TEMPLATE$ $TEMPLATE$ WHERE name = 'bills_payment'; + +INSERT INTO config.print_template + (name, label, owner, active, locale, content_type, template) +VALUES ('patron_data', 'Patron Data', 1, TRUE, 'en-US', 'text/html', ''); + +UPDATE config.print_template SET template = $TEMPLATE$ +[% + USE date; + USE money = format('$%.2f'); + SET patron = template_data.patron; +%] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% FOR addr IN patron.addresses %] + + + + + + + + + + + + [% END %] + + [% FOR entry IN patron.stat_cat_entries %] + + + [% END %] + +
Barcode:[% patron.card.barcode %]
Patron's Username:[% patron.usrname %]
Prefix/Title:[% patron.prefix %]
First Name:[% patron.first_given_name %]
Middle Name:[% patron.second_given_name %]
Last Name:[% patron.family_name %]
Suffix:[% patron.suffix %]
Holds Alias:[% patron.alias %]
Date of Birth:[% patron.dob %]
Juvenile:[% patron.juvenile %]
Primary Identification Type:[% patron.ident_type.name %]
Primary Identification:[% patron.ident_value %]
Secondary Identification Type:[% patron.ident_type2.name %]
Secondary Identification:[% patron.ident_value2 %]
Email Address:[% patron.email %]
Daytime Phone:[% patron.day_phone %]
Evening Phone:[% patron.evening_phone %]
Other Phone:[% patron.other_phone %]
Home Library:[% patron.home_ou.name %]
Main (Profile) Permission Group:[% patron.profile.name %]
Privilege Expiration Date:[% patron.expire_date %]
Internet Access Level:[% patron.net_access_level.name %]
Active:[% patron.active %]
Barred:[% patron.barred %]
Is Group Lead Account:[% patron.master_account %]
Claims-Returned Count:[% patron.claims_returned_count %]
Claims-Never-Checked-Out Count:[% patron.claims_never_checked_out_count %]
Alert Message:[% patron.alert_message %]
----------
Type:[% addr.address_type %]
Street (1):[% addr.street1 %]
Street (2):[% addr.street2 %]
City:[% addr.city %]
County:[% addr.county %]
State:[% addr.state %]
Postal Code:[% addr.post_code %]
Country:[% addr.country %]
Valid Address?:[% addr.valid %]
Within City Limits?:[% addr.within_city_limits %]
-----------
[% entry.stat_cat.name %][% entry.stat_cat_entry %]
+ +$TEMPLATE$ WHERE name = 'patron_data'; + COMMIT; -- 2.11.0