Bug 38330: Make sure biblio.opac_suppressed is populated/updated on save
This patchset adds a new column to biblio/deletedbiblio for storing the information about OPAC suppression for the record. It works as any other framework-mapped attribute. It defaults to 0 (not suppressed) and some sanitization is done on storing, because the DB should only contain 0 or 1. To test: 0. Have a couple records with 942$n set to suppress them. 1. Apply this patches 2. Run: $ ktd --shell k$ updatedatabase => SUCCESS: All good 3. Check the `opac_suppressed` column was added to both tables 4. Notice it tells you need to run `touch_all_biblios.pl` 5. Run: k$ koha-mysql kohadev > SELECT opac_suppressed,COUNT(opac_suppressed) FROM biblio GROUP BY opac_suppressed; => FAIL: There are no records with the opac_suppressed flag set to 1 6. Run: k$ perl misc/maintenance/touch_all_biblios.pl -v => SUCCESS: No failures 7. Repeat 5 => SUCCESS: Your couple records have the flag set. This means ModBiblio is doing the right thing 8. Play with adding new records (suppressed and not) => SUCCESS: Suppression status is set correctly 9. Change the status to select records => SUCCESS: The DB column and the MARC are in sync! 10. Sign off :-D Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
c798f642bf
commit
2fdf0d12d0
36
C4/Biblio.pm
36
C4/Biblio.pm
|
|
@ -229,20 +229,21 @@ sub AddBiblio {
|
|||
|
||||
my $biblio = Koha::Biblio->new(
|
||||
{
|
||||
frameworkcode => $frameworkcode,
|
||||
author => $olddata->{author},
|
||||
title => $olddata->{title},
|
||||
subtitle => $olddata->{subtitle},
|
||||
medium => $olddata->{medium},
|
||||
part_number => $olddata->{part_number},
|
||||
part_name => $olddata->{part_name},
|
||||
unititle => $olddata->{unititle},
|
||||
notes => $olddata->{notes},
|
||||
serial => $olddata->{serial},
|
||||
seriestitle => $olddata->{seriestitle},
|
||||
copyrightdate => $olddata->{copyrightdate},
|
||||
datecreated => \'NOW()',
|
||||
abstract => $olddata->{abstract},
|
||||
frameworkcode => $frameworkcode,
|
||||
author => $olddata->{author},
|
||||
title => $olddata->{title},
|
||||
subtitle => $olddata->{subtitle},
|
||||
medium => $olddata->{medium},
|
||||
part_number => $olddata->{part_number},
|
||||
part_name => $olddata->{part_name},
|
||||
unititle => $olddata->{unititle},
|
||||
notes => $olddata->{notes},
|
||||
serial => $olddata->{serial},
|
||||
seriestitle => $olddata->{seriestitle},
|
||||
copyrightdate => $olddata->{copyrightdate},
|
||||
datecreated => \'NOW()',
|
||||
abstract => $olddata->{abstract},
|
||||
opac_suppressed => $olddata->{opac_suppressed},
|
||||
}
|
||||
)->store;
|
||||
$biblionumber = $biblio->biblionumber;
|
||||
|
|
@ -2416,6 +2417,10 @@ sub TransformMarcToKoha {
|
|||
# Additional polishing for individual kohafields
|
||||
if ( $kohafield =~ /copyrightdate|publicationyear/ ) {
|
||||
$value = _adjust_pubyear($value);
|
||||
} elsif ( $kohafield eq 'biblio.opac_suppressed' ) {
|
||||
|
||||
# this should always be a boolean
|
||||
$value = $value ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2655,6 +2660,9 @@ sub _koha_modify_biblio {
|
|||
;
|
||||
my $sth = $dbh->prepare($query);
|
||||
|
||||
# it always needs to be defined
|
||||
$biblio->{opac_suppressed} //= 0;
|
||||
|
||||
$sth->execute(
|
||||
$frameworkcode, $biblio->{'author'}, $biblio->{'title'}, $biblio->{'subtitle'},
|
||||
$biblio->{'medium'}, $biblio->{'part_number'}, $biblio->{'part_name'}, $biblio->{'unititle'},
|
||||
|
|
|
|||
Loading…
Reference in New Issue