View | Details | Raw Unified | Return to bug 33605
Collapse All | Expand All

(-)a/Koha/BackgroundJob/StageMARCForImport.pm (-2 / +8 lines)
Lines 75-81 sub process { Link Here
75
    my $parse_items                = $args->{parse_items};
75
    my $parse_items                = $args->{parse_items};
76
    my $matcher_id                 = $args->{matcher_id};
76
    my $matcher_id                 = $args->{matcher_id};
77
    my $overlay_action             = $args->{overlay_action};
77
    my $overlay_action             = $args->{overlay_action};
78
    my $overlay_frameworkcode      = $args->{overlay_frameworkcode};
78
    my $nomatch_action             = $args->{nomatch_action};
79
    my $nomatch_action             = $args->{nomatch_action};
80
    my $import_frameworkcode       = $args->{import_frameworkcode};
79
    my $item_action                = $args->{item_action};
81
    my $item_action                = $args->{item_action};
80
    my $vendor_id                  = $args->{vendor_id};
82
    my $vendor_id                  = $args->{vendor_id};
81
    my $basket_id                  = $args->{basket_id};
83
    my $basket_id                  = $args->{basket_id};
Lines 131-139 sub process { Link Here
131
            $self->set({ progress => 0, status => 'failed' });
133
            $self->set({ progress => 0, status => 'failed' });
132
        }
134
        }
133
135
136
        my $import_batch = Koha::ImportBatches->find($batch_id);
134
        if ($profile_id) {
137
        if ($profile_id) {
135
            my $ibatch = Koha::ImportBatches->find($batch_id);
138
            $import_batch->set( { profile_id => $profile_id } )->store;
136
            $ibatch->set( { profile_id => $profile_id } )->store;
139
        }
140
        if ($import_frameworkcode){
141
            $import_batch->set({ import_frameworkcode => $import_frameworkcode })->store;
137
        }
142
        }
138
143
139
        if ($matcher_id) {
144
        if ($matcher_id) {
Lines 148-153 sub process { Link Here
148
                SetImportBatchOverlayAction( $batch_id, $overlay_action );
153
                SetImportBatchOverlayAction( $batch_id, $overlay_action );
149
                SetImportBatchNoMatchAction( $batch_id, $nomatch_action );
154
                SetImportBatchNoMatchAction( $batch_id, $nomatch_action );
150
                SetImportBatchItemAction( $batch_id, $item_action );
155
                SetImportBatchItemAction( $batch_id, $item_action );
156
                $import_batch->set({ overlay_frameworkcode => $overlay_frameworkcode })->store if $overlay_frameworkcode;
151
                $schema->storage->txn_commit;
157
                $schema->storage->txn_commit;
152
            }
158
            }
153
            else {
159
            else {
(-)a/installer/data/mysql/atomicupdate/bug_33605.pl (+24 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "33605",
5
    description => "Add import_framework and overlay_framework columns to import_batches table",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        unless( column_exists("import_batches","overlay_frameworkcode") ){
10
            $dbh->do(q{
11
                ALTER TABLE `import_batches` 
12
                ADD `overlay_frameworkcode` varchar(4) NOT NULL DEFAULT '' AFTER `overlay_action` ;
13
            });
14
            say $out "Added column 'import_batches.overlay_frameworkcode'";
15
        }
16
        unless( column_exists("import_batches","import_frameworkcode") ){
17
            $dbh->do(q{
18
                ALTER TABLE `import_batches` 
19
                ADD `import_frameworkcode` varchar(4) NOT NULL DEFAULT '' AFTER `nomatch_action` ;
20
            });
21
            say $out "Added column 'import_batches.import_frameworkcode'";
22
        }
23
    },
24
};
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 3349-3355 CREATE TABLE `import_batches` ( Link Here
3349
  `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3349
  `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3350
  `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3350
  `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3351
  `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3351
  `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3352
  `overlay_frameworkcode` varchar(4) NOT NULL DEFAULT '',
3352
  `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3353
  `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3354
  `import_frameworkcode` varchar(4) NOT NULL DEFAULT '',
3353
  `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',
3355
  `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',
3354
  `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3356
  `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3355
  `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3357
  `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt (+19 lines)
Lines 171-176 Link Here
171
            [% END %]
171
            [% END %]
172
        </select>
172
        </select>
173
    </li>
173
    </li>
174
    <li>
175
        Add new bibliographic records into this framework:
176
        <select name="framework" id="frameworks">
177
            <option value="">Default</option>
178
            [% FOREACH framework IN frameworks %]
179
                <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
180
            [% END %]
181
        </select>
182
    </li>
174
</ol></fieldset>
183
</ol></fieldset>
175
184
176
  [% IF MarcModificationTemplatesLoop %]
185
  [% IF MarcModificationTemplatesLoop %]
Lines 204-209 Link Here
204
      <li><label for="overlay_action">Action if matching record found: </label>
213
      <li><label for="overlay_action">Action if matching record found: </label>
205
           [% INCLUDE 'tools-overlay-action.inc' %]
214
           [% INCLUDE 'tools-overlay-action.inc' %]
206
      </li>
215
      </li>
216
    <li>
217
        When replacing records use this framework:
218
        <select name="overlay_framework" id="overlay_frameworks">
219
            <option value="_USE_ORIG_">Keep original framework</option>
220
            <option value="">Default</option>
221
            [% FOREACH framework IN frameworks %]
222
                <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
223
            [% END %]
224
        </select>
225
    </li>
207
      <li><label for="nomatch_action">Action if no match is found: </label>
226
      <li><label for="nomatch_action">Action if no match is found: </label>
208
           [% INCLUDE 'tools-nomatch-action.inc' %]
227
           [% INCLUDE 'tools-nomatch-action.inc' %]
209
      </li>
228
      </li>
(-)a/tools/stage-marc-import.pl (-1 / +4 lines)
Lines 48-54 my $input = CGI->new; Link Here
48
my $fileID                     = $input->param('uploadedfileid');
48
my $fileID                     = $input->param('uploadedfileid');
49
my $matcher_id                 = $input->param('matcher');
49
my $matcher_id                 = $input->param('matcher');
50
my $overlay_action             = $input->param('overlay_action');
50
my $overlay_action             = $input->param('overlay_action');
51
my $overlay_frameworkcode      = $input->param('overlay_framework');
51
my $nomatch_action             = $input->param('nomatch_action');
52
my $nomatch_action             = $input->param('nomatch_action');
53
my $import_frameworkcode       = $input->param('import_framework');
52
my $parse_items                = $input->param('parse_items');
54
my $parse_items                = $input->param('parse_items');
53
my $item_action                = $input->param('item_action');
55
my $item_action                = $input->param('item_action');
54
my $comments                   = $input->param('comments');
56
my $comments                   = $input->param('comments');
Lines 91-97 if ($fileID) { Link Here
91
        parse_items                => $parse_items,
93
        parse_items                => $parse_items,
92
        matcher_id                 => $matcher_id,
94
        matcher_id                 => $matcher_id,
93
        overlay_action             => $overlay_action,
95
        overlay_action             => $overlay_action,
96
        overlay_frameworkcode      => $overlay_frameworkcode,
94
        nomatch_action             => $nomatch_action,
97
        nomatch_action             => $nomatch_action,
98
        import_frameworkcode       => $import_frameworkcode,
95
        item_action                => $item_action,
99
        item_action                => $item_action,
96
        basket_id                  => $basketno,
100
        basket_id                  => $basketno,
97
        vendor_id                  => $booksellerid,
101
        vendor_id                  => $booksellerid,
98
- 

Return to bug 33605