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

(-)a/admin/marc_subfields_structure.pl (-33 / +24 lines)
Lines 18-23 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Encode qw( encode_utf8 );
21
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
22
use C4::Auth qw( get_template_and_user );
23
use C4::Auth qw( get_template_and_user );
23
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
Lines 211-252 if ( $op eq 'add_form' ) { Link Here
211
elsif ( $op eq 'add_validate' ) {
212
elsif ( $op eq 'add_validate' ) {
212
    my $dbh = C4::Context->dbh;
213
    my $dbh = C4::Context->dbh;
213
    $template->param( tagfield => "$input->param('tagfield')" );
214
    $template->param( tagfield => "$input->param('tagfield')" );
214
    my @tagsubfield       = $input->multi_param('tagsubfield');
215
    my $tagfield    = $input->param('tagfield');
215
    my @liblibrarian      = $input->multi_param('liblibrarian');
216
    my @tagsubfield = $input->multi_param('tagsubfield');
216
    my @libopac           = $input->multi_param('libopac');
217
    use Data::Printer colored => 1; warn p @tagsubfield;
217
    my @kohafield         = $input->multi_param('kohafield');
218
    my @tab_ids     = $input->multi_param('tab_id');
218
    my @tab               = $input->multi_param('tab');
219
    my @seealso           = $input->multi_param('seealso');
220
    my @hidden            = $input->multi_param('hidden');
221
    my @authorised_values = $input->multi_param('authorised_value');
222
    my @authtypecodes     = $input->multi_param('authtypecode');
223
    my @value_builder     = $input->multi_param('value_builder');
224
    my @link              = $input->multi_param('link');
225
    my @defaultvalue      = $input->multi_param('defaultvalue');
226
    my @maxlength         = $input->multi_param('maxlength');
227
219
228
    my $display_order;
220
    my $display_order;
229
    for ( my $i = 0 ; $i <= $#tagsubfield ; $i++ ) {
221
    for my $tagsubfield ( @tagsubfield ) {
230
        my $tagfield    = $input->param('tagfield');
231
        my $tagsubfield = $tagsubfield[$i];
232
        $tagsubfield = "@" unless $tagsubfield ne '';
222
        $tagsubfield = "@" unless $tagsubfield ne '';
233
        my $liblibrarian     = $liblibrarian[$i];
223
        my $id = shift @tab_ids;
234
        my $libopac          = $libopac[$i];
224
        my $liblibrarian     = $input->param("liblibrarian_$id");
235
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
225
        my $libopac          = $input->param("libopac_$id");
236
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
226
        my $repeatable       = $input->param("repeatable_$id") ? 1 : 0;
237
        my $important        = $input->param("important$i") ? 1 : 0;
227
        my $mandatory        = $input->param("mandatory_$id") ? 1 : 0;
238
        my $kohafield        = $kohafield[$i];
228
        my $important        = $input->param("important_$id") ? 1 : 0;
239
        my $tab              = $tab[$i];
229
        my $kohafield        = $input->param("kohafield_$id");
240
        my $seealso          = $seealso[$i];
230
        my $tab              = $input->param("tab_$id");
241
        my $authorised_value = $authorised_values[$i];
231
        my $seealso          = $input->param("seealso_$id");
242
        my $authtypecode     = $authtypecodes[$i];
232
        my $authorised_value = $input->param("authorised_values_$id");
243
        my $value_builder    = $value_builder[$i];
233
        my $authtypecode     = $input->param("authtypecodes_$id");
244
        my $hidden = $hidden[$i];                     #input->param("hidden$i");
234
        my $value_builder    = $input->param("value_builder_$id");
245
        my $isurl  = $input->param("isurl$i") ? 1 : 0;
235
        my $hidden = $input->param("hidden_$id");
246
        my $link   = $link[$i];
236
        my $isurl  = $input->param("isurl_$id") ? 1 : 0;
247
        my $defaultvalue = $defaultvalue[$i];
237
        my $link   = $input->param("link_$id");
248
        my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
238
        my $defaultvalue = $input->param("defaultvalue_$id");
249
        
239
        my $maxlength = $input->param("maxlength_$id") || 9999;
240
250
        if (defined($liblibrarian) && $liblibrarian ne "") {
241
        if (defined($liblibrarian) && $liblibrarian ne "") {
251
            my $mss = Koha::MarcSubfieldStructures->find({tagfield => $tagfield, tagsubfield => $tagsubfield, frameworkcode => $frameworkcode });
242
            my $mss = Koha::MarcSubfieldStructures->find({tagfield => $tagfield, tagsubfield => $tagsubfield, frameworkcode => $frameworkcode });
252
            if ($mss) {
243
            if ($mss) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (-22 / +24 lines)
Lines 161-186 Link Here
161
                                                        [% IF ( subfieldcode == 0 || subfieldcode ) %]
161
                                                        [% IF ( subfieldcode == 0 || subfieldcode ) %]
162
                                                            <li>
162
                                                            <li>
163
                                                                <span class="label">Subfield code:</span>
163
                                                                <span class="label">Subfield code:</span>
164
                                                                [% loo.subfieldcode | html %] <input type="hidden" name="tagsubfield" value="[% loo.subfieldcode | html %]" />
164
                                                                [% loo.subfieldcode | html %]
165
                                                                <input type="hidden" name="tagsubfield" value="[% loo.subfieldcode | html %]" />
166
                                                                <input type="hidden" name="tab_id" value="[% loo.row | html %]" />
165
                                                            </li>
167
                                                            </li>
166
                                                        [% ELSE %]
168
                                                        [% ELSE %]
167
                                                            <li>
169
                                                            <li>
168
                                                                <label for="tagsubfield[% loo.row | html %]">Subfield code:</label>
170
                                                                <label for="tagsubfield[% loo.row | html %]">Subfield code:</label>
169
                                                                    <input type="text" id="tagsubfield[% loo.row | html %]" name="tagsubfield" value="[% loo.subfieldcode | html %]" />
171
                                                                    <input type="text" id="tagsubfield[% loo.row | html %]" name="tagsubfield" value="[% loo.subfieldcode | html %]" />
172
                                                                    <input type="hidden" name="tab_id" value="[% loo.row | html %]" />
170
                                                                </li>
173
                                                                </li>
171
                                                        [% END %]
174
                                                        [% END %]
172
                                                        <li>
175
                                                        <li>
173
                                                            <label for="liblibrarian[% loo.row | html %]">Text for librarian: </label>
176
                                                            <label for="liblibrarian[% loo.row | html %]">Text for librarian: </label>
174
                                                            <input id="liblibrarian[% loo.row | html %]" type="text" name="liblibrarian" value="[% loo.liblibrarian | html_entity %]" size="40" maxlength="80" />
177
                                                            <input id="liblibrarian[% loo.row | html %]" type="text" name="liblibrarian_[% loo.row | html %]" value="[% loo.liblibrarian | html_entity %]" size="40" maxlength="80" />
175
                                                        </li>
178
                                                        </li>
176
                                                        <li>
179
                                                        <li>
177
                                                            <label for="libopac[% loo.row | html %]">Text for OPAC: </label>
180
                                                            <label for="libopac[% loo.row | html %]">Text for OPAC: </label>
178
                                                            <input type="text" id="libopac[% loo.row | html %]" name="libopac" value="[% loo.libopac | html_entity %]" size="40" maxlength="80" />
181
                                                            <input type="text" id="libopac[% loo.row | html %]" name="libopac_[% loo.row | html %]" value="[% loo.libopac | html_entity %]" size="40" maxlength="80" />
179
                                                        </li>
182
                                                        </li>
180
                                                        <li>
183
                                                        <li>
181
                                                            <label for="repeatable[% loo.row | html %]">Repeatable: </label>
184
                                                            <label for="repeatable[% loo.row | html %]">Repeatable: </label>
182
                                                            [% IF loo.repeatable %]
185
                                                            [% IF loo.repeatable %]
183
                                                                <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" checked="checked" value="1" />
186
                                                                <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable_[% loo.row | html %]" checked="checked" value="1" />
184
                                                            [% ELSE %]
187
                                                            [% ELSE %]
185
                                                                <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" value="1" />
188
                                                                <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" value="1" />
186
                                                            [% END %]
189
                                                            [% END %]
Lines 188-208 Link Here
188
                                                        <li>
191
                                                        <li>
189
                                                            <label for="mandatory[% loo.row | html %]">Mandatory: </label>
192
                                                            <label for="mandatory[% loo.row | html %]">Mandatory: </label>
190
                                                            [% IF loo.mandatory %]
193
                                                            [% IF loo.mandatory %]
191
                                                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" checked="checked" value="1" />
194
                                                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory_[% loo.row | html %]" checked="checked" value="1" />
192
                                                            [% ELSE %]
195
                                                            [% ELSE %]
193
                                                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
196
                                                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory_[% loo.row | html %]" value="1" />
194
                                                            [% END %]
197
                                                            [% END %]
195
                                                        </li>
198
                                                        </li>
196
                                                        <li>
199
                                                        <li>
197
                                                            <label for="important[% loo.row | html %]">Important: </label>
200
                                                            <label for="important[% loo.row | html %]">Important: </label>
198
                                                            [% IF loo.important %]
201
                                                            [% IF loo.important %]
199
                                                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" checked="checked" value="1" />
202
                                                                <input type="checkbox" id="important[% loo.row | html %]" name="important_[% loo.row | html %]" checked="checked" value="1" />
200
                                                            [% ELSE %]
203
                                                            [% ELSE %]
201
                                                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" value="1" />
204
                                                                <input type="checkbox" id="important[% loo.row | html %]" name="important_[% loo.row | html %]" value="1" />
202
                                                            [% END %]
205
                                                            [% END %]
203
                                                        </li>
206
                                                        </li>
204
                                                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
207
                                                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
205
                                                            <select name="tab" tabindex="" id="tab[% loo.row | html %]">
208
                                                            <select name="tab_[% loo.row | html %]" tabindex="" id="tab[% loo.row | html %]">
206
                                                            [%- IF ( loo.tab ==  -1 ) -%]
209
                                                            [%- IF ( loo.tab ==  -1 ) -%]
207
                                                                <option value="-1" selected="selected">ignore</option>
210
                                                                <option value="-1" selected="selected">ignore</option>
208
                                                            [%- ELSE -%]
211
                                                            [%- ELSE -%]
Lines 233-249 Link Here
233
                                                    <ol>
236
                                                    <ol>
234
                                                        <li>
237
                                                        <li>
235
                                                            <label for="defaultvalue[% loo.row | html %]">Default value:</label>
238
                                                            <label for="defaultvalue[% loo.row | html %]">Default value:</label>
236
                                                            <input type="text" name="defaultvalue" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" />
239
                                                            <input type="text" name="defaultvalue_[% loo.row | html %]" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" />
237
                                                        </li>
240
                                                        </li>
238
                                                        <li>
241
                                                        <li>
239
                                                            <label for="maxlength[% loo.row | html %]">Max length:</label>
242
                                                            <label for="maxlength[% loo.row | html %]">Max length:</label>
240
                                                            <input type="text" id="maxlength[% loo.row | html %]" name="maxlength" value="[% loo.maxlength | html %]" size="4" />
243
                                                            <input type="text" id="maxlength[% loo.row | html %]" name="maxlength_[% loo.row | html %]" value="[% loo.maxlength | html %]" size="4" />
241
                                                        </li>
244
                                                        </li>
242
                                                        <li>
245
                                                        <li>
243
                                                            [% IF loo.hidden_protected %]
246
                                                            [% IF loo.hidden_protected %]
244
                                                                <input type="hidden" id="hidden-[% loo.row | html %]" name="hidden" value="[% loo.hidden | html %]" data-koha-protected="1" />
247
                                                                <input type="hidden" id="hidden-[% loo.row | html %]" name="hidden_[% loo.row | html %]" value="[% loo.hidden | html %]" data-koha-protected="1" />
245
                                                            [% ELSE %]
248
                                                            [% ELSE %]
246
                                                                <input type="hidden" id="hidden-[% loo.row | html %]" name="hidden" value="[% loo.hidden | html %]" />
249
                                                                <input type="hidden" id="hidden-[% loo.row | html %]" name="hidden_[% loo.row | html %]" value="[% loo.hidden | html %]" />
247
                                                            [% END %]
250
                                                            [% END %]
248
                                                            <label for="hidden[% loo.row | html %]">Visibility: </label>
251
                                                            <label for="hidden[% loo.row | html %]">Visibility: </label>
249
                                                            <input type="checkbox" id="hidden_opac_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_opac_[% loo.row | html %]"/>
252
                                                            <input type="checkbox" id="hidden_opac_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_opac_[% loo.row | html %]"/>
Lines 260-280 Link Here
260
                                                        <li>
263
                                                        <li>
261
                                                            <label for="isurl[% loo.row | html %]">Is a URL:</label>
264
                                                            <label for="isurl[% loo.row | html %]">Is a URL:</label>
262
                                                            [% IF loo.isurl %]
265
                                                            [% IF loo.isurl %]
263
                                                                <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" checked="checked" value="1" />
266
                                                                <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl_[% loo.row | html %]" checked="checked" value="1" />
264
                                                            [% ELSE %]
267
                                                            [% ELSE %]
265
                                                                <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" value="1" />
268
                                                                <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl_[% loo.row | html %]" value="1" />
266
                                                            [% END %]
269
                                                            [% END %]
267
                                                            <span class="hint">If checked, it means that the subfield is a URL and can be clicked</span>
270
                                                            <span class="hint">If checked, it means that the subfield is a URL and can be clicked</span>
268
                                                        </li>
271
                                                        </li>
269
                                                        <li>
272
                                                        <li>
270
                                                            <label for="link[% loo.row | html %]">Link:</label>
273
                                                            <label for="link[% loo.row | html %]">Link:</label>
271
                                                            <input type="text" id="link[% loo.row | html %]" name="link" value="[% loo.link | html %]" size="10" maxlength="80" />
274
                                                            <input type="text" id="link[% loo.row | html %]" name="link_[% loo.row | html %]" value="[% loo.link | html %]" size="10" maxlength="80" />
272
                                                            <div class="hint">An index name, e.g. title or Local-Number</div>
275
                                                            <div class="hint">An index name, e.g. title or Local-Number</div>
273
                                                        </li>
276
                                                        </li>
274
                                                        <li>
277
                                                        <li>
275
                                                            <label for="kohafield[% loo.row | html %]">Koha link:</label>
278
                                                            <label for="kohafield[% loo.row | html %]">Koha link:</label>
276
                                                            <!-- This select should be DISABLED; value is submitted by the following hidden input -->
279
                                                            <!-- This select should be DISABLED; value is submitted by the following hidden input -->
277
                                                            <select name="kohafield" id="kohafield[% loo.row | html %]" disabled>
280
                                                            <select name="kohafield_[% loo.row | html %]" id="kohafield[% loo.row | html %]" disabled>
278
                                                            [% FOREACH value IN loo.kohafields %]
281
                                                            [% FOREACH value IN loo.kohafields %]
279
                                                            [% IF ( value == loo.kohafield ) %]
282
                                                            [% IF ( value == loo.kohafield ) %]
280
                                                                <option value="[% value | html %]" selected="selected">[% value | html %]</option>
283
                                                                <option value="[% value | html %]" selected="selected">[% value | html %]</option>
Lines 284-290 Link Here
284
                                                            [% END %]
287
                                                            [% END %]
285
                                                            </select>
288
                                                            </select>
286
                                                            <!-- Do NOT remove this next hidden input! We need it to save kohafield. -->
289
                                                            <!-- Do NOT remove this next hidden input! We need it to save kohafield. -->
287
                                                            <input type="hidden" name="kohafield" value="[% loo.kohafield | html %]"/>
290
                                                            <input type="hidden" name="kohafield_[% loo.row | html %]" value="[% loo.kohafield | html %]"/>
288
                                                        </li>
291
                                                        </li>
289
                                                    </ol>
292
                                                    </ol>
290
                                                </fieldset> <!-- /.rows -->
293
                                                </fieldset> <!-- /.rows -->
Lines 296-302 Link Here
296
                                                    <ol>
299
                                                    <ol>
297
                                                        <li>
300
                                                        <li>
298
                                                            <label for="authorised_value[% loo.row | html %]">Authorized value:</label>
301
                                                            <label for="authorised_value[% loo.row | html %]">Authorized value:</label>
299
                                                            <select name="authorised_value" id="authorised_value[% loo.row | html %]">
302
                                                            <select name="authorised_value_[% loo.row | html %]" id="authorised_value[% loo.row | html %]">
300
                                                            <option value=""></option>
303
                                                            <option value=""></option>
301
                                                            [% FOREACH value IN loo.authorised_values %]
304
                                                            [% FOREACH value IN loo.authorised_values %]
302
                                                                [% IF ( value == loo.authorised_value ) %]
305
                                                                [% IF ( value == loo.authorised_value ) %]
Lines 309-315 Link Here
309
                                                        </li>
312
                                                        </li>
310
                                                        <li>
313
                                                        <li>
311
                                                            <label for="authtypecode[% loo.row | html %]">Thesaurus:</label>
314
                                                            <label for="authtypecode[% loo.row | html %]">Thesaurus:</label>
312
                                                            <select name="authtypecode" id="authtypecode[% loo.row | html %]">
315
                                                            <select name="authtypecode_[% loo.row | html %]" id="authtypecode[% loo.row | html %]">
313
                                                            [% FOREACH value IN loo.authtypes %]
316
                                                            [% FOREACH value IN loo.authtypes %]
314
                                                                [% IF ( value == loo.authtypecode ) %]
317
                                                                [% IF ( value == loo.authtypecode ) %]
315
                                                                    <option value="[% value | html %]" selected="selected">[% value | html %]</option>
318
                                                                    <option value="[% value | html %]" selected="selected">[% value | html %]</option>
Lines 321-327 Link Here
321
                                                        </li>
324
                                                        </li>
322
                                                        <li>
325
                                                        <li>
323
                                                            <label for="value_builder[% loo.row | html %]">Plugin:</label>
326
                                                            <label for="value_builder[% loo.row | html %]">Plugin:</label>
324
                                                            <select name="value_builder" id="value_builder[% loo.row | html %]">
327
                                                            <select name="value_builder_[% loo.row | html %]" id="value_builder[% loo.row | html %]">
325
                                                            [% FOREACH value IN loo.value_builders %]
328
                                                            [% FOREACH value IN loo.value_builders %]
326
                                                                [% IF ( value == loo.value_builder ) %]
329
                                                                [% IF ( value == loo.value_builder ) %]
327
                                                                    <option value="[% value | html %]" selected="selected">[% value | html %]</option>
330
                                                                    <option value="[% value | html %]" selected="selected">[% value | html %]</option>
328
- 

Return to bug 29001