Created attachment 9884 [details] [review] Bug 8180 - cataloguing/additem.pl plack scoping $dbh needs our scoping when using "Add item" to prevent error Can't call method "prepare" on an undefined value at /srv/koha/cataloguing/additem.pl line 88. Test scenario: 1. start intranet with plack 2. select one Edit items on one record 3. fill in new item and click on "Add item"
This works fine for me under Plack. Can you please confirm exactly how one would go about reproducing this bug?
I just verified it with current master using following: 1. search for word in intranet (I'm using human with URL /cgi-bin/koha/catalogue/search.pl?idx=kw&q=human&idx=kw&q=&idx=kw&q=&limit=&limit=&limit=&limit=&limit=&sort_by=relevance) 2. select "edit item" from first result 3. press "add item" button on add item form 4. Can't call method "prepare" on an undefined value at /srv/koha/cataloguing/additem.pl line 88. Hope this helps. p.s. I can also reproduce it with different search queries, and this patch still fixes problem for me.
I also can not replicate this issue.
This bug depends on barcodes, so your item.barcode must be used in framework and you should have (any) barcode plugin enabled in system preferences.
Dobrica, my item.barcode is linked to Plugin:barcode.pl. Also, i use autoBarcode syspref but can't reproduce the bug.
Created attachment 10270 [details] [review] [SIGNED-OFF] Bug 8180 - cataloguing/additem.pl plack scoping Steps to reproduce the bug: - Set autoBarcode syspref to "incremental" ("generated in the form 1, 2, 3.") - Assure you have an item subfield mapped to items.barcode - Go to cataloguing/additem.pl and add a new item leaving empty the barcode field. Signed off.
I can't reproduce with: - syspref autoBarcode=incremental (generated in the form 1, 2, 3.) - items.barcode mapped with 995$f mysql> select kohafield, frameworkcode from marc_subfield_structure where tagfield=995 and tagsubfield='f'; +---------------+---------------+ | kohafield | frameworkcode | +---------------+---------------+ | items.barcode | | | items.barcode | ACQ | - I can edit and create items on a biblio which already contains (or not) items So I can't passed QA
I probably forgot to say that you SHOULD NOT enter barcode using plugin, but to leave it empty to trigger code path which this bug fixes. If you already have barcode or you fill it in using plugin it will not show up. Jonathan, could you please insert warn inside sub _increment_barcode to verify which framework gets passed like this: my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); warn "## $frameworkcode $tagfield $tagsubfield"; unless ($record->field($tagfield)->subfield($tagsubfield)) { # triggers bug } In my case this warn produce "LIB 952 p" which is consistent with our configuration: mysql> select variable,value from systempreferences where variable = 'autoBarcode' ; +-------------+-------------+ | variable | value | +-------------+-------------+ | autoBarcode | incremental | +-------------+-------------+ mysql> select kohafield, frameworkcode, tagfield, tagsubfield from marc_subfield_structure where kohafield='items.barcode' and frameworkcode='LIB' ; +---------------+---------------+----------+-------------+ | kohafield | frameworkcode | tagfield | tagsubfield | +---------------+---------------+----------+-------------+ | items.barcode | LIB | 952 | p | +---------------+---------------+----------+-------------+
Plack scoping change only, ruled safe for CGI environments, marking Passed QA
There have been no further reports of problems so I am marking this bug resolved.