Bugzilla – Attachment 150203 Details for
Bug 33605
Import framework and overlay framework are not stored for imports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33605: WIP
Bug-33605-WIP.patch (text/plain), 8.01 KB, created by
Nick Clemens (kidclamp)
on 2023-04-25 13:16:48 UTC
(
hide
)
Description:
Bug 33605: WIP
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-04-25 13:16:48 UTC
Size:
8.01 KB
patch
obsolete
>From 5ab876ed5ae02405a86ca783961116b3369a5223 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 25 Apr 2023 13:15:12 +0000 >Subject: [PATCH] Bug 33605: WIP > >TO DO: >- make profiles save the info >- pass frameowrks to scripts >- make import form fetch values from DB for new fields >- handle changing values after staging (do along with redoing matching?) >- tests? >--- > Koha/BackgroundJob/StageMARCForImport.pm | 10 ++++++-- > .../data/mysql/atomicupdate/bug_33605.pl | 24 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 ++ > .../en/modules/tools/stage-marc-import.tt | 19 +++++++++++++++ > tools/stage-marc-import.pl | 4 ++++ > 5 files changed, 57 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_33605.pl > >diff --git a/Koha/BackgroundJob/StageMARCForImport.pm b/Koha/BackgroundJob/StageMARCForImport.pm >index 7858eae7a0..94743cae12 100644 >--- a/Koha/BackgroundJob/StageMARCForImport.pm >+++ b/Koha/BackgroundJob/StageMARCForImport.pm >@@ -75,7 +75,9 @@ sub process { > my $parse_items = $args->{parse_items}; > my $matcher_id = $args->{matcher_id}; > my $overlay_action = $args->{overlay_action}; >+ my $overlay_frameworkcode = $args->{overlay_frameworkcode}; > my $nomatch_action = $args->{nomatch_action}; >+ my $import_frameworkcode = $args->{import_frameworkcode}; > my $item_action = $args->{item_action}; > my $vendor_id = $args->{vendor_id}; > my $basket_id = $args->{basket_id}; >@@ -131,9 +133,12 @@ sub process { > $self->set({ progress => 0, status => 'failed' }); > } > >+ my $import_batch = Koha::ImportBatches->find($batch_id); > if ($profile_id) { >- my $ibatch = Koha::ImportBatches->find($batch_id); >- $ibatch->set( { profile_id => $profile_id } )->store; >+ $import_batch->set( { profile_id => $profile_id } )->store; >+ } >+ if ($import_frameworkcode){ >+ $import_batch->set({ import_frameworkcode => $import_frameworkcode })->store; > } > > if ($matcher_id) { >@@ -148,6 +153,7 @@ sub process { > SetImportBatchOverlayAction( $batch_id, $overlay_action ); > SetImportBatchNoMatchAction( $batch_id, $nomatch_action ); > SetImportBatchItemAction( $batch_id, $item_action ); >+ $import_batch->set({ overlay_frameworkcode => $overlay_frameworkcode })->store if $overlay_frameworkcode; > $schema->storage->txn_commit; > } > else { >diff --git a/installer/data/mysql/atomicupdate/bug_33605.pl b/installer/data/mysql/atomicupdate/bug_33605.pl >new file mode 100755 >index 0000000000..c88eb3f1cf >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_33605.pl >@@ -0,0 +1,24 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "33605", >+ description => "Add import_framework and overlay_framework columns to import_batches table", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ unless( column_exists("import_batches","overlay_frameworkcode") ){ >+ $dbh->do(q{ >+ ALTER TABLE `import_batches` >+ ADD `overlay_frameworkcode` varchar(4) NOT NULL DEFAULT '' AFTER `overlay_action` ; >+ }); >+ say $out "Added column 'import_batches.overlay_frameworkcode'"; >+ } >+ unless( column_exists("import_batches","import_frameworkcode") ){ >+ $dbh->do(q{ >+ ALTER TABLE `import_batches` >+ ADD `import_frameworkcode` varchar(4) NOT NULL DEFAULT '' AFTER `nomatch_action` ; >+ }); >+ say $out "Added column 'import_batches.import_frameworkcode'"; >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 50796112dc..5efc9a3fb2 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3349,7 +3349,9 @@ CREATE TABLE `import_batches` ( > `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file', > `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded', > `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records', >+ `overlay_frameworkcode` varchar(4) NOT NULL DEFAULT '', > `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found', >+ `import_frameworkcode` varchar(4) NOT NULL DEFAULT '', > `item_action` enum('always_add','add_only_for_matches','add_only_for_new','ignore','replace') NOT NULL DEFAULT 'always_add' COMMENT 'what to do with item records', > `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file', > `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from', >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >index 0fe36f2ba4..112655cd08 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >@@ -171,6 +171,15 @@ > [% END %] > </select> > </li> >+ <li> >+ Add new bibliographic records into this framework: >+ <select name="framework" id="frameworks"> >+ <option value="">Default</option> >+ [% FOREACH framework IN frameworks %] >+ <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option> >+ [% END %] >+ </select> >+ </li> > </ol></fieldset> > > [% IF MarcModificationTemplatesLoop %] >@@ -204,6 +213,16 @@ > <li><label for="overlay_action">Action if matching record found: </label> > [% INCLUDE 'tools-overlay-action.inc' %] > </li> >+ <li> >+ When replacing records use this framework: >+ <select name="overlay_framework" id="overlay_frameworks"> >+ <option value="_USE_ORIG_">Keep original framework</option> >+ <option value="">Default</option> >+ [% FOREACH framework IN frameworks %] >+ <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option> >+ [% END %] >+ </select> >+ </li> > <li><label for="nomatch_action">Action if no match is found: </label> > [% INCLUDE 'tools-nomatch-action.inc' %] > </li> >diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl >index 2fe21b1a23..48348de05c 100755 >--- a/tools/stage-marc-import.pl >+++ b/tools/stage-marc-import.pl >@@ -48,7 +48,9 @@ my $input = CGI->new; > my $fileID = $input->param('uploadedfileid'); > my $matcher_id = $input->param('matcher'); > my $overlay_action = $input->param('overlay_action'); >+my $overlay_frameworkcode = $input->param('overlay_framework'); > my $nomatch_action = $input->param('nomatch_action'); >+my $import_frameworkcode = $input->param('import_framework'); > my $parse_items = $input->param('parse_items'); > my $item_action = $input->param('item_action'); > my $comments = $input->param('comments'); >@@ -91,7 +93,9 @@ if ($fileID) { > parse_items => $parse_items, > matcher_id => $matcher_id, > overlay_action => $overlay_action, >+ overlay_frameworkcode => $overlay_frameworkcode, > nomatch_action => $nomatch_action, >+ import_frameworkcode => $import_frameworkcode, > item_action => $item_action, > basket_id => $basketno, > vendor_id => $booksellerid, >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33605
:
150203
|
155320
|
155321