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(
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');
} 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);
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 ??
+[% USE Koha %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
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());
});
</form>
<p>
<a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
+ [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]">Manage invoice files</a>[% END %]
</p>
<h2>Invoice details</h2>
[% IF orders_loop.size %]
[% ELSE %]
<div class="dialog message"><p>No orders yet</p></div>
[% END %]
+ [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
+ <br />
+ <h2>Files attached to invoice</h2>
+ <table id="invoice_files_table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Description</th>
+ <th>Uploaded</th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH f IN files %]
+ <tr>
+ <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]&op=download&view=1&file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
+ <td>[% f.file_type | html %]</td>
+ <td>[% f.file_description | html %]</td>
+ <td><!-- [% f.date_uploaded %] -->[% f.date_uploaded | $KohaDates %]</td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ [% END %]
</div>
</div>
<div class="yui-b">