[Bug 33285] New: It should be possible to specify the separator used in runreport.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Bug ID: 33285 Summary: It should be possible to specify the separator used in runreport.pl Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 148435 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148435&action=edit Bug 33285: Allow specifying the delimeter for runreport.pl To test: 1 - Write a report in koha 2 - perl misc/cronjobs/runreport.pl --format csv 1 (or correct report number) 3 - Note you get commas 4 - Apply patch 5 - Repeat #2 - no change 6 - perl misc/cronjobs/runreport.pl --format csv --separator "|" 1 7 - Now it is pipe delimited 8 - perl misc/cronjobs/runreport.pl --format tsv --separator "|" 1 9 - Error is reported, you cannot set separator unless csv 10 - Try other separators -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #2 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- Created attachment 148769 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148769&action=edit Bug 33284: Unit test Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #3 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- Created attachment 148770 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148770&action=edit Bug 33284: Set renewer_id appropriately for anonymize settings This patch adds a trigger into the anonymize function of Koha::Old::Checkout such that we pass along the anonymize action to the renewals record. Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #4 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- Created attachment 148771 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148771&action=edit Bug 33284: Set renewer_id for sets of checkouts This patch adds a trigger into the anonymize function of Koha::Old::Checkouts such that we pass along the anonymize action to the renewals record. Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrewfh@dubcolib.org Status|Signed Off |Needs Signoff --- Comment #5 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- (sorry, mistyped a bug number) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148769|0 |1 is obsolete| | --- Comment #6 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- Comment on attachment 148769 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148769 Bug 33284: Unit test
From 7885567b7214e27baeef1e951456b6c78833ecb4 Mon Sep 17 00:00:00 2001 From: Martin Renvoize <martin.renvoize@ptfs-europe.com> Date: Tue, 21 Mar 2023 15:01:08 +0000 Subject: [PATCH] Bug 33284: Unit test
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
https://bugs.koha-community.org/show_bug.cgi?id=33285 --- t/db_dependent/Koha/Old/Checkout.t | 37 ++++++++++++++++++++++++----- t/db_dependent/Koha/Old/Checkouts.t | 30 ++++++++++++++++++++++- 2 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/t/db_dependent/Koha/Old/Checkout.t b/t/db_dependent/Koha/Old/Checkout.t index 7cf520e96f..ade2a1ff2b 100755 --- a/t/db_dependent/Koha/Old/Checkout.t +++ b/t/db_dependent/Koha/Old/Checkout.t @@ -30,7 +30,7 @@ my $builder = t::lib::TestBuilder->new;
subtest 'anonymize() tests' => sub {
- plan tests => 8; + plan tests => 9;
$schema->storage->txn_begin;
@@ -50,6 +50,25 @@ subtest 'anonymize() tests' => sub { value => { borrowernumber => $patron->id } } ); + my $renewal_1 = $builder->build_object( + { + class => 'Koha::Checkouts::Renewals', + value => { + checkout_id => $checkout_2->id, + interface => 'opac', + renewer_id => $patron->id + } + } + ); + my $renewal_2 = $builder->build_object( + { + class => 'Koha::Checkouts::Renewals', + value => { + checkout_id => $checkout_2->id, + interface => 'intranet' + } + } + );
is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' );
@@ -63,20 +82,26 @@ subtest 'anonymize() tests' => sub { is( $@->syspref, 'AnonymousPatron', 'syspref parameter is correctly passed' ); is( $patron->old_checkouts->count, 2, 'No changes, patron has 2 linked completed checkouts' );
- is( $checkout_1->borrowernumber, $patron->id, - 'Anonymized hold not linked to patron' ); is( $checkout_2->borrowernumber, $patron->id, - 'Not anonymized hold still linked to patron' ); + 'Checkout to anonymize still linked to patron' ); + is( $checkout_2->renewals->count, 2, 'Checkout 2 has 2 renewals' );
my $anonymous_patron = $builder->build_object( { class => 'Koha::Patrons' } ); t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous_patron->id );
- # anonymize second hold + # anonymize second checkout $checkout_2->anonymize; $checkout_2->discard_changes; is( $checkout_2->borrowernumber, $anonymous_patron->id, - 'Anonymized hold linked to anonymouspatron' ); + 'Anonymized checkout linked to anonymouspatron' ); + is( + $checkout_2->renewals->search( + { renewer_id => $anonymous_patron->id } + )->count, + 1, + 'OPAC renewal was anonymized' + );
$schema->storage->txn_rollback; }; diff --git a/t/db_dependent/Koha/Old/Checkouts.t b/t/db_dependent/Koha/Old/Checkouts.t index 2c7c52ad62..7254bcba8e 100755 --- a/t/db_dependent/Koha/Old/Checkouts.t +++ b/t/db_dependent/Koha/Old/Checkouts.t @@ -32,7 +32,7 @@ my $builder = t::lib::TestBuilder->new;
subtest 'anonymize() tests' => sub {
- plan tests => 10; + plan tests => 13;
$schema->storage->txn_begin;
@@ -89,8 +89,28 @@ subtest 'anonymize() tests' => sub { } } ); + my $renewal_1 = $builder->build_object( + { + class => 'Koha::Checkouts::Renewals', + value => { + checkout_id => $checkout_4->id, + interface => 'opac', + renewer_id => $patron->id + } + } + ); + my $renewal_2 = $builder->build_object( + { + class => 'Koha::Checkouts::Renewals', + value => { + checkout_id => $checkout_4->id, + interface => 'intranet' + } + } + );
is( $patron->old_checkouts->count, 4, 'Patron has 4 completed checkouts' ); + is( $checkout_4->renewals->count, 2, 'Checkout 4 has 2 renewals' );
# filter them so only the older two are part of the resultset my $checkouts = $patron->old_checkouts->filter_by_last_update( @@ -112,6 +132,14 @@ subtest 'anonymize() tests' => sub { is( $anonymized_count, 2, 'update() tells 2 rows were updated' );
is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' ); + is( $checkout_4->renewals->count, 2, 'Checkout 4 still has 2 renewals' ); + is( + $checkout_4->renewals->search( + { renewer_id => $anonymous_patron->id } + )->count, + 1, + 'OPAC renewal was anonymized' + );
$schema->storage->txn_rollback; }; -- 2.30.2
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148770|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148771|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Andrew Fuerste-Henry <andrewfh@dubcolib.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148435|0 |1 is obsolete| | --- Comment #7 from Andrew Fuerste-Henry <andrewfh@dubcolib.org> --- Created attachment 148775 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148775&action=edit Bug 33285: Allow specifying the delimeter for runreport.pl To test: 1 - Write a report in koha 2 - perl misc/cronjobs/runreport.pl --format csv 1 (or correct report number) 3 - Note you get commas 4 - Apply patch 5 - Repeat #2 - no change 6 - perl misc/cronjobs/runreport.pl --format csv --separator "|" 1 7 - Now it is pipe delimited 8 - perl misc/cronjobs/runreport.pl --format tsv --separator "|" 1 9 - Error is reported, you cannot set separator unless csv 10 - Try other separators Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |33050 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33050 [Bug 33050] More args for misc/cronjobs/runreport.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #148775|0 |1 is obsolete| | --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 149058 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149058&action=edit Bug 33285: Allow specifying the delimeter for runreport.pl To test: 1 - Write a report in koha 2 - perl misc/cronjobs/runreport.pl --format csv 1 (or correct report number) 3 - Note you get commas 4 - Apply patch 5 - Repeat #2 - no change 6 - perl misc/cronjobs/runreport.pl --format csv --separator "|" 1 7 - Now it is pipe delimited 8 - perl misc/cronjobs/runreport.pl --format tsv --separator "|" 1 9 - Error is reported, you cannot set separator unless csv 10 - Try other separators Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #9 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 149059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149059&action=edit Bug 33285: (QA follow-up) add POD and fix some code style Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Strange we can not use "\t" : perl misc/cronjobs/runreport.pl --format csv --separator "\t" 1 Generates with "\" as separator. We have format tsv for that so no issue. Great option ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |23.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Jacob O'Mara <jacob.omara@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.05.00 |23.05.00,22.11.05 released in| | Status|Pushed to master |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 --- Comment #12 from Jacob O'Mara <jacob.omara@ptfs-europe.com> --- Nice work, thanks everyone! Pushed to 22.11.x for the next release. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|23.05.00,22.11.05 |23.05.00,22.11.05,22.05.12 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #13 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for upcoming 22.05.12 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.05.00,22.11.05,22.05.12 |23.05.00,22.11.05,22.05.12, released in| |21.11.20 Status|Pushed to oldstable |Pushed to oldoldstable CC| |arthur.suzuki@biblibre.com --- Comment #14 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- applied to 21.11.x for 21.11.20 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org