When creating a new basket in Acquisitions the fields "Title" and "quantity" are red (indicating mandatory) so I fill them in and click save, however if you do not select an option from "Source of classification or shelving scheme" (leaving it blank) then after clicking save an internal error occurs[1]. Using the back button to go back and fill in this field then clicking save will then show a basket with an excess entry (as the entry from before, although it caused an error, appears to still be added to the basket). Should "Source of classification or shelving scheme" be marked mandatory, or is this a bug in the display of the basket? [1] on mykoha.co.nz it is mentioned as "an internal error occured", however using my local setup I get "mismatched tag at line 7, column 2, byte 273 at /usr/lib/perl5/XML/Parser.pm line 187".
Created attachment 6324 [details] [review] Patch adds a stronger check on adding a closing </datafield> tag
Here is a further explanation of the bug, I was planning to post it with the patch but the attach patch button took me to another page. The bug seems to be caused by the line: $xml .= "</datafield>\n" if @$tags > 0; in C4/Biblio.pm (line 1955) It seems that if the Source of classification or shelving scheme is not filed in then the resulting xml is: <collection$ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> </datafield> </record> </collection> and if you do fill in the field then the xml is: <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> <datafield tag="952" ind1=" " ind2=" "> <subfield code="2">ddc</subfield> </datafield> </record> </collection> Patch places a stronger check on that line (checking if $xml contains a <datafield tag, rather than if $tags size is > 0)
I think the problem is perhaps not classification source, but that you have to fill out at least one field from the items form. Normally I use itemtype, branches would probably work too. Bug 4955 might be a duplicate.
Hey Katrin It appears you are right about any one of the fields having to be filled out, silly me. The issue described in bug 4955 seems to be related, sorry for the duplicate.
I spent a lot of time in acq running into this problem a lot. Glad you came up with a patch for it - it's an annoying bug.
Hi Chris, something seems to be wrong with your patch: git bz apply 7239 Bug 7239 - Acquisitions basket, add order to basket, from new, Source of classification or shelving scheme being blank caused internal error Patch adds a stronger check on adding a closing </datafield> tag Apply? [yn] y Patch format detection failed. git am -is3 /tmp/Patch-adds-a-stronger-check-on-adding-a-closing-da-zOWPN2.patch Patch format detection failed. Can you check and attach a new file please? Thx!
Created attachment 6588 [details] [review] Patch adds a stronger check on adding a closing </datafield> tag Sorry about that, it seems I generated that using git diff rather than format-patch. Corrected formatted patch attached.
Created attachment 6589 [details] [review] [SIGNED-OFF] bug 7239 fix to avoid error being thrown even though a record is created Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> When creating an item in acquisitions while ordering and not filling out any fields, there is no longer shown a perl error message.
QA comment: description updated, everything else fine, 1 line patch works as expected
*** Bug 4955 has been marked as a duplicate of this bug. ***
*** Bug 7692 has been marked as a duplicate of this bug. ***
This patch was included in 3.6.x prior to 3.6.4.