Bugzilla – Attachment 6509 Details for
Bug 3216
UNIMARC author facets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-3216-UNIMARC-author-facets.patch (text/plain), 3.66 KB, created by
Frédéric Demians
on 2011-12-02 07:17:08 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2011-12-02 07:17:08 UTC
Size:
3.66 KB
patch
obsolete
>From 3de8012e957c79e508966165de67135f104da2b3 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Fri, 2 Dec 2011 07:56:27 +0100 >Subject: [PATCH] Bug 3216 UNIMARC author facets > >Add 700$b to UNIMARC author facets. > >Other facets subfields could be added now. For example, other subjects subfields. >--- > C4/Koha.pm | 2 +- > C4/Search.pm | 30 +++++++++++++++--------------- > 2 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 06b2ec5..a28044b 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -703,7 +703,7 @@ sub getFacets { > link_value => 'au', > label_value => 'Authors', > tags => [ '700', '701', '702', ], >- subfield => 'a', >+ subfield => 'ab', > }, > { > link_value => 'se', >diff --git a/C4/Search.pm b/C4/Search.pm >index 98db887..13c10e4 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -473,7 +473,7 @@ sub getRecords { > ($facets->[$k]) or next; > my @fcodes = @{$facets->[$k]->{'tags'}}; > my $sfcode = $facets->[$k]->{'subfield'}; >- >+ my @sfcodes = split('', $sfcode); > for ( my $j = 0 ; $j < $jmax ; $j++ ) { > my $render_record = $results[ $i - 1 ]->record($j)->render(); > my @used_datas = (); >@@ -483,22 +483,22 @@ sub getRecords { > # avoid first line > my $field_pattern = '\n'.$fcode.' ([^\n]+)'; > my @field_tokens = ( $render_record =~ /$field_pattern/g ) ; >- > foreach my $field_token (@field_tokens) { >- my $subfield_pattern = '\$'.$sfcode.' ([^\$]+)'; >- my @subfield_values = ( $field_token =~ /$subfield_pattern/g ); >- >- foreach my $subfield_value (@subfield_values) { >- >- my $data = $subfield_value; >- $data =~ s/^\s+//; # trim left >- $data =~ s/\s+$//; # trim right >- >- unless ( $data ~~ @used_datas ) { >- $facets_counter->{ $facets->[$k]->{'link_value'} }->{$data}++; >- push @used_datas, $data; >+ my @subf = ( $field_token =~ /\$([a-zA-Z0-9]) ([^\$]+)/g ); >+ my @values; >+ for (my $i = 0; $i < @subf; $i += 2) { >+ if ( $sfcode =~ $subf[$i] ) { >+ my $value = $subf[$i+1]; >+ $value =~ s/^ *//; >+ $value =~ s/ *$//; >+ push @values, $value; > } >- } # subfields >+ } >+ my $data = join(', ', @values); >+ unless ( $data ~~ @used_datas ) { >+ $facets_counter->{ $facets->[$k]->{'link_value'} }->{$data}++; >+ push @used_datas, $data; >+ } > } # fields > } # field codes > } # records >-- >1.7.6.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3216
:
6509
|
6535
|
6716
|
8157