From 35d323ae7272fbcad315c2e194d045eb62e57717 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Fri, 9 May 2014 11:45:29 +0200 Subject: [PATCH] Bug 3050 - Add an option to upload scanned invoices #2/3 (part #2: changes to existing acqui scripts & templates) Signed-off-by: Paola Rossi Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- acqui/invoice.pl | 11 ++++++ .../prog/en/modules/acqui/invoice.tt | 38 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/acqui/invoice.pl b/acqui/invoice.pl index 18e94d99ec..66089478d8 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -35,6 +35,7 @@ use C4::Output; use C4::Acquisition; use C4::Bookseller qw/GetBookSellerFromId/; use C4::Budgets; +use Koha::Misc::Files; my $input = new CGI; my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( @@ -51,6 +52,12 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( my $invoiceid = $input->param('invoiceid'); my $op = $input->param('op'); +my $invoice_files; +if ( C4::Context->preference('AcqEnableFiles') ) { + $invoice_files = Koha::Misc::Files->new( + tabletag => 'aqinvoices', recordid => $invoiceid ); +} + if ( $op && $op eq 'close' ) { CloseInvoice($invoiceid); my $referer = $input->param('referer'); @@ -86,11 +93,13 @@ elsif ( $op && $op eq 'mod' ) { } elsif ($input->param('merge')) { my @sources = $input->param('merge'); MergeInvoices($invoiceid, \@sources); + defined($invoice_files) && $invoice_files->MergeFileRecIds(@sources); } $template->param( modified => 1 ); } elsif ( $op && $op eq 'delete' ) { DelInvoice($invoiceid); + defined($invoice_files) && $invoice_files->DelAllFiles(); my $referer = $input->param('referer') || 'invoices.pl'; if ($referer) { print $input->redirect($referer); @@ -166,6 +175,8 @@ $template->param( budgets_loop => \@budgets_loop, ); +defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() ); + # FIXME # Fonction dupplicated from basket.pl # Code must to be exported. Where ?? diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index 35bc2daf3e..911ff81b62 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] @@ -27,7 +28,17 @@ bFilter: false, sDom: "t" })); - +[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %] + $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ 3 ], "sType": "natural" } + ], + bInfo: false, + bPaginate: false, + bFilter: false, + sDom: "t" + })); +[% END %] $("#show_all_details").click(function(){ updateColumnsVisibility($(this+":checked").val()); }); @@ -108,6 +119,7 @@

Go to receipt page + [% IF Koha.Preference('AcqEnableFiles') %]| Manage invoice files[% END %]

Invoice details

[% IF orders_loop.size %] @@ -199,6 +211,30 @@ [% ELSE %]

No orders yet

[% END %] + [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %] +
+

Files attached to invoice

+ + + + + + + + + + + [% FOREACH f IN files %] + + + + + + + [% END %] + +
NameTypeDescriptionUploaded
[% f.file_name | html %][% f.file_type | html %][% f.file_description | html %][% f.date_uploaded | $KohaDates %]
+ [% END %]
-- 2.39.5