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

(-)a/C4/Acquisition.pm (-1 lines)
Lines 1893-1899 cancelled. Link Here
1893
1893
1894
sub DelOrder {
1894
sub DelOrder {
1895
    my ( $bibnum, $ordernumber, $delete_biblio, $reason ) = @_;
1895
    my ( $bibnum, $ordernumber, $delete_biblio, $reason ) = @_;
1896
1897
    my $error;
1896
    my $error;
1898
    my $dbh = C4::Context->dbh;
1897
    my $dbh = C4::Context->dbh;
1899
    my $query = "
1898
    my $query = "
(-)a/Koha/Acquisition/Invoice/Adjustment.pm (+15 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Carp;
20
use Carp;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Acquisition::Invoice;
23
24
24
use base qw(Koha::Object);
25
use base qw(Koha::Object);
25
26
Lines 33-38 Koha::Acquisition::Invoice::Adjustment - Koha Invoice Adjustment class Link Here
33
34
34
=cut
35
=cut
35
36
37
=head3 invoice
38
39
my $invoice = $adjustment->invoice;
40
41
Return the invoice for this adjustment
42
43
=cut
44
45
sub invoice {
46
    my ( $self ) = @_;
47
    my $invoice_rs = $self->_result->invoiceid;
48
    return Koha::Acquisition::Invoice->_new_from_dbic( $invoice_rs );
49
}
50
36
=head3 type
51
=head3 type
37
52
38
=cut
53
=cut
(-)a/acqui/ordered.pl (-1 / +1 lines)
Lines 107-113 while ( my $data = $sth->fetchrow_hashref ) { Link Here
107
    }
107
    }
108
}
108
}
109
109
110
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { join => 'invoiceid' } );
110
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { prefetch => 'invoiceid' } );
111
while ( my $adj = $adjustments->next ){
111
while ( my $adj = $adjustments->next ){
112
    $total += $adj->adjustment;
112
    $total += $adj->adjustment;
113
}
113
}
(-)a/acqui/spent.pl (-1 / +1 lines)
Lines 135-141 while (my $data = $sth->fetchrow_hashref) { Link Here
135
}
135
}
136
$sth->finish;
136
$sth->finish;
137
137
138
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $bookfund, closedate => { '!=' => undef } }, { join => 'invoiceid' } );
138
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $bookfund, closedate => { '!=' => undef } }, { prefetch => 'invoiceid' },  );
139
while ( my $adj = $adjustments->next ){
139
while ( my $adj = $adjustments->next ){
140
    $total += $adj->adjustment;
140
    $total += $adj->adjustment;
141
}
141
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt (-1 / +5 lines)
Lines 77-83 Link Here
77
            [% FOREACH adjustment IN adjustments %]
77
            [% FOREACH adjustment IN adjustments %]
78
                <tr>
78
                <tr>
79
                    <td></td>
79
                    <td></td>
80
                    <td colspan="6">Adjustment cost for invoice [% adjustment.invoiceid | html %]</td>
80
                    <td colspan="6">Adjustment cost for invoice
81
                        <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% adjustment.invoiceid | uri %]">
82
                            [% adjustment.invoice.invoicenumber | html %]
83
                        </a>
84
                    </td>
81
                    <td class="data total">[% adjustment.adjustment | $Price %]</td>
85
                    <td class="data total">[% adjustment.adjustment | $Price %]</td>
82
                </tr>
86
                </tr>
83
            [% END %]
87
            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt (-2 / +10 lines)
Lines 87-93 Link Here
87
            [% FOREACH shipmentcost IN shipmentcosts %]
87
            [% FOREACH shipmentcost IN shipmentcosts %]
88
                <tr>
88
                <tr>
89
                    <td></td>
89
                    <td></td>
90
                    <td colspan="8">Shipping cost for invoice [% shipmentcost.invoicenumber | html %]</td>
90
                    <td colspan="8">Shipping cost for invoice
91
                        <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% shipmentcode.invoiceid | uri %]">
92
                             [% shipmentcost.invoicenumber | html %]
93
                        </a>
94
                    </td>
91
                    <td class="data total">[% shipmentcost.shipmentcost | $Price %]</td>
95
                    <td class="data total">[% shipmentcost.shipmentcost | $Price %]</td>
92
                </tr>
96
                </tr>
93
            [% END %]
97
            [% END %]
Lines 96-102 Link Here
96
            [% FOREACH adjustment IN adjustments %]
100
            [% FOREACH adjustment IN adjustments %]
97
                <tr>
101
                <tr>
98
                    <td></td>
102
                    <td></td>
99
                    <td colspan="8">Adjustment cost for invoice [% adjustment.invoiceid | html %]</td>
103
                    <td colspan="8">Adjustment cost for invoice
104
                        <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% adjustment.invoiceid | uri %]">
105
                            [% adjustment.invoice.invoicenumber | html %]
106
                        </a>
107
                    </td>
100
                    <td class="data total">[% adjustment.adjustment | $Price %]</td>
108
                    <td class="data total">[% adjustment.adjustment | $Price %]</td>
101
                </tr>
109
                </tr>
102
            [% END %]
110
            [% END %]
(-)a/t/db_dependent/Koha/Acquisition/Invoice/Adjustments.t (-2 / +9 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 6;
22
use Test::More tests => 7;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
Lines 64-67 is( $retrieved_adj->reason, $new_adj->reason, 'Find an adjustment by id should r Link Here
64
$retrieved_adj->delete;
64
$retrieved_adj->delete;
65
is( Koha::Acquisition::Invoice::Adjustments->search->count, $nb_of_adjs + 1, 'Delete should have deleted the adjustment' );
65
is( Koha::Acquisition::Invoice::Adjustments->search->count, $nb_of_adjs + 1, 'Delete should have deleted the adjustment' );
66
66
67
subtest 'invoice' => sub {
68
    plan tests => 2;
69
70
    my $invoice = $retrieved_adj->invoice;
71
    is( ref( $invoice ), 'Koha::Acquisition::Invoice', 'Koha::Acquisition::Invoice::Adjustment->invoice should return a Koha::Acquisition::Invoice' );
72
    is( $invoice->invoiceid, $retrieved_adj->invoiceid, 'Koha::Acquisition::Invoice::Adjustment->invoice should return the correct invoice' );
73
};
74
67
$schema->storage->txn_rollback;
75
$schema->storage->txn_rollback;
68
- 

Return to bug 22541