Bugzilla – Attachment 74922 Details for
Bug 20678
Save draft records without committing them to the catalogue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20678 - Save draft MARC record without committing to catalog
Bug-20678---Save-draft-MARC-record-without-committ.patch (text/plain), 16.13 KB, created by
Alex Buckley
on 2018-04-29 10:53:44 UTC
(
hide
)
Description:
Bug 20678 - Save draft MARC record without committing to catalog
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-04-29 10:53:44 UTC
Size:
16.13 KB
patch
obsolete
>From d7043f547b03f587177c5e4d24d9552bea12efca Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 24 Apr 2018 20:13:52 +0000 >Subject: [PATCH] Bug 20678 - Save draft MARC record without committing to > catalog > >In the 'Save' dropdown button in addbiblio.pl patrons can select the >'Save without cataloguing' button. This saves the catalog to the >import_biblio db table (also referred to as the reservoir) but not to >the catalog. > >To re-edit or save this draft record the user can either go to >Tools->Manage staged MARC records and select the 'Draft records' tab, >which displays all these draft records along with links to edit them in >the cataloguing interface. > >Or the patron can search for the record in the addbooks.pl webpage in >the cataloguing interface and the record will be displayed in the >'Biblios in the reservoir' section of results. Then the user can select >Actions->Continue editing draft record > >By being able to save a record as a draft it means a librarian does not >have to either save a un-finished MARC record to the catalog, or start >again cataloguing from scratch if they are interrupted during >cataloguing. > >Test plan: >1. Drop and re-create your DB and go through the web installation >process so that the new atomicupdate is run > >2. Go to Tools->Manage staged MARC records and notice there is a default >batch file 'draft_marc_records.mrc' (with the id of 1) this batch file >is what all the draft records will be 'stored' in when they are stored >in the import_biblios db table. A batch file is required for all records >in this aforementioned table due to foreign key constraints. > >3. Go to Cataloging->New record and create a MARC record and select >Save->Save without cataloging > >4. Search for the title you just created and notice it is displayed in >the 'Biblios in reservoir' result section and not in the catalog >results. > >5. Select Actions->Continue editing draft record' and now select 'Save >and view record' > >6. Now search the catalog for the title and the detail page of the >cataloged record appears showing the record is now committed to the >catalog. > >7. Go to Tools->Manage staged MARC records and click on the 'Draft >records' tab and notice the title you saved as a draft is displayed in >the table along with a 'Edit' link which is for the cataloging page. The >benefit of having this table of all draft records is librarians can quickly find all draft records and click to edit and commit the draft >records to the catalog without having to remember the title of the draft >record was in the cataloging search > >Sponsored-by: Toi Ohomai library >--- > cataloguing/addbiblio.pl | 10 ++- > .../mysql/atomicupdate/add_draft_record_batch.sql | 1 + > .../prog/en/modules/cataloguing/addbiblio.tt | 10 +++ > .../prog/en/modules/cataloguing/addbooks.tt | 4 + > .../prog/en/modules/tools/manage-marc-import.tt | 90 +++++++++++++++++++--- > tools/batch_records_ajax.pl | 6 +- > 6 files changed, 107 insertions(+), 14 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/add_draft_record_batch.sql > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 4ecaf69..6f0f924 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -702,7 +702,7 @@ my $fa_barcode = $input->param('barcode'); > my $fa_branch = $input->param('branch'); > my $fa_stickyduedate = $input->param('stickyduedate'); > my $fa_duedatespec = $input->param('duedatespec'); >- >+my $previewrecord = $input->param('preview'); > my $userflags = 'edit_catalogue'; > > my $changed_framework = $input->param('changed_framework'); >@@ -774,6 +774,7 @@ my ( > if (($biblionumber) && !($breedingid)){ > $record = GetMarcBiblio({ biblionumber => $biblionumber }); > } >+ > if ($breedingid) { > ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; > } >@@ -843,7 +844,12 @@ if ( $op eq "addbiblio" ) { > ModBiblio( $record, $biblionumber, $frameworkcode ); > } > else { >- ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); >+ if ($previewrecord) { >+ AddBiblioToBatch(1, 0, $record, 'biblio', int(rand(99999)), 0); >+ print $input->redirect('/cgi-bin/koha/cataloguing/addbooks.pl'); >+ } else { >+ ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); >+ } > } > if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ > if ($frameworkcode eq 'FA'){ >diff --git a/installer/data/mysql/atomicupdate/add_draft_record_batch.sql b/installer/data/mysql/atomicupdate/add_draft_record_batch.sql >new file mode 100644 >index 0000000..0432d25 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/add_draft_record_batch.sql >@@ -0,0 +1 @@ >+INSERT INTO import_batches (import_batch_id,record_type,file_name,comments) VALUES (1, 'biblio', 'draft_marc_records.mrc', 'MARC file containing draft MARC records created in the addbiblio.pl file but not saved to the Koha catalog'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index c92d51e..41864ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -85,6 +85,13 @@ > return false; > }); > >+ $("#previewrecord").click(function(){ >+ $(".btn-group").removeClass("open"); >+ document.getElementById('preview').value = 1; >+ onOption(); >+ return false; >+ }); >+ > $("#saveandview").click(function(){ > $(".btn-group").removeClass("open"); > redirect("view"); >@@ -345,6 +352,7 @@ function AreMandatoriesNotOk(){ > function Check(){ > var StrAlert = AreMandatoriesNotOk(); > if( ! StrAlert ){ >+ > document.f.submit(); > return true; > } else { >@@ -467,6 +475,7 @@ function Changefwk() { > <li><a id="saveandview" href="#">Save and view record</a></li> > <li><a id="saveanditems" href="#">Save and edit items</a></li> > <li><a id="saveandcontinue" href="#">Save and continue editing</a></li> >+ <li><a id="previewrecord" name="previewrecord" href="#">Save without cataloging</a></li> > </ul> > </div> > [% END %] >@@ -554,6 +563,7 @@ function Changefwk() { > <input type="hidden" name="mode" value="popup" /> > [% END %] > <input type="hidden" name="op" value="addbiblio" /> >+ <input type="hidden" id="preview" name="preview" /> > <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode %]" /> > <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> > <input type="hidden" name="breedingid" value="[% breedingid %]" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >index 7305bd5..21d73c2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >@@ -180,7 +180,11 @@ > <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li> > <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li> > [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] >+ [% IF breeding_loo.file == "draft_marc_records.mrc" %] >+ <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]"><i class="fa fa-plus"></i> Continue editing draft record</a></li> >+ [% ELSE %] > <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]"><i class="fa fa-plus"></i> Add biblio</a></li> >+ [% END %] > [% END %] > </ul> > </div> >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 21cd576..422bf74 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 >@@ -32,7 +32,7 @@ > <div id="yui-main"> > <div class="yui-b"> > >-<h1>Manage staged MARC records >+<h1 id="managed_records">Manage staged MARC records > [% IF ( import_batch_id ) %] > › Batch [% import_batch_id %] > [% END %] >@@ -60,7 +60,7 @@ > <div class="dialog message"> > <p>No records have been staged.</p> > <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p> >- </div> >+ /div> > [% END %] > [% END %] > >@@ -270,6 +270,14 @@ > [% END %] > </div> > [% END %] >+<div class="statictabs"> >+ <ul> >+ <li><a id="marcfileslink">Marc files</a></li> >+ <li><a id="draftrecordslink" name="draft_record_to_display" value="1">Draft records</a></li> >+ </ul> >+ >+ <div class="tabs-container"> >+<div id="marcfiles"> > <table> > <tr> > <th>#</th> >@@ -284,8 +292,8 @@ > </tr> > [% FOREACH batch_lis IN batch_list %] > <tr> >- <td>[% batch_lis.import_batch_id %]</td> >- <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td> >+ <td class="import_batch_id">[% batch_lis.import_batch_id %]</td> >+ <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&display_file_content=1">[% batch_lis.file_name %]</a></td> > <td>[% batch_lis.comments %]</td> > <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td> > <td> >@@ -307,7 +315,7 @@ > </td> > <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>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&display_file_content=1&op=create_labels">(Create label batch)</a>[% END %]</td> > <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 %]" class="batch_form batch_clean" > >@@ -326,6 +334,28 @@ > </tr> > [% END %] > </table> >+</div> >+ >+<div id="draftrecords" onload="document.getElementById("draftrecords").style.display ='none';"> >+ <p> To edit or save these draft records click the 'Edit' link beside the appropriate record. </p> >+ <table id="records-table"> >+ <thead> >+ <tr> >+ <th>#</th> >+ <th>Citation</th> >+ <th>Status</th> >+ <th>Match type</th> >+ <th>Match details</th> >+ <th><abbr title="Differences between the original biblio and the imported">Diff</abbr></th> >+ <th>Record</th> >+ <th>Catalog link</th> >+ </tr> >+ </thead> >+ </table> >+</div> >+</div> >+</div> >+ > [% IF ( pages ) %] > <div class="pages"> > [% FOREACH page IN pages %] >@@ -396,7 +426,35 @@ > $(this).parent().hide(); > }); > >- [% IF import_batch_id %] >+ [% IF !(import_batch_id) %] >+ document.getElementById('draftrecords').style.display = 'none'; >+ var marcfileslink = document.getElementById("marcfileslink"); >+ marcfileslink.style.backgroundColor = "#FFF"; >+ [% END %] >+ >+ var marcfiles = document.getElementById("marcfiles"); >+ var draftrecords = document.getElementById("draftrecords"); >+ var draftrecordslink = document.getElementById("draftrecordslink"); >+ var marcfileslink = document.getElementById("marcfileslink"); >+ >+ $("#draftrecordslink").click(function(e){ >+ draftrecords.style.display = "block"; >+ draftrecordslink.style.backgroundColor = "#FFF"; >+ marcfileslink.style.backgroundColor= "#e6f0f2"; >+ marcfiles.style.display = "none"; >+ if (document.getElementById("draftrecords").style.display === 'block') { >+ [% draft_record_to_display = 1 %] >+ } >+ }); >+ >+ $("#marcfileslink").click(function(e){ >+ draftrecords.style.display = "none"; >+ marcfiles.style.display = "block"; >+ draftrecordslink.style.backgroundColor = "#e6f0f2"; >+ marcfileslink.style.backgroundColor= "#FFF"; >+ }); >+ >+ [% IF (import_batch_id || draft_record_to_display) %] > $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, { > "bAutoWidth": false, > "bFilter": false, >@@ -412,11 +470,16 @@ > { "mDataProp": "overlay_status" }, > { "mDataProp": "match_citation" }, > { "mDataProp": "diff_url" }, >- { "mDataProp": "matched" } >+ { "mDataProp": "matched" }, >+ [% IF !(import_batch_id) %] { "mDataProp": "catalog_link" } [% END %] > ], >- "fnServerData": function ( sSource, aoData, fnCallback ) { >- aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } ); >- >+ [% IF (import_batch_id) %] >+ "fnServerData": function ( sSource, aoData, fnCallback ) { >+ aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } ); >+ [% ELSE %] >+ "fnServerData": function ( sSource, aoData, fnCallback ) { >+ aoData.push( { "name": "import_batch_id", "value": [% draft_record_to_display %] } ); >+ [% END %] > $.ajax({ > 'dataType': 'json', > 'type': 'POST', >@@ -475,6 +538,13 @@ > '<a target="_blank" href="' + record_details_url > + aData['matched'] + '">' + aData['matched'] + '</a>' > ); >+ [% IF !(import_batch_id) %] >+ if (aData['catalog_link']){ >+ $('td:eq(7)', nRow).html( >+ '<a href="' + aData['catalog_link'] + '">' + "Edit" + '</a>' >+ ); >+ } >+ [% END %] > }, > })); > $("#import_batch_form").on("submit",function(){ >diff --git a/tools/batch_records_ajax.pl b/tools/batch_records_ajax.pl >index 349d858..f6aeaa8 100755 >--- a/tools/batch_records_ajax.pl >+++ b/tools/batch_records_ajax.pl >@@ -38,6 +38,7 @@ use C4::Context; > use C4::Charset; > use C4::Auth qw/check_cookie_auth/; > use C4::ImportBatch; >+use Data::Dumper; > > my $input = new CGI; > >@@ -107,10 +108,11 @@ foreach my $record (@$records) { > || q{}, > score => $#$match > -1 ? $match->[0]->{'score'} : 0, > match_id => $match_id, >- diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id" : undef >+ diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id" : undef, >+ catalog_link => "/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=$record->{import_record_id}", > }; > } >- >+warn Dumper(@list); > my $data; > $data->{'iTotalRecords'} = $batch->{'num_records'}; > $data->{'iTotalDisplayRecords'} = $batch->{'num_records'}; >-- >2.1.4
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 20678
:
74922
|
74928
|
74929
|
74960
|
74961
|
74962
|
75192
|
75193
|
78021
|
78920
|
92248
|
107454
|
107472