|
Line 0
Link Here
|
| 0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
|
| 3 |
return { |
| 4 |
bug_number => "35138", |
| 5 |
description => "Make the elastic facets editable", |
| 6 |
up => sub { |
| 7 |
my ($args) = @_; |
| 8 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
| 9 |
|
| 10 |
my $facets = { |
| 11 |
author => 'Authors', |
| 12 |
itype => 'Item types', |
| 13 |
location => 'Location', |
| 14 |
'su-geo' => 'Places', |
| 15 |
'title-series' => 'Series', |
| 16 |
subject => 'Topics', |
| 17 |
ln => 'Languages', |
| 18 |
}; |
| 19 |
# Do not update the label if different from the original one |
| 20 |
my $sth = $dbh->prepare(q{ |
| 21 |
UPDATE search_field |
| 22 |
SET label = ? |
| 23 |
WHERE name = ? AND label = ? |
| 24 |
}); |
| 25 |
while ( my ( $name, $label ) = each %$facets ) { |
| 26 |
$sth->execute( $label, $name, $name ); |
| 27 |
} |
| 28 |
|
| 29 |
$sth->execute( 'Collections', 'ccode', 'collection-code'); |
| 30 |
$sth->execute( 'Holding libraries', 'holdingbranch', 'holdinglibrary'); |
| 31 |
$sth->execute( 'Home libraries', 'homebranch', 'homelibrary'); |
| 32 |
}, |
| 33 |
}; |