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

(-)a/C4/ImportBatch.pm (+19 lines)
Lines 53-58 BEGIN { Link Here
53
    BatchCommitRecords
53
    BatchCommitRecords
54
    BatchRevertRecords
54
    BatchRevertRecords
55
    CleanBatch
55
    CleanBatch
56
    DeleteBatch
56
57
57
    GetAllImportBatches
58
    GetAllImportBatches
58
    GetStagedWebserviceBatches
59
    GetStagedWebserviceBatches
Lines 959-964 sub CleanBatch { Link Here
959
    SetImportBatchStatus($batch_id, 'cleaned');
960
    SetImportBatchStatus($batch_id, 'cleaned');
960
}
961
}
961
962
963
=head2 DeleteBatch
964
965
  DeleteBatch($batch_id)
966
967
Deletes the record from the database. This can only be done
968
once the batch has been cleaned.
969
970
=cut
971
972
sub DeleteBatch {
973
    my $batch_id = shift;
974
    return unless defined $batch_id;
975
976
    my $dbh = C4::Context->dbh;
977
    my $sth = $dbh->prepare('DELETE FROM import_batches WHERE import_batch_id = ?');
978
    $sth->execute( $batch_id );
979
}
980
962
=head2 GetAllImportBatches
981
=head2 GetAllImportBatches
963
982
964
  my $results = GetAllImportBatches();
983
  my $results = GetAllImportBatches();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-2 / +13 lines)
Lines 38-43 Link Here
38
<script type="text/javascript">
38
<script type="text/javascript">
39
//<![CDATA[
39
//<![CDATA[
40
var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch?  This cannot be undone.");
40
var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch?  This cannot be undone.");
41
var MSG_CONFIRM_DELETE = _("Are you sure you want to permanently delete this batch?");
41
42
42
$(document).ready(function(){
43
$(document).ready(function(){
43
  $("#staged-record-matching-rules select").change(function(){
44
  $("#staged-record-matching-rules select").change(function(){
Lines 194-199 $(document).ready(function(){ Link Here
194
  <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
195
  <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
195
[% END %]
196
[% END %]
196
197
198
[% IF ( did_delete ) %]
199
  <div class="dialog message">Import batch deleted successfully</div>
200
[% END %]
201
197
[% UNLESS ( batch_list ) %]
202
[% UNLESS ( batch_list ) %]
198
   [% UNLESS ( batch_info ) %]
203
   [% UNLESS ( batch_info ) %]
199
   <div class="dialog message">
204
   <div class="dialog message">
Lines 448-458 Page Link Here
448
    <td>[% batch_lis.upload_timestamp %]</td>
453
    <td>[% batch_lis.upload_timestamp %]</td>
449
    <td>[% batch_lis.num_records %]</td>
454
    <td>[% batch_lis.num_records %]</td>
450
    <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
455
    <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
451
    <td>[% IF ( batch_lis.can_clean ) %]
456
    <td class="actions">[% IF ( batch_lis.can_clean ) %]
452
          <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
457
          <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
453
            <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
458
            <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
454
            <input type="hidden" name="op" value="clean-batch" />
459
            <input type="hidden" name="op" value="clean-batch" />
455
            <button class="btn btn-small" onclick="return confirm(MSG_CONFIRM_CLEAN);">Clean</button>
460
            <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_CLEAN);"><i class="fa fa-minus-square-o"></i> Clean</button>
461
          </form>
462
        [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
463
          <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id %]" id="delete_batch_[% batch_lis.import_batch_id %]">
464
            <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
465
            <input type="hidden" name="op" value="delete-batch" />
466
            <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);"><i class="fa fa-trash"></i> Delete</button>
456
          </form>
467
          </form>
457
        [% END %]
468
        [% END %]
458
    </td>
469
    </td>
(-)a/tools/manage-marc-import.pl (-1 / +6 lines)
Lines 123-128 if ($op eq "") { Link Here
123
        did_clean       => 1,
123
        did_clean       => 1,
124
        import_batch_id => $import_batch_id,
124
        import_batch_id => $import_batch_id,
125
    );
125
    );
126
} elsif ($op eq "delete-batch") {
127
    DeleteBatch($import_batch_id);
128
    import_batches_list($template, $offset, $results_per_page);
129
    $template->param(
130
        did_delete      => 1,
131
    );
126
} elsif ($op eq "redo-matching") {
132
} elsif ($op eq "redo-matching") {
127
    my $new_matcher_id = $input->param('new_matcher_id');
133
    my $new_matcher_id = $input->param('new_matcher_id');
128
    my $current_matcher_id = $input->param('current_matcher_id');
134
    my $current_matcher_id = $input->param('current_matcher_id');
129
- 

Return to bug 9259