Lines 930-1001
sub GetMarcStructure {
Link Here
|
930 |
return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; |
930 |
return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; |
931 |
} |
931 |
} |
932 |
|
932 |
|
933 |
# my $sth = $dbh->prepare( |
933 |
my $lib= ($forlibrarian?'liblibrarian':'IFNULL(libopac,liblibrarian)'); |
934 |
# "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?"); |
934 |
|
935 |
# $sth->execute($frameworkcode); |
935 |
my $restags = $dbh->selectall_hashref( |
936 |
# my ($total) = $sth->fetchrow; |
936 |
qq{SELECT frameworkcode,tagfield,$lib as lib,mandatory,repeatable |
937 |
# $frameworkcode = "" unless ( $total > 0 ); |
|
|
938 |
my $sth = $dbh->prepare( |
939 |
"SELECT tagfield,liblibrarian,libopac,mandatory,repeatable |
940 |
FROM marc_tag_structure |
937 |
FROM marc_tag_structure |
941 |
WHERE frameworkcode=? |
938 |
ORDER BY frameworkcode,tagfield}, |
942 |
ORDER BY tagfield" |
939 |
["frameworkcode", "tagfield"], |
943 |
); |
940 |
); |
944 |
$sth->execute($frameworkcode); |
|
|
945 |
my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable ); |
946 |
|
947 |
while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) { |
948 |
$res->{$tag}->{lib} = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac; |
949 |
$res->{$tag}->{tab} = ""; |
950 |
$res->{$tag}->{mandatory} = $mandatory; |
951 |
$res->{$tag}->{repeatable} = $repeatable; |
952 |
} |
953 |
|
941 |
|
954 |
$sth = $dbh->prepare( |
942 |
my $ressubfields = $dbh->selectall_hashref( |
955 |
"SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue |
943 |
"SELECT frameworkcode,tagfield,tagsubfield,$lib as lib,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue |
956 |
FROM marc_subfield_structure |
944 |
FROM marc_subfield_structure |
957 |
WHERE frameworkcode=? |
945 |
ORDER BY frameworkcode,tagfield,tagsubfield", |
958 |
ORDER BY tagfield,tagsubfield |
946 |
["frameworkcode", "tagfield","tagsubfield"], |
959 |
" |
|
|
960 |
); |
947 |
); |
|
|
948 |
my $res; |
949 |
foreach my $fwkcode (keys %$restags){ |
950 |
foreach my $tag (keys %{$restags->{$fwkcode}}){ |
951 |
%{$res->{$fwkcode}->{$tag}}=%{$ressubfields->{$fwkcode}->{$tag}} if ($ressubfields->{$fwkcode}->{$tag}); |
952 |
foreach my $key (keys %{$restags->{$fwkcode}->{$tag}}){ |
953 |
$res->{$fwkcode}->{$tag}->{$key}=$restags->{$fwkcode}->{$tag}->{$key}; |
954 |
} |
955 |
} |
956 |
} |
957 |
$marc_structure_cache->{$forlibrarian} = $res; |
961 |
|
958 |
|
962 |
$sth->execute($frameworkcode); |
959 |
return $res->{$frameworkcode}; |
963 |
|
|
|
964 |
my $subfield; |
965 |
my $authorised_value; |
966 |
my $authtypecode; |
967 |
my $value_builder; |
968 |
my $kohafield; |
969 |
my $seealso; |
970 |
my $hidden; |
971 |
my $isurl; |
972 |
my $link; |
973 |
my $defaultvalue; |
974 |
|
975 |
while ( |
976 |
( $tag, $subfield, $liblibrarian, $libopac, $tab, $mandatory, $repeatable, $authorised_value, |
977 |
$authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, $link, $defaultvalue |
978 |
) |
979 |
= $sth->fetchrow |
980 |
) { |
981 |
$res->{$tag}->{$subfield}->{lib} = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac; |
982 |
$res->{$tag}->{$subfield}->{tab} = $tab; |
983 |
$res->{$tag}->{$subfield}->{mandatory} = $mandatory; |
984 |
$res->{$tag}->{$subfield}->{repeatable} = $repeatable; |
985 |
$res->{$tag}->{$subfield}->{authorised_value} = $authorised_value; |
986 |
$res->{$tag}->{$subfield}->{authtypecode} = $authtypecode; |
987 |
$res->{$tag}->{$subfield}->{value_builder} = $value_builder; |
988 |
$res->{$tag}->{$subfield}->{kohafield} = $kohafield; |
989 |
$res->{$tag}->{$subfield}->{seealso} = $seealso; |
990 |
$res->{$tag}->{$subfield}->{hidden} = $hidden; |
991 |
$res->{$tag}->{$subfield}->{isurl} = $isurl; |
992 |
$res->{$tag}->{$subfield}->{'link'} = $link; |
993 |
$res->{$tag}->{$subfield}->{defaultvalue} = $defaultvalue; |
994 |
} |
995 |
|
996 |
$marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; |
997 |
|
998 |
return $res; |
999 |
} |
960 |
} |
1000 |
|
961 |
|
1001 |
=head2 GetUsedMarcStructure |
962 |
=head2 GetUsedMarcStructure |
1002 |
- |
|
|