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

(-)a/Koha/Acquisition/Bookseller.pm (-8 / +4 lines)
Lines 21-30 use Koha::Acquisition::Bookseller::Aliases; Link Here
21
use Koha::Acquisition::Bookseller::Contacts;
21
use Koha::Acquisition::Bookseller::Contacts;
22
use Koha::Acquisition::Bookseller::Interfaces;
22
use Koha::Acquisition::Bookseller::Interfaces;
23
use Koha::Acquisition::Bookseller::Issues;
23
use Koha::Acquisition::Bookseller::Issues;
24
use Koha::Acquisition::Contracts;
24
use Koha::Subscriptions;
25
use Koha::Subscriptions;
25
26
26
use C4::Contract qw( GetContracts );
27
28
use base qw( Koha::Object );
27
use base qw( Koha::Object );
29
28
30
=head1 NAME
29
=head1 NAME
Lines 86-92 sub contacts { Link Here
86
=head3 contracts
85
=head3 contracts
87
86
88
    my $vendor   = Koha::Acquisition::Booksellers->find( $id );
87
    my $vendor   = Koha::Acquisition::Booksellers->find( $id );
89
    my @contracts = $vendor->contracts();
88
    my $contracts = $vendor->contracts();
90
89
91
Returns the list of contracts for the vendor
90
Returns the list of contracts for the vendor
92
91
Lines 94-104 Returns the list of contracts for the vendor Link Here
94
93
95
sub contracts {
94
sub contracts {
96
    my ($self) = @_;
95
    my ($self) = @_;
97
    return GetContracts(
96
    my $contracts_rs = $self->_result->aqcontracts;
98
        {
97
    return Koha::Acquisition::Contracts->_new_from_dbic($contracts_rs);
99
            booksellerid => $self->id,
100
        }
101
    );
102
}
98
}
103
99
104
=head3 subscriptions
100
=head3 subscriptions
(-)a/acqui/basketheader.pl (-20 / +8 lines)
Lines 51-60 use C4::Context; Link Here
51
use C4::Auth        qw( get_template_and_user );
51
use C4::Auth        qw( get_template_and_user );
52
use C4::Output      qw( output_html_with_http_headers );
52
use C4::Output      qw( output_html_with_http_headers );
53
use C4::Acquisition qw( GetBasket ModBasket ModBasketHeader NewBasket );
53
use C4::Acquisition qw( GetBasket ModBasket ModBasketHeader NewBasket );
54
use C4::Contract    qw( GetContracts GetContract );
54
use C4::Contract    qw( GetContract );
55
55
56
use Koha::Acquisition::Booksellers;
56
use Koha::Acquisition::Booksellers;
57
use Koha::Acquisition::Baskets;
57
use Koha::Acquisition::Baskets;
58
use Koha::Acquisition::Contracts;
58
use Koha::AdditionalFields;
59
use Koha::AdditionalFields;
59
use Koha::Database;
60
use Koha::Database;
60
61
Lines 78-84 my $is_an_edit = $input->param('is_an_edit'); Link Here
78
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
79
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
79
80
80
if ( $op eq 'add_form' ) {
81
if ( $op eq 'add_form' ) {
82
    my @contracts = Koha::Acquisition::Contracts->search(
83
        { booksellerid => $booksellerid, contractenddate => { '>=' => \'now()' } } )->as_list;
81
    my @contractloop;
84
    my @contractloop;
85
    foreach my $contract (@contracts) {
86
        push( @contractloop, $contract->unblessed );
87
    }
82
    if ($basketno) {
88
    if ($basketno) {
83
89
84
        #this is an edit
90
        #this is an edit
Lines 86-118 if ( $op eq 'add_form' ) { Link Here
86
        if ( !$booksellerid ) {
92
        if ( !$booksellerid ) {
87
            $booksellerid = $basket->{'booksellerid'};
93
            $booksellerid = $basket->{'booksellerid'};
88
        }
94
        }
89
        my $contracts = GetContracts(
90
            {
91
                booksellerid => $booksellerid,
92
                activeonly   => 1,
93
            }
94
        );
95
95
96
        @contractloop = @$contracts;
97
        for (@contractloop) {
96
        for (@contractloop) {
98
            if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) {
97
            if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) {
99
                $_->{'selected'} = 1;
98
                $_->{selected} = 1;
100
            }
99
            }
101
        }
100
        }
102
        $template->param( is_an_edit => 1 );
101
        $template->param( is_an_edit => 1 );
103
        $template->param( additional_field_values =>
102
        $template->param( additional_field_values =>
104
                Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template );
103
                Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template );
105
    } else {
106
107
        #new basket
108
        my $basket;
109
        my $contracts = GetContracts(
110
            {
111
                booksellerid => $booksellerid,
112
                activeonly   => 1,
113
            }
114
        );
115
        push( @contractloop, @$contracts );
116
    }
104
    }
117
    my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
105
    my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
118
    my $count      = scalar @contractloop;
106
    my $count      = scalar @contractloop;
(-)a/admin/aqcontract.pl (-3 / +1 lines)
Lines 29-35 use C4::Contract qw( Link Here
29
    AddContract
29
    AddContract
30
    DelContract
30
    DelContract
31
    GetContract
31
    GetContract
32
    GetContracts
33
    ModContract
32
    ModContract
34
);
33
);
35
use Koha::DateUtils qw( dt_from_string );
34
use Koha::DateUtils qw( dt_from_string );
Lines 169-175 if ( $op eq 'list' ) { Link Here
169
    $template->param( else => 1 );
168
    $template->param( else => 1 );
170
169
171
    # get contracts
170
    # get contracts
172
    my @contracts = @{ GetContracts( { booksellerid => $booksellerid } ) };
171
    my @contracts = Koha::Acquisition::Contracts->search( { booksellerid => $booksellerid } )->as_list;
173
172
174
    $template->param( loop => \@contracts );
173
    $template->param( loop => \@contracts );
175
174
176
- 

Return to bug 39711