Summary: | Dates compared arithmetically in MsgType.pm (warns: Argument isn't numeric in numeric ne) | ||
---|---|---|---|
Product: | Koha | Reporter: | Andrii Nugged <nugged> |
Component: | SIP2 | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | Pushed to main --- | QA Contact: | Paul Derscheid <paul.derscheid> |
Severity: | minor | ||
Priority: | P5 - low | CC: | jonathan.druart, m.de.rooy, paul.derscheid |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: |
25.05.00
|
Circulation function: | |
Bug Depends on: | 5601 | ||
Bug Blocks: | 25790 | ||
Attachments: |
Bug 29410: Resolve warn on numeric ne for two dates
Bug 29410: Resolve warn on numeric ne for two dates |
Description
Andrii Nugged
2021-11-04 03:34:54 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 error, 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' 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' 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. 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. Created attachment 178920 [details] [review] Bug 29410: Resolve warn on numeric ne for two dates Simply, remove the !=0 test. Test for true. Test plan: Restart SIP. Ask item info (SIP 17) on a waiting hold. It must have a hold pickup date. Check that warn disappears with this patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Trivial. Self SO Cane across this one in 23.11. Still in master too. Created attachment 179050 [details] [review] Bug 29410: Resolve warn on numeric ne for two dates Simply, remove the !=0 test. Test for true. Test plan: Restart SIP. Ask item info (SIP 17) on a waiting hold. It must have a hold pickup date. Check that warn disappears with this patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Pushed for 25.05! Well done everyone, thank you! |