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