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

(-)a/acqui/invoices.pl (-50 / +37 lines)
Lines 33-43 use CGI; Link Here
33
use C4::Auth;
33
use C4::Auth;
34
use C4::Output;
34
use C4::Output;
35
35
36
use C4::Acquisition;
36
use C4::Acquisition qw/GetInvoices/;
37
use C4::Bookseller qw/GetBookSeller/;
37
use C4::Bookseller qw/GetBookSeller/;
38
use C4::Branch;
38
use C4::Branch qw/GetBranches/;
39
39
40
my $input = new CGI;
40
my $input = CGI->new;
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
42
    {
42
    {
43
        template_name   => 'acqui/invoices.tmpl',
43
        template_name   => 'acqui/invoices.tmpl',
Lines 63-75 my $publicationyear = $input->param('publicationyear'); Link Here
63
my $branch           = $input->param('branch');
63
my $branch           = $input->param('branch');
64
my $op               = $input->param('op');
64
my $op               = $input->param('op');
65
65
66
my @results_loop = ();
66
my $invoices = [];
67
if ( $op and $op eq "do_search" ) {
67
if ( $op and $op eq 'do_search' ) {
68
    my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output("iso");
68
    my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output('iso');
69
    my $shipmentdateto_iso   = C4::Dates->new($shipmentdateto)->output("iso");
69
    my $shipmentdateto_iso   = C4::Dates->new($shipmentdateto)->output('iso');
70
    my $billingdatefrom_iso  = C4::Dates->new($billingdatefrom)->output("iso");
70
    my $billingdatefrom_iso  = C4::Dates->new($billingdatefrom)->output('iso');
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output("iso");
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output('iso');
72
    my @invoices             = GetInvoices(
72
    @{$invoices} = GetInvoices(
73
        invoicenumber    => $invoicenumber,
73
        invoicenumber    => $invoicenumber,
74
        suppliername     => $supplier,
74
        suppliername     => $supplier,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
Lines 83-106 if ( $op and $op eq "do_search" ) { Link Here
83
        publicationyear  => $publicationyear,
83
        publicationyear  => $publicationyear,
84
        branchcode       => $branch
84
        branchcode       => $branch
85
    );
85
    );
86
    foreach (@invoices) {
87
        my %row = (
88
            invoiceid       => $_->{invoiceid},
89
            billingdate     => $_->{billingdate},
90
            invoicenumber   => $_->{invoicenumber},
91
            suppliername    => $_->{suppliername},
92
            receivedbiblios => $_->{receivedbiblios},
93
            receiveditems   => $_->{receiveditems},
94
            subscriptionid  => $_->{subscriptionid},
95
            closedate       => $_->{closedate},
96
        );
97
        push @results_loop, \%row;
98
    }
99
}
86
}
100
87
101
# Build suppliers list
88
# Build suppliers list
102
my @suppliers      = GetBookSeller(undef);
89
my @suppliers      = GetBookSeller(undef);
103
my @suppliers_loop = ();
90
my $suppliers_loop = [];
104
my $suppliername;
91
my $suppliername;
105
foreach (@suppliers) {
92
foreach (@suppliers) {
106
    my $selected = 0;
93
    my $selected = 0;
Lines 108-124 foreach (@suppliers) { Link Here
108
        $selected     = 1;
95
        $selected     = 1;
109
        $suppliername = $_->{'name'};
96
        $suppliername = $_->{'name'};
110
    }
97
    }
111
    my %row = (
98
    push @{$suppliers_loop},
112
        suppliername => $_->{'name'},
99
      {
113
        supplierid   => $_->{'id'},
100
        suppliername => $_->{name},
101
        supplierid   => $_->{id},
114
        selected     => $selected,
102
        selected     => $selected,
115
    );
103
      };
116
    push @suppliers_loop, \%row;
117
}
104
}
118
105
119
# Build branches list
106
# Build branches list
120
my $branches      = GetBranches();
107
my $branches      = GetBranches();
121
my @branches_loop = ();
108
my $branches_loop = [];
122
my $branchname;
109
my $branchname;
123
foreach ( sort keys %$branches ) {
110
foreach ( sort keys %$branches ) {
124
    my $selected = 0;
111
    my $selected = 0;
Lines 126-156 foreach ( sort keys %$branches ) { Link Here
126
        $selected   = 1;
113
        $selected   = 1;
127
        $branchname = $branches->{$_}->{'branchname'};
114
        $branchname = $branches->{$_}->{'branchname'};
128
    }
115
    }
129
    my %row = (
116
    push @{$branches_loop},
117
      {
130
        branchcode => $_,
118
        branchcode => $_,
131
        branchname => $branches->{$_}->{'branchname'},
119
        branchname => $branches->{$_}->{branchname},
132
        selected   => $selected,
120
        selected   => $selected,
133
    );
121
      };
134
    push @branches_loop, \%row;
135
}
122
}
136
123
137
$template->param(
124
$template->param(
138
    do_search => ( $op and $op eq "do_search" ) ? 1 : 0,
125
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
139
    results_loop             => \@results_loop,
126
    invoices => $invoices,
140
    invoicenumber            => $invoicenumber,
127
    invoicenumber   => $invoicenumber,
141
    supplier                 => $supplier,
128
    supplier        => $supplier,
142
    suppliername             => $suppliername,
129
    suppliername    => $suppliername,
143
    billingdatefrom          => $billingdatefrom,
130
    billingdatefrom => $billingdatefrom,
144
    billingdateto            => $billingdateto,
131
    billingdateto   => $billingdateto,
145
    isbneanissn              => $isbneanissn,
132
    isbneanissn     => $isbneanissn,
146
    title                    => $title,
133
    title           => $title,
147
    author                   => $author,
134
    author          => $author,
148
    publisher                => $publisher,
135
    publisher       => $publisher,
149
    publicationyear          => $publicationyear,
136
    publicationyear => $publicationyear,
150
    branch                   => $branch,
137
    branch          => $branch,
151
    branchname               => $branchname,
138
    branchname      => $branchname,
152
    suppliers_loop           => \@suppliers_loop,
139
    suppliers_loop  => $suppliers_loop,
153
    branches_loop            => \@branches_loop,
140
    branches_loop   => $branches_loop,
154
);
141
);
155
142
156
output_html_with_http_headers $input, $cookie, $template->output;
143
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-16 / +15 lines)
Lines 41-47 $(document).ready(function() { Link Here
41
    <div class="yui-b">
41
    <div class="yui-b">
42
      <h1>Invoices</h1>
42
      <h1>Invoices</h1>
43
      [% IF ( do_search ) %]
43
      [% IF ( do_search ) %]
44
        [% IF ( results_loop ) %]
44
        [% IF invoices %]
45
          <table id="resultst">
45
          <table id="resultst">
46
            <thead>
46
            <thead>
47
              <tr>
47
              <tr>
Lines 55-84 $(document).ready(function() { Link Here
55
              </tr>
55
              </tr>
56
            </thead>
56
            </thead>
57
            <tbody>
57
            <tbody>
58
              [% FOREACH result IN results_loop %]
58
              [% FOREACH invoice IN invoices %]
59
                <tr>
59
                <tr>
60
                  <td>[% result.invoicenumber %]</td>
60
                  <td>[% invoice.invoicenumber %]</td>
61
                  <td>[% result.suppliername %]</td>
61
                  <td>[% invoice.suppliername %]</td>
62
                  <td>
62
                  <td>
63
                    [% IF (result.billingdate) %]
63
                    [% IF invoice.billingdate %]
64
                      [% result.billingdate | $KohaDates %]
64
                      [% invoice.billingdate | $KohaDates %]
65
                    [% END %]
65
                    [% END %]
66
                  </td>
66
                  </td>
67
                  <td>[% result.receivedbiblios %]</td>
67
                  <td>[% invoice.receivedbiblios %]</td>
68
                  <td>[% result.receiveditems %]</td>
68
                  <td>[% invoice.receiveditems %]</td>
69
                  <td>
69
                  <td>
70
                    [% IF ( result.closedate ) %]
70
                    [% IF invoice.closedate %]
71
                      Closed on [% result.closedate | $KohaDates %]
71
                      Closed on [% invoice.closedate | $KohaDates %]
72
                    [% ELSE %]
72
                    [% ELSE %]
73
                      Open
73
                      Open
74
                    [% END %]
74
                    [% END %]
75
                  </td>
75
                  </td>
76
                  <td>
76
                  <td>
77
                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% result.invoiceid %]">Details</a> /
77
                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">Details</a> /
78
                    [% IF ( result.closedate ) %]
78
                    [% IF invoice.closedate %]
79
                      <a href="invoice.pl?op=reopen&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
79
                      <a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
80
                    [% ELSE %]
80
                    [% ELSE %]
81
                      <a href="invoice.pl?op=close&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
81
                      <a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
82
                    [% END %]
82
                    [% END %]
83
                  </td>
83
                  </td>
84
                </tr>
84
                </tr>
Lines 131-137 $(document).ready(function() { Link Here
131
              [% END %]
131
              [% END %]
132
            </ul>
132
            </ul>
133
          </p>
133
          </p>
134
        [% END %]<!-- results_loop -->
134
        [% END %]<!-- invoices -->
135
      [% ELSE %]
135
      [% ELSE %]
136
        <p>Use the search form on the left to find invoices.</p>
136
        <p>Use the search form on the left to find invoices.</p>
137
      [% END %]<!-- do_search -->
137
      [% END %]<!-- do_search -->
138
- 

Return to bug 9505