Bugzilla – Attachment 71106 Details for
Bug 20119
Ability to print claims for late orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20119 - Ability to print claims for late orders
Bug-20119---Ability-to-print-claims-for-late-order.patch (text/plain), 4.26 KB, created by
Alex Arnaud
on 2018-02-01 10:40:34 UTC
(
hide
)
Description:
Bug 20119 - Ability to print claims for late orders
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-02-01 10:40:34 UTC
Size:
4.26 KB
patch
obsolete
>From 0b52094b57b40e61bfd24ac7aad2bd4dc2340257 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 25 Jan 2018 10:14:03 +0000 >Subject: [PATCH] Bug 20119 - Ability to print claims for late orders > >--- > C4/Letters.pm | 66 ++++++++++++++++++++++ > acqui/lateorders.pl | 12 ++++ > .../prog/en/modules/acqui/lateorders.tt | 12 ++++ > 3 files changed, 90 insertions(+) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 42893f1..efa74ac 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -659,6 +659,72 @@ sub SendAlerts { > return 1; > } > >+=head2 PrintClaimOrderNotice >+ >+Returns a 'claimorders' notice for given order ids and letter code as PDF >+ >+ my $pdf = PrintClaimOrderNotice(\@orderids, $letter_code); >+ >+ print $cgi->header('application/pdf'); >+ print $pdf; >+ >+=cut >+ >+sub PrintClaimOrderNotice { >+ my ($orderids, $letter_code) = @_; >+ >+ return unless ref $orderids eq 'ARRAY'; >+ return unless @$orderids > 0; >+ return unless $letter_code; >+ >+ my $dbh = C4::Context->dbh; >+ >+ my $orderids_str = join(',', ('?') x @$orderids); >+ my $orders = $dbh->selectall_arrayref(qq{ >+ SELECT aqorders.*, aqbasket.*, biblio.* >+ FROM aqorders >+ LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber >+ LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno >+ WHERE aqorders.ordernumber IN ($orderids_str) >+ }, {Slice => {}}, @$orderids); >+ >+ return unless @$orders; >+ >+ my $booksellerid = $orders->[0]->{aqbooksellerid}; >+ >+ my $schema = Koha::Database->new->schema; >+ my $bookseller = >+ $schema->resultset('Aqbookseller')->find( { id => $booksellerid }, >+ { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ); >+ >+ my $userenv = C4::Context->userenv; >+ my $letter = GetPreparedLetter( >+ module => 'claimacquisition', >+ letter_code => $letter_code, >+ branchcode => $userenv->{branch}, >+ message_transport_type => 'print', >+ tables => { >+ 'branches' => $userenv->{branch}, >+ 'aqbooksellers' => $bookseller, >+ }, >+ want_librarian => 1, >+ repeat => $orders, >+ ) or return; >+ >+ my $content = $letter->{content}; >+ if ($letter->{is_html}) { >+ $content = _wrap_html($content, $letter->{title}); >+ } >+ >+ my $output = ''; >+ my $pdf = PDF::FromHTML->new(encoding => 'utf-8'); >+ $pdf->load_file(\$content); >+ $pdf->convert(); >+ $pdf->write_file(\$output); >+ >+ return $output; >+} >+ > =head2 GetPreparedLetter( %params ) > > %params hash: >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index 9febcf6..77bd139 100755 >--- a/acqui/lateorders.pl >+++ b/acqui/lateorders.pl >@@ -122,6 +122,18 @@ if ($op and $op eq "send_alert"){ > } > } > >+if ($op and $op eq "print_alert") { >+ my @orderids = $input->multi_param('ordernumber'); >+ >+ my $pdf = C4::Letters::PrintClaimOrderNotice(\@orderids, 'ACQCLAIM'); >+ print $input->header( >+ -type => 'application/pdf', >+ -attachment => 'claims.pdf', >+ ); >+ print $pdf; >+ exit; >+} >+ > my @parameters = ( $delay ); > push @parameters, $estimateddeliverydatefrom_dt > ? $estimateddeliverydatefrom_dt->ymd() >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >index 2363765..0581182 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -64,6 +64,17 @@ $(document).ready(function() { > location.href = url; > return false; > }); >+ >+ $('#print-claim').on('click', function(e) { >+ e.preventDefault(); >+ var form = $(this).parents('form') >+ var op = form.find('input[name="op"]'); >+ >+ op.val('print_alert'); >+ form.submit(); >+ op.val('send_alert'); >+ }); >+ > }); > //]]> > </script> >@@ -208,6 +219,7 @@ $(document).ready(function() { > <input type="button" value="Export as CSV" id="ExportSelected" /> > [% UNLESS lateorder.budget_lock %] > <input type="submit" value="Claim order" /> >+ <input type="button" value="Print claim" id="print-claim" /> > [% END %] > </p> > </form> >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20119
:
71106
|
71107
|
71150
|
71151
|
72928
|
72929
|
72944
|
72945
|
125823
|
125824
|
125825