Bugzilla – Attachment 141496 Details for
Bug 31552
SIP2 option format_due_date not honored for AH field in item information response
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31552: SIP2 option format_due_date not honored for AH field in item information response
Bug-31552-SIP2-option-formatduedate-not-honored-fo.patch (text/plain), 4.14 KB, created by
Katrin Fischer
on 2022-10-07 11:55:05 UTC
(
hide
)
Description:
Bug 31552: SIP2 option format_due_date not honored for AH field in item information response
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-10-07 11:55:05 UTC
Size:
4.14 KB
patch
obsolete
>From da11ad9189e566cf9d0701973c6f4102be75ec81 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Mon, 12 Sep 2022 13:52:23 -0400 >Subject: [PATCH] Bug 31552: SIP2 option format_due_date not honored for AH > field in item information response > >Bug 28730 added the ability to format due dates based on Koha's date format, but missed formatting the due date field in the item information response. > >Test Plan: >1) Apply this patch >2) prove t/db_dependent/SIP/Message.t > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > C4/SIP/Sip/MsgType.pm | 23 +++++++++++++---------- > t/db_dependent/SIP/Message.t | 14 +++++++++++++- > 2 files changed, 26 insertions(+), 11 deletions(-) > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index fb4322f21c..cad82e0b35 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -574,12 +574,10 @@ sub handle_checkout { > $resp .= add_field( FID_ITEM_ID, $item_id, $server ); > $resp .= add_field( FID_TITLE_ID, $item->title_id, $server ); > if ( $item->due_date ) { >- my $due_date; >- if( $account->{format_due_date} ){ >- $due_date = output_pref({ str => $item->due_date, as_due_date => 1 }); >- } else { >- $due_date = timestamp( $item->due_date ); >- } >+ my $due_date = >+ $account->{format_due_date} >+ ? output_pref( { str => $item->due_date, as_due_date => 1 } ) >+ : timestamp( $item->due_date ); > $resp .= add_field( FID_DUE_DATE, $due_date, $server ); > } else { > $resp .= add_field( FID_DUE_DATE, q{}, $server ); >@@ -1203,10 +1201,11 @@ sub handle_fee_paid { > > sub handle_item_information { > my ( $self, $server ) = @_; >- my $ils = $server->{ils}; >+ my $account = $server->{account}; >+ my $ils = $server->{ils}; >+ my $fields = $self->{fields}; >+ my $resp = ITEM_INFO_RESP; > my $trans_date; >- my $fields = $self->{fields}; >- my $resp = ITEM_INFO_RESP; > my $item; > my $i; > >@@ -1266,7 +1265,11 @@ sub handle_item_information { > $resp .= add_field( FID_HOLD_QUEUE_LEN, $i, $server ); > } > if ( $item->due_date ) { >- $resp .= add_field( FID_DUE_DATE, timestamp( $item->due_date ), $server ); >+ my $due_date = >+ $account->{format_due_date} >+ ? output_pref( { str => $item->due_date, as_due_date => 1 } ) >+ : timestamp( $item->due_date ); >+ $resp .= add_field( FID_DUE_DATE, $due_date, $server ); > } > if ( ( $i = $item->recall_date ) != 0 ) { > $resp .= add_field( FID_RECALL_DATE, timestamp($i), $server ); >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index a4d787d8ee..e985c3e27a 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -296,7 +296,7 @@ subtest "Test build_custom_field_string" => sub { > }; > > subtest "Test cr_item_field" => sub { >- plan tests => 2; >+ plan tests => 3; > > my $builder = t::lib::TestBuilder->new(); > my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >@@ -368,6 +368,18 @@ subtest "Test cr_item_field" => sub { > > my $itype = $item_object->itype; > ok( $response =~ m/CR$itype/, "Found correct CR field in response"); >+ >+ $server->{account}->{format_due_date} = 1; >+ t::lib::Mocks::mock_preference( 'dateFormat', 'sql' ); >+ my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object->itemnumber, date_due => "1999-01-01 12:59:00" })->store; >+ $siprequest = ITEM_INFORMATION . 'YYYYMMDDZZZZHHMMSS' . >+ FID_INST_ID . $branchcode . '|'. >+ FID_ITEM_ID . $item_object->barcode . '|' . >+ FID_TERMINAL_PWD . 'ignored' . '|'; >+ undef $response; >+ $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); >+ $msg->handle_item_information( $server ); >+ ok( $response =~ m/AH1999-01-01 12:59/, "Found correct CR field in response"); > }; > > subtest 'Patron info summary > 5 should not crash server' => sub { >-- >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 31552
:
140486
|
140487
| 141496