View | Details | Raw Unified | Return to bug 3050
Collapse All | Expand All

(-)a/acqui/invoice.pl (+11 lines)
Lines 35-40 use C4::Output; Link Here
35
use C4::Acquisition;
35
use C4::Acquisition;
36
use C4::Bookseller qw/GetBookSellerFromId/;
36
use C4::Bookseller qw/GetBookSellerFromId/;
37
use C4::Budgets;
37
use C4::Budgets;
38
use Koha::Misc::Files;
38
39
39
my $input = new CGI;
40
my $input = new CGI;
40
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
Lines 51-56 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
51
my $invoiceid = $input->param('invoiceid');
52
my $invoiceid = $input->param('invoiceid');
52
my $op        = $input->param('op');
53
my $op        = $input->param('op');
53
54
55
my $invoice_files;
56
if ( C4::Context->preference('AcqEnableFiles') ) {
57
    $invoice_files = Koha::Misc::Files->new(
58
        tabletag => 'aqinvoices', recordid => $invoiceid );
59
}
60
54
if ( $op && $op eq 'close' ) {
61
if ( $op && $op eq 'close' ) {
55
    CloseInvoice($invoiceid);
62
    CloseInvoice($invoiceid);
56
    my $referer = $input->param('referer');
63
    my $referer = $input->param('referer');
Lines 86-96 elsif ( $op && $op eq 'mod' ) { Link Here
86
    } elsif ($input->param('merge')) {
93
    } elsif ($input->param('merge')) {
87
        my @sources = $input->param('merge');
94
        my @sources = $input->param('merge');
88
        MergeInvoices($invoiceid, \@sources);
95
        MergeInvoices($invoiceid, \@sources);
96
        defined($invoice_files) && $invoice_files->MergeFileRecIds(@sources);
89
    }
97
    }
90
    $template->param( modified => 1 );
98
    $template->param( modified => 1 );
91
}
99
}
92
elsif ( $op && $op eq 'delete' ) {
100
elsif ( $op && $op eq 'delete' ) {
93
    DelInvoice($invoiceid);
101
    DelInvoice($invoiceid);
102
    defined($invoice_files) && $invoice_files->DelAllFiles();
94
    my $referer = $input->param('referer') || 'invoices.pl';
103
    my $referer = $input->param('referer') || 'invoices.pl';
95
    if ($referer) {
104
    if ($referer) {
96
        print $input->redirect($referer);
105
        print $input->redirect($referer);
Lines 166-171 $template->param( Link Here
166
    budgets_loop     => \@budgets_loop,
175
    budgets_loop     => \@budgets_loop,
167
);
176
);
168
177
178
defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() );
179
169
# FIXME
180
# FIXME
170
# Fonction dupplicated from basket.pl
181
# Fonction dupplicated from basket.pl
171
# Code must to be exported. Where ??
182
# Code must to be exported. Where ??
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-2 / +37 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
2
3
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
Lines 27-33 Link Here
27
            bFilter: false,
28
            bFilter: false,
28
            sDom: "t"
29
            sDom: "t"
29
        }));
30
        }));
30
31
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
32
        $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
33
            "aoColumnDefs": [
34
                { "aTargets": [ 3 ], "sType": "natural" }
35
            ],
36
            bInfo: false,
37
            bPaginate: false,
38
            bFilter: false,
39
            sDom: "t"
40
        }));
41
[% END %]
31
        $("#show_all_details").click(function(){
42
        $("#show_all_details").click(function(){
32
            updateColumnsVisibility($(this+":checked").val());
43
            updateColumnsVisibility($(this+":checked").val());
33
        });
44
        });
Lines 108-113 Link Here
108
      </form>
119
      </form>
109
      <p>
120
      <p>
110
          <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
121
          <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
122
          [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]">Manage invoice files</a>[% END %]
111
      </p>
123
      </p>
112
      <h2>Invoice details</h2>
124
      <h2>Invoice details</h2>
113
      [% IF orders_loop.size %]
125
      [% IF orders_loop.size %]
Lines 199-204 Link Here
199
        [% ELSE %]
211
        [% ELSE %]
200
            <div class="dialog message"><p>No orders yet</p></div>
212
            <div class="dialog message"><p>No orders yet</p></div>
201
        [% END %]
213
        [% END %]
214
        [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
215
            <br />
216
            <h2>Files attached to invoice</h2>
217
            <table id="invoice_files_table">
218
                <thead>
219
                    <tr>
220
                        <th>Name</th>
221
                        <th>Type</th>
222
                        <th>Description</th>
223
                        <th>Uploaded</th>
224
                    </tr>
225
                </thead>
226
                <tbody>
227
                [% FOREACH f IN files %]
228
                    <tr>
229
                         <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
230
                         <td>[% f.file_type | html %]</td>
231
                         <td>[% f.file_description | html %]</td>
232
                         <td><!-- [% f.date_uploaded %] -->[% f.date_uploaded | $KohaDates %]</td>
233
                    </tr>
234
                [% END %]
235
                </tbody>
236
            </table>
237
        [% END %]
202
    </div>
238
    </div>
203
  </div>
239
  </div>
204
  <div class="yui-b">
240
  <div class="yui-b">
205
- 

Return to bug 3050