|
Lines 966-1004
sub get_marc_notes {
Link Here
|
| 966 |
return \@marcnotes; |
966 |
return \@marcnotes; |
| 967 |
} |
967 |
} |
| 968 |
|
968 |
|
| 969 |
=head3 get_marc_contributors |
969 |
sub _get_marc_authors { |
| 970 |
|
|
|
| 971 |
my $contributors = $biblio->get_marc_contributors; |
| 972 |
|
| 973 |
Get all contributors (but first author) from the MARC record and returns them in an array. |
| 974 |
They are stored in different fields depending on MARC flavour |
| 975 |
|
| 976 |
=cut |
| 977 |
|
| 978 |
sub get_marc_contributors { |
| 979 |
my ( $self, $params ) = @_; |
970 |
my ( $self, $params ) = @_; |
| 980 |
|
971 |
|
| 981 |
my ( $mintag, $maxtag, $fields_filter ); |
972 |
my $fields_filter = $params->{fields_filter}; |
| 982 |
my $marcflavour = C4::Context->preference('marcflavour'); |
973 |
my $mintag = $params->{mintag}; |
|
|
974 |
my $maxtag = $params->{maxtag}; |
| 975 |
|
| 976 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
| 977 |
my $marcflavour = C4::Context->preference('marcflavour'); |
| 983 |
|
978 |
|
| 984 |
# tagslib useful only for UNIMARC author responsibilities |
979 |
# tagslib useful only for UNIMARC author responsibilities |
| 985 |
my $tagslib; |
980 |
my $tagslib = $marcflavour eq "UNIMARC" |
| 986 |
if ( $marcflavour eq "UNIMARC" ) { |
981 |
? C4::Biblio::GetMarcStructure( 1, $self->frameworkcode, { unsafe => 1 } ) |
| 987 |
$tagslib = C4::Biblio::GetMarcStructure( 1, $self->frameworkcode, { unsafe => 1 }); |
982 |
: undef; |
| 988 |
$mintag = "700"; |
|
|
| 989 |
$maxtag = "712"; |
| 990 |
$fields_filter = '7..'; |
| 991 |
} else { # marc21/normarc |
| 992 |
$mintag = "700"; |
| 993 |
$maxtag = "720"; |
| 994 |
$fields_filter = '7..'; |
| 995 |
} |
| 996 |
|
983 |
|
| 997 |
my @marcauthors; |
984 |
my @marcauthors; |
| 998 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
|
|
| 999 |
|
| 1000 |
foreach my $field ( $self->metadata->record->field($fields_filter) ) { |
985 |
foreach my $field ( $self->metadata->record->field($fields_filter) ) { |
| 1001 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
986 |
|
|
|
987 |
next |
| 988 |
if $mintag && $field->tag() < $mintag |
| 989 |
|| $maxtag && $field->tag() > $maxtag; |
| 990 |
|
| 1002 |
my @subfields_loop; |
991 |
my @subfields_loop; |
| 1003 |
my @link_loop; |
992 |
my @link_loop; |
| 1004 |
my @subfields = $field->subfields(); |
993 |
my @subfields = $field->subfields(); |
|
Lines 1062-1067
sub get_marc_contributors {
Link Here
|
| 1062 |
return \@marcauthors; |
1051 |
return \@marcauthors; |
| 1063 |
} |
1052 |
} |
| 1064 |
|
1053 |
|
|
|
1054 |
=head3 get_marc_contributors |
| 1055 |
|
| 1056 |
my $contributors = $biblio->get_marc_contributors; |
| 1057 |
|
| 1058 |
Get all contributors (but first author) from the MARC record and returns them in an array. |
| 1059 |
They are stored in different fields depending on MARC flavour (700..712 for MARC21) |
| 1060 |
|
| 1061 |
=cut |
| 1062 |
|
| 1063 |
sub get_marc_contributors { |
| 1064 |
my ( $self, $params ) = @_; |
| 1065 |
|
| 1066 |
my ( $mintag, $maxtag, $fields_filter ); |
| 1067 |
my $marcflavour = C4::Context->preference('marcflavour'); |
| 1068 |
|
| 1069 |
if ( $marcflavour eq "UNIMARC" ) { |
| 1070 |
$mintag = "700"; |
| 1071 |
$maxtag = "712"; |
| 1072 |
$fields_filter = '7..'; |
| 1073 |
} else { # marc21/normarc |
| 1074 |
$mintag = "700"; |
| 1075 |
$maxtag = "720"; |
| 1076 |
$fields_filter = '7..'; |
| 1077 |
} |
| 1078 |
|
| 1079 |
return $self->_get_marc_authors( |
| 1080 |
{ |
| 1081 |
fields_filter => $fields_filter, |
| 1082 |
mintag => $mintag, |
| 1083 |
maxtag => $maxtag |
| 1084 |
} |
| 1085 |
); |
| 1086 |
} |
| 1087 |
|
| 1088 |
=head3 get_marc_authors |
| 1089 |
|
| 1090 |
my $authors = $biblio->get_marc_authors; |
| 1091 |
|
| 1092 |
Get all authors from the MARC record and returns them in an array. |
| 1093 |
They are stored in different fields depending on MARC flavour |
| 1094 |
(main author from 100 then secondary authors from 700..712). |
| 1095 |
|
| 1096 |
=cut |
| 1097 |
|
| 1098 |
sub get_marc_authors { |
| 1099 |
my ( $self, $params ) = @_; |
| 1100 |
|
| 1101 |
my ( $mintag, $maxtag, $fields_filter ); |
| 1102 |
my $marcflavour = C4::Context->preference('marcflavour'); |
| 1103 |
|
| 1104 |
if ( $marcflavour eq "UNIMARC" ) { |
| 1105 |
$fields_filter = '200'; |
| 1106 |
} else { # marc21/normarc |
| 1107 |
$fields_filter = '100'; |
| 1108 |
} |
| 1109 |
|
| 1110 |
my @first_authors = @{$self->_get_marc_authors( |
| 1111 |
{ |
| 1112 |
fields_filter => $fields_filter, |
| 1113 |
mintag => $mintag, |
| 1114 |
maxtag => $maxtag |
| 1115 |
} |
| 1116 |
)}; |
| 1117 |
|
| 1118 |
my @other_authors = @{$self->get_marc_contributors}; |
| 1119 |
|
| 1120 |
return [@first_authors, @other_authors]; |
| 1121 |
} |
| 1122 |
|
| 1123 |
|
| 1065 |
=head3 to_api |
1124 |
=head3 to_api |
| 1066 |
|
1125 |
|
| 1067 |
my $json = $biblio->to_api; |
1126 |
my $json = $biblio->to_api; |