Bug 8275

Summary: xml parsing error when the webservice GetPatronInfo/show_loans is called
Product: Koha Reporter: Koha Team University Lyon 3 <koha>
Component: CirculationAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Mason James <mtj>
Severity: normal    
Priority: P5 - low CC: chris, gmcharlt, kyle.m.hall, mtj, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Proposed patch (dates with hour)
Bug 8275: xml parsing error when the webservice GetPatronInfo/show_loans is called

Description Koha Team University Lyon 3 2012-06-20 14:26:22 UTC
When called by the webservice GetPatronInfo (C4/ILSDI/Services.pm) with show_loans parameter defined, the GetPendingIssues routine return a hash including Datetime object (since Bug 5549 - Hourly Loans). These Datetime objects seem to have some bad consequences on the display :

The final display :
Parsing error...
<pre>A Datetime object can only be compared to another Datetime object (DateTime=HASH(0xaa1a3000), HASH(0xa960xf0)) at /usr/share/perl5/XML/Simple.xml line 1406

As a work-around, I added theese lines (wich permit a correct display) in Services.pm line 421 :

if ( $cgi->param('show_loans') eq "1" ) {
    my $issues = GetPendingIssues($borrowernumber);
+    foreach my $issue ( @$issues ){
+        $issue->{issuedate} =  $issue->{issuedate}->ymd;
+        $issue->{date_due} =  $issue->{date_due}->ymd;
+    }
    $borrower->{'loans'}->{'loan'} = $issues;
}
Comment 1 Fridolin Somers 2012-07-19 09:49:41 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2012-08-24 03:49:16 UTC
Created attachment 11822 [details] [review]
Bug 8275: xml parsing error when the webservice GetPatronInfo/show_loans is called

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 3 Mason James 2012-09-14 15:40:52 UTC
> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

patch looks good, passing QA…

$ koha-qa.pl 

testing 1 commit(s) (applied to commit 0acebb8)
 * 3414757 Bug 8275: xml parsing error when the webservice GetPatronInfo/sho
      C4/ILSDI/Services.pm

* C4/ILSDI/Services.pm                                                     OK
Comment 4 Paul Poulain 2012-09-17 17:03:01 UTC
Koha team Lyon 3, do you agree with the counter fix proposed by Fridolyn ?
Comment 5 Koha Team University Lyon 3 2012-09-18 08:51:10 UTC
(In reply to comment #4)
> Koha team Lyon 3, do you agree with the counter fix proposed by Fridolyn ?

Seems that makes sense, it's ok for us
Comment 6 Paul Poulain 2012-09-18 09:30:07 UTC
Patch pushed to master
Comment 7 Chris Cormack 2012-09-19 02:59:09 UTC
Pushed to 3.8.x, will be in 3.8.5