This project is mirrored from https://git.koha-community.org/Koha-community/Koha.git. Pull mirroring updated .
  1. 19 Jul, 2018 1 commit
    • Wm. Nick Clemens's avatar
      Bug 13560: Add an 'Add' option for marc modification templates · 284226a4
      Wm. Nick Clemens authored
      
      
      Add/Update would update a field or create new if it existed, but didn't
      allow for creating new if the field existed.
      
      This patchset splits the options to 'Add & Update' so that 'Add' will always
      add a field and 'Update' will operate as it always has
      
      To test:
      1 - Have a record with a known existing field (make a copy)
      2 - Define a marc modification template that 'Add/update' on that field
      3 - Define an 'Add/Update' on a field that doesn't exist
      4 - Batch modify the copy of record using the above template
      5 - Verify the existing field was updated
      6 - Verify the non-existing field was updated
      7 - Apply patch and update database
      8 - Make another copy
      9 - Modify the copy with the same template as above
      10 - Should match initial modification
      11 - Add a new rule to add a new field
      12 - Modify using the updated template
      13 - Ensure your new field is created
      14 - Test various options in the modification tool
      15 - prove t/db_dependent/MarcModificationTemplates.t
      Signed-off-by: Victor Grousset/tuxayo's avatarVictor Grousset <victor.grousset@biblibre.com>
      Signed-off-by: default avatarChris Cormack <chrisc@catalyst.net.nz>
      Signed-off-by: Wm. Nick Clemens's avatarNick Clemens <nick@bywatersolutions.com>
      284226a4
  2. 24 Mar, 2016 1 commit
  3. 07 Sep, 2015 3 commits
  4. 14 Nov, 2014 2 commits
    • joubu's avatar
      Bug 11413: Fix field_numbers · b969aa3f
      joubu authored and Tomas Cohen Arazi's avatar Tomas Cohen Arazi committed
      
      
      This fix is a global fix for the MarcModificationTemplate feature.
      Some unit tests were missing and some behaviors were wrong.
      For instance, if you tried to update a non existent field, the script
      crashed.
      
      The following line was completely stupid:
          if $from_field ne $to_subfield
      
      The field_number equals 1 if the user wants to update the first field
      and 0 for all fields.
      
      The field_numbers (note the s) variable contains the field numbers to
      update. This array is filled if a condition exists (field exists or
      field equals).
      Signed-off-by: default avatarBrendan Gallagher <brendan@bywatersolutions.com>
      Signed-off-by: default avatarMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
      Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
      b969aa3f
    • joubu's avatar
      Bug 11413: Change the field number logic · 6d2e5f58
      joubu authored and Tomas Cohen Arazi's avatar Tomas Cohen Arazi committed
      
      
      This patch series is a bugfix for the Marc modification templates tool.
      
      Bug description:
      If you want to do an action (delete/update/move/...) on a multivalued
      field and if a condition is defined on the same field, it is highly
      probable the resulted record will not be what you expect.
      
      For example:
      Deleting All (or the first) fields 650 if 245$a="Bad title" works with
      the current code.
      BUT if you want to delete All (or the first) fields 650 with a condition
      on 650$9=42, and if at least one field matches the condition :
      - if you have selected all, all fields 650 will be deleted, even the
        ones who do not match the condition.
      - if you have selected first, the first 650 field will be deleted, even
        if it does not match the condition.
      The expected behavior is to delete the fields matching the
      condition (and not all the 650 fields).
      
      What this patch does:
      This patch introduces 2 changes in the logic of Koha::SimpleMARC.
      The first change is a change of the prototypes for the 2 routines
      field_exists and field_equals. Now they return the "field number" of the
      matching fields.
      The second change is the type of the "n" parameter for all routines
      using it in Koha::SimpleMARC. Before this patch, the "n" parameter was a
      boolean in most cases. If 0, the action was done on all fields, if 1
      on the first one only. Now it is possible to specify the "field numbers"
      (so the array of field numbers which is returned by field_exists or
      field_equals) for all routines which had the n parameter.
      
      Test plan for the patch series:
      Note: This test plan describes a specific example, feel free to create
      your own one.
      0/ Define a marc modification template with the following action:
        Delete field 245 if 245$9 = 42
      1/ choose and export a record with several 245 fields.
      For ex:
        245
          $a The art of computer programming
          $c Donald E. Knuth.
          $9 41
        245
          $a Bad title
          $c Bad author
          $9 42
      2/ import it using the Stage MARC for import tool.
      3/ verify the imported record does not contain any 245 field.
      4/ apply all the patches from this bug report
      5/ do again steps 2 and 3
      6/ verify the imported record contains only one 245 field, the one with
      245$9=41
      7/ verify the unit tests passed:
        prove t/SimpleMARC.t
        prove t/db_dependent/MarcModificationTemplates.t
      Signed-off-by: Kyle M Hall's avatarKyle M Hall <kyle@bywatersolutions.com>
      Signed-off-by: default avatarBrendan Gallagher <brendan@bywatersolutions.com>
      Signed-off-by: default avatarMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
      Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
      6d2e5f58
  5. 12 Nov, 2014 2 commits
    • joubu's avatar
      Bug 11319: Add the field management for Koha::SimpleMARC · c7d862bb
      joubu authored and Tomas Cohen Arazi's avatar Tomas Cohen Arazi committed
      
      
      Currently the Koha::SimpleMARC module call a "field" a "subfield".
      And the way to manage field is not implemented for all routines.
      
      This patch does not modify the API. The routine's names are kept. It
      just creates 2 privates routines for each action (e.g. delete_field
      will call _delete_field if the action affects field and _delete_subfield
      if the action affects subfields).
      
      Before this patch the move action was authorised by the interface but
      caused an error if executed.
      
      Note: I don't see the meaning for the add/update action if no subfield
      is given. So the call without subfield raises an error.
      
      Test plan:
      - apply all patches
      - create or modify an existent template
      - try at least the correct behavior for the following actions:
        * delete subfield and field
        * add new subfield to an existing field
        * add new subfield to an nonexisting field
        * move a subfield
        * move an entire field
        * copy a subfield
        * copy an entire field
      - import a biblio and use this template
      - verify the imported biblio matches actions defined.
      Signed-off-by: Kyle M Hall's avatarKyle M Hall <kyle@bywatersolutions.com>
      Signed-off-by: default avatarMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
      Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
      c7d862bb
    • joubu's avatar
      Bug 11319: Koha::SimpleMARC should take a hashref for parameters · c48639ee
      joubu authored and Tomas Cohen Arazi's avatar Tomas Cohen Arazi committed
      
      
      In order to avoid a long list of parameters, it should be better to
      pass all of them into a hashref.
      
      This patch does not add or modify a behavior.
      
      Test plan:
      Verify the unit tests still pass
      - prove t/SimpleMARC.t
      - prove t/db_dependent/MarcModificationTemplates.t
      Signed-off-by: Kyle M Hall's avatarKyle M Hall <kyle@bywatersolutions.com>
      Signed-off-by: default avatarMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
      Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
      c48639ee
  6. 20 Feb, 2014 1 commit
  7. 31 Oct, 2013 5 commits