4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Stage MARC records for import</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <style type="text/css">
8 #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
12 <body id="tools_stage-marc-import" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( uploadmarc ) %]<a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a> › Upload Results[% ELSE %]Stage MARC records for import[% END %]</div>
18 <div id="doc3" class="yui-t2">
24 [% IF ( uploadmarc ) %]
25 <div id="toolbar" class="btn-toolbar">
26 <a class="btn btn-default btn-sm" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
27 <a class="btn btn-default btn-sm" href="/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=[% import_batch_id | html %]"><i class="fa fa-list-ul"></i> Manage staged records</a>
31 <h1>Stage MARC records for import</h1>
32 [% IF ( uploadmarc ) %]
33 <p>MARC staging results :</p>
35 [% SWITCH (record_type) %]
37 <li>Processing bibliographic records</li>
39 <li>Processing authority records</li>
41 <li>[% total | html %] records in file</li>
42 <li>[% import_errors | html %] records not staged because of MARC error</li>
43 <li>[% staged | html %] records staged</li>
44 [% IF ( checked_matches ) %]
45 <li>[% matched | html %] records with at least one match in catalog per matching rule
46 "[% matcher_code | html %]"</li>
48 [% IF ( matcher_failed ) %]
49 <li>Record matching failed -- unable to retrieve selected matching rule.</li>
51 <li>Did not check for matches with existing records in catalog</li>
54 [% IF record_type == 'biblio' %]
55 <li>[% num_items | html %] item records found and staged</li>
57 [% IF ( label_batch ) %]
58 <li>New label batch created: # [% label_batch | html %] </li>
61 [% IF basketno && booksellerid %]
63 <a id="addtobasket" class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% import_batch_id | html %]&basketno=[% basketno | html %]&booksellerid=[% booksellerid | html %]">Add staged files to basket</a>
68 <li>Select a MARC file to stage in the import reservoir. It will be parsed, and each valid record staged for later import into the catalog.</li>
69 <li>You can enter a name for this import. It may be useful, when creating a record, to remember where the suggested MARC data comes from!</li>
71 <form method="post" action="[% SCRIPT_NAME | html %]" id="uploadfile" enctype="multipart/form-data">
72 <fieldset class="rows" id="uploadform">
73 <legend>Stage records into the reservoir</legend>
76 <div id="fileuploadform">
77 <label for="fileToUpload">Select the file to stage: </label>
78 <input type="file" id="fileToUpload" name="fileToUpload" />
81 <fieldset class="action">
82 <button id="fileuploadbutton">Upload file</button>
83 <button id="fileuploadcancel">Cancel</button>
87 <div id="fileuploadpanel">
88 <div id="fileuploadstatus" class="progress_panel">Upload progress:
89 <progress id="fileuploadprogress" max="100" value="0">
91 <span class="fileuploadpercent">0</span>%
93 <div id="fileuploadfailed"></div>
97 <form method="post" id="processfile" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
98 [% IF basketno && booksellerid %]
99 <input type="hidden" name="basketno" id="basketno" value="[% basketno | html %]" />
100 <input type="hidden" name="booksellerid" id="booksellerid" value="[% booksellerid | html %]" />
102 <fieldset class="rows">
103 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
104 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
105 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
107 <label for="comments">Comments about this file: </label>
108 <input type="text" id="comments" name="comments" />
112 <label for='record_type'>Record type:</label>
113 <select name='record_type' id='record_type'>
114 <option value='biblio' selected='selected'>Bibliographic</option>
115 <option value='auth'>Authority</option>
119 <label for="encoding">Character encoding: </label>
120 <select name="encoding" id="encoding">
121 <option value="UTF-8" selected="selected">UTF-8 (Default)</option>
122 <option value="MARC-8">MARC 8</option>
123 <option value="ISO_5426">ISO 5426</option>
124 <option value="ISO_6937">ISO 6937</option>
125 <option value="ISO_8859-1">ISO 8859-1</option>
126 <option value="EUC-KR">EUC-KR</option>
130 <label for='format'>Format:</label>
131 <select name='format' id='format'>
132 <option value='ISO2709'>MARC</option>
133 <option value='MARCXML'>MARCXML</option>
134 [% FOREACH p IN plugins %]
135 <option value="[% p.metadata.class | html %]">[% p.metadata.name | html %] ( other format via plugin)</option>
141 [% IF MarcModificationTemplatesLoop %]
142 <fieldset class="rows">
143 <legend>Use MARC Modification Template:</legend>
146 <label for="comments">Modify record using the following template: </label>
147 <select name="marc_modification_template_id" id="marc_modification_template_id">
148 <option value="">Do not use.</option>
149 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
150 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
158 <fieldset class="rows">
159 <legend>Look for existing records in catalog?</legend>
160 <ol><li><label for="matcher">Record matching rule:</label>
161 <select name="matcher" id="matcher">
162 <option value="">Do not look for matching records</option>
163 [% FOREACH available_matcher IN available_matchers %]
164 <option value="[% available_matcher.matcher_id | html %]">[% available_matcher.code | html %] ([% available_matcher.description | html %])
169 <li><label for="overlay_action">Action if matching record found: </label>
170 [% INCLUDE 'tools-overlay-action.inc' %]
172 <li><label for="nomatch_action">Action if no match is found: </label>
173 [% INCLUDE 'tools-nomatch-action.inc' %]
177 <fieldset class="rows" id="items">
178 <legend>Check for embedded item record data?</legend>
181 <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
182 <label for="parse_itemsyes">Yes</label>
185 <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
186 <label for="parse_itemsno">No</label>
190 <li><label for="item_action">How to process items: </label>
191 [% INCLUDE 'tools-item-action.inc' %]
195 <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
197 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
198 <div id="jobfailed"></div></div>
206 [% INCLUDE 'tools-menu.inc' %]
210 [% MACRO jsinclude BLOCK %]
211 [% Asset.js("js/tools-menu.js") | $raw %]
212 [% Asset.js("js/background-job-progressbar.js") | $raw %]
213 [% Asset.js("js/file-upload.js") | $raw %]
214 <script type="text/javascript">
216 $(document).ready(function(){
217 $("#processfile").hide();
218 $("#record_type").change(function() {
219 if ($(this).val() == 'auth') {
225 $("#fileuploadbutton").on("click",function(e){
229 $("#fileuploadcancel").on("click",function(e){
233 $("#mainformsubmit").on("click",function(){
234 return CheckForm( document.getElementById("processfile"));
237 function CheckForm(f) {
238 if ($("#fileToUpload").value == '') {
239 alert(_("Please upload a file first."));
241 return submitBackgroundJob(f);
245 function StartUpload() {
246 if( $('#fileToUpload').prop('files').length == 0 ) return;
247 $('#fileuploadbutton').hide();
248 $("#fileuploadfailed").hide();
249 $("#processfile").hide();
250 $("#fileuploadstatus").show();
251 $("#uploadedfileid").val('');
252 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
253 $("#fileuploadcancel").show();
255 function CancelUpload() {
256 if( xhr ) xhr.abort();
257 $("#fileuploadstatus").hide();
258 $('#fileuploadbutton').show();
259 $("#fileuploadcancel").hide();
260 $("#fileuploadfailed").show();
261 $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
263 function cbUpload( status, fileid, errors ) {
264 if( status=='done' ) {
265 $("#uploadedfileid").val( fileid );
266 $('#fileToUpload').prop('disabled',true);
267 $('#fileuploadbutton').prop('disabled',true);
268 $('#fileuploadbutton').show();
269 $("#fileuploadcancel").hide();
270 var filename=$('#fileToUpload').prop('files')[0].name;
271 if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
272 $('#format').val('MARCXML');
274 $("#processfile").show();
276 var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
277 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
278 $('#fileuploadbutton').show();
279 $("#fileuploadcancel").hide();
280 $("#fileuploadstatus").hide();
281 $("#fileuploadfailed").show();
282 $("#fileuploadfailed").text( _("Upload status: ") +
283 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
284 ( status=='denied'? _("Denied"): status ))
291 [% INCLUDE 'intranet-bottom.inc' %]