@@ -, +, @@ catalog --- 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 --- a/cataloguing/addbiblio.pl +++ a/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'){ --- a/installer/data/mysql/atomicupdate/add_draft_record_batch.sql +++ a/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'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ a/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() {
  • Save and view record
  • Save and edit items
  • Save and continue editing
  • +
  • Save without cataloging
  • [% END %] @@ -554,6 +563,7 @@ function Changefwk() { [% END %] + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -180,7 +180,11 @@
  • MARC preview
  • Card preview
  • [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] + [% IF breeding_loo.file == "draft_marc_records.mrc" %] +
  • Continue editing draft record
  • + [% ELSE %]
  • Add biblio
  • + [% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -32,7 +32,7 @@
    -

    Manage staged MARC records +

    Manage staged MARC records [% IF ( import_batch_id ) %] › Batch [% import_batch_id %] [% END %] @@ -60,7 +60,7 @@

    No records have been staged.

    Stage MARC records for import.

    -
    + /div> [% END %] [% END %] @@ -270,6 +270,14 @@ [% END %]

    [% END %] +
    + + +
    +
    @@ -284,8 +292,8 @@ [% FOREACH batch_lis IN batch_list %] - - + + - + [% END %]
    #
    [% batch_lis.import_batch_id %][% batch_lis.file_name %][% batch_lis.import_batch_id %][% batch_lis.file_name %] [% batch_lis.comments %] [% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %] @@ -307,7 +315,7 @@ [% batch_lis.upload_timestamp %] [% batch_lis.num_records %][% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] (Create label batch)[% END %][% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] (Create label batch)[% END %] [% IF ( batch_lis.can_clean ) %]
    @@ -326,6 +334,28 @@
    +
    + +
    +

    To edit or save these draft records click the 'Edit' link beside the appropriate record.

    + + + + + + + + + + + + + +
    #CitationStatusMatch typeMatch detailsDiffRecordCatalog link
    +
    +
    +
    + [% IF ( 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 @@ '' + aData['matched'] + '' ); + [% IF !(import_batch_id) %] + if (aData['catalog_link']){ + $('td:eq(7)', nRow).html( + '' + "Edit" + '' + ); + } + [% END %] }, })); $("#import_batch_form").on("submit",function(){ --- a/tools/batch_records_ajax.pl +++ a/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'}; --