Bugzilla – Attachment 156704 Details for
Bug 29811
misc/export_records.pl add possibility to export with timestamp option on authority record type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29811: add timestamp option on authority record type
Bug-29811-add-timestamp-option-on-authority-record.patch (text/plain), 3.27 KB, created by
Chris Cormack
on 2023-10-08 07:15:59 UTC
(
hide
)
Description:
Bug 29811: add timestamp option on authority record type
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2023-10-08 07:15:59 UTC
Size:
3.27 KB
patch
obsolete
>From f68ce282515593689e99830e4d9cfad4eea491a6 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Thu, 6 Jan 2022 14:48:36 +0100 >Subject: [PATCH] Bug 29811: add timestamp option on authority record type > >According to the timestamp option for bibs record type I added the >timestamp option for authority records. >Timestamp is already present in database on field "modification_time" > >Test Plan : >1 - Be sure to have authority record type for easiest test create one >2 - Execute script export_records.pl in your koha/misc directory and >choose a date (example yesterday if you just created an authority >right now).(see export_records.pl -h for help) >3 - Timestamp option has no effect on authority record type >4 - Execute script again but choose the date of tomorrow for example >5 - Same result >6 - Apply this patch >7 - Play again steps 2 and 4 >8 - On step 2 you will see only your authorities created today (because >script show you authority has changes since the date you choose in >option) and for step 4 you must see an empty file. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > misc/export_records.pl | 34 ++++++++++++++++++++++------------ > 1 file changed, 22 insertions(+), 12 deletions(-) > >diff --git a/misc/export_records.pl b/misc/export_records.pl >index 32658cb8c8..051657aa76 100755 >--- a/misc/export_records.pl >+++ b/misc/export_records.pl >@@ -100,9 +100,6 @@ if ( $output_format eq 'csv' and not $csv_profile_id ) { > pod2usage(q|Define a csv profile to export in CSV|); > } > >-if ( $timestamp and $record_type ne 'bibs' ) { >- pod2usage(q|--timestamp can only be used with biblios|); >-} > > if ( $record_type ne 'bibs' and $record_type ne 'auths' ) { > pod2usage(q|--record_type is not valid|); >@@ -210,20 +207,33 @@ if ( $record_type eq 'bibs' ) { > } > } > elsif ( $record_type eq 'auths' ) { >- my $conditions = { >- ( $starting_authid or $ending_authid ) >+ if ($timestamp) { >+ push @record_ids, $_->{authid} for @{ >+ $dbh->selectall_arrayref( >+ q| ( >+ SELECT authid >+ FROM auth_header >+ WHERE modification_time >= ? >+ ) |, { Slice => {} }, $timestamp >+ ); >+ }; >+ } else { >+ my $conditions = { >+ ( $starting_authid or $ending_authid ) > ? ( > authid => { > ( $starting_authid ? ( '>=' => $starting_authid ) : () ), >- ( $ending_authid ? ( '<=' => $ending_authid ) : () ), >+ ( $ending_authid ? ( '<=' => $ending_authid ) : () ), > } >- ) >+ ) > : (), >- ( $authtype ? ( authtypecode => $authtype ) : () ), >- }; >- # Koha::MetadataRecord::Authority is not a Koha::Object... >- my $authorities = Koha::Database->new->schema->resultset('AuthHeader')->search( $conditions ); >- @record_ids = map { $_->authid } $authorities->all; >+ ( $authtype ? ( authtypecode => $authtype ) : () ), >+ }; >+ >+ # Koha::MetadataRecord::Authority is not a Koha::Object... >+ my $authorities = Koha::Database->new->schema->resultset('AuthHeader')->search($conditions); >+ @record_ids = map { $_->authid } $authorities->all; >+ } > } > > @record_ids = uniq @record_ids; >-- >2.30.2
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 29811
:
129088
|
156704
|
156984