Bug 29410 - Dates compared arithmetically in MsgType.pm (warns: Argument isn't numeric in numeric ne)
Summary: Dates compared arithmetically in MsgType.pm (warns: Argument isn't numeric in...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 5601
Blocks: 25790
  Show dependency treegraph
 
Reported: 2021-11-04 03:34 UTC by Andrii Nugged
Modified: 2022-05-17 11:57 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrii Nugged 2021-11-04 03:34:54 UTC
Regular warnings a-la:

Argument "2021-11-04" isn't numeric in numeric ne (!=) at /usr/share/koha/lib/C4/SIP/Sip/MsgType.pm line 1265.

emitted in C4::SIP::Sip::MsgType handle_item_information sub.
Comment 1 Andrii Nugged 2021-11-05 09:11:47 UTC Comment hidden (obsolete)
Comment 2 Andrii Nugged 2021-11-05 09:12:20 UTC
there are two pieces of the code:

    if ( ( $i = $item->recall_date ) != 0 ) {
        $resp .= add_field( FID_RECALL_DATE, timestamp($i), $server );
    }
    if ( ( $i = $item->hold_pickup_date ) != 0 ) {
        $resp .= add_field( FID_HOLD_PICKUP_DATE, timestamp($i), $server );
    }


when those emits the warning,

Argument "2021-11-04" isn't numeric in numeric ne (!=) at /usr/share/koha/lib/C4/SIP/Sip/MsgType.pm

I that dumped, 'C4::SIP::ILS::Item=HASH(0x556838ade6a8)' comes with hold_pickup_date '2021-11-04' which is 'SCALAR'
Comment 3 Andrii Nugged 2021-11-06 13:46:39 UTC
more notes:

$item->due_date comes in as DateTime object once,
    '2021-12-03T23:59:00', ref: 'DateTime'
    but it also comes as scalar '0'.

$item->hold_pickup_date comes in as scalar '2021-11-11', ref: ''
    it also comes as scalar '0'.

$item->recall_date comes as scalar '0',
    I didn't yet figure out in which kind it comes when it has non-zero.
Comment 4 Jonathan Druart 2021-11-18 09:20:56 UTC
See also
  commit d4842d45601bd0f9c1bd33bf7978586ae746888f
  Bug 5601 Fix processing of DueDate return

I think it would make sense to apply the same change for both recall_date and hold_pickup_date.