[Bug 8738] New: DateTime object being compared to a date string in circulation
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Priority: P5 - low Change sponsored?: Sponsored Bug ID: 8738 CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Assignee: koha-bugs@lists.koha-community.org Summary: DateTime object being compared to a date string in circulation Severity: enhancement Classification: Unclassified OS: All Reporter: mjr@software.coop URL: http://intranet/cgi-bin/koha/circ/circulation.pl Hardware: All Status: NEW Version: rel_3_8 Component: Circulation Product: Koha A DateTime object can only be compared to another DateTime object (DateTime=HASH(0x54110d8), 0). at /home/coop/koha/unstable/src/circ/circulation.pl line 346 at /usr/lib/perl5/DateTime.pm line 1801 DateTime::_compare('DateTime=HASH(0x54110d8)', 0, 0) called at /usr/lib/perl5/DateTime.pm line 1780 DateTime::compare('DateTime=HASH(0x54110d8)', 0) called at /usr/lib/perl5/DateTime.pm line 1762 DateTime::_compare_overload('DateTime=HASH(0x54110d8)', 0, '') called at /home/coop/koha/unstable/src/circ/circulation.pl line 346 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 MJ Ray (software.coop) <mjr@software.coop> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Severity|enhancement |major --- Comment #1 from MJ Ray (software.coop) <mjr@software.coop> --- This is happening when I try to circulate a book. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 --- Comment #2 from MJ Ray (software.coop) <mjr@software.coop> --- Created attachment 12049 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12049&action=edit circ/circulation.pl: force issuedate to a string to fix bug 8738 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 MJ Ray (software.coop) <mjr@software.coop> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff --- Comment #3 from MJ Ray (software.coop) <mjr@software.coop> --- Tested as working on local development installation. I can now circulate books again. I apologise for the incorrect line number in the earlier backtrace. It seems I had some development code (analytic item types, bug 7716) in the tree at the time. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 --- Comment #4 from Owen Leonard <oleonard@myacpl.org> --- See a lot of errors in the log from circulation.pl, but not this one. Does this only happen with a certain version or under certain circumstances? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to comment #4)
See a lot of errors in the log from circulation.pl, but not this one. Does this only happen with a certain version or under certain circumstances?
I must concur with Owen. I'm not seeing this error in master. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 --- Comment #6 from MJ Ray (software.coop) <mjr@software.coop> --- Well, it's great that it works for you, but it's erroring for some libraries. I suspect this might only present itself on upgrades where the circulation history meets some combination of conditions, but I have met it three times on different servers at different libraries so far: one we installed, one we upgraded and one we only support after they met this. In theory, it looks like a type error to me. Can you see how that circ/circulation.pl line http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=circ/circulation.p... isn't comparing a DateTime to a string, or explain why that isn't a bug? In the first comparison in that line: $it->{'issuedate'} is a DateTime returned by C4::Members::GetPendingIssues(...) since the addition of hourly loans. http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Members.pm;h=b2... $todaysdate is a string returned by C4::Dates->new->output('iso') http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Dates.pm;h=4fd0... At best, if this fix doesn't break your test copies in practice and you can't see a theoretical problem with it, could we include it, please? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- MJ, can you please provide us with a scenario that will produce the error you describe in comment 1? You tell us to prove this is not a bug. That seems a bit backwards, don't you think? I just want to be able to reproduce your error, and prove this patch fixes it with no new errors or bad behavior. Kyle (In reply to comment #6)
Well, it's great that it works for you, but it's erroring for some libraries.
I suspect this might only present itself on upgrades where the circulation history meets some combination of conditions, but I have met it three times on different servers at different libraries so far: one we installed, one we upgraded and one we only support after they met this.
In theory, it looks like a type error to me. Can you see how that circ/circulation.pl line http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=circ/circulation. pl;h=f15d4cea94e67e74b6c87ccbef50d0c572b658d1;hb=HEAD#l469 isn't comparing a DateTime to a string, or explain why that isn't a bug?
In the first comparison in that line:
$it->{'issuedate'} is a DateTime returned by C4::Members::GetPendingIssues(...) since the addition of hourly loans. http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Members.pm; h=b2f45b955bf3ff3ba57457ca6ec2130fb38021ec;hb=HEAD#l1039
$todaysdate is a string returned by C4::Dates->new->output('iso') http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Dates.pm; h=4fd08aeb6c4e94a744652b321202d313cd531eb5;hb=HEAD#l184
At best, if this fix doesn't break your test copies in practice and you can't see a theoretical problem with it, could we include it, please?
-- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 --- Comment #8 from MJ Ray (software.coop) <mjr@software.coop> --- For completeness, here's the correct error message when the analytic items enh isn't installed: Software error: A DateTime object can only be compared to another DateTime object (DateTime=HASH(0xa2d8aa8), 2012-08-31). at /usr/share/koha/intranet/cgi-bin/circ/circulation.pl line 464 I think the scenario is as follows: a. install a post-hourly-loans koha-common (3.8.4 was where I met it) on Ubuntu 10.04 LTS; b. circulate some books. And no, I don't think it's "backwards" to study the code and question how that ever doesn't error! Looking into that key question further, I found the changelog for DateTime.pm suggests only versions >= 0.54 allow comparing a DateTime to a string, but koha-common doesn't require any version (interestingly C4::Installer::PerlDependencies::PERL_DEPS says 0.58, so there's arguably a bug there) and Ubuntu 10.04 LTS (which is on at least two of the servers I've seen this bug on) only has version 0.52. So there are two obvious fixes: 1. apply this patch; 2. add a libdatetime-perl version requirement to koha-common which effectively excludes Ubuntu 10.04 Long Term Support from them, or would need us to provide packages for it. (This seems like an old chestnut - racing ahead with adoption of new versions of dependencies without considering what is actually available on stable server distributions - with a new twist, in that koha-common's version requirements don't match what's in C4::Installer::PerlDepenencies.) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12049|0 |1 is obsolete| | --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 12522 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12522&action=edit [SIGNED-OFF] circ/circulation.pl: force issuedate to a string to fix bug 8738 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Installed DataTime version 0.53, verified the error occurs. Applied patch, verified patch removes the error. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Thanks for the extra info. I was able to recreate your error and verify the patch fixes it. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |mtj@kohaaloha.com QA Contact| |mtj@kohaaloha.com --- Comment #11 from Mason James <mtj@kohaaloha.com> --- (In reply to comment #9)
Created attachment 12522 [details] [SIGNED-OFF] circ/circulation.pl: force issuedate to a string to fix bug 8738
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Installed DataTime version 0.53, verified the error occurs. Applied patch, verified patch removes the error.
i've verified this too, passing QA... $ koha-qa.pl -c 1 testing 1 commit(s) (applied to commit 6c18204) * 8bae944 circ/circulation.pl: force issuedate to a string to fix bug 8738 circ/circulation.pl * circ/circulation.pl OK -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |paul.poulain@biblibre.com --- Comment #12 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed to master -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8738 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED CC| |chris@bigballofwax.co.nz Resolution|--- |FIXED --- Comment #13 from Chris Cormack <chris@bigballofwax.co.nz> --- Released in 3.10.0 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org