$path =~ m:opac/(advanced|numeric|expert):;
return $self->load_rresults if $path =~ m|opac/results|;
- return $self->load_record if $path =~ m|opac/record|;
+ return $self->load_print_record if $path =~ m|opac/record/print|;
+ return $self->load_record if $path =~ m|opac/record/\d|;
return $self->load_cnbrowse if $path =~ m|opac/cnbrowse|;
return $self->load_mylist_add if $path =~ m|opac/mylist/add|;
# ----------------------------------------------------------------
return $self->redirect_auth unless $self->editor->requestor;
+ return $self->load_email_record if $path =~ m|opac/record/email|;
+
return $self->load_place_hold if $path =~ m|opac/place_hold|;
return $self->load_myopac_holds if $path =~ m|opac/myopac/holds|;
return $self->load_myopac_circs if $path =~ m|opac/myopac/circs|;
$search->kill_me;
}
+sub load_print_record {
+ my $self = shift;
+
+ my $rec_id = $self->ctx->{page_args}->[0]
+ or return Apache2::Const::HTTP_BAD_REQUEST;
+
+ $self->{ctx}->{bre_id} = $rec_id;
+ $self->{ctx}->{printable_record} = $U->simplereq(
+ 'open-ils.search',
+ 'open-ils.search.biblio.record.print', $rec_id);
+
+ return Apache2::Const::OK;
+}
+
+sub load_email_record {
+ my $self = shift;
+
+ my $rec_id = $self->ctx->{page_args}->[0]
+ or return Apache2::Const::HTTP_BAD_REQUEST;
+
+ $self->{ctx}->{bre_id} = $rec_id;
+ $U->simplereq(
+ 'open-ils.search',
+ 'open-ils.search.biblio.record.email',
+ $self->ctx->{authtoken}, $rec_id);
+
+ return Apache2::Const::OK;
+}
+
1;
cleanup_failure,
group_field,
granularity,
+ delay,
template
) VALUES (
31,
'DeleteTempBiblioBucket',
'owner',
NULL,
+ '00:00:00'
$$
-[%- USE date -%]
[%- SET user = target.0.owner -%]
To: [%- params.recipient_email || user.email %]
From: [%- params.sender_email || default_sender %]
Subject: Bibliographic Records
- [% FOR cbreb IN target %]
- [% FOR cbrebi IN cbreb.items %]
- Bib ID# [% cbrebi.target_biblio_record_entry.id %] ISBN: [% crebi.target_biblio_record_entry.simple_record.isbn %]
- Title: [% cbrebi.target_biblio_record_entry.simple_record.title %]
- Author: [% cbrebi.target_biblio_record_entry.simple_record.author %]
- Publication Year: [% cbrebi.target_biblio_record_entry.simple_record.pubdate %]
+[% FOR cbreb IN target %]
+[% FOR item IN cbreb.items;
+ bre_id = item.target_biblio_record_entry;
- [% END %]
- [% END %]
+ bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+ FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+ title = title _ part.textContent;
+ END;
+
+ author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+ item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+ publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+ pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+ isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+ issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+ upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+%]
+
+[% loop.count %]/[% loop.size %]. Bib ID# [% bre_id %]
+[% IF isbn %]ISBN: [% isbn _ "\n" %][% END -%]
+[% IF issn %]ISSN: [% issn _ "\n" %][% END -%]
+[% IF upc %]UPC: [% upc _ "\n" %] [% END -%]
+Title: [% title %]
+Author: [% author %]
+Publication Info: [% publisher %] [% pubdate %]
+Item Type: [% item_type %]
+
+[% END %]
+[% END %]
$$
)
,(
'DeleteTempBiblioBucket',
'owner',
'print-on-demand',
+ NULL,
$$
-[%- USE date -%]
<div>
<style> li { padding: 8px; margin 5px; }</style>
<ol>
[% FOR cbreb IN target %]
- [% FOR cbrebi IN cbreb.items %]
- <li>Bib ID# [% cbrebi.target_biblio_record_entry.id %] ISBN: [% crebi.target_biblio_record_entry.simple_record.isbn %]<br />
- Title: [% cbrebi.target_biblio_record_entry.simple_record.title %]<br />
- Author: [% cbrebi.target_biblio_record_entry.simple_record.author %]<br />
- Publication Year: [% cbrebi.target_biblio_record_entry.simple_record.pubdate %]
+ [% FOR item IN cbreb.items;
+ bre_id = item.target_biblio_record_entry;
+
+ bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+ FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+ title = title _ part.textContent;
+ END;
+
+ author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+ item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+ publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+ pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+ isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+ %]
+
+ <li>
+ Bib ID# [% bre_id %] ISBN: [% isbn %]<br />
+ Title: [% title %]<br />
+ Author: [% author %]<br />
+ Publication Info: [% publisher %] [% pubdate %]<br/>
+ Item Type: [% item_type %]
</li>
[% END %]
[% END %]
) VALUES -- for fleshing cbreb objects
( 31, 'owner' )
,( 31, 'items' )
- ,( 31, 'items.target_biblio_record_entry' )
- ,( 31, 'items.target_biblio_record_entry.simple_record' )
- ,( 31, 'items.target_biblio_record_entry.call_numbers' )
- ,( 31, 'items.target_biblio_record_entry.fixed_fields' )
- ,( 31, 'items.target_biblio_record_entry.notes' )
- ,( 31, 'items.target_biblio_record_entry.full_record_entries' )
- ,( 32, 'owner' )
,( 32, 'items' )
- ,( 32, 'items.target_biblio_record_entry' )
- ,( 32, 'items.target_biblio_record_entry.simple_record' )
- ,( 32, 'items.target_biblio_record_entry.call_numbers' )
- ,( 32, 'items.target_biblio_record_entry.fixed_fields' )
- ,( 32, 'items.target_biblio_record_entry.notes' )
- ,( 32, 'items.target_biblio_record_entry.full_record_entries' )
;
INSERT INTO acq.invoice_item_type (code,name) VALUES ('TAX',oils_i18n_gettext('TAX', 'Tax', 'aiit', 'name'));
--- /dev/null
+
+
+UPDATE action_trigger.event_definition SET template = $$
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <ol>
+ [% FOR cbreb IN target %]
+ [% FOR item IN cbreb.items;
+ bre_id = item.target_biblio_record_entry;
+
+ bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+ FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+ title = title _ part.textContent;
+ END;
+
+ author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+ item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+ publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+ pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+ isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+ issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+ upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+ %]
+
+ <li>
+ Bib ID# [% bre_id %]<br/>
+ [% IF isbn %]ISBN: [% isbn %]<br/>[% END %]
+ [% IF issn %]ISSN: [% issn %]<br/>[% END %]
+ [% IF upc %]UPC: [% upc %]<br/>[% END %]
+ Title: [% title %]<br />
+ Author: [% author %]<br />
+ Publication Info: [% publisher %] [% pubdate %]<br/>
+ Item Type: [% item_type %]
+ </li>
+ [% END %]
+ [% END %]
+ </ol>
+</div>
+$$
+WHERE hook = 'biblio.format.record_entry.print' AND id < 100; -- sample data
+
+
+UPDATE action_trigger.event_definition SET delay = '00:00:00', template = $$
+[%- SET user = target.0.owner -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Bibliographic Records
+
+[% FOR cbreb IN target %]
+[% FOR item IN cbreb.items;
+ bre_id = item.target_biblio_record_entry;
+
+ bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+ FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+ title = title _ part.textContent;
+ END;
+
+ author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+ item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+ publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+ pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+ isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+ issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+ upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+%]
+
+[% loop.count %]/[% loop.size %]. Bib ID# [% bre_id %]
+[% IF isbn %]ISBN: [% isbn _ "\n" %][% END -%]
+[% IF issn %]ISSN: [% issn _ "\n" %][% END -%]
+[% IF upc %]UPC: [% upc _ "\n" %] [% END -%]
+Title: [% title %]
+Author: [% author %]
+Publication Info: [% publisher %] [% pubdate %]
+Item Type: [% item_type %]
+
+[% END %]
+[% END %]
+$$
+WHERE hook = 'biblio.format.record_entry.email' AND id < 100; -- sample data
+
+-- remove a swath of unused environment entries
+
+DELETE FROM action_trigger.environment env
+ USING action_trigger.event_definition def
+ WHERE env.event_def = def.id AND
+ env.path != 'items' AND
+ def.hook = 'biblio.format.record_entry.print' AND
+ def.id < 100; -- sample data
+
+DELETE FROM action_trigger.environment env
+ USING action_trigger.event_definition def
+ WHERE env.event_def = def.id AND
+ env.path != 'items' AND
+ env.path != 'owner' AND
+ def.hook = 'biblio.format.record_entry.email' AND
+ def.id < 100; -- sample data
+
+
<hr />
-[%- # This holds the record summary information %]
+[%-# This holds the record summary information %]
<div id="rdetail_summary_header">
<div id="rdetail_image_div">
[% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
[% label %]
</a>
</div>
+ <div class="rdetail_aux_utils">
+ <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
+ <a href="[% mkurl(ctx.opac_root _ '/record/print/' _ ctx.bre_id) %]" class="no-dec">[% l('Print') %]</a> /
+ <a href="[% mkurl(ctx.opac_root _ '/record/email/' _ ctx.bre_id) %]" class="no-dec">[% l('Email') %]</a>
+ </div>
</div>
<div id='rdetail_title_div'>
[%- IF attrs.format_icon %]
--- /dev/null
+[% PROCESS "opac/parts/header.tt2";
+ PROCESS "opac/parts/config.tt2";
+ WRAPPER "opac/parts/base.tt2";
+ INCLUDE "opac/parts/topnav.tt2";
+ ctx.page_title = l("Record Detail") %]
+ <div id="search-wrapper">
+ [% INCLUDE "opac/parts/searchbar.tt2" %]
+ </div>
+ <br class="clear-both" />
+ <div id="content-wrapper" class="content-wrapper-record-page">
+ <div id='main-content'>
+ <br/>
+ <h2 class='success'>[% l('Your email has been queued for Delivery.') %]</h2>
+ <br/>
+ <p>[ <a href="[% mkurl(ctx.opac_root _ '/record/' _ ctx.bre_id) %]">[% l("Back to Record") %]</a> ]</p>
+ <div class="common-full-pad"></div>
+ </div>
+ <br class="clear-both" />
+ </div>
+[% END %]
+
--- /dev/null
+[% PROCESS 'opac/parts/header.tt2' %]
+<html>
+ <head>
+ <title>[% l('Print Record') %]</title>
+ <style type="text/css" media="print">.noprint {display: none}</style>
+ </head>
+ <body onload="if (document.getElementById('printable-record')) window.print();">
+ [% IF ctx.printable_record.template_output %]
+ <tt id="printable-record">
+ [% ctx.printable_record.template_output.data %]
+ </tt>
+ [% ELSE %]
+ <div class="noprint print-error">
+ [% l(
+ 'Error printing record: [_1]',
+ (ctx.printable_record.textcode ? ctx.printable_record.textcode _ ' / ' _ ctx.printable_record.desc : 0) ||
+ ctx.printable_record.error_output.data ||
+ l('No record data returned from server')
+ ) | html %]
+ </div>
+ [% END %]
+ <div class='noprint'>
+ <hr />
+ <p>[ <a href="[% mkurl(ctx.opac_root _ '/record/' _ ctx.bre_id) %]">[% l("Back to Record") %]</a> ]</p>
+ </div>
+ </body>
+</html>