[Bug 20486] New: Add --marc_conditions option to export_records.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Bug ID: 20486 Summary: Add --marc_conditions option to export_records.pl Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: glasklas@gmail.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz We had the need to filter out certain record based on marc-fields when exporting, so added a --marc_conditions options where filter conditions can be passed to the export script. For example: --marc_conditions="942a=!1". -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #1 from David Gustafsson <glasklas@gmail.com> --- Created attachment 73384 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73384&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #2 from David Gustafsson <glasklas@gmail.com> --- Oops, condition in first comment should be: --marc_conditions="942a!=1" (not =!) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Maksim Sen <maksim.sen@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Maksim Sen <maksim.sen@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73384|0 |1 is obsolete| | --- Comment #3 from Maksim Sen <maksim.sen@inlibro.com> --- Created attachment 73497 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73497&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library Signed-off-by: Maksim Sen <maksim.sen@inlibro.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Maksim Sen <maksim.sen@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maksim.sen@inlibro.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73497|0 |1 is obsolete| | --- Comment #4 from David Gustafsson <glasklas@gmail.com> --- Created attachment 73999 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73999&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #5 from David Gustafsson <glasklas@gmail.com> --- Fix a problem where _get_record_for_export returns undef both on error and if not matching condition, so impossible to catch the error, now logging all errors inside of _get_record_for_export instead. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |glasklas@gmail.com |y.org | CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Comment on attachment 73999 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73999 Bug 20486: Add --marc_conditions option to export_records.pl Review of attachment 73999: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=20486&attachment=73999) ----------------------------------------------------------------- Same question as on bug 20465: this adds functionality to the CLI script that is not available in the export tool in the GUI. Do we want them to diverge like that? Requesting feedback. Also: QA scripts shows a POD issue: FAIL misc/export_records.pl OK critic OK forbidden patterns OK git manipulation FAIL pod Apparent command =back not preceded by blank line *** ERROR: =over on line 263 without closing =back (at head1) in file misc/export_records.pl ::: Koha/Exporter/Record.pm @@ +77,5 @@
+ return undef unless all { $op->($_, $match_value) } @target_values; + } + } + } + return undef if $no_target && $operator ne '!='; # TODO: ??
Gives me an uneasy feeling. What was the thought here? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |glasklas@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73999|0 |1 is obsolete| | --- Comment #7 from David Gustafsson <glasklas@gmail.com> --- Created attachment 74853 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74853&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #8 from David Gustafsson <glasklas@gmail.com> --- I fixed the pod issue. The reason for the "# TODO: ??" was that not completely sure how ta handle the case where marc target cannot be found for different operators, but think it's handled correctly so removed this. Unfortunately we do not have the resources to port this functionality to the web-UI as well as we do not use it. This was initially just supposed to be a hard coded hack for our local needs but I generalized the matching functionality so other targets that the ones we use can be used for filtering in case someone else needed this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74853|0 |1 is obsolete| | --- Comment #9 from David Gustafsson <glasklas@gmail.com> --- Created attachment 75110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75110&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #10 from David Gustafsson <glasklas@gmail.com> --- Rebased against Koha master. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #75110|0 |1 is obsolete| | --- Comment #11 from Michal Denar <black23@gmail.com> --- Created attachment 79266 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=79266&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library Signed-off-by: Michal Denar <black23@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #79266|0 |1 is obsolete| | --- Comment #12 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 80318 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80318&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/db_dependent/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library Signed-off-by: Maksim Sen <maksim.sen@inlibro.com> Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #13 from Chris Cormack <chris@bigballofwax.co.nz> --- I have passed QA But the question about the divergent functionality between the CLI and the web interface remains unanswered. I will leave that in the RM hands to decide -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex.arnaud@biblibre.com, | |jonathan.druart@bugs.koha-c | |ommunity.org, | |josef.moravec@gmail.com, | |julian.maurice@biblibre.com | |, | |kyle@bywatersolutions.com, | |m.de.rooy@rijksmuseum.nl, | |nick@bywatersolutions.com, | |tomascohen@gmail.com --- Comment #14 from Nick Clemens <nick@bywatersolutions.com> --- I would like a second opinion here, I would like the scripts to have the same options, but don't consider it a blocker. Can another QA member (or more) weigh in -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I would not consider it blocker either. Side note: return undef will raise a perlcritic warning: "return" statement with explicit "undef" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #16 from Josef Moravec <josef.moravec@gmail.com> --- The ui part of this could be done as follow-up bug, no blocker for me. But the return explicit undef should be fixed, we want to pass perlcritic -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 David Gustafsson <glasklas@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80318|0 |1 is obsolete| | --- Comment #17 from David Gustafsson <glasklas@gmail.com> --- Created attachment 81762 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81762&action=edit Bug 20486: Add --marc_conditions option to export_records.pl Add --marc_conditions option to export_records.pl script, for excluding records based on conditions applied to MARC-record data. How to test: 1) Run tests in t/db_dependent/Exporter/Record.t 2) All tests should pass Sponsored-by: Gothenburg University Library Signed-off-by: Maksim Sen <maksim.sen@inlibro.com> Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #18 from David Gustafsson <glasklas@gmail.com> --- Ok, fixed! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #19 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #20 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Enhancement, will not be backported to 18.05.x series. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Resolution|--- |FIXED Status|Pushed to Master |RESOLVED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 Koha Team Lyon 3 <koha@univ-lyon3.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |koha@univ-lyon3.fr --- Comment #21 from Koha Team Lyon 3 <koha@univ-lyon3.fr> --- Hello, I have questions about this one : is it possible to add several filters? If it's the case, which is the separator between the several filters? Could we use whatever operator in the filter (= or > or < )? Thanks in advance! Sonia -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20486 --- Comment #22 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Koha Team Lyon 3 from comment #21)
Hello, I have questions about this one : is it possible to add several filters? If it's the case, which is the separator between the several filters? Could we use whatever operator in the filter (= or > or < )?
Thanks in advance!
Sonia
Bonjour Sonia, Reading the POD, it says: """ [...] with multiple conditions separated by commas (,). For example: --marc_conditions="035a!=(EXAMPLE)123,041a=swe". Multiple conditions are all required to match. """ The operators are <, >, = and != -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org