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> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit24ee60cb62
) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commite5d014de8c
) Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
7aa5ac9c75
commit
5ae7da9352
1 changed files with 22 additions and 12 deletions
|
@ -100,9 +100,6 @@ if ( $output_format eq 'csv' and not $csv_profile_id ) {
|
||||||
pod2usage(q|Define a csv profile to export in CSV|);
|
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' ) {
|
if ( $record_type ne 'bibs' and $record_type ne 'auths' ) {
|
||||||
pod2usage(q|--record_type is not valid|);
|
pod2usage(q|--record_type is not valid|);
|
||||||
|
@ -210,20 +207,33 @@ if ( $record_type eq 'bibs' ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( $record_type eq 'auths' ) {
|
elsif ( $record_type eq 'auths' ) {
|
||||||
my $conditions = {
|
if ($timestamp) {
|
||||||
( $starting_authid or $ending_authid )
|
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 => {
|
authid => {
|
||||||
( $starting_authid ? ( '>=' => $starting_authid ) : () ),
|
( $starting_authid ? ( '>=' => $starting_authid ) : () ),
|
||||||
( $ending_authid ? ( '<=' => $ending_authid ) : () ),
|
( $ending_authid ? ( '<=' => $ending_authid ) : () ),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
: (),
|
: (),
|
||||||
( $authtype ? ( authtypecode => $authtype ) : () ),
|
( $authtype ? ( authtypecode => $authtype ) : () ),
|
||||||
};
|
};
|
||||||
# Koha::MetadataRecord::Authority is not a Koha::Object...
|
|
||||||
my $authorities = Koha::Database->new->schema->resultset('AuthHeader')->search( $conditions );
|
# Koha::MetadataRecord::Authority is not a Koha::Object...
|
||||||
@record_ids = map { $_->authid } $authorities->all;
|
my $authorities = Koha::Database->new->schema->resultset('AuthHeader')->search($conditions);
|
||||||
|
@record_ids = map { $_->authid } $authorities->all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@record_ids = uniq @record_ids;
|
@record_ids = uniq @record_ids;
|
||||||
|
|
Loading…
Reference in a new issue