@@ -, +, @@ checkout response 1 - checkout an item via SIP: 2 - Note the AH field is like "YYYYMMDD HHMMSS" 3 - Apply patch 4 - repeat SIP checkout - nothing has changed 5 - edit SIPConfig.xml and add format_due_date="1" to 'term1' account: 6 - restart all 7 - repeat the SIP checkout 8 - AH field now matches dateFormat system preference 9 - Change your dateFormat preference --- C4/SIP/Sip/MsgType.pm | 9 ++++++++- t/db_dependent/SIP/Message.t | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) --- a/C4/SIP/Sip/MsgType.pm +++ a/C4/SIP/Sip/MsgType.pm @@ -21,6 +21,7 @@ use C4::Auth qw(&check_api_auth); use Koha::Patrons; use Koha::Patron::Attributes; use Koha::Items; +use Koha::DateUtils qw( output_pref ); use UNIVERSAL::can; @@ -562,7 +563,13 @@ 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 ) { - $resp .= add_field( FID_DUE_DATE, timestamp( $item->due_date ), $server ); + 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 ); + } + $resp .= add_field( FID_DUE_DATE, $due_date, $server ); } else { $resp .= add_field( FID_DUE_DATE, q{}, $server ); } --- a/t/db_dependent/SIP/Message.t +++ a/t/db_dependent/SIP/Message.t @@ -71,7 +71,7 @@ subtest 'Testing Patron Info Request V2' => sub { subtest 'Checkout V2' => sub { my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; - plan tests => 3; + plan tests => 5; $C4::SIP::Sip::protocol_version = 2; test_checkout_v2(); $schema->storage->txn_rollback; @@ -614,6 +614,15 @@ sub test_checkout_v2 { $msg->handle_checkout( $server ); $respcode = substr( $response, 0, 2 ); is( Koha::Checkouts->search({ itemnumber => $item_object->id })->count, 1, "Item was checked out (prevcheckout_block_checkout disabled)"); + + $msg->handle_checkout( $server ); + ok( $response =~ m/AH\d{8} \d{6}/, "Found AH field as timestamp in response"); + $server->{account}->{format_due_date} = 1; + t::lib::Mocks::mock_preference( 'dateFormat', 'sql' ); + undef $response; + $msg->handle_checkout( $server ); + ok( $response =~ m/AH\d{4}-\d{2}-\d{2}/, "Found AH field as SQL date in response"); + } sub test_checkin_v2 { --