Bug 17774 - Acquisitions module getting internal server error when adding orders to basket - a case of barcode not autoincrementing (?)
Summary: Acquisitions module getting internal server error when adding orders to baske...
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-14 10:52 UTC by Eugene Espinoza
Modified: 2020-11-30 21:45 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Espinoza 2016-12-14 10:52:51 UTC
In a new Koha 16.11 instance, when adding orders to basket with the following system preferences: 
a) AcqCreateItem = placing an order
b) autoBarcode is set to generated in the form <branchcode>yymm0001.
c) plack enabled
d) 952$o has plugin 'barcode.pl'

A barcode is not filled up (just clicked 'Add item' button) during adding of items since it is implicitly stated in the interface: "The autoBarcode system preference is set to hbyymmincr and items with blank barcodes will have barcodes generated upon save to database." However, when the order is being saved, I am getting internal server error. So, I have to click the Back button to go back to what I'm doing. And when I returned to the "add orders to basket" interface, and then click save to finish the transaction, I am able to finish the transaction, however, I now get two items ordered, first one with only the title and the second one has the title and the patron who suggested the material (see http://koha.1045719.n5.nabble.com/file/n5913371/acqui_internal_server_error.png).

Tried this in another server with same database, however I'm getting "Software error:

DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /usr/share/koha/lib/Koha/Acquisition/Order.pm line 68"

But when brought to the Basket no., I can see the order.

Delving into the plack-error message in the first server:
No existing hbyymmincr barcodes found.  Reverting to initial value. at /usr/share/koha/lib/C4/Barcodes/hbyymmincr.pm line 62.
DBD::mysql::st execute failed: Duplicate entry 'DLSU-D16120002' for key 'itembarcodeidx' [for Statement "INSERT INTO items SET
            biblionumber        = ?,
            biblioitemnumber    = ?,
            barcode             = ?,
            dateaccessioned     = ?,
            booksellerid        = ?,
            homebranch          = ?,
            price               = ?,
            replacementprice    = ?,
            replacementpricedate = ?,
            datelastborrowed    = ?,
            datelastseen        = ?,
            stack               = ?,
            notforloan          = ?,
            damaged             = ?,
            itemlost            = ?,
            withdrawn           = ?,
            itemcallnumber      = ?,
            coded_location_qualifier = ?,
            restricted          = ?,
            itemnotes           = ?,
            itemnotes_nonpublic = ?,
            holdingbranch       = ?,
            paidfor             = ?,
            location            = ?,
            permanent_location  = ?,
            onloan              = ?,
            issues              = ?,
            renewals            = ?,
            reserves            = ?,
            cn_source           = ?,
            cn_sort             = ?,
            ccode               = ?,
            itype               = ?,
            materials           = ?,
            uri                 = ?,
            enumchron           = ?,
            more_subfields_xml  = ?,
            copynumber          = ?,
            stocknumber         = ?,
            new_status          = ?
          " with ParamValues: 0="4911", 1='4911', 2="DLSU-D16120002", 3='2016-12-14', 4=undef, 5="DLSU-D", 6=undef, 7=undef, 8='2016-12-14', 9=undef, 10='2016-12-14', 11=undef, 12=0, 13=0, 14=0, 15=0, 16=undef, 17=undef, 18=undef, 19=undef, 20=undef, 21="DLSU-D", 22=undef, 23=undef, 24=undef, 25=undef, 26=undef, 27=undef, 28=undef, 29="lcc", 30='', 31=undef, 32=undef, 33=undef, 34=undef, 35=undef, 36=undef, 37=undef, 38=undef, 39=undef] at /usr/share/koha/lib/C4/Items.pm line 2119.
DBD::mysql::st execute failed: Column 'itemnumber' cannot be null [for Statement "INSERT INTO `aqorders_items` ( `itemnumber`, `ordernumber`) VALUES ( ?, ? )" with ParamValues: 0=undef, 1='45'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

And the second server's intranet error log snippet:
[Wed Dec 14 18:15:55.903548 2016] [cgi:error] [pid 19570] [client 112.198.75.180:54634] AH01215: [Wed Dec 14 18:15:55 2016] addorder.pl:           " with ParamValues: 0="4914", 1='4913', 2="DLSU-D16120002", 3='2016-12-14', 4=undef, 5="DLSU-D", 6=undef, 7=undef, 8='2016-12-14', 9=undef, 10='2016-12-14', 11=undef, 12=0, 13=0, 14=0, 15=0, 16=undef, 17=undef, 18=undef, 19=undef, 20=undef, 21="DLSU-D", 22=undef, 23=undef, 24=undef, 25=undef, 26=undef, 27=undef, 28=undef, 29="lcc", 30='', 31=undef, 32=undef, 33=undef, 34=undef, 35=undef, 36=undef, 37=undef, 38=undef, 39=undef] at /usr/share/koha/lib/C4/Items.pm line 2119.

I feel that the barcode is not auto-incrementing (but I don't know why it isn't) as I see in the first server the same barcode 'DLSU-D16120002' is showing up several times, and this is supposed to be incremented. I also see that this barcode is already used by another item. A discussion of this is in http://koha.1045719.n5.nabble.com/Acquisitions-module-internal-server-error-td5913371.html#a5914017
Comment 1 Eugene Espinoza 2016-12-14 11:01:53 UTC
I tried renaming the barcode of the item that already has the problematic barcode. I was able to successfully add an order into the basket by going through the same process as described in the first post. I added again another order into the basket (based from a suggestion), I got same error message as described in the second server.
Comment 2 Jonathan Druart 2017-01-09 10:46:14 UTC
I cannot recreate. I have used the default configuration (ie. 952$p has plugin barcode.pl).
When I order my first item, I get "No existing hbyymmincr barcodes found.  Reverting to initial value. at /home/vagrant/kohaclone/C4/Barcodes/hbyymmincr.pm line 62." in the log, but the barcode field has correctly been set to CPL17010002.
Then I ordered 2 more items, and got CPL17010003 and CPL17010004 generated.
Comment 3 Nick Clemens 2019-12-10 17:42:48 UTC
Is this still happening? Or was it resolved?
Comment 4 Jonathan Druart 2019-12-11 09:34:55 UTC
No answered, and worked for me.
Closing, Eugene please reopen if still valid.