Created attachment 13711 [details] 090 in the marc record I have itemcallnumber set to 090abvy but it's only pulling subfields ab from the attached record. This preference should pull all subfields listed.
Created attachment 13712 [details] call number on item
How do you reproduce this bug?
I think what I'd try is adding a 090 with all the listed subfields to a record. Then set itemcallnumber to 090abvy and create an item from the record. It should pull all subfields. Bug 3426 seems similar.
To fix the probblrm we need to work on line 149 - 160 of ../cataloguing/additem.pl. The lines are: 149 my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); 150 if (!$value && $subfieldlib->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) { 151 my $CNtag = substr($pref_itemcallnumber, 0, 3); 152 my $CNsubfield = substr($pref_itemcallnumber, 3, 1); 153 my $CNsubfield2 = substr($pref_itemcallnumber, 4, 1); 154 my $temp2 = $temp->field($CNtag); 155 if ($temp2) { 156 $value = ($temp2->subfield($CNsubfield)).' '.($temp2->subfield($CNsubfield2)); 157 #remove any trailing space incase one subfield is used 158 $value =~ s/^\s+|\s+$//g; 159 } 160 } It is clear that first and second subfields are user. Inside '$temp' you find bibliographic record data.
Created attachment 95580 [details] [review] Bug 9156: itemcallnumber not pulling more than 2 subfields When the itemcallnumber system preference is defined, the item add form pulls data from the specified tag and subfield(s) to pre-populate the call number field. This update makes it possible to build the prepopulated callnumber from more than just the first two subfields. To test, apply the patch and update the itemcallnumber system preference so that it includes more than two subfields. For instance, "092abef" - Edit a bibliographic record and populate the specified subfields. e.g. subfield a -> "One", b-> "Two", e-> "Three", f-> "Four". - Save the record and go to the add/edit items screen. - The call number field should contain a string which contains each of the subfields you populated, concatenated with spaces: "One Two Three Four." - Test with other numbers of subfields. - Test with an empty itemcallnumber preference.
Hi Owen, I had 2 issues during my tests. The itemcallnumber field is not populated when I add the item, I need to modify it and save it a second time. I know it's not allowed in MARC21, but we have in our Unimarc item framework both upper and lower case and the patch only works with Upper case. Do you think it can be case sensitive ? (if I remember well, I think Katrin can be also concerned).
Séverine I wasn't able to reproduce either of these problems. Could you test again and see if luck shines on me?
Created attachment 96486 [details] [review] Bug 9156: itemcallnumber not pulling more than 2 subfields When the itemcallnumber system preference is defined, the item add form pulls data from the specified tag and subfield(s) to pre-populate the call number field. This update makes it possible to build the prepopulated callnumber from more than just the first two subfields. To test, apply the patch and update the itemcallnumber system preference so that it includes more than two subfields. For instance, "092abef" - Edit a bibliographic record and populate the specified subfields. e.g. subfield a -> "One", b-> "Two", e-> "Three", f-> "Four". - Save the record and go to the add/edit items screen. - The call number field should contain a string which contains each of the subfields you populated, concatenated with spaces: "One Two Three Four." - Test with other numbers of subfields. - Test with an empty itemcallnumber preference. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Owen's test plan worked for me. I could not replicate Séverine's issues. I added a subfield A and Koha correctly handled both a and A.
Created attachment 96499 [details] [review] Bug 9156: (follow-up) Simpliy code The MARC::Field as_string method can join multiple subfield using a delimiter, this simplifies the code here
After Nick's change, this is misbehaving slightly, not getting the right order in the item record. My syspref says: 082abmqA My bib says: 082 $a a $b b $m m $q q $A A The item call number generates as: a A b m q
Failing QA because of Andrew's comment.
(In reply to Andrew Fuerste-Henry from comment #11) > After Nick's change, this is misbehaving slightly, not getting the right > order in the item record. > > My syspref says: 082abmqA > > My bib says: > 082 $a a > $b b > $m m > $q q > $A A > > The item call number generates as: a A b m q I cannot recreate this - the code for MARC::Field->as_string should preserve the order in the record. Can you share your sample record?
Created attachment 96764 [details] [review] Bug 9156: Clarify order in the syspref
(In reply to Katrin Fischer from comment #12) > Failing QA because of Andrew's comment. Spoke with Andrew, we agreed order in record should preserved, attached a follow-up to be explicit about this in the pref
Created attachment 96766 [details] [review] Bug 9156: (follow-up) Simpliy code The MARC::Field as_string method can join multiple subfield using a delimiter, this simplifies the code here Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Created attachment 96767 [details] [review] Bug 9156: Clarify order in the syspref Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
signing off again based on clarification
Comment on attachment 96767 [details] [review] Bug 9156: Clarify order in the syspref Review of attachment 96767 [details] [review]: ----------------------------------------------------------------- ::: C4/Reserves.pm @@ +1195,5 @@ > # FIXME - a lot of places in the code do this > # or something similar - need to be > # consolidated > + my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); > + my $notforloan_per_itemtype = defined $itemtype ? $itemtype->notforloan : 0; I think this got in by accident - can you please resubmit the patch?
Created attachment 96792 [details] [review] Bug 9156: Clarify order in the syspref
(In reply to Nick Clemens from comment #13) > (In reply to Andrew Fuerste-Henry from comment #11) > > After Nick's change, this is misbehaving slightly, not getting the right > > order in the item record. > > > > My syspref says: 082abmqA > > > > My bib says: > > 082 $a a > > $b b > > $m m > > $q q > > $A A > > > > The item call number generates as: a A b m q > > I cannot recreate this - the code for MARC::Field->as_string should preserve > the order in the record. Can you share your sample record? It preserves the order in the record, but not the one from the syspref. From the test plan, if I edit the pref and set 082$efab it does not change anything. Should not we follow the order of the syspref?
We can't both preserve record order and obey syspref order. Talking it over with Andrew and the educators we agreed the record order should be preserved
(In reply to Nick Clemens from comment #22) > We can't both preserve record order and obey syspref order. > > Talking it over with Andrew and the educators we agreed the record order > should be preserved Order in the recod with a clear note on the pref like done here makes sense to me.
Created attachment 97190 [details] [review] Bug 9156: itemcallnumber not pulling more than 2 subfields When the itemcallnumber system preference is defined, the item add form pulls data from the specified tag and subfield(s) to pre-populate the call number field. This update makes it possible to build the prepopulated callnumber from more than just the first two subfields. To test, apply the patch and update the itemcallnumber system preference so that it includes more than two subfields. For instance, "092abef" - Edit a bibliographic record and populate the specified subfields. e.g. subfield a -> "One", b-> "Two", e-> "Three", f-> "Four". - Save the record and go to the add/edit items screen. - The call number field should contain a string which contains each of the subfields you populated, concatenated with spaces: "One Two Three Four." - Test with other numbers of subfields. - Test with an empty itemcallnumber preference. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 97191 [details] [review] Bug 9156: (follow-up) Simpliy code The MARC::Field as_string method can join multiple subfield using a delimiter, this simplifies the code here Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 97192 [details] [review] Bug 9156: Clarify order in the syspref Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nice work everyone! Pushed to master for 20.05
Pushed to 19.11.x branch for 19.11.03