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
60
60
my $input = CGI->new;
61
my $input = CGI->new;
Lines 77-83 my $is_an_edit = $input->param('is_an_edit'); Link Here
77
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
78
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
78
79
79
if ( $op eq 'add_form' ) {
80
if ( $op eq 'add_form' ) {
81
    my @contracts = Koha::Acquisition::Contracts->search(
82
        { booksellerid => $booksellerid, contractenddate => { '>=' => \'now()' } } )->as_list;
80
    my @contractloop;
83
    my @contractloop;
84
    foreach my $contract (@contracts) {
85
        push( @contractloop, $contract->unblessed );
86
    }
81
    if ($basketno) {
87
    if ($basketno) {
82
88
83
        #this is an edit
89
        #this is an edit
Lines 85-117 if ( $op eq 'add_form' ) { Link Here
85
        if ( !$booksellerid ) {
91
        if ( !$booksellerid ) {
86
            $booksellerid = $basket->{'booksellerid'};
92
            $booksellerid = $basket->{'booksellerid'};
87
        }
93
        }
88
        my $contracts = GetContracts(
89
            {
90
                booksellerid => $booksellerid,
91
                activeonly   => 1,
92
            }
93
        );
94
94
95
        @contractloop = @$contracts;
96
        for (@contractloop) {
95
        for (@contractloop) {
97
            if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) {
96
            if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) {
98
                $_->{'selected'} = 1;
97
                $_->{selected} = 1;
99
            }
98
            }
100
        }
99
        }
101
        $template->param( is_an_edit => 1 );
100
        $template->param( is_an_edit => 1 );
102
        $template->param( additional_field_values =>
101
        $template->param( additional_field_values =>
103
                Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template );
102
                Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template );
104
    } else {
105
106
        #new basket
107
        my $basket;
108
        my $contracts = GetContracts(
109
            {
110
                booksellerid => $booksellerid,
111
                activeonly   => 1,
112
            }
113
        );
114
        push( @contractloop, @$contracts );
115
    }
103
    }
116
    my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
104
    my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
117
    my $count      = scalar @contractloop;
105
    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