Bugzilla – Attachment 179338 Details for
Bug 38330
Make bib-level suppression a biblio table field instead of part of a marc tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38330: Make sure biblio.opac_suppressed is populated/updated on save
Bug-38330-Make-sure-biblioopacsuppressed-is-popula.patch (text/plain), 4.57 KB, created by
Martin Renvoize (ashimema)
on 2025-03-14 15:54:39 UTC
(
hide
)
Description:
Bug 38330: Make sure biblio.opac_suppressed is populated/updated on save
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-14 15:54:39 UTC
Size:
4.57 KB
patch
obsolete
>From 6ffd6524e6145e0bee73a5757e6095424ede8478 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 18 Dec 2024 09:58:14 -0300 >Subject: [PATCH] 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> >--- > C4/Biblio.pm | 36 ++++++++++++++++++++++-------------- > 1 file changed, 22 insertions(+), 14 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 374cddca0ae..f40a225eb83 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -230,20 +230,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; >@@ -2417,6 +2418,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'}, >-- >2.48.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 38330
:
175648
|
175649
|
175650
|
175651
|
175767
|
175768
|
175769
|
175770
|
179335
|
179336
|
179337
| 179338 |
179339
|
179340
|
179341