Summary: | DateTime object being compared to a date string in circulation | ||
---|---|---|---|
Product: | Koha | Reporter: | MJ Ray (software.coop) <mjr> |
Component: | Circulation | Assignee: | Bugs List <koha-bugs> |
Status: | CLOSED FIXED | QA Contact: | Mason James <mtj> |
Severity: | major | ||
Priority: | P5 - low | CC: | chris, gmcharlt, kyle.m.hall, kyle, mtj, paul.poulain |
Version: | 3.8 | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://intranet/cgi-bin/koha/circ/circulation.pl | ||
Change sponsored?: | Sponsored | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
circ/circulation.pl: force issuedate to a string to fix bug 8738
[SIGNED-OFF] circ/circulation.pl: force issuedate to a string to fix bug 8738 |
Description
MJ Ray (software.coop)
2012-09-07 14:13:37 UTC
This is happening when I try to circulate a book. Created attachment 12049 [details] [review] circ/circulation.pl: force issuedate to a string to fix bug 8738 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. 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? (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. 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? 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? 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.) Created attachment 12522 [details] [review] [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. Thanks for the extra info. I was able to recreate your error and verify the patch fixes it. (In reply to comment #9) > Created attachment 12522 [details] [review] > [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 Patch pushed to master Released in 3.10.0 |