Lines 1001-1039
sub get_marc_notes {
Link Here
|
1001 |
return \@marcnotes; |
1001 |
return \@marcnotes; |
1002 |
} |
1002 |
} |
1003 |
|
1003 |
|
1004 |
=head3 get_marc_contributors |
1004 |
sub _get_marc_authors { |
1005 |
|
|
|
1006 |
my $contributors = $biblio->get_marc_contributors; |
1007 |
|
1008 |
Get all contributors (but first author) from the MARC record and returns them in an array. |
1009 |
They are stored in different fields depending on MARC flavour |
1010 |
|
1011 |
=cut |
1012 |
|
1013 |
sub get_marc_contributors { |
1014 |
my ( $self, $params ) = @_; |
1005 |
my ( $self, $params ) = @_; |
1015 |
|
1006 |
|
1016 |
my ( $mintag, $maxtag, $fields_filter ); |
1007 |
my $fields_filter = $params->{fields_filter}; |
1017 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1008 |
my $mintag = $params->{mintag}; |
|
|
1009 |
my $maxtag = $params->{maxtag}; |
1010 |
|
1011 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1012 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1018 |
|
1013 |
|
1019 |
# tagslib useful only for UNIMARC author responsibilities |
1014 |
# tagslib useful only for UNIMARC author responsibilities |
1020 |
my $tagslib; |
1015 |
my $tagslib = $marcflavour eq "UNIMARC" |
1021 |
if ( $marcflavour eq "UNIMARC" ) { |
1016 |
? C4::Biblio::GetMarcStructure( 1, $self->frameworkcode, { unsafe => 1 } ) |
1022 |
$tagslib = C4::Biblio::GetMarcStructure( 1, $self->frameworkcode, { unsafe => 1 }); |
1017 |
: undef; |
1023 |
$mintag = "700"; |
|
|
1024 |
$maxtag = "712"; |
1025 |
$fields_filter = '7..'; |
1026 |
} else { # marc21/normarc |
1027 |
$mintag = "700"; |
1028 |
$maxtag = "720"; |
1029 |
$fields_filter = '7..'; |
1030 |
} |
1031 |
|
1018 |
|
1032 |
my @marcauthors; |
1019 |
my @marcauthors; |
1033 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
|
|
1034 |
|
1035 |
foreach my $field ( $self->metadata->record->field($fields_filter) ) { |
1020 |
foreach my $field ( $self->metadata->record->field($fields_filter) ) { |
1036 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
1021 |
|
|
|
1022 |
next |
1023 |
if $mintag && $field->tag() < $mintag |
1024 |
|| $maxtag && $field->tag() > $maxtag; |
1025 |
|
1037 |
my @subfields_loop; |
1026 |
my @subfields_loop; |
1038 |
my @link_loop; |
1027 |
my @link_loop; |
1039 |
my @subfields = $field->subfields(); |
1028 |
my @subfields = $field->subfields(); |
Lines 1097-1102
sub get_marc_contributors {
Link Here
|
1097 |
return \@marcauthors; |
1086 |
return \@marcauthors; |
1098 |
} |
1087 |
} |
1099 |
|
1088 |
|
|
|
1089 |
=head3 get_marc_contributors |
1090 |
|
1091 |
my $contributors = $biblio->get_marc_contributors; |
1092 |
|
1093 |
Get all contributors (but first author) from the MARC record and returns them in an array. |
1094 |
They are stored in different fields depending on MARC flavour (700..712 for MARC21) |
1095 |
|
1096 |
=cut |
1097 |
|
1098 |
sub get_marc_contributors { |
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 |
$mintag = "700"; |
1106 |
$maxtag = "712"; |
1107 |
$fields_filter = '7..'; |
1108 |
} else { # marc21/normarc |
1109 |
$mintag = "700"; |
1110 |
$maxtag = "720"; |
1111 |
$fields_filter = '7..'; |
1112 |
} |
1113 |
|
1114 |
return $self->_get_marc_authors( |
1115 |
{ |
1116 |
fields_filter => $fields_filter, |
1117 |
mintag => $mintag, |
1118 |
maxtag => $maxtag |
1119 |
} |
1120 |
); |
1121 |
} |
1122 |
|
1123 |
=head3 get_marc_authors |
1124 |
|
1125 |
my $authors = $biblio->get_marc_authors; |
1126 |
|
1127 |
Get all authors from the MARC record and returns them in an array. |
1128 |
They are stored in different fields depending on MARC flavour |
1129 |
(main author from 100 then secondary authors from 700..712). |
1130 |
|
1131 |
=cut |
1132 |
|
1133 |
sub get_marc_authors { |
1134 |
my ( $self, $params ) = @_; |
1135 |
|
1136 |
my ( $mintag, $maxtag, $fields_filter ); |
1137 |
my $marcflavour = C4::Context->preference('marcflavour'); |
1138 |
|
1139 |
if ( $marcflavour eq "UNIMARC" ) { |
1140 |
$fields_filter = '200'; |
1141 |
} else { # marc21/normarc |
1142 |
$fields_filter = '100'; |
1143 |
} |
1144 |
|
1145 |
my @first_authors = @{$self->_get_marc_authors( |
1146 |
{ |
1147 |
fields_filter => $fields_filter, |
1148 |
mintag => $mintag, |
1149 |
maxtag => $maxtag |
1150 |
} |
1151 |
)}; |
1152 |
|
1153 |
my @other_authors = @{$self->get_marc_contributors}; |
1154 |
|
1155 |
return [@first_authors, @other_authors]; |
1156 |
} |
1157 |
|
1158 |
|
1100 |
=head3 to_api |
1159 |
=head3 to_api |
1101 |
|
1160 |
|
1102 |
my $json = $biblio->to_api; |
1161 |
my $json = $biblio->to_api; |