Bug 10477 - Allow to select MARC fields to merge on staged MARC import
Summary: Allow to select MARC fields to merge on staged MARC import
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Amit Gupta
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-17 05:10 UTC by Amit Gupta
Modified: 2023-07-08 16:15 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Increased flexibility for upload of Staged (15.51 KB, patch)
2013-06-24 12:17 UTC, Amit Gupta
Details | Diff | Splinter Review
Alter table import_batches (3.00 KB, patch)
2013-06-24 12:19 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug-10477 Increased flexibility for upload of Staged (14.88 KB, patch)
2013-10-17 16:34 UTC, Amit Gupta
Details | Diff | Splinter Review
Alter table import_batches (3.00 KB, patch)
2013-10-17 16:39 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug-10477 Increased flexibility for upload of Staged (14.86 KB, patch)
2013-10-30 07:28 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug-10477-Alter table import_batches (2.97 KB, patch)
2013-10-30 07:28 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug-10477 Increased flexibility for upload of Staged (14.74 KB, patch)
2014-01-09 12:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug-10477-Alter table import_batches (3.00 KB, patch)
2014-01-09 12:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug-10477 Increased flexibility for upload of Staged (14.79 KB, patch)
2014-01-10 15:56 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug-10477-Alter table import_batches (3.11 KB, patch)
2014-01-10 15:56 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Gupta 2013-06-17 05:10:36 UTC
Increased flexibility for upload of Staged MARC records. When uploading bulk MARC records against existing records -  need further option to allow the process to just add/merge extra MARC tags rather than having to completely overwrite an existing record or just leave the existing record unchanged.
Comment 1 Amit Gupta 2013-06-24 12:17:56 UTC Comment hidden (obsolete)
Comment 2 Amit Gupta 2013-06-24 12:19:03 UTC Comment hidden (obsolete)
Comment 3 I'm just a bot 2013-09-18 09:55:16 UTC
Applying: Bug-10477 Increased flexibility for upload of Staged
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
M	tools/manage-marc-import.pl
Falling back to patching base and 3-way merge...
Auto-merging tools/manage-marc-import.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
Patch failed at 0001 Bug-10477 Increased flexibility for upload of Staged
The copy of the patch that failed is found in:
   /home/christopher/git/koha/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Comment 4 Amit Gupta 2013-10-17 16:34:17 UTC Comment hidden (obsolete)
Comment 5 Amit Gupta 2013-10-17 16:39:34 UTC Comment hidden (obsolete)
Comment 6 I'm just a bot 2013-10-30 07:23:28 UTC
Applying: Bug-10477-Alter table import_batches
Using index info to reconstruct a base tree...
M	installer/data/mysql/kohastructure.sql
M	installer/data/mysql/updatedatabase.pl
Falling back to patching base and 3-way merge...
Auto-merging installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Auto-merging installer/data/mysql/kohastructure.sql
Patch failed at 0001 Bug-10477-Alter table import_batches
The copy of the patch that failed is found in:
   /home/christopher/git/koha/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Comment 7 Chris Cormack 2013-10-30 07:28:44 UTC Comment hidden (obsolete)
Comment 8 Chris Cormack 2013-10-30 07:28:58 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2014-01-09 12:06:47 UTC Comment hidden (obsolete)
Comment 10 Jonathan Druart 2014-01-09 12:06:54 UTC Comment hidden (obsolete)
Comment 11 Jonathan Druart 2014-01-09 12:07:29 UTC
Rebased patches. I did not test.
Comment 12 nicolas 2014-01-10 15:36:19 UTC
Patch works correctly!
thx
Comment 13 Biblibre Sandboxes 2014-01-10 15:56:10 UTC
Patch tested with a sandbox, by Nicolas B. <n.bravais@mairie-decines.fr>
Comment 14 Biblibre Sandboxes 2014-01-10 15:56:39 UTC
Created attachment 24159 [details] [review]
Bug-10477 Increased flexibility for upload of Staged

When uploading bulk MARC records against existing records need further
option to allow the process to just add/merge extra MARC tags rather
than having to completely overwrite an existing record or just leave
the existing record unchanged.

Test Plan:
1. Click on Tools->Stage MARC records for import.
2. Upload the MARC file for ex: first.mrc
3. Click on upload button.
4. Choose Record matching rule: 020$a ISBN.
5. Choose Action if matching record found: Append or update MARC21/UNIMARC
tag a text box will appear after choosing enter MARC tag for ex: 700a which
you want to merge.
6. Click on Stage for import button.
7. On the next screen click on Manage staged records.
8. You can also edit the record matching rule in manage record screen.
9. Click on Import this batch on catalog button.
10. Next screen will give no of record updated.
11. It will check duplicate field record for ex: 700$aamit is already in record
it will skip the tag and move to next.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>

Signed-off-by: Nicolas B. <n.bravais@mairie-decines.fr>
Comment 15 Biblibre Sandboxes 2014-01-10 15:56:43 UTC
Created attachment 24160 [details] [review]
Bug-10477-Alter table import_batches

Added overlay_action to "appendmarctag" and new column "marctag"

Signed-off-by: Nicolas B. <n.bravais@mairie-decines.fr>
Signed-off-by: Nicolas B <n.bravais@mairie-decines.fr>
Comment 16 Jonathan Druart 2014-01-17 15:09:03 UTC
Hello Amit,
Could you provide unit tests for changes introduced in modules please?

Marked as Failed QA.
Comment 17 Mark Tompsett 2014-03-19 18:18:17 UTC
Comment on attachment 24160 [details] [review]
Bug-10477-Alter table import_batches

Review of attachment 24160 [details] [review]:
-----------------------------------------------------------------

::: installer/data/mysql/updatedatabase.pl
@@ +7914,5 @@
>  
> +$DBversion = "3.15.00.XXX";
> +if ( CheckVersion($DBversion) ) {
> +    $dbh->do("ALTER TABLE import_batches MODIFY overlay_action  enum('replace', 'create_new', 'use_template', 'ignore', 'appendmarctag') NOT NULL default 'create_new'");
> +    $dbh->do("ALTER TABLE import_batches ADD COLUMN marctag mediumtext");

You should probably add an 'AFTER' statement, so that the kohastructure.sql and updatedatabase.pl will generate the same field order.
Comment 18 Mark Tompsett 2014-03-19 18:29:23 UTC
Comment on attachment 24159 [details] [review]
Bug-10477 Increased flexibility for upload of Staged

Review of attachment 24159 [details] [review]:
-----------------------------------------------------------------

::: C4/ImportBatch.pm
@@ +249,5 @@
> +    my $sth = $dbh->prepare("UPDATE import_batches SET marctag = ? WHERE import_batch_id = ?");
> +    $sth->execute($marctag, $batch_id);
> +    return;
> +}
> +

When you add functions to a C4 or Koha library, you need to make sure there is a test file. There is no ./t/db_dependent/ImportBatch.t file, which is likely what you need to create, since this requires the import_batches table. The test file generally calls the functions/methods in every way that could be done normally inside code.

@@ +724,5 @@
> +            $sth->execute($oldxml, $rowref->{'import_record_id'});
> +            $sth = $dbh->prepare($query);
> +            $sth->execute($recordid, $rowref->{'import_record_id'});
> +            SetImportRecordOverlayStatus($rowref->{'import_record_id'}, 'match_applied');
> +            SetImportRecordStatus($rowref->{'import_record_id'}, 'imported');

And your test file will have to trigger this code segment too. :)

::: tools/manage-marc-import.pl
@@ +228,3 @@
>          };
>      }
>      $template->param(batch_list => \@list); 

Make sure your git repo has:
git config --global core.whitespace trailing-space,space-before-tab
git config --global apply.whitespace fix
Comment 19 emjhet 2018-07-26 01:07:43 UTC
Did anything ever come of this?
Comment 20 Katrin Fischer 2023-07-08 16:15:22 UTC
The idea of this is still quite interesting. While we can use overlay rules to protect fields, the idea here is to define what is being merged.