Bugzilla – Attachment 49746 Details for
Bug 9259
Delete marc batches from staged marc management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9259: Ability to delete a staged file once it has been cleaned
Bug-9259-Ability-to-delete-a-staged-file-once-it-h.patch (text/plain), 5.38 KB, created by
Liz Rea
on 2016-03-31 20:58:33 UTC
(
hide
)
Description:
Bug 9259: Ability to delete a staged file once it has been cleaned
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2016-03-31 20:58:33 UTC
Size:
5.38 KB
patch
obsolete
>From 27c43f28b7938158ffe02c586755344492ed492f Mon Sep 17 00:00:00 2001 >From: Aleisha <aleishaamohia@hotmail.com> >Date: Tue, 29 Mar 2016 00:04:36 +0000 >Subject: [PATCH] Bug 9259: Ability to delete a staged file once it has been > cleaned > >To test: >1) Go to Tools -> Staged MARC Management and clean a file. If you have no files to clean, go to 'Stage MARC for import' and upload one to clean following the necessary steps. >2) Confirm that once the file has been cleaned, the Action column now shows a Delete button. Confirm this button only shows for cleaned files. >3) Click the Delete button. >4) Confirm that clicking Cancel exits the pop-up message and does not delete the file. >5) Confirm that clicking OK refreshes the list of staged records and the one you just deleted is no longer on it (has been deleted). You can confirm this by checking for the file in mysql (SELECT * FROM import_batches WHERE import_batch_id = X;) > >Sponsored-by: Catalyst IT >Signed-off-by: Liz Rea <liz@catalyst.net.nz> >Catalyst sign off, so needs another one but YAY this is great. >--- > C4/ImportBatch.pm | 19 +++++++++++++++++++ > .../prog/en/modules/tools/manage-marc-import.tt | 15 +++++++++++++-- > tools/manage-marc-import.pl | 6 ++++++ > 3 files changed, 38 insertions(+), 2 deletions(-) > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index 77ba9f3..8ef5b4d 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -53,6 +53,7 @@ BEGIN { > BatchCommitRecords > BatchRevertRecords > CleanBatch >+ DeleteBatch > > GetAllImportBatches > GetStagedWebserviceBatches >@@ -959,6 +960,24 @@ sub CleanBatch { > SetImportBatchStatus($batch_id, 'cleaned'); > } > >+=head2 DeleteBatch >+ >+ DeleteBatch($batch_id) >+ >+Deletes the record from the database. This can only be done >+once the batch has been cleaned. >+ >+=cut >+ >+sub DeleteBatch { >+ my $batch_id = shift; >+ return unless defined $batch_id; >+ >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare('DELETE FROM import_batches WHERE import_batch_id = ?'); >+ $sth->execute( $batch_id ); >+} >+ > =head2 GetAllImportBatches > > my $results = GetAllImportBatches(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >index d06ff67..8e03870 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >@@ -38,6 +38,7 @@ > <script type="text/javascript"> > //<![CDATA[ > var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch? This cannot be undone."); >+var MSG_CONFIRM_DELETE = _("Are you sure you want to permanently delete this batch?"); > > $(document).ready(function(){ > $("#staged-record-matching-rules select").change(function(){ >@@ -194,6 +195,10 @@ $(document).ready(function(){ > <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div> > [% END %] > >+[% IF ( did_delete ) %] >+ <div class="dialog message">Import batch deleted successfully</div> >+[% END %] >+ > [% UNLESS ( batch_list ) %] > [% UNLESS ( batch_info ) %] > <div class="dialog message"> >@@ -448,11 +453,17 @@ Page > <td>[% batch_lis.upload_timestamp %]</td> > <td>[% batch_lis.num_records %]</td> > <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&op=create_labels">(Create label batch)</a>[% END %]</td> >- <td>[% IF ( batch_lis.can_clean ) %] >+ <td class="actions">[% IF ( batch_lis.can_clean ) %] > <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" > > <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" /> > <input type="hidden" name="op" value="clean-batch" /> >- <button class="btn btn-small" onclick="return confirm(MSG_CONFIRM_CLEAN);">Clean</button> >+ <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_CLEAN);"><i class="fa fa-minus-square-o"></i> Clean</button> >+ </form> >+ [% ELSIF ( batch_lis.import_status == 'cleaned' ) %] >+ <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 %]"> >+ <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" /> >+ <input type="hidden" name="op" value="delete-batch" /> >+ <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);"><i class="fa fa-trash"></i> Delete</button> > </form> > [% END %] > </td> >diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl >index b0d4f88..83abc91 100755 >--- a/tools/manage-marc-import.pl >+++ b/tools/manage-marc-import.pl >@@ -123,6 +123,12 @@ if ($op eq "") { > did_clean => 1, > import_batch_id => $import_batch_id, > ); >+} elsif ($op eq "delete-batch") { >+ DeleteBatch($import_batch_id); >+ import_batches_list($template, $offset, $results_per_page); >+ $template->param( >+ did_delete => 1, >+ ); > } elsif ($op eq "redo-matching") { > my $new_matcher_id = $input->param('new_matcher_id'); > my $current_matcher_id = $input->param('current_matcher_id'); >-- >1.9.1
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 9259
:
49609
|
49746
|
53007
|
53116
|
53139
|
53140