Bug 32336: (QA follow-up) Use $metadata->schema
[srvgit] / authorities / authorities.pl
1 #!/usr/bin/perl
2
3
4 # Copyright 2000-2002 Katipo Communications
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21 use Modern::Perl;
22
23 use CGI qw ( -utf8 );
24 use C4::Auth qw( get_template_and_user );
25 use C4::Output qw( output_html_with_http_headers );
26 use C4::AuthoritiesMarc qw( AddAuthority ModAuthority GetAuthority GetTagsLabels GetAuthMARCFromKohaField FindDuplicateAuthority );
27 use C4::Context;
28 use Date::Calc qw( Today );
29 use MARC::File::USMARC;
30 use MARC::File::XML;
31 use C4::Biblio qw( TransformHtmlToMarc );
32 use Koha::Authority::Types;
33 use Koha::Import::Records;
34 use Koha::ItemTypes;
35 use vars qw( $tagslib);
36 use vars qw( $authorised_values_sth);
37 use vars qw( $is_a_modif );
38
39 our($authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950);
40
41 =head1 FUNCTIONS
42
43 =over
44
45 =item build_authorized_values_list
46
47 builds list, depending on authorised value...
48
49 =cut
50
51 sub build_authorized_values_list {
52     my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_;
53
54     my @authorised_values;
55     my %authorised_lib;
56
57     my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
58     push @authorised_values, q{} unless $tagslib->{$tag}->{$subfield}->{mandatory} && $value;
59
60     if ( $category eq "branches" ) {
61         my $sth = $dbh->prepare( "select branchcode,branchname from branches order by branchname" );
62         $sth->execute;
63         while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
64             push @authorised_values, $branchcode;
65             $authorised_lib{$branchcode} = $branchname;
66         }
67     }
68     elsif ( $category eq "itemtypes" ) {
69         my $itemtypes = Koha::ItemTypes->search_with_localization;
70         while ( my $itemtype = $itemtypes->next ) {
71             push @authorised_values, $itemtype->itemtype;
72             $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
73         }
74     }
75     else { # "true" authorised value
76         $authorised_values_sth->execute(
77             $tagslib->{$tag}->{$subfield}->{authorised_value}
78         );
79         while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
80             push @authorised_values, $value;
81             $authorised_lib{$value} = $lib;
82         }
83     }
84
85     return {
86         type     => 'select',
87         id       => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
88         name     => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
89         values   => \@authorised_values,
90         labels   => \%authorised_lib,
91         default  => $value,
92         ( ( grep { $_ eq $category } ( qw(branches itemtypes cn_source) ) ) ? () : ( category => $category ) ),
93     };
94 }
95
96 =item create_input
97
98 builds the <input ...> entry for a subfield.
99
100 =cut
101
102 sub create_input {
103     my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth, $cgi ) = @_;
104
105     my $index_subfield = CreateKey(); # create a specifique key for each subfield
106
107     # determine maximum length; 9999 bytes per ISO 2709 except for leader and MARC21 008
108     my $max_length = 9999;
109     if ($tag eq '000') {
110         $max_length = 24;
111     } elsif ($tag eq '008' and C4::Context->preference('marcflavour') eq 'MARC21')  {
112         $max_length = 40;
113     }
114
115     # Apply optional framework default value when it is a new record,
116     # or when editing as new (duplicating a record),
117     # based on the ApplyFrameworkDefaults setting.
118     # Substitute date parts, user name
119     my $applydefaults = C4::Context->preference('ApplyFrameworkDefaults');
120     if ( $value eq '' && (
121         ( $applydefaults =~ /new/ && !$cgi->param('authid') ) ||
122         ( $applydefaults =~ /duplicate/ && $cgi->param('op') eq 'duplicate' ) ||
123         ( $applydefaults =~ /imported/ && $cgi->param('breedingid') )
124     ) ) {
125         $value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
126         if (!defined $value) {
127             $value = q{};
128         }
129
130         # get today date & replace YYYY, MM, DD if provided in the default value
131         my ( $year, $month, $day ) = Today();
132         $month = sprintf( "%02d", $month );
133         $day   = sprintf( "%02d", $day );
134         $value =~ s/YYYY/$year/g;
135         $value =~ s/MM/$month/g;
136         $value =~ s/DD/$day/g;
137     }
138     my $dbh = C4::Context->dbh;
139
140     # map '@' as "subfield" label for fixed fields
141     # to something that's allowed in a div id.
142     my $id_subfield = $subfield;
143     $id_subfield = "00" if $id_subfield eq "@";
144
145     my %subfield_data = (
146         tag        => $tag,
147         subfield   => $id_subfield,
148         marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
149         tag_mandatory  => $tagslib->{$tag}->{mandatory},
150         mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
151         repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
152         kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
153         index          => $index_tag,
154         id             => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
155         value          => $value,
156         random         => CreateKey(),
157     );
158
159     if(exists $mandatory_z3950->{$tag.$subfield}){
160         $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
161     }
162     
163     $subfield_data{visibility} = "display:none;"
164         if( $tagslib->{$tag}->{$subfield}->{hidden} and $value ne ''
165             or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory})
166         );
167     
168     # it's an authorised field
169     if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
170         $subfield_data{marc_value} =
171         build_authorized_values_list( $tag, $subfield, $value, $dbh,
172             $authorised_values_sth,$index_tag,$index_subfield );
173
174     # it's a thesaurus / authority field
175     }
176     elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
177         $subfield_data{marc_value} = {
178             type         => 'text1',
179             id           => $subfield_data{id},
180             name         => $subfield_data{id},
181             value        => $value,
182             authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode},
183         };
184     }
185     elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { # plugin
186         require Koha::FrameworkPlugin;
187         my $plugin = Koha::FrameworkPlugin->new({
188             name => $tagslib->{$tag}->{$subfield}->{'value_builder'},
189         });
190         my $pars=  { dbh => $dbh, record => $rec, tagslib =>$tagslib,
191             id => $subfield_data{id} };
192         $plugin->build( $pars );
193         if( !$plugin->errstr ) {
194             $subfield_data{marc_value} = {
195                 type       => 'text2',
196                 id        => $subfield_data{id},
197                 name      => $subfield_data{id},
198                 value     => $value,
199                 maxlength => $max_length,
200                 javascript => $plugin->javascript,
201                 noclick    => $plugin->noclick,
202             };
203         } else { # warn and supply default field
204             warn $plugin->errstr;
205             $subfield_data{marc_value} = {
206                 type      => 'text',
207                 id        => $subfield_data{id},
208                 name      => $subfield_data{id},
209                 value     => $value,
210                 maxlength => $max_length,
211             };
212         }
213     }
214     # it's an hidden field
215     elsif ( $tag eq '' ) {
216         $subfield_data{marc_value} = {
217             type      => 'hidden',
218             id        => $subfield_data{id},
219             name      => $subfield_data{id},
220             value     => $value,
221             maxlength => $max_length,
222         }
223     }
224     elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) {
225         $subfield_data{marc_value} = {
226             type => 'text',
227             id        => $subfield_data{id},
228             name      => $subfield_data{id},
229             value     => $value,
230             maxlength => $max_length,
231         };
232
233         # it's a standard field
234     }
235     else {
236         if (
237             length($value) > 100
238             or
239             ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300
240                 and $tag < 400 && $subfield eq 'a' )
241             or (    $tag >= 600
242                 and $tag < 700
243                 && C4::Context->preference("marcflavour") eq "MARC21" )
244         )
245         {
246             $subfield_data{marc_value} = {
247                 type => 'textarea',
248                 id        => $subfield_data{id},
249                 name      => $subfield_data{id},
250                 value     => $value,
251                 maxlength => $max_length,
252             };
253
254         }
255         else {
256             $subfield_data{marc_value} = {
257                 type => 'text',
258                 id        => $subfield_data{id},
259                 name      => $subfield_data{id},
260                 value     => $value,
261                 maxlength => $max_length,
262             };
263
264         }
265     }
266     if ($cgi->param('tagreport') && $subfield_data{tag} == $cgi->param('tagreport')) {
267         $subfield_data{marc_value}{value} = $cgi->param('tag'. $cgi->param('tagbiblio') . 'subfield' . $subfield_data{subfield});
268     }
269     $subfield_data{'index_subfield'} = $index_subfield;
270     return \%subfield_data;
271 }
272
273 =item format_indicator
274
275 Translate indicator value for output form - specifically, map
276 indicator = ' ' to ''.  This is for the convenience of a cataloger
277 using a mouse to select an indicator input.
278
279 =cut
280
281 sub format_indicator {
282     my $ind_value = shift;
283     return '' if not defined $ind_value;
284     return '' if $ind_value eq ' ';
285     return $ind_value;
286 }
287
288 =item CreateKey
289
290 Create a random value to set it into the input name
291
292 =cut
293
294 sub CreateKey {
295     return int(rand(1000000));
296 }
297
298 =item GetMandatoryFieldZ3950
299
300     This function returns a hashref which contains all mandatory field
301     to search with z3950 server.
302
303 =cut
304
305 sub GetMandatoryFieldZ3950 {
306     my $authtypecode = shift;
307     if ( C4::Context->preference('marcflavour') eq 'MARC21' ){
308         return {
309             '100a' => 'authorpersonal',
310             '110a' => 'authorcorp',
311             '111a' => 'authormeetingcon',
312             '130a' => 'uniformtitle',
313             '150a' => 'subject',
314         };
315     }else{
316         return {
317             '200a' => 'authorpersonal',
318             '210a' => 'authorcorp', #210 in UNIMARC is used for both corporation and meeting
319             '230a' => 'uniformtitle',
320         };
321     }
322 }
323
324 sub build_tabs {
325     my ( $template, $record, $dbh, $input ) = @_;
326
327     # fill arrays
328     my @loop_data = ();
329     my $tag;
330
331     my $authorised_values_sth = $dbh->prepare(
332         "SELECT authorised_value,lib
333         FROM authorised_values
334         WHERE category=? ORDER BY lib"
335     );
336     
337     # in this array, we will push all the 10 tabs
338     # to avoid having 10 tabs in the template : they will all be in the same BIG_LOOP
339     my @BIG_LOOP;
340     my %seen;
341     my @tab_data; # all tags to display
342     
343     foreach my $used ( keys %$tagslib ){
344         push @tab_data,$used if not $seen{$used};
345         $seen{$used}++;
346     }
347         
348     my $max_num_tab=9;
349     # loop through each tab 0 through 9
350     for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
351         my @loop_data = (); #innerloop in the template.
352         my $i = 0;
353         foreach my $tag (sort @tab_data) {
354             $i++;
355             next if ! $tag;
356             my ($indicator1, $indicator2);
357             my $index_tag = CreateKey;
358
359             # if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
360             # if MARC::Record is empty => use tab as master loop.
361             if ( $record && ( $record->field($tag) || $tag eq '000' ) ) {
362                 my @fields;
363                 if ( $tag ne '000' ) {
364                                 @fields = $record->field($tag);
365                 }
366                 else {
367                 push @fields, $record->leader(); # if tag == 000
368                 }
369                 # loop through each field
370                 foreach my $field (@fields) {
371                     
372                     my @subfields_data;
373                     if ( $tag < 10 ) {
374                         my ( $value, $subfield );
375                         if ( $tag ne '000' ) {
376                             $value    = $field->data();
377                             $subfield = "@";
378                         }
379                         else {
380                             $value    = $field;
381                             $subfield = '@';
382                         }
383                         next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
384                         next if $tagslib->{$tag}->{$subfield}->{hidden} && $subfield ne '9';
385                         push(
386                             @subfields_data,
387                             &create_input(
388                                 $tag, $subfield, $value, $index_tag, $record,
389                                 $authorised_values_sth,$input
390                             )
391                         );
392                     }
393                     else {
394                         my @subfields = $field->subfields();
395                         foreach my $subfieldcount ( 0 .. $#subfields ) {
396                             my $subfield = $subfields[$subfieldcount][0];
397                             my $value    = $subfields[$subfieldcount][1];
398                             next if ( length $subfield != 1 );
399                             next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
400                             next if $tagslib->{$tag}->{$subfield}->{hidden} && $subfield ne '9';
401                             push(
402                                 @subfields_data,
403                                 &create_input(
404                                     $tag, $subfield, $value, $index_tag,
405                                     $record, $authorised_values_sth,$input
406                                 )
407                             );
408                         }
409                     }
410
411                     # now, loop again to add parameter subfield that are not in the MARC::Record
412                     foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) )
413                     {
414                         next if ( length $subfield != 1 );
415                         next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
416                         next if ( $tag < 10 );
417                         next if $tagslib->{$tag}->{$subfield}->{hidden} && $subfield ne '9';
418                         next if ( defined( $field->subfield($subfield) ) );
419                         push(
420                             @subfields_data,
421                             &create_input(
422                                 $tag, $subfield, '', $index_tag, $record,
423                                 $authorised_values_sth,$input
424                             )
425                         );
426                     }
427                     if ( $#subfields_data >= 0 ) {
428                         # build the tag entry.
429                         # note that the random() field is mandatory. Otherwise, on repeated fields, you'll 
430                         # have twice the same "name" value, and cgi->param() will return only one, making
431                         # all subfields to be merged in a single field.
432                         my %tag_data = (
433                             tag           => $tag,
434                             index         => $index_tag,
435                             tag_lib       => $tagslib->{$tag}->{lib},
436                             repeatable       => $tagslib->{$tag}->{repeatable},
437                             mandatory       => $tagslib->{$tag}->{mandatory},
438                             subfield_loop => \@subfields_data,
439                             fixedfield    => ($tag < 10)?(1):(0),
440                             random        => CreateKey,
441                         );
442                         if ($tag >= 10){ # no indicator for theses tag
443                             $tag_data{indicator1} = format_indicator($field->indicator(1)),
444                             $tag_data{indicator2} = format_indicator($field->indicator(2)),
445                         }
446                         push( @loop_data, \%tag_data );
447                     }
448                 } # foreach $field end
449
450             # if breeding is empty
451             }
452             else {
453                 my @subfields_data;
454                 foreach my $subfield (
455                     sort { $a->{display_order} <=> $b->{display_order} || $a->{subfield} cmp $b->{subfield} }
456                     grep { ref($_) && %$_ } # Not a subfield (values for "important", "lib", "mandatory", etc.) or empty
457                     values %{ $tagslib->{$tag} } )
458                 {
459                     next if $subfield->{hidden} && $subfield->{subfield} ne '9';
460                     next if ( $subfield->{tab} ne $tabloop );
461                     push(
462                         @subfields_data,
463                         &create_input(
464                             $tag, $subfield->{subfield}, '', $index_tag, $record,
465                             $authorised_values_sth,$input
466                         )
467                     );
468                 }
469                 if ( $#subfields_data >= 0 ) {
470                     my %tag_data = (
471                         tag              => $tag,
472                         index            => $index_tag,
473                         tag_lib          => $tagslib->{$tag}->{lib},
474                         repeatable       => $tagslib->{$tag}->{repeatable},
475                         mandatory       => $tagslib->{$tag}->{mandatory},
476                         indicator1       => $indicator1,
477                         indicator2       => $indicator2,
478                         subfield_loop    => \@subfields_data,
479                         tagfirstsubfield => $subfields_data[0],
480                         fixedfield       => ($tag < 10)?(1):(0)
481                     );
482                     
483                     push @loop_data, \%tag_data ;
484                 }
485             }
486         }
487         if ( $#loop_data >= 0 ) {
488             push @BIG_LOOP, {
489                 number    => $tabloop,
490                 innerloop => \@loop_data,
491             };
492         }
493     }
494     $template->param( BIG_LOOP => \@BIG_LOOP );
495 }
496
497
498 sub build_hidden_data {
499     # build hidden data =>
500     # we store everything, even if we show only requested subfields.
501
502     my @loop_data =();
503     my $i=0;
504     foreach my $tag (keys %{$tagslib}) {
505         my $previous_tag = '';
506
507         # loop through each subfield
508         foreach my $subfield (keys %{$tagslib->{$tag}}) {
509             next if ($subfield eq 'lib');
510             next if ($subfield eq 'tab');
511             next if ($subfield eq 'mandatory');
512                 next if ($subfield eq 'repeatable');
513             next if ($tagslib->{$tag}->{$subfield}->{'tab'}  ne "-1");
514             my %subfield_data;
515             $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
516             $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
517             $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
518             $subfield_data{marc_value} = {
519                 type => 'hidden_simple',
520                 name => 'field_value[]',
521             };
522             push(@loop_data, \%subfield_data);
523             $i++
524         }
525     }
526 }
527
528 =back
529
530 =cut
531
532
533 # ======================== 
534 #          MAIN 
535 #=========================
536 my $input = CGI->new;
537 my $z3950 = $input->param('z3950');
538 my $error = $input->param('error');
539 my $authid=$input->param('authid'); # if authid exists, it's a modif, not a new authority.
540 my $op = $input->param('op');
541 my $nonav = $input->param('nonav');
542 my $myindex = $input->param('index');
543 my $linkid=$input->param('linkid');
544 my $authtypecode = $input->param('authtypecode');
545 my $breedingid    = $input->param('breedingid');
546
547
548 my $dbh = C4::Context->dbh;
549 if(!$authtypecode) {
550     $authtypecode = $authid ? Koha::Authorities->find($authid)->authtypecode : '';
551 }
552
553 my $authobj = Koha::Authorities->find($authid);
554 my $count = $authobj ? $authobj->get_usage_count : 0;
555
556 my ($template, $loggedinuser, $cookie)
557     = get_template_and_user({template_name => "authorities/authorities.tt",
558                             query => $input,
559                             type => "intranet",
560                             flagsrequired => {editauthorities => 1},
561                             });
562 $template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid, count=>$count);
563
564 $tagslib = GetTagsLabels(1,$authtypecode);
565 $mandatory_z3950 = GetMandatoryFieldZ3950($authtypecode);
566
567 my $record;
568 if ($breedingid) {
569     my $import_record = Koha::Import::Records->find($breedingid);
570     if ($import_record) {
571         $record = $import_record->get_marc_record();
572     }
573 } elsif ($authid) {
574     $record = GetAuthority($authid);
575 }
576
577 my ($oldauthnumtagfield,$oldauthnumtagsubfield);
578 my ($oldauthtypetagfield,$oldauthtypetagsubfield);
579 $is_a_modif=0;
580 if ($authid) {
581     $is_a_modif=1;
582     ($oldauthnumtagfield,$oldauthnumtagsubfield) = GetAuthMARCFromKohaField("auth_header.authid",$authtypecode);
583     ($oldauthtypetagfield,$oldauthtypetagsubfield) = GetAuthMARCFromKohaField("auth_header.authtypecode",$authtypecode);
584 }
585 $op ||= q{};
586 #------------------------------------------------------------------------------------------------------------------------------
587 if ($op eq "add") {
588 #------------------------------------------------------------------------------------------------------------------------------
589     # rebuild
590     my @tags = $input->multi_param('tag');
591     my @subfields = $input->multi_param('subfield');
592     my @values = $input->multi_param('field_value');
593     # build indicator hash.
594     my @ind_tag = $input->multi_param('ind_tag');
595     my @indicator = $input->multi_param('indicator');
596     my $record = TransformHtmlToMarc($input, 0);
597
598     my ($duplicateauthid,$duplicateauthvalue);
599      ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
600     my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
601     # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
602     if (!$duplicateauthid or $confirm_not_duplicate) {
603         if ($is_a_modif ) {     
604             ModAuthority($authid,$record,$authtypecode);
605         } else {
606             ($authid) = AddAuthority($record,$authid,$authtypecode);
607         }
608         if ($myindex) {
609             print $input->redirect("blinddetail-biblio-search.pl?authid=$authid&index=$myindex");
610         } else {
611             print $input->redirect("detail.pl?authid=$authid");
612         }
613         exit;
614     } else {
615     # it may be a duplicate, warn the user and do nothing
616         build_tabs($template, $record, $dbh, $input);
617         build_hidden_data;
618         $template->param(authid =>$authid,
619                         duplicateauthid     => $duplicateauthid,
620                         duplicateauthvalue  => $duplicateauthvalue->{'authorized'}->[0]->{'heading'},
621                         );
622     }
623 } elsif ($op eq "delete") {
624 #------------------------------------------------------------------------------------------------------------------------------
625         DelAuthority({ authid => $authid });
626         if ($nonav){
627             print $input->redirect("auth_finder.pl");
628         }else{
629             print $input->redirect("authorities-home.pl?authid=0");
630         }
631                 exit;
632 } else {
633 if ($op eq "duplicate")
634         {
635                 $authid = "";
636         }
637         build_tabs ($template, $record, $dbh, $input);
638         build_hidden_data;
639         $template->param(oldauthtypetagfield=>$oldauthtypetagfield, oldauthtypetagsubfield=>$oldauthtypetagsubfield,
640                         oldauthnumtagfield=>$oldauthnumtagfield, oldauthnumtagsubfield=>$oldauthnumtagsubfield,
641                         authid                      => $authid , authtypecode=>$authtypecode,   );
642 }
643
644 my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
645
646 my $type = $authority_types->find($authtypecode);
647 $template->param(
648     authority_types => $authority_types,
649     authtypecode    => $authtypecode,
650     authid          => $authid,
651     linkid          => $linkid,
652     authtypetext    => $type ? $type->authtypetext : "",
653     hide_marc       => C4::Context->preference('hide_marc'),
654 );
655 output_html_with_http_headers $input, $cookie, $template->output;