From 9b6d4b8fe19e97a48102ba46b248eaaf538945a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= Date: Mon, 6 Oct 2025 16:05:44 -0300 Subject: [PATCH] Bug 39816: (QA follow-up) Rename 'late_since_days' to 'days_late' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Cohen Arazi --- Koha/Acquisition/Basket.pm | 11 +++++------ api/v1/swagger/definitions/basket.yaml | 2 +- api/v1/swagger/paths/acquisitions_baskets.yaml | 2 +- api/v1/swagger/paths/acquisitions_orders.yaml | 4 ++-- .../intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 2 +- t/db_dependent/Koha/Acquisition/Basket.t | 9 +++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm index c3cd6387180..ebdbce61903 100644 --- a/Koha/Acquisition/Basket.pm +++ b/Koha/Acquisition/Basket.pm @@ -165,17 +165,16 @@ sub estimated_delivery_date { return dt_from_string( $self->closedate )->add( days => $self->bookseller->deliverytime ); } -=head3 late_since_days +=head3 days_late -my $number_of_days_late = $basket->late_since_days; + my $number_of_days_late = $basket->days_late; -Return the number of days the basket is late. - -Return implicit undef if the basket is not closed. +Returns the number of days the basket is late. I is returned if +the basket is not closed. =cut -sub late_since_days { +sub days_late { my ($self) = @_; return unless $self->closedate; return dt_from_string->delta_days( dt_from_string( $self->closedate ) )->delta_days(); diff --git a/api/v1/swagger/definitions/basket.yaml b/api/v1/swagger/definitions/basket.yaml index af08323abd8..46d384c9e51 100644 --- a/api/v1/swagger/definitions/basket.yaml +++ b/api/v1/swagger/definitions/basket.yaml @@ -84,7 +84,7 @@ properties: - null description: "When items should be created for orders in this basket (Options: 'ordering', 'receiving', 'cataloguing'. Null means system wide config)" - late_since_days: + days_late: type: - integer - "null" diff --git a/api/v1/swagger/paths/acquisitions_baskets.yaml b/api/v1/swagger/paths/acquisitions_baskets.yaml index d3fb3e8dcd9..7c2821f0111 100644 --- a/api/v1/swagger/paths/acquisitions_baskets.yaml +++ b/api/v1/swagger/paths/acquisitions_baskets.yaml @@ -24,7 +24,7 @@ enum: - basket_group - creator - - late_since_days + - days_late collectionFormat: csv produces: - application/json diff --git a/api/v1/swagger/paths/acquisitions_orders.yaml b/api/v1/swagger/paths/acquisitions_orders.yaml index 5b87bf4cc3c..4974b38fe45 100644 --- a/api/v1/swagger/paths/acquisitions_orders.yaml +++ b/api/v1/swagger/paths/acquisitions_orders.yaml @@ -53,7 +53,7 @@ - basket - basket.basket_group - basket.creator - - basket.late_since_days + - basket.days_late - biblio - biblio.uncancelled_orders+count - biblio.holds+count @@ -181,7 +181,7 @@ - basket - basket.basket_group - basket.creator - - basket.late_since_days + - basket.days_late - biblio - biblio.uncancelled_orders+count - biblio.holds+count diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 446e5ce38d7..9fb6877b9c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -107,7 +107,7 @@ [% lateorder.ordernumber | $raw %] - [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days) + [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.days_late | html %] days) [% IF lateorder.get_column('estimated_delivery_date') %] [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %] [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %] diff --git a/t/db_dependent/Koha/Acquisition/Basket.t b/t/db_dependent/Koha/Acquisition/Basket.t index cec135aabc6..efd7c337750 100755 --- a/t/db_dependent/Koha/Acquisition/Basket.t +++ b/t/db_dependent/Koha/Acquisition/Basket.t @@ -239,7 +239,8 @@ subtest 'estimated_delivery_date' => sub { $schema->storage->txn_rollback; }; -subtest 'late_since_days' => sub { +subtest 'days_late() tests' => sub { + plan tests => 3; $schema->storage->txn_begin; @@ -251,13 +252,13 @@ subtest 'late_since_days' => sub { my $now = dt_from_string; $basket->closedate(undef)->store; # Basket is open - is( $basket->late_since_days, undef, 'return undef if basket is still open' ); + is( $basket->days_late, undef, 'return undef if basket is still open' ); $basket->closedate($now)->store; #Closing the basket today - is( $basket->late_since_days, 0, 'return 0 if basket has been closed on today' ); + is( $basket->days_late, 0, 'return 0 if basket has been closed on today' ); $basket->closedate( $now->clone->subtract( days => 2 ) )->store; - is( $basket->late_since_days, 2, 'return 2 if basket has been closed 2 days ago' ); + is( $basket->days_late, 2, 'return 2 if basket has been closed 2 days ago' ); $schema->storage->txn_rollback; }; -- 2.51.0