Lines 3-11
Link Here
|
3 |
#A script that lets the user populate a basket from an iso2709 file |
3 |
#A script that lets the user populate a basket from an iso2709 file |
4 |
#the script first displays a list of import batches, then when a batch is selected displays all the biblios in it. |
4 |
#the script first displays a list of import batches, then when a batch is selected displays all the biblios in it. |
5 |
#The user can then pick which biblios he wants to order |
5 |
#The user can then pick which biblios he wants to order |
6 |
#written by john.soros@biblibre.com 01/12/2008 |
|
|
7 |
|
6 |
|
8 |
# Copyright 2008 - 2009 BibLibre SARL |
7 |
# Copyright 2008 - 2010 BibLibre SARL |
9 |
# |
8 |
# |
10 |
# This file is part of Koha. |
9 |
# This file is part of Koha. |
11 |
# |
10 |
# |
Lines 25-44
Link Here
|
25 |
use strict; |
24 |
use strict; |
26 |
use warnings; |
25 |
use warnings; |
27 |
use CGI; |
26 |
use CGI; |
|
|
27 |
use Number::Format qw(:all); |
28 |
|
28 |
use C4::Context; |
29 |
use C4::Context; |
29 |
use C4::Auth; |
30 |
use C4::Auth; |
30 |
use C4::Input; |
31 |
use C4::Input; |
31 |
use C4::Output; |
32 |
use C4::Output; |
32 |
use C4::ImportBatch qw/GetImportBatchRangeDesc GetNumberOfNonZ3950ImportBatches GetImportRecordMatches GetImportBibliosRange GetImportBatchOverlayAction GetImportBatchNoMatchAction GetImportBatchItemAction GetImportRecordMarc GetImportBatch/; |
33 |
use C4::ImportBatch; |
33 |
use C4::Matcher; |
34 |
use C4::Matcher; |
34 |
use C4::Search qw/FindDuplicate BiblioAddAuthorities/; |
35 |
use C4::Search qw/FindDuplicate BiblioAddAuthorities/; |
35 |
use C4::Acquisition qw/NewOrder/; |
36 |
use C4::Acquisition; |
36 |
use C4::Biblio; |
37 |
use C4::Biblio; |
37 |
use C4::Items; |
38 |
use C4::Items; |
38 |
use C4::Koha qw/GetItemTypes/; |
39 |
use C4::Koha; |
39 |
use C4::Budgets qw/GetBudgets/; |
40 |
use C4::Budgets; |
40 |
use C4::Acquisition qw/NewOrderItem GetBasket/; |
41 |
use C4::Acquisition; |
41 |
use C4::Bookseller qw/GetBookSellerFromId/; |
42 |
use C4::Bookseller qw/GetBookSellerFromId/; |
|
|
43 |
use C4::Dates; |
44 |
use C4::Suggestions; # GetSuggestion |
45 |
use C4::Branch; # GetBranches |
46 |
use C4::Members; |
42 |
|
47 |
|
43 |
my $input = new CGI; |
48 |
my $input = new CGI; |
44 |
my ($template, $loggedinuser, $cookie) = get_template_and_user({ |
49 |
my ($template, $loggedinuser, $cookie) = get_template_and_user({ |
Lines 53-58
my $cgiparams = $input->Vars;
Link Here
|
53 |
my $op = $cgiparams->{'op'}; |
58 |
my $op = $cgiparams->{'op'}; |
54 |
my $booksellerid = $input->param('booksellerid'); |
59 |
my $booksellerid = $input->param('booksellerid'); |
55 |
my $bookseller = GetBookSellerFromId($booksellerid); |
60 |
my $bookseller = GetBookSellerFromId($booksellerid); |
|
|
61 |
my $data; |
56 |
|
62 |
|
57 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
63 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
58 |
booksellerid => $booksellerid, |
64 |
booksellerid => $booksellerid, |
Lines 69-85
if (! $cgiparams->{'basketno'}){
Link Here
|
69 |
die "Basketnumber required to order from iso2709 file import"; |
75 |
die "Basketnumber required to order from iso2709 file import"; |
70 |
} |
76 |
} |
71 |
|
77 |
|
|
|
78 |
# |
79 |
# 1st step = choose the file to import into acquisition |
80 |
# |
72 |
if ($op eq ""){ |
81 |
if ($op eq ""){ |
73 |
$template->param("basketno" => $cgiparams->{'basketno'}); |
82 |
$template->param("basketno" => $cgiparams->{'basketno'}); |
74 |
#display batches |
83 |
#display batches |
75 |
import_batches_list($template); |
84 |
import_batches_list($template); |
|
|
85 |
# |
86 |
# 2nd step = display the content of the choosen file |
87 |
# |
76 |
} elsif ($op eq "batch_details"){ |
88 |
} elsif ($op eq "batch_details"){ |
77 |
#display lines inside the selected batch |
89 |
#display lines inside the selected batch |
78 |
$template->param("batch_details" => 1, |
90 |
$template->param("batch_details" => 1, |
79 |
"basketno" => $cgiparams->{'basketno'}); |
91 |
"basketno" => $cgiparams->{'basketno'}); |
80 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
92 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
81 |
|
93 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) { |
82 |
} elsif ($op eq 'import_records'){ |
94 |
# prepare empty item form |
|
|
95 |
my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' ); |
96 |
|
97 |
# warn "==> ".Data::Dumper::Dumper($cell); |
98 |
unless ($cell) { |
99 |
$cell = PrepareItemrecordDisplay( '', '', '', '' ); |
100 |
$template->param( 'NoACQframework' => 1 ); |
101 |
} |
102 |
my @itemloop; |
103 |
push @itemloop, $cell; |
104 |
|
105 |
$template->param( items => \@itemloop ); |
106 |
} |
107 |
# |
108 |
# 3rd step = import the records |
109 |
# |
110 |
} elsif ( $op eq 'import_records' ) { |
111 |
my $num=FormatNumber(); |
83 |
#import selected lines |
112 |
#import selected lines |
84 |
$template->param('basketno' => $cgiparams->{'basketno'}); |
113 |
$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 |
114 |
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards |
Lines 95-235
if ($op eq ""){
Link Here
|
95 |
my $import_batch_id = $cgiparams->{'import_batch_id'}; |
124 |
my $import_batch_id = $cgiparams->{'import_batch_id'}; |
96 |
my $biblios = GetImportBibliosRange($import_batch_id); |
125 |
my $biblios = GetImportBibliosRange($import_batch_id); |
97 |
for my $biblio (@$biblios){ |
126 |
for my $biblio (@$biblios){ |
98 |
if($cgiparams->{'order-'.$biblio->{'import_record_id'}}){ |
127 |
# 1st insert the biblio |
99 |
my ($marcblob, $encoding) = GetImportRecordMarc($biblio->{'import_record_id'}); |
128 |
my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); |
100 |
my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; |
129 |
my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; |
101 |
my ($duplicatetitle, $biblionumber); |
130 |
my ( $duplicatetitle, $biblionumber ); |
102 |
if(!(($biblionumber,$duplicatetitle) = FindDuplicate($marcrecord))){ |
131 |
if ( !( ( $biblionumber, $duplicatetitle ) = FindDuplicate($marcrecord) ) ) { |
103 |
#FIXME: missing: marc21 support (should be same with different field) |
132 |
# add the biblio |
104 |
if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) { |
133 |
my $bibitemnum; |
105 |
my $itemtypeid = "itemtype-" . $biblio->{'import_record_id'}; |
134 |
|
106 |
$marcrecord->field(200)->update("b" => $cgiparams->{$itemtypeid}); |
135 |
# remove ISBN - |
107 |
} |
136 |
my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' ); |
108 |
# add the biblio |
137 |
if ( $marcrecord->field($isbnfield) ) { |
109 |
my $bibitemnum; |
138 |
foreach my $field ( $marcrecord->field($isbnfield) ) { |
110 |
# remove ISBN - |
139 |
foreach my $subfield ( $field->subfield($isbnsubfield) ) { |
111 |
my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn',''); |
140 |
my $newisbn = $field->subfield($isbnsubfield); |
112 |
if ( $marcrecord->field($isbnfield) ) { |
141 |
$newisbn =~ s/-//g; |
113 |
foreach my $field ( $marcrecord->field($isbnfield) ) { |
142 |
$field->update( $isbnsubfield => $newisbn ); |
114 |
foreach my $subfield ( $field->subfield($isbnsubfield) ) { |
|
|
115 |
my $newisbn = $field->subfield($isbnsubfield); |
116 |
$newisbn =~ s/-//g; |
117 |
$field->update( $isbnsubfield => $newisbn ); |
118 |
} |
119 |
} |
143 |
} |
120 |
} |
144 |
} |
121 |
|
|
|
122 |
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
123 |
} else { |
124 |
warn("Duplicate item found: ", $biblionumber, "; Duplicate: ", $duplicatetitle); |
125 |
} |
145 |
} |
|
|
146 |
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); |
147 |
# 2nd add authorities if applicable |
126 |
if (C4::Context->preference("BiblioAddsAuthorities")){ |
148 |
if (C4::Context->preference("BiblioAddsAuthorities")){ |
127 |
my ($countlinked,$countcreated)=BiblioAddAuthorities($marcrecord, $cgiparams->{'frameworkcode'}); |
149 |
my ($countlinked,$countcreated)=BiblioAddAuthorities($marcrecord, $cgiparams->{'frameworkcode'}); |
128 |
} |
150 |
} |
|
|
151 |
# 3rd add order |
129 |
my $patron = C4::Members->GetMember(borrowernumber => $loggedinuser); |
152 |
my $patron = C4::Members->GetMember(borrowernumber => $loggedinuser); |
130 |
my $branch = C4::Branch->GetBranchDetail($patron->{branchcode}); |
153 |
my $branch = C4::Branch->GetBranchDetail($patron->{branchcode}); |
131 |
my ($invoice); |
154 |
my ($invoice); |
|
|
155 |
# get quantity in the MARC record (1 if none) |
156 |
my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1; |
132 |
my %orderinfo = ("biblionumber", $biblionumber, |
157 |
my %orderinfo = ("biblionumber", $biblionumber, |
133 |
"basketno", $cgiparams->{'basketno'}, |
158 |
"basketno", $cgiparams->{'basketno'}, |
134 |
"quantity", $cgiparams->{'quantityrec-' . $biblio->{'import_record_id'}}, |
159 |
"quantity", $quantity, |
135 |
"branchcode", $branch, |
160 |
"branchcode", $branch, |
136 |
"booksellerinvoicenumber", $invoice, |
161 |
"booksellerinvoicenumber", $invoice, |
137 |
"budget_id", $budget_id, |
162 |
"budget_id", $budget_id, |
138 |
"uncertainprice", 1, |
163 |
"uncertainprice", 1, |
|
|
164 |
"sort1", $cgiparams->{'sort1'}, |
165 |
"sort2", $cgiparams->{'sort2'}, |
139 |
); |
166 |
); |
140 |
# get the price if there is one. |
167 |
# get the price if there is one. |
141 |
# filter by storing only the 1st number |
168 |
# filter by storing only the 1st number |
142 |
# we suppose the currency is correct, as we have no possibilities to get it. |
169 |
# we suppose the currency is correct, as we have no possibilities to get it. |
143 |
if ($marcrecord->subfield("345","d")) { |
170 |
my $price= GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); |
144 |
$orderinfo{'listprice'} = $marcrecord->subfield("345","d"); |
171 |
if ($price){ |
145 |
if ($orderinfo{'listprice'} =~ /^([\d\.,]*)/) { |
172 |
$price = $num->unformat_number($price); |
146 |
$orderinfo{'listprice'} = $1; |
|
|
147 |
$orderinfo{'listprice'} =~ s/,/\./; |
148 |
my $basket = GetBasket($orderinfo{basketno}); |
149 |
my $bookseller = GetBookSellerFromId($basket->{booksellerid}); |
150 |
# '//' is like '||' but tests for defined, rather than true |
151 |
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
152 |
$orderinfo{'unitprice'} = $orderinfo{listprice} - ($orderinfo{listprice} * ($bookseller->{discount} / 100)); |
153 |
$orderinfo{'ecost'} = $orderinfo{unitprice}; |
154 |
} else { |
155 |
$orderinfo{'listprice'} = 0; |
156 |
} |
157 |
$orderinfo{'rrp'} = $orderinfo{'listprice'}; |
158 |
} |
173 |
} |
159 |
elsif ($marcrecord->subfield("010","d")) { |
174 |
if ($price){ |
160 |
$orderinfo{'listprice'} = $marcrecord->subfield("010","d"); |
175 |
$orderinfo{'listprice'} = $price; |
161 |
if ($orderinfo{'listprice'} =~ /^([\d\.,]*)/) { |
176 |
eval "use C4::Acquisition qw/GetBasket/;"; |
162 |
$orderinfo{'listprice'} = $1; |
177 |
eval "use C4::Bookseller qw/GetBookSellerFromId/;"; |
163 |
$orderinfo{'listprice'} =~ s/,/\./; |
178 |
my $basket = GetBasket( $orderinfo{basketno} ); |
164 |
my $basket = GetBasket($orderinfo{basketno}); |
179 |
my $bookseller = GetBookSellerFromId( $basket->{booksellerid} ); |
165 |
my $bookseller = GetBookSellerFromId($basket->{booksellerid}); |
180 |
my $gst = $bookseller->{gstrate} || C4::Context->preference("gist") || 0; |
166 |
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
181 |
$orderinfo{'unitprice'} = $orderinfo{listprice} - ( $orderinfo{listprice} * ( $bookseller->{discount} / 100 ) ); |
167 |
$orderinfo{'unitprice'} = $orderinfo{listprice} - ($orderinfo{listprice} * ($bookseller->{discount} / 100)); |
182 |
$orderinfo{'ecost'} = $orderinfo{unitprice}; |
168 |
$orderinfo{'ecost'} = $orderinfo{unitprice}; |
183 |
} else { |
169 |
} else { |
184 |
$orderinfo{'listprice'} = 0; |
170 |
$orderinfo{'listprice'} = 0; |
|
|
171 |
} |
172 |
$orderinfo{'rrp'} = $orderinfo{'listprice'}; |
173 |
} |
185 |
} |
|
|
186 |
$orderinfo{'rrp'} = $orderinfo{'listprice'}; |
187 |
|
174 |
# remove uncertainprice flag if we have found a price in the MARC record |
188 |
# remove uncertainprice flag if we have found a price in the MARC record |
175 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
189 |
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; |
176 |
my $basketno; |
190 |
my $basketno; |
177 |
( $basketno, $ordernumber ) = NewOrder(\%orderinfo); |
191 |
( $basketno, $ordernumber ) = NewOrder(\%orderinfo); |
178 |
|
192 |
|
179 |
# now, add items if applicable |
193 |
# 4th, add items if applicable |
180 |
# parse all items sent by the form, and create an item just for the import_record_id we are dealing with |
194 |
# parse the item sent by the form, and create an item just for the import_record_id we are dealing with |
181 |
# this is not optimised, but it's working ! |
195 |
# this is not optimised, but it's working ! |
182 |
if (C4::Context->preference('AcqCreateItem') eq 'ordering') { |
196 |
if (C4::Context->preference('AcqCreateItem') eq 'ordering') { |
183 |
my @tags = $input->param('tag'); |
197 |
my @tags = $input->param('tag'); |
184 |
my @subfields = $input->param('subfield'); |
198 |
my @subfields = $input->param('subfield'); |
185 |
my @field_values = $input->param('field_value'); |
199 |
my @field_values = $input->param('field_value'); |
186 |
my @serials = $input->param('serial'); |
200 |
my @serials = $input->param('serial'); |
187 |
my @itemids = $input->param('itemid'); # hint : in iso2709, the itemid contains the import_record_id, not an item id. It is used to get the right item, as we have X biblios. |
|
|
188 |
my @ind_tag = $input->param('ind_tag'); |
201 |
my @ind_tag = $input->param('ind_tag'); |
189 |
my @indicator = $input->param('indicator'); |
202 |
my @indicator = $input->param('indicator'); |
190 |
#Rebuilding ALL the data for items into a hash |
203 |
my $item; |
191 |
# parting them on $itemid. |
204 |
push @{ $item->{tags} }, $tags[0]; |
192 |
my %itemhash; |
205 |
push @{ $item->{subfields} }, $subfields[0]; |
193 |
my $range=scalar(@itemids); |
206 |
push @{ $item->{field_values} }, $field_values[0]; |
194 |
|
207 |
push @{ $item->{ind_tag} }, $ind_tag[0]; |
195 |
my $i = 0; |
208 |
push @{ $item->{indicator} }, $indicator[0]; |
196 |
my @items; |
209 |
my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator ); |
197 |
for my $itemid (@itemids){ |
210 |
my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); |
198 |
my $realitemid; #javascript generated random itemids, in the form itemid-randomnumber, $realitemid is the itemid, while $itemid is the itemide parsed from the html |
211 |
my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); |
199 |
if ($itemid =~ m/(\d+)-.*/){ |
212 |
NewOrderItem( $itemnumber, $ordernumber ); |
200 |
my @splits = split(/-/, $itemid); |
|
|
201 |
$realitemid = $splits[0]; |
202 |
} |
203 |
if ( ( $realitemid && $cgiparams->{'order-'. $realitemid} && $realitemid eq $biblio->{import_record_id}) || ($itemid && $cgiparams->{'order-'. $itemid} && $itemid eq $biblio->{import_record_id}) ){ |
204 |
my ($item, $found); |
205 |
for my $tmpitem (@items){ |
206 |
if ($tmpitem->{itemid} eq $itemid){ |
207 |
$item = $tmpitem; |
208 |
$found = 1; |
209 |
} |
210 |
} |
211 |
push @{$item->{tags}}, $tags[$i]; |
212 |
push @{$item->{subfields}}, $subfields[$i]; |
213 |
push @{$item->{field_values}}, $field_values[$i]; |
214 |
push @{$item->{ind_tag}}, $ind_tag[$i]; |
215 |
push @{$item->{indicator}}, $indicator[$i]; |
216 |
$item->{itemid} = $itemid; |
217 |
if (! $found){ |
218 |
push @items, $item; |
219 |
} |
220 |
} |
221 |
++$i |
222 |
} |
223 |
foreach my $item (@items){ |
224 |
my $xml = TransformHtmlToXml( $item->{'tags'}, |
225 |
$item->{'subfields'}, |
226 |
$item->{'field_values'}, |
227 |
$item->{'ind_tag'}, |
228 |
$item->{'indicator'}); |
229 |
my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); |
230 |
my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); |
231 |
NewOrderItem( $itemnumber, $ordernumber); |
232 |
} |
233 |
} |
213 |
} |
234 |
} |
214 |
} |
235 |
} |
215 |
} |
Lines 237-242
if ($op eq ""){
Link Here
|
237 |
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}); |
217 |
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}); |
238 |
exit; |
218 |
exit; |
239 |
} |
219 |
} |
|
|
220 |
|
221 |
my $budgets = GetBudgets(); |
222 |
my $budget_id = @$budgets[0]->{'budget_id'}; |
223 |
# build bookfund list |
224 |
my $borrower = GetMember( 'borrowernumber' => $loggedinuser ); |
225 |
my ( $flags, $homebranch ) = ( $borrower->{'flags'}, $borrower->{'branchcode'} ); |
226 |
my $budget = GetBudget($budget_id); |
227 |
|
228 |
# build budget list |
229 |
my $budget_loop = []; |
230 |
my $budgets = GetBudgetHierarchy( q{}, $borrower->{branchcode}, $borrower->{borrowernumber} ); |
231 |
foreach my $r ( @{$budgets} ) { |
232 |
if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { |
233 |
next; |
234 |
} |
235 |
push @{$budget_loop}, |
236 |
{ b_id => $r->{budget_id}, |
237 |
b_txt => $r->{budget_name}, |
238 |
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, |
239 |
}; |
240 |
} |
241 |
$template->param( budget_loop => $budget_loop,); |
242 |
|
243 |
my $CGIsort1; |
244 |
if ($budget) { # its a mod .. |
245 |
if ( defined $budget->{'sort1_authcat'} ) { # with custom Asort* planning values |
246 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', $budget->{'sort1_authcat'}, $data->{'sort1'} ); |
247 |
} |
248 |
} elsif ( scalar(@$budgets) ) { |
249 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', @$budgets[0]->{'sort1_authcat'}, '' ); |
250 |
} else { |
251 |
$CGIsort1 = GetAuthvalueDropbox( 'sort1', '', '' ); |
252 |
} |
253 |
|
254 |
# if CGIsort is successfully fetched, the use it |
255 |
# else - failback to plain input-field |
256 |
if ($CGIsort1) { |
257 |
$template->param( CGIsort1 => $CGIsort1 ); |
258 |
} else { |
259 |
$template->param( sort1 => $data->{'sort1'} ); |
260 |
} |
261 |
|
262 |
my $CGIsort2; |
263 |
if ($budget) { |
264 |
if ( defined $budget->{'sort2_authcat'} ) { |
265 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', $budget->{'sort2_authcat'}, $data->{'sort2'} ); |
266 |
} |
267 |
} elsif ( scalar(@$budgets) ) { |
268 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', @$budgets[0]->{sort2_authcat}, '' ); |
269 |
} else { |
270 |
$CGIsort2 = GetAuthvalueDropbox( 'sort2', '', '' ); |
271 |
} |
272 |
|
273 |
if ($CGIsort2) { |
274 |
$template->param( CGIsort2 => $CGIsort2 ); |
275 |
} else { |
276 |
$template->param( sort2 => $data->{'sort2'} ); |
277 |
} |
278 |
|
240 |
output_html_with_http_headers $input, $cookie, $template->output; |
279 |
output_html_with_http_headers $input, $cookie, $template->output; |
241 |
|
280 |
|
242 |
|
281 |
|
Lines 268-279
sub import_biblios_list {
Link Here
|
268 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
307 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
269 |
my $biblios = GetImportBibliosRange($import_batch_id,'','','staged'); |
308 |
my $biblios = GetImportBibliosRange($import_batch_id,'','','staged'); |
270 |
my @list = (); |
309 |
my @list = (); |
271 |
# # Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards |
310 |
|
272 |
# my $itemtypehash = GetItemTypes(); |
|
|
273 |
# my @itemtypes; |
274 |
# for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) { |
275 |
# push(@itemtypes, $itemtypehash->{$key}); |
276 |
# } |
277 |
foreach my $biblio (@$biblios) { |
311 |
foreach my $biblio (@$biblios) { |
278 |
my $citation = $biblio->{'title'}; |
312 |
my $citation = $biblio->{'title'}; |
279 |
$citation .= " $biblio->{'author'}" if $biblio->{'author'}; |
313 |
$citation .= " $biblio->{'author'}" if $biblio->{'author'}; |
Lines 293-310
sub import_biblios_list {
Link Here
|
293 |
match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0, |
327 |
match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0, |
294 |
match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '', |
328 |
match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '', |
295 |
match_score => $#$match > -1 ? $match->[0]->{'score'} : 0, |
329 |
match_score => $#$match > -1 ? $match->[0]->{'score'} : 0, |
296 |
# itemtypes => \@itemtypes, |
|
|
297 |
); |
330 |
); |
298 |
# if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { |
|
|
299 |
# # prepare empty item form |
300 |
# my $cell = PrepareItemrecordDisplay(); |
301 |
# my @itemloop; |
302 |
# push @itemloop,$cell; |
303 |
# $cellrecord{'items'} = \@itemloop; |
304 |
# } |
305 |
push @list, \%cellrecord; |
331 |
push @list, \%cellrecord; |
306 |
|
|
|
307 |
|
308 |
} |
332 |
} |
309 |
my $num_biblios = $batch->{'num_biblios'}; |
333 |
my $num_biblios = $batch->{'num_biblios'}; |
310 |
my $overlay_action = GetImportBatchOverlayAction($import_batch_id); |
334 |
my $overlay_action = GetImportBatchOverlayAction($import_batch_id); |