Bug 26414 - Unable to export Withdrawn status using CSV profile
Summary: Unable to export Withdrawn status using CSV profile
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Alexis Ripetti
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-08 21:44 UTC by Caroline Cyr La Rose
Modified: 2020-09-15 21:49 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 26414: Unable to export Withdrawn status using CSV profile (5.50 KB, patch)
2020-09-11 20:45 UTC, Alexis Ripetti
Details | Diff | Splinter Review
Bug 26414: Unable to export Withdrawn status using CSV profile (5.56 KB, patch)
2020-09-15 21:25 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2020-09-08 21:44:44 UTC
When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

To replicate:
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status

I tried with different ways to write the MARC fields, but 952$0 just never shows alone.
245a|100a|952o|Withdrawn=952$0
245a|100a|952o|952$0

Caroline
Comment 1 Alexis Ripetti 2020-09-11 20:45:28 UTC
Created attachment 109970 [details] [review]
Bug 26414: Unable to export Withdrawn status using CSV profile

When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

Test Plan :
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status
11) Apply patch
12) Redo steps 9) and 10)
Comment 2 didier 2020-09-13 10:05:14 UTC
hi

Why not just a plain
  my $subfieldtag = $2;

and removing the WIP comment with the previous line?

Regards
Didier
Comment 3 Katrin Fischer 2020-09-13 21:34:50 UTC
Hi Alexis, whenever you plan to work on a patch for a bug, please assign it to yourself using the Asignee field. I've fixed it :)
Comment 4 David Nind 2020-09-15 21:25:24 UTC
Created attachment 110132 [details] [review]
Bug 26414: Unable to export Withdrawn status using CSV profile

When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

Test Plan :
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status
11) Apply patch
12) Redo steps 9) and 10)

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Katrin Fischer 2020-09-15 21:49:14 UTC
Hi Alexis,

I believe the tests may need a bit more work to run on different installations:

Processing additional checks OK!
kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Record/marcrecord2csv.t
t/db_dependent/Record/marcrecord2csv.t .. 1/13 
#   Failed test 'normal way: headers retrieved from the DB'
#   at t/db_dependent/Record/marcrecord2csv.t line 53.
#          got: '"TITLE STATEMENT"|"SUBJECT ADDED ENTRY--TOPICAL TERM"
# "The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499"
# '
#     expected: '"Mention du titre"|Vedette-matière--Sujet
# "The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499"
# '
# Looks like you failed 1 test of 13.
t/db_dependent/Record/marcrecord2csv.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/13 subtests