Bug 4955 - adding to basket with no item throws error
Summary: adding to basket with no item throws error
Status: CLOSED DUPLICATE of bug 7239
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low critical (vote)
Assignee: Henri-Damien LAURENT
QA Contact: Bugs List
URL: cgi-bin/koha/acqui/addorder.pl
: 5073 (view as bug list)
Depends on:
Reported: 2010-07-07 13:49 UTC by Nicole C. Engard
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2010-07-07 13:49:55 UTC
When I am adding items to the basket and ignore the 'add item' form (filling in no values) I get the following error when I click 'save'


Software error:

:7: parser error : Opening and ending tag mismatch: record line 6 and datafield
:8: parser error : Opening and ending tag mismatch: collection line 2 and record
:9: parser error : Extra content at the end of the document
^ at /usr/lib/perl5/XML/LibXML/SAX/Parser.pm line 31

For help, please send mail to the webmaster (staff@bywatersolutions.com), giving this error message and the time and date of the error.


The item is added to my basket despite this error though.
Comment 1 Katrin Fischer 2010-07-08 21:46:01 UTC
I think my problem is related to Nicole's.

I filled out title and vendor price and clicked on save.

I have not defined an ACQ framework yet.

First my error message was:
mismatched tag at line 7, column 2, byte 273 at /usr/lib/perl5/XML/Parser.pm line 187

I changed my /etc/perl/XML/SAX/ParserDetails.ini according to Chris instructions so that sax_parser_print.pl was happy:

koha@koha-dev:/home/katrin/kohaclone/misc$ perl sax_parser_print.pl
Koha wants something like:
You have:
Looks good.

Now I see an Error 500 page after saving an order and a lot of error messages in koha-error_log caused by addorder.pl.

Koha version:

I think some fields are mandatory, but ther is no way to know which fields are. After I filled out title, itemtype, callnumber and vendor price the record saved ok.
Comment 2 Nicole C. Engard 2010-07-29 13:45:50 UTC
*** Bug 5073 has been marked as a duplicate of this bug. ***
Comment 3 Robin Sheat 2010-07-29 22:36:27 UTC
In this case, it's itemtype that's required, and without a default framework, the system can't know that it's mandatory. As Nicole said in bug 5073, it's a bug because of the error message alone. However, when I went into the code, it's not as simple as I hoped it might be to fix. I think three (and a bit) possible solutions are:
1) require an ACQ framework to exist, rather than just give a warning. It might be this could be done in a similar/the same way as in bug 5072. This doesn't solve the problem of requiring the ACQ to be mandatory however, as if the framework doesn't require it, (I think) this error will still occur.
1.1) provide a default ACQ framework that is properly set up.
2) Have the code near where the error is happening check for an item type and display a meaningful error when it's missing.
3) Have some JS on the relevant pages check for itemtype being set and notify the user.

Possibly all of these are correct, and should be done together :)

The comment on bug 3727 about not setting a default for mandatory items also has potential, in order to force a decision about what it should be to reduce the risk of junk entries.

Any thoughts?
Comment 4 Koustubha Kale 2010-12-02 09:02:55 UTC
I too am running into this problem. 
Selecting just item type while ignoring all other item fields, even ones marked as mandatory in the default framework allows the record to be added to the basket.

If I don't select the item type i get the 500 error on next web page while log displays a LARGE number of error lines.
Comment 5 Paul Poulain 2011-05-23 13:07:12 UTC
I think that if you validate without entering any subfield, it will result in a MARC::Field that is not builded. Thus when you try to append to MARC::Record, it fails.

That's a bug probably, even if we should request to have some information entered, Koha should fail gracefully in case there is none !
Comment 6 Katrin Fischer 2011-12-27 20:38:06 UTC

*** This bug has been marked as a duplicate of bug 7239 ***