kohabug 2112 - add indicators to MARC display
[koha.git] / 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 under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA  02111-1307 USA
20
21 use strict;
22 use CGI;
23 use C4::Auth;
24 use C4::Output;
25 use C4::AuthoritiesMarc;
26 use C4::Context;
27 use C4::Koha; # XXX subfield_is_koha_internal_p
28 use Date::Calc qw(Today);
29 use MARC::File::USMARC;
30 use MARC::File::XML;
31 use C4::Biblio;
32 use vars qw( $tagslib);
33 use vars qw( $authorised_values_sth);
34 use vars qw( $is_a_modif );
35
36 my $itemtype; # created here because it can be used in build_authorized_values_list sub
37 our($authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950);
38
39 =item build_authorized_values_list
40
41 =cut
42
43 sub build_authorized_values_list ($$$$$$$) {
44     my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_;
45
46     my @authorised_values;
47     my %authorised_lib;
48
49     # builds list, depending on authorised value...
50
51     #---- branch
52     if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
53         my $sth =
54         $dbh->prepare(
55             "select branchcode,branchname from branches order by branchname");
56         $sth->execute;
57         push @authorised_values, ""
58         unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
59
60         while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
61             push @authorised_values, $branchcode;
62             $authorised_lib{$branchcode} = $branchname;
63         }
64
65         #----- itemtypes
66     }
67     elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
68         my $sth =
69         $dbh->prepare(
70             "select itemtype,description from itemtypes order by description");
71         $sth->execute;
72         push @authorised_values, ""
73         unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
74         
75         my $itemtype;
76         
77         while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
78             push @authorised_values, $itemtype;
79             $authorised_lib{$itemtype} = $description;
80         }
81         $value = $itemtype unless ($value);
82
83         #---- "true" authorised value
84     }
85     else {
86         $authorised_values_sth->execute(
87             $tagslib->{$tag}->{$subfield}->{authorised_value} );
88
89         push @authorised_values, ""
90         unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
91
92         while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
93             push @authorised_values, $value;
94             $authorised_lib{$value} = $lib;
95         }
96     }
97     return CGI::scrolling_list(
98         -name     => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
99         -values   => \@authorised_values,
100         -default  => $value,
101         -labels   => \%authorised_lib,
102         -override => 1,
103         -size     => 1,
104         -multiple => 0,
105         -tabindex => 1,
106         -id       => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
107         -class    => "input_marceditor",
108     );
109 }
110
111
112 =item create_input
113 builds the <input ...> entry for a subfield.
114 =cut
115
116 sub create_input {
117     my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_;
118     
119     my $index_subfield = CreateKey(); # create a specifique key for each subfield
120
121     $value =~ s/"/&quot;/g;
122
123     # if there is no value provided but a default value in parameters, get it
124     unless ($value) {
125         $value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
126
127         # get today date & replace YYYY, MM, DD if provided in the default value
128         my ( $year, $month, $day ) = Today();
129         $month = sprintf( "%02d", $month );
130         $day   = sprintf( "%02d", $day );
131         $value =~ s/YYYY/$year/g;
132         $value =~ s/MM/$month/g;
133         $value =~ s/DD/$day/g;
134     }
135     my $dbh = C4::Context->dbh;
136     my %subfield_data = (
137         tag        => $tag,
138         subfield   => $subfield,
139         marc_lib   => substr( $tagslib->{$tag}->{$subfield}->{lib}, 0, 22 ),
140         marc_lib_plain => $tagslib->{$tag}->{$subfield}->{lib}, 
141         tag_mandatory  => $tagslib->{$tag}->{mandatory},
142         mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
143         repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
144         kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
145         index          => $index_tag,
146         id             => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
147         value          => $value,
148     );
149     if($subfield eq '@'){
150         $subfield_data{id} = "tag_".$tag."_subfield_00_".$index_tag."_".$index_subfield;
151     } else {
152         $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield;
153     }
154
155     if(exists $mandatory_z3950->{$tag.$subfield}){
156         $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
157     }
158     
159     $subfield_data{visibility} = "display:none;"
160         if (    ($tagslib->{$tag}->{$subfield}->{hidden} % 2 == 1) and $value ne ''
161             or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory})
162         );
163     
164     # it's an authorised field
165     if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
166         $subfield_data{marc_value} =
167         build_authorized_values_list( $tag, $subfield, $value, $dbh,
168             $authorised_values_sth,$index_tag,$index_subfield );
169
170     # it's a thesaurus / authority field
171     }
172     elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
173         $subfield_data{marc_value} =
174     "<input type=\"text\"
175                         id=\"".$subfield_data{id}."\"
176                         name=\"".$subfield_data{id}."\"
177     value=\"$value\"
178     class=\"input_marceditor\"
179     tabindex=\"1\"                     
180     disabled=\"disabled\"
181         readonly=\"readonly\" \/>
182     <span class=\"buttonDot\"
183         onclick=\"Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}')\">...</span>
184     ";
185     # it's a plugin field
186     }
187     elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
188
189         # opening plugin. Just check wether we are on a developper computer on a production one
190         # (the cgidir differs)
191         my $cgidir = C4::Context->intranetdir . "/cgi-bin/cataloguing/value_builder";
192         unless (-r $cgidir and -d $cgidir) {
193             $cgidir = C4::Context->intranetdir . "/cataloguing/value_builder";
194         }
195         my $plugin = $cgidir . "/" . $tagslib->{$tag}->{$subfield}->{'value_builder'};
196         do $plugin || die "Plugin Failed: ".$plugin;
197         my $extended_param = plugin_parameters( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
198         my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop );
199 #         my ( $function_name, $javascript,$extended_param );
200         
201         $subfield_data{marc_value} =
202             "<input tabindex=\"1\"
203                     type=\"text\"
204                     id=\"".$subfield_data{id}."\"
205                     size=\"67\"
206                     maxlength=\"255\" 
207                     name=\"".$subfield_data{id}."\"
208                     value=\"$value\"
209                     class=\"input_marceditor\"
210                     onfocus=\"Focus$function_name($index_tag)\"
211                     onblur=\"Blur$function_name($index_tag); \" \/>
212                     <a href=\"#\" class=\"buttonDot\" onclick=\"Clic$function_name('$subfield_data{id}'); return false;\" title=\"Tag Editor\">...</a>
213                     $javascript";
214         # it's an hidden field
215     }
216     elsif ( $tag eq '' ) {
217         $subfield_data{marc_value} =
218             "<input tabindex=\"1\"
219                     type=\"hidden\"
220                     id=\"".$subfield_data{id}."\"
221                     name=\"".$subfield_data{id}."\"
222                     size=\"67\"
223                     maxlength=\"255\" 
224                     value=\"$value\" \/>
225             ";
226     }
227     elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) {
228         $subfield_data{marc_value} =
229             "<input type=\"text\"
230                     id=\"".$subfield_data{id}."\"
231                     name=\"".$subfield_data{id}."\"
232                     class=\"input_marceditor\"
233                     tabindex=\"1\"
234                     size=\"67\"
235                     maxlength=\"255\" 
236                     value=\"$value\"
237             \/>";
238
239         # it's a standard field
240     }
241     else {
242         if (
243             length($value) > 100
244             or
245             ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300
246                 and $tag < 400 && $subfield eq 'a' )
247             or (    $tag >= 500
248                 and $tag < 600
249                 && C4::Context->preference("marcflavour") eq "MARC21" )
250         )
251         {
252             $subfield_data{marc_value} =
253                 "<textarea cols=\"70\"
254                         rows=\"4\"
255                         id=\"".$subfield_data{id}."\"
256                         name=\"".$subfield_data{id}."\"
257                         class=\"input_marceditor\"
258                         tabindex=\"1\"
259                         size=\"67\"
260                         maxlength=\"255\" 
261                         >$value</textarea>
262                 ";
263         }
264         else {
265             $subfield_data{marc_value} =
266                 "<input type=\"text\"
267                         id=\"".$subfield_data{id}."\"
268                         name=\"".$subfield_data{id}."\"
269                         value=\"$value\"
270                         tabindex=\"1\"
271                         size=\"67\"
272                         maxlength=\"255\" 
273                         class=\"input_marceditor\"
274                 \/>
275                 ";
276         }
277     }
278     $subfield_data{'index_subfield'} = $index_subfield;
279     return \%subfield_data;
280 }
281
282 =item format_indicator
283
284 Translate indicator value for output form - specifically, map
285 indicator = ' ' to ''.  This is for the convenience of a cataloger
286 using a mouse to select an indicator input.
287
288 =cut
289
290 sub format_indicator {
291     my $ind_value = shift;
292     return '' if not defined $ind_value;
293     return '' if $ind_value eq ' ';
294     return $ind_value;
295 }
296
297 =item CreateKey
298
299     Create a random value to set it into the input name
300
301 =cut
302
303 sub CreateKey(){
304     return int(rand(1000000));
305 }
306
307 sub build_tabs ($$$$$) {
308     my ( $template, $record, $dbh, $encoding,$input ) = @_;
309
310     # fill arrays
311     my @loop_data = ();
312     my $tag;
313
314     my $authorised_values_sth = $dbh->prepare(
315         "SELECT authorised_value,lib
316         FROM authorised_values
317         WHERE category=? ORDER BY lib"
318     );
319     
320     # in this array, we will push all the 10 tabs
321     # to avoid having 10 tabs in the template : they will all be in the same BIG_LOOP
322     my @BIG_LOOP;
323     my %seen;
324     my @tab_data; # all tags to display
325     
326     foreach my $used ( keys %$tagslib ){
327         push @tab_data,$used if not $seen{$used};
328         $seen{$used}++;
329     }
330         
331     my $max_num_tab=9;
332     # loop through each tab 0 through 9
333     for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
334         my @loop_data = (); #innerloop in the template.
335         my $i = 0;
336         foreach my $tag (sort @tab_data) {
337             $i++;
338             next if ! $tag;
339             my ($indicator1, $indicator2);
340             my $index_tag = CreateKey;
341
342             # if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
343             # if MARC::Record is empty => use tab as master loop.
344             if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) {
345                 my @fields;
346                 if ( $tag ne '000' ) {
347                                 @fields = $record->field($tag);
348                 }
349                 else {
350                 push @fields, $record->leader(); # if tag == 000
351                 }
352                 # loop through each field
353                 foreach my $field (@fields) {
354                     
355                     my @subfields_data;
356                     if ( $tag < 10 ) {
357                         my ( $value, $subfield );
358                         if ( $tag ne '000' ) {
359                             $value    = $field->data();
360                             $subfield = "@";
361                         }
362                         else {
363                             $value    = $field;
364                             $subfield = '@';
365                         }
366                         next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
367                         push(
368                             @subfields_data,
369                             &create_input(
370                                 $tag, $subfield, $value, $index_tag, $tabloop, $record,
371                                 $authorised_values_sth,$input
372                             )
373                         );
374                     }
375                     else {
376                         my @subfields = $field->subfields();
377                         foreach my $subfieldcount ( 0 .. $#subfields ) {
378                             my $subfield = $subfields[$subfieldcount][0];
379                             my $value    = $subfields[$subfieldcount][1];
380                             next if ( length $subfield != 1 );
381                             next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
382                             push(
383                                 @subfields_data,
384                                 &create_input(
385                                     $tag, $subfield, $value, $index_tag, $tabloop,
386                                     $record, $authorised_values_sth,$input
387                                 )
388                             );
389                         }
390                     }
391
392                     # now, loop again to add parameter subfield that are not in the MARC::Record
393                     foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) )
394                     {
395                         next if ( length $subfield != 1 );
396                         next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
397                         next if ( $tag < 10 );
398                         next
399                         if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 )
400                             or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 )
401                         );    #check for visibility flag
402                         next if ( defined( $field->subfield($subfield) ) );
403                         push(
404                             @subfields_data,
405                             &create_input(
406                                 $tag, $subfield, '', $index_tag, $tabloop, $record,
407                                 $authorised_values_sth,$input
408                             )
409                         );
410                     }
411                     if ( $#subfields_data >= 0 ) {
412                         # build the tag entry.
413                         # note that the random() field is mandatory. Otherwise, on repeated fields, you'll 
414                         # have twice the same "name" value, and cgi->param() will return only one, making
415                         # all subfields to be merged in a single field.
416                         my %tag_data = (
417                             tag           => $tag,
418                             index         => $index_tag,
419                             tag_lib       => $tagslib->{$tag}->{lib},
420                             repeatable       => $tagslib->{$tag}->{repeatable},
421                             subfield_loop => \@subfields_data,
422                             fixedfield    => ($tag < 10)?(1):(0),
423                             random        => CreateKey,
424                         );
425                         if ($tag >= 010){ # no indicator for theses tag
426                             $tag_data{indicator1} = format_indicator($field->indicator(1)),
427                             $tag_data{indicator2} = format_indicator($field->indicator(2)),
428                         }
429                         push( @loop_data, \%tag_data );
430                     }
431                 } # foreach $field end
432
433             # if breeding is empty
434             }
435             else {
436                 my @subfields_data;
437                 foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) ) {
438                     next if ( length $subfield != 1 );
439                     next if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -5 )
440                                 or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 4 ) )
441                             ;    #check for visibility flag
442                     next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
443                     push(
444                         @subfields_data,
445                         &create_input(
446                             $tag, $subfield, '', $index_tag, $tabloop, $record,
447                             $authorised_values_sth,$input
448                         )
449                     );
450                 }
451                 if ( $#subfields_data >= 0 ) {
452                     my %tag_data = (
453                         tag              => $tag,
454                         index            => $index_tag,
455                         tag_lib          => $tagslib->{$tag}->{lib},
456                         repeatable       => $tagslib->{$tag}->{repeatable},
457                         indicator1       => $indicator1,
458                         indicator2       => $indicator2,
459                         subfield_loop    => \@subfields_data,
460                         tagfirstsubfield => $subfields_data[0],
461                         fixedfield       => ($tag < 10)?(1):(0)
462                     );
463                     
464                     push @loop_data, \%tag_data ;
465                 }
466             }
467         }
468         if ( $#loop_data >= 0 ) {
469             push @BIG_LOOP, {
470                 number    => $tabloop,
471                 innerloop => \@loop_data,
472             };
473         }
474     }
475     $template->param( BIG_LOOP => \@BIG_LOOP );
476 }
477
478
479 sub build_hidden_data () {
480     # build hidden data =>
481     # we store everything, even if we show only requested subfields.
482
483     my @loop_data =();
484     my $i=0;
485     foreach my $tag (keys %{$tagslib}) {
486         my $previous_tag = '';
487
488         # loop through each subfield
489         foreach my $subfield (keys %{$tagslib->{$tag}}) {
490             next if ($subfield eq 'lib');
491             next if ($subfield eq 'tab');
492             next if ($subfield eq 'mandatory');
493                 next if ($subfield eq 'repeatable');
494             next if ($tagslib->{$tag}->{$subfield}->{'tab'}  ne "-1");
495             my %subfield_data;
496             $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib};
497             $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory};
498             $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
499             $subfield_data{marc_value}="<input type=\"hidden\" name=\"field_value[]\">";
500             push(@loop_data, \%subfield_data);
501             $i++
502         }
503     }
504 }
505
506 # ======================== 
507 #          MAIN 
508 #=========================
509 my $input = new CGI;
510 my $z3950 = $input->param('z3950');
511 my $error = $input->param('error');
512 my $authid=$input->param('authid'); # if authid exists, it's a modif, not a new authority.
513 my $op = $input->param('op');
514 my $nonav = $input->param('nonav');
515 my $myindex = $input->param('index');
516 my $linkid=$input->param('linkid');
517 my $authtypecode = $input->param('authtypecode');
518
519 my $dbh = C4::Context->dbh;
520 $authtypecode = &GetAuthTypeCode($authid) if !$authtypecode;
521
522 my ($template, $loggedinuser, $cookie)
523     = get_template_and_user({template_name => "authorities/authorities.tmpl",
524                             query => $input,
525                             type => "intranet",
526                             authnotrequired => 0,
527                             flagsrequired => {editauthorities => 1},
528                             debug => 1,
529                             });
530 $template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,);
531 $tagslib = GetTagsLabels(1,$authtypecode);
532 my $record=-1;
533 my $encoding="";
534 $record = GetAuthority($authid) if ($authid);
535 my ($oldauthnumtagfield,$oldauthnumtagsubfield);
536 my ($oldauthtypetagfield,$oldauthtypetagsubfield);
537 $is_a_modif=0;
538 if ($authid) {
539     $is_a_modif=1;
540     ($oldauthnumtagfield,$oldauthnumtagsubfield) = &GetAuthMARCFromKohaField("auth_header.authid",$authtypecode);
541     ($oldauthtypetagfield,$oldauthtypetagsubfield) = &GetAuthMARCFromKohaField("auth_header.authtypecode",$authtypecode);
542 }
543
544 #------------------------------------------------------------------------------------------------------------------------------
545 if ($op eq "add") {
546 #------------------------------------------------------------------------------------------------------------------------------
547     # rebuild
548     my @tags = $input->param('tag');
549     my @subfields = $input->param('subfield');
550     my @values = $input->param('field_value');
551     # build indicator hash.
552     my @ind_tag = $input->param('ind_tag');
553     my @indicator = $input->param('indicator');
554     my @params = $input->param();
555     my $record = TransformHtmlToMarc(\@params,$input);
556     if  (C4::Context->preference("marcflavour") eq "UNIMARC"){
557         unless ($record->field('100')){
558         use POSIX qw(strftime);
559         my $string = strftime( "%Y%m%d", localtime(time) );
560         # set 50 to position 26 is biblios, 13 if authorities
561         my $pos=13;
562         $string = sprintf( "%-*s", 35, $string );
563         substr( $string, $pos , 2, "50" );
564         $record->append_fields(MARC::Field->new('100','','',"a"=>$string));
565         }    
566     }
567
568     my ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
569     my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
570     # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
571     if (!$duplicateauthid or $confirm_not_duplicate) {
572         if ($is_a_modif ) {     
573             ModAuthority($authid,$record,$authtypecode,1);
574         } else {
575             ($authid) = AddAuthority($record,$authid,$authtypecode);
576         }
577         print $input->redirect("detail.pl?authid=$authid");
578         exit;
579     } else {
580     # it may be a duplicate, warn the user and do nothing
581         build_tabs($template, $record, $dbh, $encoding,$input);
582         build_hidden_data;
583         $template->param(authid =>$authid,
584                         duplicateauthid     => $duplicateauthid,
585                         duplicateauthvalue  => $duplicateauthvalue,
586                         );
587     }
588 } elsif ($op eq "delete") {
589 #------------------------------------------------------------------------------------------------------------------------------
590         &AUTHdelauthority($authid);
591         if ($nonav){
592             print $input->redirect("auth_finder.pl");
593         }else{
594             print $input->redirect("authorities-home.pl?authid=0");
595         }
596                 exit;
597 } else {
598 if ($op eq "duplicate")
599         {
600                 $authid = "";
601         }
602         build_tabs ($template, $record, $dbh,$encoding,$input);
603         build_hidden_data;
604         $template->param(oldauthtypetagfield=>$oldauthtypetagfield, oldauthtypetagsubfield=>$oldauthtypetagsubfield,
605                         oldauthnumtagfield=>$oldauthnumtagfield, oldauthnumtagsubfield=>$oldauthnumtagsubfield,
606                         authid                      => $authid , authtypecode=>$authtypecode,   );
607 }
608
609 $template->param(authid                       => $authid,
610                  authtypecode => $authtypecode,
611                  linkid=>$linkid,
612 );
613
614 my $authtypes = getauthtypes;
615 my @authtypesloop;
616 foreach my $thisauthtype (keys %$authtypes) {
617     my $selected = 1 if $thisauthtype eq $authtypecode;
618     my %row =(value => $thisauthtype,
619                 selected => $selected,
620                 authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
621             );
622     push @authtypesloop, \%row;
623 }
624
625 $template->param(authtypesloop => \@authtypesloop,
626                 authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
627                 hide_marc => C4::Context->preference('hide_marc'),
628                 );
629 output_html_with_http_headers $input, $cookie, $template->output;