$mintag = "600";
$maxtag = "611";
}
+
+ my @marcsubjects;
+ my $subject = "";
+ my $subfield = "";
+ my $marcsubject;
- my @marcsubjcts;
-
- foreach my $field ( $record->fields ) {
+ foreach my $field ( $record->field('6..' )) {
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
+ my @subfields_loop;
my @subfields = $field->subfields();
- my $link = "su:";
- my $label;
- my $flag = 0;
- my $authoritysep=C4::Context->preference("authoritysep");
- for my $subject_subfield ( @subfields ) {
- if (
- $marcflavour ne 'MARC21'
- and (
- ($subject_subfield->[0] eq '3') or
- ($subject_subfield->[0] eq '4') or
- ($subject_subfield->[0] eq '5')
- )
- )
- {
- next;
- }
- my $code = $subject_subfield->[0];
- $label .= $subject_subfield->[1].$authoritysep unless ( $code == 9 );
- $link .= " and su-to:".$subject_subfield->[1] unless ( $code == 9 );
- if ( $code == 9 ) {
- $link = "an:".$subject_subfield->[1];
- $flag = 1;
- }
- elsif ( ! $flag ) {
- $link =~ s/ and\ssu-to:$//;
- }
- }
- $label =~ s/$authoritysep$//;
- push @marcsubjcts,
- {
- label => $label,
- link => $link
- }
- }
- return \@marcsubjcts;
-} #end GetMarcSubjects
+ my $counter = 0;
+ my @link_loop;
+ for my $subject_subfield (@subfields ) {
+ # don't load unimarc subfields 3,4,5
+ next if (($marcflavour eq "UNIMARC") and ($subject_subfield->[0] =~ (3|4|5) ) );
+ my $code = $subject_subfield->[0];
+ my $value = $subject_subfield->[1];
+ my $linkvalue = $value;
+ $linkvalue =~ s/(\(|\))//g;
+ my $operator = " and " unless $counter==0;
+ push @link_loop, {link => $linkvalue, operator => $operator };
+ my $separator = C4::Context->preference("authoritysep") unless $counter==0;
+ # ignore $9
+ push @subfields_loop, {code => $code, value => $value, link_loop => \@link_loop, separator => $separator} unless ($subject_subfield->[0] == 9 );
+ # this needs to be added back in in a way that the template can expose it properly
+ #if ( $code == 9 ) {
+ # $link = "an:".$subject_subfield->[1];
+ # $flag = 1;
+ #}
+ $counter++;
+ }
+
+ push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop };
+
+ }
+ return \@marcsubjects;
+} #end getMARCsubjects
=head2 GetMarcAuthors
# otherwise, a french word like "leçon" is splitted in "le" "çon", le is an empty word, we get "çon"
# and don't find anything...
foreach (keys %{C4::Context->stopwords}) {
+ next if ($_ =~/(and|or|not)/); # don't remove operators
$operand=~ s/\P{IsAlpha}$_\P{IsAlpha}/ /i;
$operand=~ s/^$_\P{IsAlpha}/ /i;
$operand=~ s/\P{IsAlpha}$_$/ /i;
# COMBINE OPERANDS, INDEXES AND OPERATORS
if ( $operands[$i] ) {
+ warn "OP: $operands[$i]";
my $operand = $operands[$i];
my $index = $indexes[$i];
# if there's no index, don't use one, it will throw a CCL error
# Remove Stopwords
$operand = _remove_stopwords($operand,$index);
-
+ warn "OP_SW: $operand";
# Handle Truncation
my ($nontruncated,$righttruncated,$lefttruncated,$rightlefttruncated,$regexpr);
($nontruncated,$righttruncated,$lefttruncated,$rightlefttruncated,$regexpr) = _add_truncation($operand,$index);