Bug 24679

Summary: Allow to apply a MARC modification template in export tool
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: ToolsAssignee: Julian Maurice <julian.maurice>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dcook, fridolin.somers, jonathan.druart, kohadevinim
Version: Main   
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: 25253    
Attachments: Bug 24679: Allow to apply a MARC modification template in export tool
Bug 24679: Allow to apply a MARC modification template in export tool
Bug 24679: Allow to apply a MARC modification template in export tool
Bug 24679: Allow to apply a MARC modification template in export tool
Bug 24679: Return the correct id in AddModificationTemplate
Bug 24679: Fix exporter tests

Description Julian Maurice 2020-02-18 11:48:58 UTC

    
Comment 1 Julian Maurice 2020-02-18 11:49:46 UTC
Created attachment 99175 [details] [review]
Bug 24679: Allow to apply a MARC modification template in export tool

Test plan:
1. Create a MARC modification template with a simple action (for
   instance, "Add new field 999$9 with value foobar")
2. Go to Tools » Export data
3. Select some records (for instance, from biblionumber 1 to 10)
4. In options, select the MARC modification template you just created
5. Select File format 'MARC'
6. Click on 'Export bibliographic records'
7. Verify that exported records contain the 999$9 field
8. Repeat steps 3-7 with other export formats, and with authority
   records
Comment 2 Julian Maurice 2020-02-20 09:29:52 UTC
Created attachment 99304 [details] [review]
Bug 24679: Allow to apply a MARC modification template in export tool

Test plan:
1. Create a MARC modification template with a simple action (for
   instance, "Add new field 999$9 with value foobar")
2. Go to Tools » Export data
3. Select some records (for instance, from biblionumber 1 to 10)
4. In options, select the MARC modification template you just created
5. Select File format 'MARC'
6. Click on 'Export bibliographic records'
7. Verify that exported records contain the 999$9 field
8. Repeat steps 3-7 with other export formats, and with authority
   records
Comment 3 Devinim 2020-02-27 14:29:52 UTC
Created attachment 99700 [details] [review]
Bug 24679: Allow to apply a MARC modification template in export tool

Test plan:
1. Create a MARC modification template with a simple action (for
   instance, "Add new field 999$9 with value foobar")
2. Go to Tools » Export data
3. Select some records (for instance, from biblionumber 1 to 10)
4. In options, select the MARC modification template you just created
5. Select File format 'MARC'
6. Click on 'Export bibliographic records'
7. Verify that exported records contain the 999$9 field
8. Repeat steps 3-7 with other export formats, and with authority
   records

Good patch, succeeded.

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Comment 4 Jonathan Druart 2020-03-25 14:45:09 UTC
Julian, tests are failing for me.

    #   Failed test 'Export XML: marc modification template should have added 999$9'
    #   at t/db_dependent/Exporter/Record.t line 483.
    #          got: undef
    #     expected: 'Foobar'
    # Looks like you failed 1 test of 2.

#   Failed test 'export xml with marc modification template'
#   at t/db_dependent/Exporter/Record.t line 484.

    #   Failed test 'Export ISO2709: marc modification template should have added 999$9'
    #   at t/db_dependent/Exporter/Record.t line 508.
    #          got: undef
    #     expected: 'Foobar'
    # Looks like you failed 1 test of 2.

#   Failed test 'export iso2709 with marc modification template'
#   at t/db_dependent/Exporter/Record.t line 509.
# Looks like you failed 2 tests of 9.

Certainly coming from bug 21708.
Comment 5 Julian Maurice 2020-10-13 08:12:20 UTC
Created attachment 111519 [details] [review]
Bug 24679: Allow to apply a MARC modification template in export tool

Test plan:
1. Create a MARC modification template with a simple action (for
   instance, "Add new field 999$9 with value foobar")
2. Go to Tools » Export data
3. Select some records (for instance, from biblionumber 1 to 10)
4. In options, select the MARC modification template you just created
5. Select File format 'MARC'
6. Click on 'Export bibliographic records'
7. Verify that exported records contain the 999$9 field
8. Repeat steps 3-7 with other export formats, and with authority
   records

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Comment 6 Julian Maurice 2020-10-13 08:12:25 UTC
Created attachment 111520 [details] [review]
Bug 24679: Return the correct id in AddModificationTemplate

'name' is not unique, and should not be used to retrieve the last
inserted id
Comment 7 Julian Maurice 2020-10-13 08:12:29 UTC
Created attachment 111521 [details] [review]
Bug 24679: Fix exporter tests

Use 998 instead of 999 which is used in MARC21 to store biblionumber
Comment 8 Katrin Fischer 2020-10-15 21:23:07 UTC
I am sorry, Julian, but tests are failing:

#   Failed test 'No tests run for subtest "export csv with marc modification template"'
#   at t/db_dependent/Exporter/Record.t line 441.
DBI last_insert_id: invalid number of arguments: got handle + 3, expected handle + between 4 and 5
Usage: $h->last_insert_id($catalog, $schema, $table_name, $field_name [, \%attr ]) at /home/vagrant/kohaclone/C4/MarcModificationTemplates.pm line 110.
# Looks like your test exited with 255 just after 7.
t/db_dependent/Exporter/Record.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/9 subtests 

Test Summary Report
-------------------
t/db_dependent/Exporter/Record.t (Wstat: 65280 Tests: 7 Failed: 1)
  Failed test:  7
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 9 tests but ran 7.
Comment 9 Fridolin Somers 2022-10-19 20:08:14 UTC
Up
Comment 10 David Cook 2023-01-08 23:07:36 UTC
This could help to add more feature parity with other library systems...