Bugzilla – Attachment 162262 Details for
Bug 36068
Add maintenance script acq_cancel_obsolete_orders.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36068: Do not overwrite cancellation date in ->cancel
Bug-36068-Do-not-overwrite-cancellation-date-in--c.patch (text/plain), 2.41 KB, created by
Marcel de Rooy
on 2024-02-19 08:26:06 UTC
(
hide
)
Description:
Bug 36068: Do not overwrite cancellation date in ->cancel
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-02-19 08:26:06 UTC
Size:
2.41 KB
patch
obsolete
>From 9541a84f6836c5e1c2195588fbb33da2afdb7ac5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 14 Feb 2024 16:57:50 +0100 >Subject: [PATCH] Bug 36068: Do not overwrite cancellation date in ->cancel >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Koha/Acquisition/Order.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Acquisition/Order.pm | 8 ++++---- > t/db_dependent/Koha/Acquisition/Order.t | 10 +++++++++- > 2 files changed, 13 insertions(+), 5 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index e0fea073f1..27887b1c60 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -203,12 +203,12 @@ sub cancel { > } > } > >- # Update order status >+ # Update order status; do not overwrite older cancellation date >+ $self->datecancellationprinted(dt_from_string) unless $self->datecancellationprinted; > $self->set( > { >- cancellationreason => $reason, >- datecancellationprinted => \'NOW()', >- orderstatus => 'cancelled', >+ cancellationreason => $reason, >+ orderstatus => 'cancelled', > } > )->store; > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 10fdfa4685..f0da354697 100755 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -659,7 +659,7 @@ subtest 'creator ()' => sub { > > subtest 'cancel() tests' => sub { > >- plan tests => 56; >+ plan tests => 58; > > $schema->storage->txn_begin; > >@@ -1017,5 +1017,13 @@ subtest 'cancel() tests' => sub { > lives_ok { $order->set($columns)->store; } 'No croak on missing biblionumber when cancelling an order'; > throws_ok { $order->orderstatus('new')->store; } qr/Cannot insert order: Mandatory parameter biblionumber is missing/, 'Expected croak'; > >+ # Try to cancel again, not overwriting cancellation date >+ my $dt = dt_from_string->subtract( days => 1 ); >+ $order->biblionumber($biblio_id)->datecancellationprinted($dt)->orderstatus('new')->store; >+ $order->cancel; >+ $order->discard_changes; >+ is( $order->orderstatus, 'cancelled', 'Check status after second cancel' ); >+ is( $order->datecancellationprinted, $dt->ymd, 'Check date after second cancel' ); >+ > $schema->storage->txn_rollback; > }; >-- >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 36068
:
162259
|
162260
|
162261
|
162262
|
163721
|
163722
|
165000
|
165001
|
165113