If ISBN has 10 numbers only the first 9 numbers are being added to the Edifact-message (PIA+5+3540556753:IB') The bug is located in Koha/Edifact/Order.pm elsif ( $isbn_field =~ m/(\d{9})[Xx\d]/ ) { $product_id = $1; $product_code = 'IB'; } product_id will only get the first 9 chars in the regular expression because of the placement on the parenthesis. The solution to this is to move the right parenthesis like below: elsif ( $isbn_field =~ m/(\d{9}[Xx\d])/ ) { $product_id = $1; $product_code = 'IB'; }
Created attachment 76225 [details] [review] Bug 20972: If ISBN has 10 numbers only the first 9 numbers are used If ISBN has 10 numbers only the first 9 numbers are being added to the Edifact-message (PIA+5+3540556753:IB') This is caused by wrong positioning of capturing parentheses in a regular expression. Sponsored-by: Gothenburg University Library
Created attachment 76281 [details] [review] Signed off patch correcting ISBN extraction Signed off patch
Created attachment 76290 [details] [review] Add a test case for this to Ediorder.t Add a test for this bug and ensure routine is correctly distinguishing 10 character ISBNs from 13 digit EANs
Thx for the quick sign-off and tests, Colin!
Created attachment 76303 [details] [review] Bug 20972: If ISBN has 10 numbers only the first 9 numbers are used If ISBN has 10 numbers only the first 9 numbers are being added to the Edifact-message (PIA+5+3540556753:IB') This is caused by wrong positioning of capturing parentheses in a regular expression. Sponsored-by: Gothenburg University Library Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 76304 [details] [review] Bug 20972: Add a testcase for bug 20972 Ensure all 10 characters of ISBN are preserved And that ISBNs and EANs are correctly identidied in the PIA segment Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Awesome work all! Pushed to master for 18.11.x
Pushed to 18.05.x for 18.05.02
Pushed to 17.11.x for 17.11.08 Regular expression are a curse, they can be hell or heaven :D
Pushed to 17.05.x for 17.05.14