|
Lines 25-30
Link Here
|
| 25 |
use strict; |
25 |
use strict; |
| 26 |
use warnings; |
26 |
use warnings; |
| 27 |
use CGI; |
27 |
use CGI; |
|
|
28 |
use Number::Format qw(:all); |
| 29 |
|
| 28 |
use C4::Context; |
30 |
use C4::Context; |
| 29 |
use C4::Auth; |
31 |
use C4::Auth; |
| 30 |
use C4::Input; |
32 |
use C4::Input; |
|
Lines 36-45
use C4::Acquisition qw/NewOrder/;
Link Here
|
| 36 |
use C4::Biblio; |
38 |
use C4::Biblio; |
| 37 |
use C4::Items; |
39 |
use C4::Items; |
| 38 |
use C4::Koha qw/GetItemTypes/; |
40 |
use C4::Koha qw/GetItemTypes/; |
| 39 |
use C4::Budgets qw/GetBudgets/; |
|
|
| 40 |
use C4::Acquisition qw/NewOrderItem GetBasket/; |
41 |
use C4::Acquisition qw/NewOrderItem GetBasket/; |
|
|
42 |
use C4::Budgets qw/GetBudgets GetBudgetHierarchy/; |
| 41 |
use C4::Bookseller qw/GetBookSellerFromId/; |
43 |
use C4::Bookseller qw/GetBookSellerFromId/; |
| 42 |
|
44 |
|
|
|
45 |
|
| 46 |
use C4::Dates; |
| 47 |
use C4::Suggestions; # GetSuggestion |
| 48 |
use C4::Branch; # GetBranches |
| 49 |
use C4::Members; |
| 50 |
#needed for z3950 import: |
| 51 |
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/; |
| 52 |
use C4::Acquisition; |
| 53 |
use C4::Koha; |
| 54 |
use C4::Budgets; |
| 55 |
use C4::Acquisition; |
| 56 |
use C4::Bookseller; |
| 57 |
|
| 43 |
my $input = new CGI; |
58 |
my $input = new CGI; |
| 44 |
my ($template, $loggedinuser, $cookie) = get_template_and_user({ |
59 |
my ($template, $loggedinuser, $cookie) = get_template_and_user({ |
| 45 |
template_name => "acqui/addorderiso2709.tmpl", |
60 |
template_name => "acqui/addorderiso2709.tmpl", |
|
Lines 52-57
my ($template, $loggedinuser, $cookie) = get_template_and_user({
Link Here
|
| 52 |
my $cgiparams = $input->Vars; |
67 |
my $cgiparams = $input->Vars; |
| 53 |
my $op = $cgiparams->{'op'}; |
68 |
my $op = $cgiparams->{'op'}; |
| 54 |
my $booksellerid = $input->param('booksellerid'); |
69 |
my $booksellerid = $input->param('booksellerid'); |
|
|
70 |
my $close = $input->param('close'); |
| 71 |
my $data; |
| 55 |
my $bookseller = GetBookSellerFromId($booksellerid); |
72 |
my $bookseller = GetBookSellerFromId($booksellerid); |
| 56 |
|
73 |
|
| 57 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
74 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
|
Lines 80-85
if ($op eq ""){
Link Here
|
| 80 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
97 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
| 81 |
|
98 |
|
| 82 |
} elsif ($op eq 'import_records'){ |
99 |
} elsif ($op eq 'import_records'){ |
|
|
100 |
my $num=FormatNumber(); |
| 83 |
#import selected lines |
101 |
#import selected lines |
| 84 |
$template->param('basketno' => $cgiparams->{'basketno'}); |
102 |
$template->param('basketno' => $cgiparams->{'basketno'}); |
| 85 |
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards |
103 |
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards |
|
Lines 119-124
if ($op eq ""){
Link Here
|
| 119 |
} |
137 |
} |
| 120 |
} |
138 |
} |
| 121 |
|
139 |
|
|
|
140 |
$price= GetMarcPrice($marcrecord); |
| 141 |
if ($price){ |
| 142 |
$price = $num->unformat_number($price); |
| 143 |
} |
| 144 |
|
| 122 |
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
145 |
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
| 123 |
} else { |
146 |
} else { |
| 124 |
warn("Duplicate item found: ", $biblionumber, "; Duplicate: ", $duplicatetitle); |
147 |
warn("Duplicate item found: ", $biblionumber, "; Duplicate: ", $duplicatetitle); |
|
Lines 171-176
if ($op eq ""){
Link Here
|
| 171 |
} |
194 |
} |
| 172 |
$orderinfo{'rrp'} = $orderinfo{'listprice'}; |
195 |
$orderinfo{'rrp'} = $orderinfo{'listprice'}; |
| 173 |
} |
196 |
} |
|
|
197 |
|
| 174 |
# remove uncertainprice flag if we have found a price in the MARC record |
198 |
# remove uncertainprice flag if we have found a price in the MARC record |
| 175 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
199 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
| 176 |
my $basketno; |
200 |
my $basketno; |
|
Lines 237-242
if ($op eq ""){
Link Here
|
| 237 |
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}); |
261 |
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}); |
| 238 |
exit; |
262 |
exit; |
| 239 |
} |
263 |
} |
|
|
264 |
|
| 265 |
my $budgets = GetBudgets(); |
| 266 |
my $budget_id = @$budgets[0]->{'budget_id'}; |
| 267 |
# build bookfund list |
| 268 |
my $borrower = GetMember( 'borrowernumber' => $loggedinuser ); |
| 269 |
my ( $flags, $homebranch ) = ( $borrower->{'flags'}, $borrower->{'branchcode'} ); |
| 270 |
my $budget = GetBudget($budget_id); |
| 271 |
|
| 272 |
# build budget list |
| 273 |
my $budget_loop = []; |
| 274 |
my $budgets = GetBudgetHierarchy( q{}, $borrower->{branchcode}, $borrower->{borrowernumber} ); |
| 275 |
foreach my $r ( @{$budgets} ) { |
| 276 |
if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { |
| 277 |
next; |
| 278 |
} |
| 279 |
push @{$budget_loop}, |
| 280 |
{ b_id => $r->{budget_id}, |
| 281 |
b_txt => $r->{budget_name}, |
| 282 |
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, |
| 283 |
}; |
| 284 |
} |
| 285 |
#warn Data::Dumper::Dumper($budget_loop); |
| 286 |
$template->param( budget_loop => $budget_loop,); |
| 287 |
|
| 288 |
my $CGIsort1; |
| 289 |
if ($budget) { # its a mod .. |
| 290 |
if ( defined $budget->{'sort1_authcat'} ) { # with custom Asort* planning values |
| 291 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', $budget->{'sort1_authcat'}, $data->{'sort1'} ); |
| 292 |
} |
| 293 |
} elsif ( scalar(@$budgets) ) { |
| 294 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', @$budgets[0]->{'sort1_authcat'}, '' ); |
| 295 |
} else { |
| 296 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', '', '' ); |
| 297 |
} |
| 298 |
|
| 299 |
# if CGIsort is successfully fetched, the use it |
| 300 |
# else - failback to plain input-field |
| 301 |
if ($CGIsort1) { |
| 302 |
$template->param( CGIsort1 => $CGIsort1 ); |
| 303 |
} else { |
| 304 |
$template->param( sort1 => $data->{'sort1'} ); |
| 305 |
} |
| 306 |
|
| 307 |
my $CGIsort2; |
| 308 |
if ($budget) { |
| 309 |
if ( defined $budget->{'sort2_authcat'} ) { |
| 310 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', $budget->{'sort2_authcat'}, $data->{'sort2'} ); |
| 311 |
} |
| 312 |
} elsif ( scalar(@$budgets) ) { |
| 313 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', @$budgets[0]->{sort2_authcat}, '' ); |
| 314 |
} else { |
| 315 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', '', '' ); |
| 316 |
} |
| 317 |
|
| 318 |
if ($CGIsort2) { |
| 319 |
$template->param( CGIsort2 => $CGIsort2 ); |
| 320 |
} else { |
| 321 |
$template->param( sort2 => $data->{'sort2'} ); |
| 322 |
} |
| 323 |
|
| 240 |
output_html_with_http_headers $input, $cookie, $template->output; |
324 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 241 |
|
325 |
|
| 242 |
|
326 |
|
|
Lines 268-279
sub import_biblios_list {
Link Here
|
| 268 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
352 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
| 269 |
my $biblios = GetImportBibliosRange($import_batch_id,'','','staged'); |
353 |
my $biblios = GetImportBibliosRange($import_batch_id,'','','staged'); |
| 270 |
my @list = (); |
354 |
my @list = (); |
| 271 |
# # Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards |
355 |
|
| 272 |
# my $itemtypehash = GetItemTypes(); |
356 |
# # Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards |
| 273 |
# my @itemtypes; |
357 |
# my $itemtypehash = GetItemTypes(); |
| 274 |
# for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) { |
358 |
# my @itemtypes; |
| 275 |
# push(@itemtypes, $itemtypehash->{$key}); |
359 |
# for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) { |
| 276 |
# } |
360 |
# push(@itemtypes, $itemtypehash->{$key}); |
|
|
361 |
# } |
| 277 |
foreach my $biblio (@$biblios) { |
362 |
foreach my $biblio (@$biblios) { |
| 278 |
my $citation = $biblio->{'title'}; |
363 |
my $citation = $biblio->{'title'}; |
| 279 |
$citation .= " $biblio->{'author'}" if $biblio->{'author'}; |
364 |
$citation .= " $biblio->{'author'}" if $biblio->{'author'}; |