synch'ing 2.2 and head
[koha.git] / acqui.simple / addbiblio.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA  02111-1307 USA
21
22 use strict;
23 use CGI;
24 use C4::Auth;
25 use C4::Output;
26 use C4::Interface::CGI::Output;
27 use C4::Biblio;
28 use C4::SearchMarc; # also includes Biblio.pm, SearchMarc is used to FindDuplicate
29 use C4::Context;
30 use C4::Log;
31 use C4::Koha; # XXX subfield_is_koha_internal_p
32 use HTML::Template;
33 use MARC::File::USMARC;
34
35 use vars qw( $tagslib);
36 use vars qw( $authorised_values_sth);
37 use vars qw( $is_a_modif );
38
39 my $itemtype; # created here because it can be used in build_authorized_values_list sub
40
41 =item find_value
42
43     ($indicators, $value) = find_value($tag, $subfield, $record,$encoding);
44
45 Find the given $subfield in the given $tag in the given
46 MARC::Record $record.  If the subfield is found, returns
47 the (indicators, value) pair; otherwise, (undef, undef) is
48 returned.
49
50 =cut
51
52 sub find_value {
53         my ($tagfield,$insubfield,$record,$encoding) = @_;
54         my @result;
55         my $indicator;
56         if ($tagfield <10) {
57                 if ($record->field($tagfield)) {
58                         push @result, $record->field($tagfield)->data();
59                 } else {
60                         push @result,"";
61                 }
62         } else {
63                 foreach my $field ($record->field($tagfield)) {
64                         my @subfields = $field->subfields();
65                         foreach my $subfield (@subfields) {
66                                 if (@$subfield[0] eq $insubfield) {
67                                         push @result,char_decode(@$subfield[1],$encoding);
68                                         $indicator = $field->indicator(1).$field->indicator(2);
69                                 }
70                         }
71                 }
72         }
73         return($indicator,@result);
74 }
75
76
77 =item MARCfindbreeding
78
79     $record = MARCfindbreeding($dbh, $breedingid);
80
81 Look up the breeding farm with database handle $dbh, for the
82 record with id $breedingid.  If found, returns the decoded
83 MARC::Record; otherwise, -1 is returned (FIXME).
84 Returns as second parameter the character encoding.
85
86 =cut
87
88 sub MARCfindbreeding {
89         my ($dbh,$id) = @_;
90         my $sth = $dbh->prepare("select file,marc,encoding from marc_breeding where id=?");
91         $sth->execute($id);
92         my ($file,$marc,$encoding) = $sth->fetchrow;
93         if ($marc) {
94                 my $record = MARC::File::USMARC::decode($marc);
95                 if (ref($record) eq undef) {
96                         return -1;
97                 } else {
98                         return $record,$encoding;
99                 }
100         }
101         return -1;
102 }
103
104
105 =item build_authorized_values_list
106
107 =cut
108
109 sub build_authorized_values_list ($$$$$) {
110         my($tag, $subfield, $value, $dbh,$authorised_values_sth) = @_;
111
112         my @authorised_values;
113         my %authorised_lib;
114
115         # builds list, depending on authorised value...
116
117         #---- branch
118         if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
119         my $sth=$dbh->prepare("select branchcode,branchname from branches order by branchname");
120         $sth->execute;
121         push @authorised_values, ""
122                 unless ($tagslib->{$tag}->{$subfield}->{mandatory});
123
124         while (my ($branchcode,$branchname) = $sth->fetchrow_array) {
125                 push @authorised_values, $branchcode;
126                 $authorised_lib{$branchcode}=$branchname;
127         }
128
129         #----- itemtypes
130         } elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") {
131                 my $sth=$dbh->prepare("select itemtype,description from itemtypes order by description");
132                 $sth->execute;
133                 push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
134         
135                 while (my ($itemtype,$description) = $sth->fetchrow_array) {
136                         push @authorised_values, $itemtype;
137                         $authorised_lib{$itemtype}=$description;
138                 }
139                 $value=$itemtype unless ($value);
140
141         #---- "true" authorised value
142         } else {
143                 $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value});
144
145                 push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory});
146         
147                 while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) {
148                         push @authorised_values, $value;
149                         $authorised_lib{$value}=$lib;
150                 }
151     }
152     return CGI::scrolling_list( -name     => 'field_value',
153                                 -values   => \@authorised_values,
154                                 -default  => $value,
155                                 -labels   => \%authorised_lib,
156                                 -size     => 1,
157                                 -multiple => 0 );
158 }
159
160 =item create_input
161  builds the <input ...> entry for a subfield.
162 =cut
163 sub create_input () {
164         my ($tag,$subfield,$value,$i,$tabloop,$rec,$authorised_values_sth) = @_;
165         $value =~ s/"/&quot;/g;
166         my $dbh = C4::Context->dbh;
167         my %subfield_data;
168         $subfield_data{tag}=$tag;
169         $subfield_data{subfield}=$subfield;
170         $subfield_data{marc_lib}="<span id=\"error$i\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>";
171         $subfield_data{tag_mandatory}=$tagslib->{$tag}->{mandatory};
172         $subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
173         $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
174         $subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{kohafield};
175         # it's an authorised field
176         if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
177                 $subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth);
178         # it's a thesaurus / authority field
179         } elsif ($tagslib->{$tag}->{$subfield}->{authtypecode}) {
180                 $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"77\" maxlength=\"255\" DISABLE READONLY> <a href=\"javascript:Dopop('../authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$i',$i)\">...</a>";
181         # it's a plugin field
182         } elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
183                 # opening plugin. Just check wether we are on a developper computer on a production one
184                 # (the cgidir differs)
185                 my $cgidir = C4::Context->intranetdir ."/cgi-bin/value_builder";
186                 unless (opendir(DIR, "$cgidir")) {
187                         $cgidir = C4::Context->intranetdir."/value_builder";
188                 } 
189                 my $plugin=$cgidir."/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; 
190                 require $plugin;
191                 my $extended_param = plugin_parameters($dbh,$rec,$tagslib,$i,$tabloop);
192                 my ($function_name,$javascript) = plugin_javascript($dbh,$rec,$tagslib,$i,$tabloop);
193                 $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\"  value=\"$value\" size=\"77\" maxlength=\"255\" OnFocus=\"javascript:Focus$function_name($i)\" OnBlur=\"javascript:Blur$function_name($i)\"> <a href=\"javascript:Clic$function_name($i)\">...</a> $javascript";
194         # it's an hidden field
195         } elsif  ($tag eq '') {
196                 $subfield_data{marc_value}="<input type=\"hidden\" name=\"field_value\" value=\"$value\">";
197         } elsif  ($tagslib->{$tag}->{$subfield}->{'hidden'}) {
198                 $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"80\" maxlength=\"255\" DISABLE READONLY>";
199         # it's a standard field
200         } else {
201                 if (length($value) >100) {
202                         $subfield_data{marc_value}="<textarea name=\"field_value\" cols=\"80\" rows=\"5\" >$value</textarea>";
203                 } else {
204                         $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"80\">"; #"
205                 }
206         }
207         return \%subfield_data;
208 }
209
210 sub build_tabs ($$$$) {
211     my($template, $record, $dbh,$encoding) = @_;
212     # fill arrays
213     my @loop_data =();
214     my $tag;
215     my $i=0;
216         my $authorised_values_sth = $dbh->prepare("select authorised_value,lib
217                 from authorised_values
218                 where category=? order by lib");
219
220 # loop through each tab 0 through 9
221         for (my $tabloop = 0; $tabloop <= 9; $tabloop++) {
222                 my @loop_data = ();
223                 foreach my $tag (sort(keys (%{$tagslib}))) {
224                         my $indicator;
225         # if MARC::Record is not empty => use it as master loop, then add missing subfields that should be in the tab.
226         # if MARC::Record is empty => use tab as master loop.
227                         if ($record ne -1 && ($record->field($tag) || $tag eq '000')) {
228                                 my @fields;
229                                 if ($tag ne '000') {
230                                         @fields = $record->field($tag);
231                                 } else {
232                                         push @fields,$record->leader();
233                                 }
234                                 foreach my $field (@fields)  {
235                                         my @subfields_data;
236                                         if ($tag<10) {
237                                                 my ($value,$subfield);
238                                                 if ($tag ne '000') {
239                                                         $value=$field->data();
240                                                         $subfield="@";
241                                                 } else {
242                                                         $value = $field;
243                                                         $subfield='@';
244                                                 }
245                                                 next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
246                                                 next if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'biblio.biblionumber');
247                                                 push(@subfields_data, &create_input($tag,$subfield,char_decode($value,$encoding),$i,$tabloop,$record,$authorised_values_sth));
248                                                 $i++;
249                                         } else {
250                                                 my @subfields=$field->subfields();
251                                                 foreach my $subfieldcount (0..$#subfields) {
252                                                         my $subfield=$subfields[$subfieldcount][0];
253                                                         my $value=$subfields[$subfieldcount][1];
254                                                         next if (length $subfield !=1);
255                                                         next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
256                                                         push(@subfields_data, &create_input($tag,$subfield,char_decode($value,$encoding),$i,$tabloop,$record,$authorised_values_sth));
257                                                         $i++;
258                                                 }
259                                         }
260 # now, loop again to add parameter subfield that are not in the MARC::Record
261                                         foreach my $subfield (sort( keys %{$tagslib->{$tag}})) {
262                                                 next if (length $subfield !=1);
263                                                 next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
264                                                 next if ($tag<10);
265                                                 next if (defined($field->subfield($subfield)));
266                                                 push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
267                                                 $i++;
268                                         }
269                                         if ($#subfields_data >= 0) {
270                                                 my %tag_data;
271                                                 $tag_data{tag} = $tag;
272                                                 $tag_data{tag_lib} = $tagslib->{$tag}->{lib};
273                                                 $tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
274                                                 $tag_data{indicator} = $record->field($tag)->indicator(1). $record->field($tag)->indicator(2) if ($tag>=10);
275                                                 $tag_data{subfield_loop} = \@subfields_data;
276                                                 push (@loop_data, \%tag_data);
277                                         }
278 # If there is more than 1 field, add an empty hidden field as separator.
279                                         if ($#fields >1) {
280                                                 my @subfields_data;
281                                                 my %tag_data;
282                                                 push(@subfields_data, &create_input('','','',$i,$tabloop,$record,$authorised_values_sth));
283                                                 $tag_data{tag} = '';
284                                                 $tag_data{tag_lib} = '';
285                                                 $tag_data{indicator} = '';
286                                                 $tag_data{subfield_loop} = \@subfields_data;
287                                                 push (@loop_data, \%tag_data);
288                                                 $i++;
289                                         }
290                                 }
291         # if breeding is empty
292                         } else {
293                                 my @subfields_data;
294                                 foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
295                                         next if (length $subfield !=1);
296                                         next if ($tagslib->{$tag}->{$subfield}->{tab} ne $tabloop);
297                                         push(@subfields_data, &create_input($tag,$subfield,'',$i,$tabloop,$record,$authorised_values_sth));
298                                         $i++;
299                                 }
300                                 if ($#subfields_data >= 0) {
301                                         my %tag_data;
302                                         $tag_data{tag} = $tag;
303                                         $tag_data{tag_lib} = $tagslib->{$tag}->{lib};
304                                         $tag_data{repeatable} = $tagslib->{$tag}->{repeatable};
305                                         $tag_data{indicator} = $indicator;
306                                         $tag_data{subfield_loop} = \@subfields_data;
307                                         push (@loop_data, \%tag_data);
308                                 }
309                         }
310                 }
311                 $template->param($tabloop."XX" =>\@loop_data);
312         }
313 }
314
315
316 sub build_hidden_data () {
317     # build hidden data =>
318     # we store everything, even if we show only requested subfields.
319
320     my @loop_data =();
321     my $i=0;
322     foreach my $tag (keys %{$tagslib}) {
323         my $previous_tag = '';
324
325         # loop through each subfield
326         foreach my $subfield (keys %{$tagslib->{$tag}}) {
327             next if ($subfield eq 'lib');
328             next if ($subfield eq 'tab');
329             next if ($subfield eq 'mandatory');
330                 next if ($subfield eq 'repeatable');
331             next if ($tagslib->{$tag}->{$subfield}->{'tab'}  ne "-1");
332             my %subfield_data;
333             $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
334             $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
335             $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
336             $subfield_data{marc_value}="<input type=\"hidden\" name=\"field_value[]\">";
337             push(@loop_data, \%subfield_data);
338             $i++
339         }
340     }
341 }
342
343
344 # ======================== 
345 #          MAIN 
346 #=========================
347 my $input = new CGI;
348 my $error = $input->param('error');
349 my $oldbiblionumber=$input->param('oldbiblionumber'); # if bib exists, it's a modif, not a new biblio.
350 my $breedingid = $input->param('breedingid');
351 my $z3950 = $input->param('z3950');
352 my $op = $input->param('op');
353 my $frameworkcode = $input->param('frameworkcode');
354 my $dbh = C4::Context->dbh;
355 my $bibid;
356
357
358 if ($oldbiblionumber) {
359         $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$oldbiblionumber);
360         # find framework type
361         $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode));
362 }else {
363         $bibid = $input->param('bibid');
364         $frameworkcode = &MARCfind_frameworkcode($dbh,$bibid) if ($bibid and not ($frameworkcode));
365 }
366 $frameworkcode='' if ($frameworkcode eq 'Default');
367 my ($template, $loggedinuser, $cookie)
368     = get_template_and_user({template_name => "acqui.simple/addbiblio.tmpl",
369                              query => $input,
370                              type => "intranet",
371                              authnotrequired => 0,
372                              flagsrequired => {editcatalogue => 1},
373                              debug => 1,
374                              });
375
376 #Getting the list of all frameworks
377 my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from biblio_framework");
378 $queryfwk->execute;
379 my %select_fwk;
380 my @select_fwk;
381 my $curfwk;
382 push @select_fwk,"Default";
383 $select_fwk{"Default"} = "Default";
384 while (my ($description, $fwk) =$queryfwk->fetchrow) {
385         push @select_fwk, $fwk;
386         $select_fwk{$fwk} = $description;
387 }
388 $curfwk=$frameworkcode;
389 my $framework=CGI::scrolling_list( -name     => 'Frameworks',
390                         -id => 'Frameworks',
391                         -default => $curfwk,
392                         -OnChange => 'Changefwk(this);',
393                         -values   => \@select_fwk,
394                         -labels   => \%select_fwk,
395                         -size     => 1,
396                         -multiple => 0 );
397 $template->param( framework => $framework);
398
399 $tagslib = &MARCgettagslib($dbh,1,$frameworkcode);
400 my $record=-1;
401 my $encoding="";
402 $record = MARCgetbiblio($dbh,$bibid) if ($bibid);
403 ($record,$encoding) = MARCfindbreeding($dbh,$breedingid) if ($breedingid);
404
405 $is_a_modif=0;
406 my ($oldbiblionumtagfield,$oldbiblionumtagsubfield);
407 my ($oldbiblioitemnumtagfield,$oldbiblioitemnumtagsubfield,$bibitem,$oldbiblioitemnumber);
408 if ($bibid) {
409         $is_a_modif=1;
410         # if it's a modif, retrieve old biblio and bibitem numbers for the future modification of old-DB.
411         ($oldbiblionumtagfield,$oldbiblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber",$frameworkcode);
412         ($oldbiblioitemnumtagfield,$oldbiblioitemnumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblioitems.biblioitemnumber",$frameworkcode);
413         # search biblioitems value
414         my $sth=$dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
415         $sth->execute($oldbiblionumber);
416         ($oldbiblioitemnumber) = $sth->fetchrow;
417 }
418 #------------------------------------------------------------------------------------------------------------------------------
419 if ($op eq "addbiblio") {
420 #------------------------------------------------------------------------------------------------------------------------------
421         # rebuild
422         my @tags = $input->param('tag');
423         my @subfields = $input->param('subfield');
424         my @values = $input->param('field_value');
425         # build indicator hash.
426         my @ind_tag = $input->param('ind_tag');
427         my @indicator = $input->param('indicator');
428         my %indicators;
429         for (my $i=0;$i<=$#ind_tag;$i++) {
430                 $indicators{$ind_tag[$i]} = $indicator[$i];
431         }
432         my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
433         # check for a duplicate
434         my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);
435         my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
436         # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
437         if (!$duplicatebiblionumber or $confirm_not_duplicate) {
438                 # MARC::Record built => now, record in DB
439                 my $oldbibnum;
440                 my $oldbibitemnum;
441                 if ($is_a_modif) {
442                         NEWmodbiblioframework($dbh,$bibid,$frameworkcode);
443                         NEWmodbiblio($dbh,$record,$bibid,$frameworkcode);
444                         logaction($loggedinuser,"acqui.simple","modify",$oldbiblionumber,"record : ".$record->as_formatted) if (C4::Context->preference("Activate_Log"));
445                 } else {
446                         ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record,$frameworkcode);
447                         logaction($loggedinuser,"acqui.simple","add",$oldbibnum,"record : ".$record->as_formatted) if (C4::Context->preference("Activate_Log"));
448                 }
449         # now, redirect to additem page
450                 print $input->redirect("additem.pl?bibid=$bibid&frameworkcode=$frameworkcode");
451                 exit;
452         } else {
453         # it may be a duplicate, warn the user and do nothing
454                 build_tabs ($template, $record, $dbh,$encoding);
455                 build_hidden_data;
456                 $template->param(
457                         oldbiblionumber             => $oldbiblionumber,
458                         bibid                       => $bibid,
459                         oldbiblionumtagfield        => $oldbiblionumtagfield,
460                         oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
461                         oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
462                         oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
463                         oldbiblioitemnumber         => $oldbiblioitemnumber,
464                         duplicatebiblionumber           => $duplicatebiblionumber,
465                         duplicatebibid                          => $duplicatebibid,
466                         duplicatetitle                          => $duplicatetitle,
467                          );
468         }
469 #------------------------------------------------------------------------------------------------------------------------------
470 } elsif ($op eq "addfield") {
471 #------------------------------------------------------------------------------------------------------------------------------
472         my $addedfield = $input->param('addfield_field');
473         my @tags = $input->param('tag');
474         my @subfields = $input->param('subfield');
475         my @values = $input->param('field_value');
476         # build indicator hash.
477         my @ind_tag = $input->param('ind_tag');
478         my @indicator = $input->param('indicator');
479         my %indicators;
480         for (my $i=0;$i<=$#ind_tag;$i++) {
481                 $indicators{$ind_tag[$i]} = $indicator[$i];
482         }
483         my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
484         # adding an empty field
485         my $field = MARC::Field->new("$addedfield",'','','a'=> "");
486         $record->append_fields($field);
487         build_tabs ($template, $record, $dbh,$encoding);
488         build_hidden_data;
489         $template->param(
490                 oldbiblionumber             => $oldbiblionumber,
491                 bibid                       => $bibid,
492                 oldbiblionumtagfield        => $oldbiblionumtagfield,
493                 oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
494                 oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
495                 oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
496                 oldbiblioitemnumber         => $oldbiblioitemnumber );
497 } elsif ($op eq "delete") {
498 #------------------------------------------------------------------------------------------------------------------------------
499         &NEWdelbiblio($dbh,$bibid);
500         logaction($loggedinuser,"acqui.simple","del",$bibid,"") if (logstatus);
501         
502         print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=/cgi-bin/koha/search.marc/search.pl?type=intranet\"></html>";
503         exit;
504 #------------------------------------------------------------------------------------------------------------------------------logaction($loggedinuser,"acqui.simple","add","biblionumber :$oldbibnum");
505 #------------------------------------------------------------------------------------------------------------------------------
506 } else {
507 #------------------------------------------------------------------------------------------------------------------------------
508         # If we're in a duplication case, we have to set to "" the bibid and biblionumber
509         # as we'll save the biblio as a new one.
510         if ($op eq "duplicate")
511         {
512                 $bibid = "";
513                 $oldbiblionumber= "";
514         }
515  
516         build_tabs ($template, $record, $dbh,$encoding);
517         build_hidden_data;
518         $template->param(
519                 oldbiblionumber             => $oldbiblionumber,
520                 bibid                       => $bibid,
521                 oldbiblionumtagfield        => $oldbiblionumtagfield,
522                 oldbiblionumtagsubfield     => $oldbiblionumtagsubfield,
523                 oldbiblioitemnumtagfield    => $oldbiblioitemnumtagfield,
524                 oldbiblioitemnumtagsubfield => $oldbiblioitemnumtagsubfield,
525                 oldbiblioitemnumber         => $oldbiblioitemnumber,
526                 );
527 }
528 $template->param(
529                 frameworkcode => $frameworkcode,
530                 itemtype => $frameworkcode # HINT: if the library has itemtype = framework, itemtype is auto filled !
531                 );
532 output_html_with_http_headers $input, $cookie, $template->output;