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

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 847-852 our $PERL_DEPS = { Link Here
847
        required => 1,
847
        required => 1,
848
        min_ver => '0.058',
848
        min_ver => '0.058',
849
    },
849
    },
850
    'String::Similarity' => {
851
        usage => 'cataloguing',
852
        required => 1,
853
        min_version => '1.04',
854
    },
850
};
855
};
851
856
852
1;
857
1;
(-)a/help.pl (+5 lines)
Lines 24-29 use C4::Output; Link Here
24
# use C4::Auth;
24
# use C4::Auth;
25
use C4::Context;
25
use C4::Context;
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use C4::Biblio;
27
28
28
sub _help_template_file_of_url {
29
sub _help_template_file_of_url {
29
    my $url = shift;
30
    my $url = shift;
Lines 75-78 if ( $help_version =~ m|^(\d+)\.(\d{2}).*$| ) { Link Here
75
}
76
}
76
$template->param( helpVersion => $help_version );
77
$template->param( helpVersion => $help_version );
77
78
79
my $rules = GetMarcPermissionsRules();
80
my $modules = GetMarcPermissionsModules();
81
$template->param( rules => $rules, modules => $modules );
82
78
output_html_with_http_headers $query, "", $template->output;
83
output_html_with_http_headers $query, "", $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (+1 lines)
Lines 47-52 Link Here
47
    <li><a href="/cgi-bin/koha/admin/matching-rules.pl">Record matching rules</a></li>
47
    <li><a href="/cgi-bin/koha/admin/matching-rules.pl">Record matching rules</a></li>
48
    <li><a href="/cgi-bin/koha/admin/oai_sets.pl">OAI sets configuration</a></li>
48
    <li><a href="/cgi-bin/koha/admin/oai_sets.pl">OAI sets configuration</a></li>
49
    <li><a href="/cgi-bin/koha/admin/items_search_fields.pl">Item search fields</a></li>
49
    <li><a href="/cgi-bin/koha/admin/items_search_fields.pl">Item search fields</a></li>
50
    <li><a href="/cgi-bin/koha/admin/marc-permissions.pl">MARC field permissions</a></li>
50
</ul>
51
</ul>
51
52
52
<h5>Acquisition parameters</h5>
53
<h5>Acquisition parameters</h5>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-permissions.tt (-199 / +28 lines)
Lines 13-19 Link Here
13
13
14
<script type="text/javascript">
14
<script type="text/javascript">
15
//<![CDATA[
15
//<![CDATA[
16
17
function doSubmit(op, id) {
16
function doSubmit(op, id) {
18
    $('<input type="hidden"/>')
17
    $('<input type="hidden"/>')
19
    .attr('name', 'op')
18
    .attr('name', 'op')
Lines 51-58 function doSubmit(op, id) { Link Here
51
}
50
}
52
51
53
$(document).ready(function(){
52
$(document).ready(function(){
54
    $('#btn-help').click(function() {
53
    $('#doremove').on("click",function(){
55
        $('#help').toggle();
54
        doSubmit('doremove');
55
    });
56
    $('#doedit').on("click",function(){
57
        doSubmit('doedit', $("#doedit").attr('value'));
58
    });
59
    $('#add').on("click", function(){
60
        doSubmit('add');
61
        return false;
62
    });
63
    $('#btn_batchremove').on("click", function(){
64
        doSubmit('remove');
56
    });
65
    });
57
66
58
    /* disable some options if subfield is indicator */
67
    /* disable some options if subfield is indicator */
Lines 116-123 $(document).ready(function(){ Link Here
116
            {"bSearchable": false, "bSortable": false}
125
            {"bSearchable": false, "bSortable": false}
117
        ],
126
        ],
118
        "sPaginationType": "four_button"
127
        "sPaginationType": "four_button"
119
    } ));
128
    }));
120
121
});
129
});
122
//]]>
130
//]]>
123
</script>
131
</script>
Lines 135-326 $(document).ready(function(){ Link Here
135
    <div id="yui-main">
143
    <div id="yui-main">
136
    <div class="yui-b">
144
    <div class="yui-b">
137
145
138
<h1>Manage MARC field permissions <a href="#" id="btn-help"><button type="button" class="btn btn-small"><i class="icon-question-sign"></i></button></a></h1>
146
<h1>Manage MARC field permissions</h1>
147
139
[% UNLESS Koha.Preference( 'MARCPermissions' ) %]
148
[% UNLESS Koha.Preference( 'MARCPermissions' ) %]
140
<div class="dialog message">
149
    <div class="dialog message">
141
The <b>MARCPermissions</b> preference is not set, don't forget to enable it for rules to take effect.
150
        The <b>MARCPermissions</b> preference is not set, don't forget to enable it for rules to take effect.
142
</div>
151
    </div>
143
[% END %]
152
[% END %]
144
<div id="help" style="display:none;" class="well">
145
    <h3>Rule evaluation</h3>
146
    <p>
147
    Rules are evaluated from least specific to most specific. This means that a
148
    more specific rule will override a less specific rule.
149
150
    <b>*</b> is less specific than a regular expression. A regular expression is
151
    less specific than a normal field name (e.g. <b>245</b>).
152
153
    A <i>Subfield tag</i> is more specific than a <i>Tag</i>.
154
155
    <p>
156
    To add a field-specific rule (i.e. not a subfield), leave the <i>Subfield
157
    tag</i> field blank.
158
    </p>
159
    </p>
160
    <h4>Defaults</h4>
161
    <p>
162
    Default action when no rules exist is to replace the old record with the new
163
    record. Same as if <b>MARCPermissions</b> is disabled.
164
    </p>
165
    <p>
166
    Default action when no matching rule is found is to leave a field
167
    unchanged (<b>skip</b>). If you wish to changed the default actions for
168
    fields and subfields, please add wildcard rules.
169
    </p>
170
171
    <h4>Wildcards</h4>
172
    <p>
173
    <b>*</b> can be used as a wildcard for <i>Tag</i>, <i>Subfield tag</i> and
174
    <i>Filter</i>. <b>*</b> is considered less specific than a non wildcard value,
175
    and thus will be overridden by a non wildcard value (e.g. "100", "a", etc).
176
    </p>
177
178
    <h4>Regular expressions</h4>
179
    Regular expressions can be used in both the <i>Tag</i> and <i>Subfield
180
    tag</i> fields. Beware though, using regular expressions may create
181
    overlapping matches, in which case they will be applied in a sorted order.
182
183
    <h4>Example rules</h4>
184
    <p>
185
    Following is an example rule set in order of specificity.
186
    </p>
187
    <table>
188
        <thead><tr>
189
            <th>Tag</th>
190
            <th>Subfield tag</th>
191
            <th>Module</th>
192
            <th>Filter</th>
193
            <th>Description</th>
194
        </tr></thead>
195
        <tbody>
196
        <tr>
197
            <td>*</td>
198
            <td></td>
199
            <td>[% modules.0.name %]</td>
200
            <td>*</td>
201
            <td><i>Match any field regardless of [% modules.0.name %]</i></td>
202
        </tr>
203
        <tr>
204
            <td>*</td>
205
            <td>*</td>
206
            <td>[% modules.0.name %]</td>
207
            <td>*</td>
208
            <td><i>Match any subfield regardless of [% modules.0.name %]</i></td>
209
        </tr>
210
        <tr>
211
            <td>245</td>
212
            <td>*</td>
213
            <td>[% modules.0.name %]</td>
214
            <td>z39.50</td>
215
            <td><i>Match any subfield under <b>245</b> when [% modules.0.name %]
216
            is <b>z39.50</b></i></td>
217
        </tr>
218
        <tr>
219
            <td>*</td>
220
            <td>b</td>
221
            <td>[% modules.0.name %]</td>
222
            <td>z39.50</td>
223
            <td><i>Match subfield <b>b</b> regardless of field when [% modules.0.name %]
224
            is <b>z39.50</b></i></td>
225
        </tr>
226
        <tr>
227
            <td>500</td>
228
            <td>[a-d]</td>
229
            <td>[% modules.0.name %]</td>
230
            <td>z39.50</td>
231
            <td><i>Match subfields <b>a, b, c, d</b> when field is 500 and [%
232
            modules.0.name %] is <b>z39.50</b></i></td>
233
        </tr>
234
        <tr>
235
            <td>5..</td>
236
            <td>a</td>
237
            <td>[% modules.0.name %]</td>
238
            <td>z39.50</td>
239
            <td><i>Match subfield <b>a</b> when field matches the regular
240
            expression <b>5..</b> (500-599) and [% modules.0.name %] is <b>z39.50</b></i></td>
241
        </tr>
242
        <tr>
243
            <td>245</td>
244
            <td>a</td>
245
            <td>[% modules.0.name %]</td>
246
            <td>z39.50</td>
247
            <td><i>Match subfield <b>a</b> when field is <b>500</b> and [%
248
            modules.0.name %] is <b>z39.50</b></i></td>
249
        </tr>
250
        </tbody>
251
    </table>
252
253
    <h3>Available filter modules</h3>
254
    Filters cannot be regular expressions. Please use a single <b>*</b> as a
255
    wildcard if need.
256
    <table>
257
        <thead>
258
            <tr>
259
                <th>Specificity</th>
260
                <th>Module</th>
261
                <th>Description</th>
262
            </tr>
263
        </thead>
264
        <tbody>
265
        [% FOREACH module IN modules %]
266
            <tr>
267
                <td>[% module.specificity %]</td>
268
                <td>[% module.name %]</td>
269
                <td>[% module.description %]</td>
270
            </tr>
271
        [% END %]
272
        </tbody>
273
    </table>
274
275
    <h3>Available sources</h3>
276
    The following sources currently implement MARCPermissions.
277
278
    <table>
279
        <thead>
280
            <tr>
281
                <th>Name</th>
282
                <th>Description</th>
283
            </tr>
284
        </thead>
285
        <tbody>
286
            <tr>
287
                <td>bulkmarcimport</td>
288
                <td>bin/migration_tools/bulkmarcimport.pl</td>
289
            </tr>
290
            <tr>
291
                <td>import_lexile</td>
292
                <td>bin/migration_tools/import_lexile.pl</td>
293
            </tr>
294
            <tr>
295
                <td>z39.50</td>
296
                <td>Import from Z39.50 search in browser</td>
297
            </tr>
298
            <tr>
299
                <td>intranet</td>
300
                <td>Modifications from intranet in browser</td>
301
            </tr>
302
            <tr>
303
                <td>batchmod</td>
304
                <td>Batch record modification in browser</td>
305
            </tr>
306
        </tbody>
307
    </table>
308
309
310
311
    <h3>Indicators</h3>
312
    <p>
313
    Indicators can be addressed as <b>i1</b> and <b>i2</b> in the <i>Subfield
314
    tag</i> field. Some actions might not be available for indicators, in which
315
    case they will be disabled.
316
    </p>
317
318
    <h3>Logging</h3>
319
    <p>If <b>MARCPermissionsLog</b> is enabled, log entries for each record
320
    modification will be available in the <b>Modification log</b> in the
321
    <b>Catalog</b> module under the <b>Modify</b> action. This can be very
322
    helpful when debugging rule sets.</p>
323
</div>
324
153
325
[% IF removeConfirm %]
154
[% IF removeConfirm %]
326
<div class="dialog alert">
155
<div class="dialog alert">
Lines 330-336 The <b>MARCPermissions</b> preference is not set, don't forget to enable it for Link Here
330
<form action="[% script_name %]" method="GET">
159
<form action="[% script_name %]" method="GET">
331
    <input type="submit" value="No, do not remove" class="deny"/>
160
    <input type="submit" value="No, do not remove" class="deny"/>
332
</form>
161
</form>
333
<input type="button" value="Yes, remove" class="approve" onClick="doSubmit('doremove');"/>
162
<input type="button" value="Yes, remove" class="approve" id="doremove" />
334
</div>
163
</div>
335
[% END %]
164
[% END %]
336
165
Lines 345-351 The <b>MARCPermissions</b> preference is not set, don't forget to enable it for Link Here
345
        <th>On Existing</th>
174
        <th>On Existing</th>
346
        <th>On New</th>
175
        <th>On New</th>
347
        <th>On Removed</th>
176
        <th>On Removed</th>
348
        <th>&nbsp;</th>
177
        <th>Actions</th>
349
        <th>&nbsp;</th>
178
        <th>&nbsp;</th>
350
    </tr></thead>
179
    </tr></thead>
351
    [% UNLESS edit %]
180
    [% UNLESS edit %]
Lines 383-390 The <b>MARCPermissions</b> preference is not set, don't forget to enable it for Link Here
383
                [% END %]
212
                [% END %]
384
                </select>
213
                </select>
385
            </th>
214
            </th>
386
            <th><button class="btn btn-small" type="button" title="Add" onClick="doSubmit('add');" ><i class="icon-plus"></i></button></th>
215
            <th><button class="btn btn-small" title="Add" id="add"><i class="fa fa-plus"></i> Add rule</button></th>
387
            <th><button id="btn_batchremove" disabled="disabled" class="btn btn-small" type="button" title="Batch remove" onClick="doSubmit('remove');" ><i class="icon-trash"></i></button></th>
216
            <th><button id="btn_batchremove" disabled="disabled" class="btn btn-small" title="Batch remove"><i class="fa fa-trash"></i> Delete selected</button></th>
388
        </tr>
217
        </tr>
389
    </tfoot>
218
    </tfoot>
390
    [% END %]
219
    [% END %]
Lines 440-448 The <b>MARCPermissions</b> preference is not set, don't forget to enable it for Link Here
440
                        [% END %]
269
                        [% END %]
441
                    </select>
270
                    </select>
442
                </td>
271
                </td>
443
                <td>
272
                <td class="actions">
444
                    <button class="btn btn-small" type="button" title="Save" onClick="doSubmit('doedit', [% rule.id %]);"><i class="icon-ok"></i></button>
273
                    <button class="btn btn-mini" title="Save" id="doedit" value="[% rule.id %]"><i class="fa fa-check"></i> Save</button>
445
                    <a href="?"><button class="btn btn-small" type="button" title="Cancel" ><i class="icon-ban-circle"></i></button></a>
274
                    <a href="?"><button class="btn btn-mini" title="Cancel" ><i class="fa fa-times"></i> Cancel</button></a>
446
                    </td>
275
                    </td>
447
                <td></td>
276
                <td></td>
448
            [% ELSE %]
277
            [% ELSE %]
Lines 454-462 The <b>MARCPermissions</b> preference is not set, don't forget to enable it for Link Here
454
                <td>[% rule.on_existing %]</td>
283
                <td>[% rule.on_existing %]</td>
455
                <td>[% rule.on_new %]</td>
284
                <td>[% rule.on_new %]</td>
456
                <td>[% rule.on_removed %]</td>
285
                <td>[% rule.on_removed %]</td>
457
                <td>
286
                <td class="actions">
458
                    <a href="?op=remove&id=[% rule.id %]" title="Remove"><i class="icon-remove"></i></a>
287
                    <a href="?op=remove&id=[% rule.id %]" title="Delete" class="btn btn-mini"><i class="fa fa-trash"></i> Delete</a>
459
                    <a href="?op=edit&id=[% rule.id %]" title="Edit"><i class="icon-pencil"></i></a>
288
                    <a href="?op=edit&id=[% rule.id %]" title="Edit" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a>
460
                </td>
289
                </td>
461
                <td>
290
                <td>
462
                    [% IF rule.remove %]
291
                    [% IF rule.remove %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc-permissions.tt (-1 / +148 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'help-top.inc' %]
2
3
<h1>Manage MARC field permissions</h1>
4
5
<h3>Rule evaluation</h3>
6
<p>Rules are evaluated from least specific to most specific. This means that a more specific rule will override a less specific rule. <b>*</b> is less specific than a regular expression. A regular expression is less specific than a normal field name (e.g. <b>245</b>). A <i>Subfield tag</i> is more specific than a <i>Tag</i>.</p>
7
<p>To add a field-specific rule (i.e. not a subfield), leave the <i>Subfield tag</i> field blank.</p>
8
9
<h4>Defaults</h4>
10
<p>Default action when no rules exist is to replace the old record with the new record. Same as if <b>MARCPermissions</b> is disabled.</p>
11
<p>Default action when no matching rule is found is to leave a field unchanged (<b>skip</b>). If you wish to changed the default actions for fields and subfields, please add wildcard rules.</p>
12
13
<h4>Wildcards</h4>
14
<p><b>*</b> can be used as a wildcard for <i>Tag</i>, <i>Subfield tag</i> and <i>Filter</i>. <b>*</b> is considered less specific than a non wildcard value, and thus will be overridden by a non wildcard value (e.g. "100", "a", etc).</p>
15
16
<h4>Regular expressions</h4>
17
<p>Regular expressions can be used in both the <i>Tag</i> and <i>Subfield tag</i> fields. Beware though, using regular expressions may create overlapping matches, in which case they will be applied in a sorted order.</p>
18
19
<h4>Example rules</h4>
20
<p>Following is an example rule set in order of specificity.</p>
21
22
<table>
23
    <thead><tr>
24
        <th>Tag</th>
25
        <th>Subfield tag</th>
26
        <th>Module</th>
27
        <th>Filter</th>
28
        <th>Description</th>
29
    </tr></thead>
30
    <tbody><tr>
31
        <td>*</td>
32
        <td></td>
33
        <td>[% modules.0.name %]</td>
34
        <td>*</td>
35
        <td><i>Match any field regardless of [% modules.0.name %]</i></td>
36
    </tr>
37
    <tr>
38
        <td>*</td>
39
        <td>*</td>
40
        <td>[% modules.0.name %]</td>
41
        <td>*</td>
42
        <td><i>Match any subfield regardless of [% modules.0.name %]</i></td>
43
    </tr>
44
    <tr>
45
        <td>245</td>
46
        <td>*</td>
47
        <td>[% modules.0.name %]</td>
48
        <td>z39.50</td>
49
        <td><i>Match any subfield under <b>245</b> when [% modules.0.name %] is <b>z39.50</b></i></td>
50
    </tr>
51
    <tr>
52
        <td>*</td>
53
        <td>b</td>
54
        <td>[% modules.0.name %]</td>
55
        <td>z39.50</td>
56
        <td><i>Match subfield <b>b</b> regardless of field when [% modules.0.name %] is <b>z39.50</b></i></td>
57
    </tr>
58
    <tr>
59
        <td>500</td>
60
        <td>[a-d]</td>
61
        <td>[% modules.0.name %]</td>
62
        <td>z39.50</td>
63
        <td><i>Match subfields <b>a, b, c, d</b> when field is 500 and [% modules.0.name %] is <b>z39.50</b></i></td>
64
    </tr>
65
    <tr>
66
        <td>5..</td>
67
        <td>a</td>
68
        <td>[% modules.0.name %]</td>
69
        <td>z39.50</td>
70
        <td><i>Match subfield <b>a</b> when field matches the regular expression <b>5..</b> (500-599) and [% modules.0.name %] is <b>z39.50</b></i></td>
71
    </tr>
72
    <tr>
73
        <td>245</td>
74
        <td>a</td>
75
        <td>[% modules.0.name %]</td>
76
        <td>z39.50</td>
77
        <td><i>Match subfield <b>a</b> when field is <b>500</b> and [% modules.0.name %] is <b>z39.50</b></i></td>
78
    </tr></tbody>
79
</table>
80
81
<br>
82
83
<h3>Available filter modules</h3>
84
<p>Filters cannot be regular expressions. Please use a single <b>*</b> as a wildcard if need.</p>
85
86
<table>
87
    <thead><tr>
88
        <th>Specificity</th>
89
        <th>Module</th>
90
        <th>Description</th>
91
    </tr></thead>
92
    <tbody>
93
    [% FOREACH module IN modules %]
94
        <tr>
95
            <td>[% module.specificity %]</td>
96
            <td>[% module.name %]</td>
97
            <td>[% module.description %]</td>
98
        </tr>
99
    [% END %]
100
    </tbody>
101
</table>
102
103
<br>
104
105
<h3>Available sources</h3>
106
<p>The following sources currently implement MARCPermissions.</p>
107
108
<table>
109
    <thead><tr>
110
        <th>Name</th>
111
        <th>Description</th>
112
    </tr></thead>
113
    <tbody><tr>
114
        <td>bulkmarcimport</td>
115
        <td>bin/migration_tools/bulkmarcimport.pl</td>
116
    </tr>
117
    <tr>
118
        <td>import_lexile</td>
119
        <td>bin/migration_tools/import_lexile.pl</td>
120
    </tr>
121
    <tr>
122
        <td>z39.50</td>
123
        <td>Import from Z39.50 search in browser</td>
124
    </tr>
125
    <tr>
126
        <td>intranet</td>
127
        <td>Modifications from intranet in browser</td>
128
    </tr>
129
    <tr>
130
        <td>batchmod</td>
131
        <td>Batch record modification in browser</td>
132
    </tr></tbody>
133
</table>
134
135
<br>
136
137
<h3>Indicators</h3>
138
<p>Indicators can be addressed as <b>i1</b> and <b>i2</b> in the <i>Subfield tag</i> field. Some actions might not be available for indicators, in which case they will be disabled.</p>
139
140
<br>
141
142
<h3>Logging</h3>
143
<p>If <b>MARCPermissionsLog</b> is enabled, log entries for each record modification will be available in the <b>Modification log</b> in the <b>Catalog</b> module under the <b>Modify</b> action. This can be very helpful when debugging rule sets.</p>
144
<p>The administration area is where you set all of your preferences for the system. Preference are broken down into several categories, detailed below.</p>
145
146
<p><strong>See the full documentation for Koha in the <a href="http://manual.koha-community.org/[% helpVersion %]/en/">manual</a> (online).</strong></p>
147
148
[% INCLUDE 'help-bottom.inc' %]

Return to bug 14957