|
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; |
|
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 |
|
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; |