[Bug 17933] New: Prevent internal software error when searching patron with invalid birth date
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Bug ID: 17933 Summary: Prevent internal software error when searching patron with invalid birth date Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Staff Client Assignee: koha-bugs@lists.koha-community.org Reporter: dpavlin@rot13.org QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com It seems that Bug 17557 reintroduced problem with invalid birth dates fixed by Bug 17375. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=17375 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #1 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Our current problem are patrons without date of birth, which isn't covered by tests -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Prevent internal software |Internal software error |error when searching patron |when searching patron |with invalid birth date |without birth date -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dpavlin@rot13.org |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #2 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Created attachment 59172 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59172&action=edit Bug 17933 - Internal software error when searching patron without birth date When patrons don't have date of birth (which is not required) patron search results on moremember page produce internal server error since we can't convert MySQL invalid date 0000-00-00 to datetime object and call strfdate on it. Additionally, since we assign dates to template variables and after than assign whole $data hash to template, later assigment overrides previous one, so we see birth date field even for patrons which don't have one. This patch fixes both of those problems. Test: 1. edit patron and remove it's birth date 2. try to search for it, and verify server error 3. apply patch 4. repeat search for patron and verify that it works and doesn't have enpty birth date field -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - low |P1 - high Severity|major |critical -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Gracie <grace.mcky@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |grace.mcky@gmail.com --- Comment #3 from Gracie <grace.mcky@gmail.com> --- I followed your test plan and I cannot reproduce the bug. Can someone else test to confirm that this a valid bug? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I found a way to reproduce it. It happens when 0000-00-00 is in the dateofbirth field in the borrowers table, not with NULL or ''. But the only way I managed to put the invalid date there was SQL. Dobrica, could this be old data we are dealing with here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Gracie <grace.mcky@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Gracie <grace.mcky@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59172|0 |1 is obsolete| | --- Comment #5 from Gracie <grace.mcky@gmail.com> --- Created attachment 59194 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59194&action=edit Bug 17933 - Internal software error when searching patron without birth date When patrons don't have date of birth (which is not required) patron search results on moremember page produce internal server error since we can't convert MySQL invalid date 0000-00-00 to datetime object and call strfdate on it. Additionally, since we assign dates to template variables and after than assign whole $data hash to template, later assigment overrides previous one, so we see birth date field even for patrons which don't have one. This patch fixes both of those problems. Test: 1. edit patron and remove it's birth date 2. try to search for it, and verify server error 3. apply patch 4. repeat search for patron and verify that it works and doesn't have enpty birth date field Signed-off-by: Grace McKenzie <grace.mcky@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 59214 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59214&action=edit Bug 17933: Add test and return unless defined dob Without this patch get_age return actually 0 instead of -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 59215 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59215&action=edit Bug 17933: Do not instanciate a patron if not needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Hi Dobrica! Since 3.21.00.023 you should not have any 0000-00-00 values in the borrowers table. We should no longer deal with these values in our code. However undef must be handled in the ->get_age method. I also agree with the change in the pl script. Note that these 2 last patches will break again 0000-00-00, will you agree with that? Do you know why you still get these invalid values in DB? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |major --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Lowering the severity as it should not happen with valid data. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #10 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Most of our invalid birth dates in DB are result of external bulk script to open accounts at beginning of each academic year since source data sometimes doesn't have birth dates, so this is our local problem, and not Koha related. However, it doesn't explain all entries, since some of them are created after bulk script, using Koha's replication from LDAP. We have following mapping in koha-conf.xml: <dateofbirth is="hredupersondateofbirth" ></dateofbirth> and if LDAP entry doesn't have hredupersondateofbirth we are also getting 0000-00-00 for dateofbirth in Koha mosty because of $data = $mapping{$key}->{content} || ''; # default or failsafe '' from ldap_entry_2_hash in C4/Auth_with_ldap.pm. Sould I fix ldap_entry_2_hash as separate bug? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #11 from Dobrica Pavlinusic <dpavlin@rot13.org> --- On closer review, our script is using C4::Auth_with_ldap::ldap_entry_2_hash so I opened Bug 18016 to track this issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=18016 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59194|0 |1 is obsolete| | Attachment #59214|0 |1 is obsolete| | Attachment #59215|0 |1 is obsolete| | --- Comment #12 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Created attachment 59733 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59733&action=edit Bug 17933: Do not instanciate a patron if not needed Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Dobrica Pavlinusic <dpavlin@rot13.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59733|0 |1 is obsolete| | --- Comment #13 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Created attachment 59734 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59734&action=edit Bug 17933 - Internal software error when searching patron without birth date When patrons don't have date of birth (which is not required) patron search results on moremember page produce internal server error since we can't convert MySQL invalid date 0000-00-00 to datetime object and call strfdate on it. Additionally, since we assign dates to template variables and after than assign whole $data hash to template, later assigment overrides previous one, so we see birth date field even for patrons which don't have one. This patch fixes both of those problems. Test: 1. edit patron and remove it's birth date 2. try to search for it, and verify server error 3. apply patch 4. repeat search for patron and verify that it works and doesn't have enpty birth date field Signed-off-by: Grace McKenzie <grace.mcky@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #14 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Created attachment 59735 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59735&action=edit Bug 17933: Add test and return unless defined dob Without this patch get_age return actually 0 instead of Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #15 from Dobrica Pavlinusic <dpavlin@rot13.org> --- Created attachment 59736 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59736&action=edit Bug 17933: Do not instanciate a patron if not needed Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59734|0 |1 is obsolete| | --- Comment #16 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 60356 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60356&action=edit Bug 17933 - Internal software error when searching patron without birth date When patrons don't have date of birth (which is not required) patron search results on moremember page produce internal server error since we can't convert MySQL invalid date 0000-00-00 to datetime object and call strfdate on it. Additionally, since we assign dates to template variables and after than assign whole $data hash to template, later assigment overrides previous one, so we see birth date field even for patrons which don't have one. This patch fixes both of those problems. Test: 1. edit patron and remove it's birth date 2. try to search for it, and verify server error 3. apply patch 4. repeat search for patron and verify that it works and doesn't have enpty birth date field Signed-off-by: Grace McKenzie <grace.mcky@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59735|0 |1 is obsolete| | --- Comment #17 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 60357 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60357&action=edit Bug 17933: Add test and return unless defined dob Without this patch get_age return actually 0 instead of Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #59736|0 |1 is obsolete| | --- Comment #18 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 60358 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60358&action=edit Bug 17933: Do not instanciate a patron if not needed Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |kyle@bywatersolutions.com --- Comment #19 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 17.05, thank Dobrica, Jonathan! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Patch doesn't apply cleanly on 16.11.x - please rebase! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Master |RESOLVED --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hm, looking at the dependencies more closely - as bug 17557 is not part of 16.11.x this doesn't seem to be needed. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org