Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [%- USE date;
- user = target.0.usr;
- fcirc = [];
- fdata = [];
- rcirc = [];
- rdata = [];
- FOR circ IN target;
- ddate = date.format(helpers.format_date(circ.due_date), '%s');
- IF '00:59' == date.format(ddate, '%H:%M');
- ddate = ddate - 3600;
- circ.due_date = date.format(ddate, '%Y-%m-%dT%H:%M:%S-0400');
- END;
- SET idx = loop.count - 1;
- SET udata = user_data.$idx;
- IF udata.is_renewed;
- rcirc.push(circ);
- rdata.push(udata);
- ELSE;
- fcirc.push(circ);
- fdata.push(udata);
- END;
- END;
- -%]
- To: [% params.recipient_email || user.email %]
- From: noreply@evergreen.lib.in.us
- Date: [% date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
- Subject: [% IF fcirc.size > 0 %]Some Items Were Not Auto-Renewed[% ELSE %]Auto-Renewal Notification[% END %]
- Auto-Submitted: auto-generated
- Dear [% user.pref_first_given_name || user.first_given_name %],
- [% IF fcirc.size > 0 %]
- The following items could NOT be renewed and remain due on the original date:
- [% FOR circ IN fcirc;
- SET idx = loop.count - 1;
- SET udata = fdata.$idx;
- SET cid = circ.target_copy.id || udata.copy;
- SET copy_details = helpers.get_copy_bib_basics(cid);
- -%]
- [%- msg = BLOCK -%][%- udata.reason | remove('^.*: *') -%][%- END -%]
- [% loop.count %]. [% copy_details.title %][% IF copy_details.author %] by [% copy_details.author %][% END %]
- Call number: [% circ.target_copy.call_number.label %]
- Barcode: [% circ.target_copy.barcode %]
- Could not be renewed because: [% IF msg == "" %][% udata.reason | remove(' *: *') %][% ELSE %][% msg %][% END %]
- Due: [% date.format(helpers.format_date(circ.due_date), '%A, %b %d, %Y') %]
- [% END %]
- [%- END %]
- [% IF rcirc.size > 0 %]The following items have been renewed automatically:
- [% FOR circ IN rcirc;
- SET idx = loop.count - 1;
- SET udata = rdata.$idx;
- NEXT UNLESS udata.is_renewed;
- SET cid = circ.target_copy.id || udata.copy;
- SET copy_details = helpers.get_copy_bib_basics(cid) -%]
- [% loop.count %]. [% copy_details.title %][% IF copy_details.author %] by [% copy_details.author %][% END %]
- Call number: [% circ.target_copy.call_number.label %]
- Barcode: [% circ.target_copy.barcode %]
- Due: [% date.format(helpers.format_date(udata.new_due_date), '%A, %b %d, %Y') %]
- [% END %]
- [%- END %]
Add Comment
Please, Sign In to add comment