Bug 8180

Summary: cataloguing/additem.pl plack scoping
Product: Koha Reporter: Dobrica Pavlinusic <dpavlin>
Component: CatalogingAssignee: Dobrica Pavlinusic <dpavlin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: alex.arnaud, chris, jonathan.druart+koha, julian.maurice, koha.sekjal, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 7172    
Attachments: Bug 8180 - cataloguing/additem.pl plack scoping
[SIGNED-OFF] Bug 8180 - cataloguing/additem.pl plack scoping

Description Dobrica Pavlinusic 2012-06-01 14:15:05 UTC

    
Comment 1 Dobrica Pavlinusic 2012-06-01 14:40:09 UTC Comment hidden (obsolete)
Comment 2 Jared Camins-Esakov 2012-06-09 19:53:13 UTC
This works fine for me under Plack. Can you please confirm exactly how one would go about reproducing this bug?
Comment 3 Dobrica Pavlinusic 2012-06-09 21:49:14 UTC
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.
Comment 4 Chris Cormack 2012-06-11 11:16:47 UTC
I also can not replicate this issue.
Comment 5 Dobrica Pavlinusic 2012-06-11 11:42:28 UTC
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.
Comment 6 Alex Arnaud 2012-06-11 15:21:17 UTC
Dobrica,

my item.barcode is linked to Plugin:barcode.pl. Also, i use autoBarcode syspref but can't reproduce the bug.
Comment 7 Julian Maurice 2012-06-14 08:09:22 UTC
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.
Comment 8 Jonathan Druart 2012-06-14 12:50:37 UTC
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
Comment 9 Dobrica Pavlinusic 2012-06-14 14:21:27 UTC
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           |
+---------------+---------------+----------+-------------+
Comment 10 Ian Walls 2012-06-15 17:11:00 UTC
Plack scoping change only, ruled safe for CGI environments, marking Passed QA
Comment 11 Jared Camins-Esakov 2012-12-31 01:11:31 UTC
There have been no further reports of problems so I am marking this bug resolved.