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

(-)a/C4/Biblio.pm (-5 / +7 lines)
Lines 982-1004 sub GetMarcStructure { Link Here
982
982
983
    my $dbh = C4::Context->dbh;
983
    my $dbh = C4::Context->dbh;
984
    my $sth = $dbh->prepare(
984
    my $sth = $dbh->prepare(
985
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
985
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,important
986
        FROM marc_tag_structure 
986
        FROM marc_tag_structure 
987
        WHERE frameworkcode=? 
987
        WHERE frameworkcode=? 
988
        ORDER BY tagfield"
988
        ORDER BY tagfield"
989
    );
989
    );
990
    $sth->execute($frameworkcode);
990
    $sth->execute($frameworkcode);
991
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
991
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $important );
992
992
993
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
993
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $important ) = $sth->fetchrow ) {
994
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
994
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
995
        $res->{$tag}->{tab}        = "";
995
        $res->{$tag}->{tab}        = "";
996
        $res->{$tag}->{mandatory}  = $mandatory;
996
        $res->{$tag}->{mandatory}  = $mandatory;
997
        $res->{$tag}->{important}  = $important;
997
        $res->{$tag}->{repeatable} = $repeatable;
998
        $res->{$tag}->{repeatable} = $repeatable;
998
    }
999
    }
999
1000
1000
    $sth = $dbh->prepare(
1001
    $sth = $dbh->prepare(
1001
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
1002
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,important
1002
         FROM   marc_subfield_structure 
1003
         FROM   marc_subfield_structure 
1003
         WHERE  frameworkcode=? 
1004
         WHERE  frameworkcode=? 
1004
         ORDER BY tagfield,tagsubfield
1005
         ORDER BY tagfield,tagsubfield
Lines 1022-1034 sub GetMarcStructure { Link Here
1022
    while (
1023
    while (
1023
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1024
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1024
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1025
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1025
            $maxlength
1026
            $maxlength, $important
1026
        )
1027
        )
1027
        = $sth->fetchrow
1028
        = $sth->fetchrow
1028
      ) {
1029
      ) {
1029
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1030
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1030
        $res->{$tag}->{$subfield}->{tab}              = $tab;
1031
        $res->{$tag}->{$subfield}->{tab}              = $tab;
1031
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
1032
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
1033
        $res->{$tag}->{$subfield}->{important}        = $important;
1032
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
1034
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
1033
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
1035
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
1034
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
1036
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
(-)a/admin/marc_subfields_structure.pl (-3 / +9 lines)
Lines 191-196 if ( $op eq 'add_form' ) { Link Here
191
        $row_data{isurl}             = $data->{isurl};
191
        $row_data{isurl}             = $data->{isurl};
192
        $row_data{row}               = $i;
192
        $row_data{row}               = $i;
193
        $row_data{link}              = $data->{'link'};
193
        $row_data{link}              = $data->{'link'};
194
        $row_data{important}         = $data->{important};
194
        push( @loop_data, \%row_data );
195
        push( @loop_data, \%row_data );
195
        $i++;
196
        $i++;
196
    }
197
    }
Lines 215-220 if ( $op eq 'add_form' ) { Link Here
215
    $row_data{authtypes}         = \@authtypes;
216
    $row_data{authtypes}         = \@authtypes;
216
    $row_data{link}              = "";
217
    $row_data{link}              = "";
217
    $row_data{row}               = $i;
218
    $row_data{row}               = $i;
219
    $row_data{important}         = "";
218
    push( @loop_data, \%row_data );
220
    push( @loop_data, \%row_data );
219
221
220
    $template->param( 'use_heading_flags_p'      => 1 );
222
    $template->param( 'use_heading_flags_p'      => 1 );
Lines 238-248 elsif ( $op eq 'add_validate' ) { Link Here
238
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
240
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
239
#     );
241
#     );
240
    my $sth_insert = $dbh->prepare(qq{
242
    my $sth_insert = $dbh->prepare(qq{
241
        insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue,maxlength)
243
        insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,important,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue,maxlength)
242
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
244
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
243
    });
245
    });
244
    my $sth_update = $dbh->prepare(qq{
246
    my $sth_update = $dbh->prepare(qq{
245
        update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?,  link=?, defaultvalue=?, maxlength=?
247
        update marc_subfield_structure set tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, important=?, kohafield=?, tab=?, seealso=?, authorised_value=?, authtypecode=?, value_builder=?, hidden=?, isurl=?, frameworkcode=?,  link=?, defaultvalue=?, maxlength=?
246
        where tagfield=? and tagsubfield=? and frameworkcode=?
248
        where tagfield=? and tagsubfield=? and frameworkcode=?
247
    });
249
    });
248
    my @tagsubfield       = $input->multi_param('tagsubfield');
250
    my @tagsubfield       = $input->multi_param('tagsubfield');
Lines 268-273 elsif ( $op eq 'add_validate' ) { Link Here
268
        my $libopac          = $libopac[$i];
270
        my $libopac          = $libopac[$i];
269
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
271
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
270
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
272
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
273
        my $important        = $input->param("important$i") ? 1 : 0;
271
        my $kohafield        = $kohafield[$i];
274
        my $kohafield        = $kohafield[$i];
272
        my $tab              = $tab[$i];
275
        my $tab              = $tab[$i];
273
        my $seealso          = $seealso[$i];
276
        my $seealso          = $seealso[$i];
Lines 289-294 elsif ( $op eq 'add_validate' ) { Link Here
289
                    $libopac,
292
                    $libopac,
290
                    $repeatable,
293
                    $repeatable,
291
                    $mandatory,
294
                    $mandatory,
295
                    $important,
292
                    $kohafield,
296
                    $kohafield,
293
                    $tab,
297
                    $tab,
294
                    $seealso,
298
                    $seealso,
Lines 320-325 elsif ( $op eq 'add_validate' ) { Link Here
320
                    $libopac,
324
                    $libopac,
321
                    $repeatable,
325
                    $repeatable,
322
                    $mandatory,
326
                    $mandatory,
327
                    $important,
323
                    $kohafield,
328
                    $kohafield,
324
                    $tab,
329
                    $tab,
325
                    $seealso,
330
                    $seealso,
Lines 402-407 else { # DEFAULT Link Here
402
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
407
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
403
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
408
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
404
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
409
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
410
        $row_data{important}        = $results->[$i]{'important'};
405
        $row_data{tab}              = $results->[$i]{'tab'};
411
        $row_data{tab}              = $results->[$i]{'tab'};
406
        $row_data{seealso}          = $results->[$i]{'seealso'};
412
        $row_data{seealso}          = $results->[$i]{'seealso'};
407
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
413
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
(-)a/admin/marctagstructure.pl (-4 / +12 lines)
Lines 89-95 if ($op eq 'add_form') { Link Here
89
	#---- if primkey exists, it's a modify action, so read values to modify...
89
	#---- if primkey exists, it's a modify action, so read values to modify...
90
	my $data;
90
	my $data;
91
	if ($searchfield) {
91
	if ($searchfield) {
92
		$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?");
92
        $sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value, important from marc_tag_structure where tagfield=? and frameworkcode=?");
93
		$sth->execute($searchfield,$frameworkcode);
93
		$sth->execute($searchfield,$frameworkcode);
94
		$data=$sth->fetchrow_hashref;
94
		$data=$sth->fetchrow_hashref;
95
	}
95
	}
Lines 108-113 if ($op eq 'add_form') { Link Here
108
            repeatable => $data->{'repeatable'},
108
            repeatable => $data->{'repeatable'},
109
            mandatory => $data->{'mandatory'},
109
            mandatory => $data->{'mandatory'},
110
            authorised_value => $data->{authorised_value},
110
            authorised_value => $data->{authorised_value},
111
            important => $data->{'important'},
111
			frameworkcode => $frameworkcode,
112
			frameworkcode => $frameworkcode,
112
    );  # FIXME: move checkboxes to presentation layer
113
    );  # FIXME: move checkboxes to presentation layer
113
													# END $OP eq ADD_FORM
114
													# END $OP eq ADD_FORM
Lines 119-146 if ($op eq 'add_form') { Link Here
119
	my $libopac          = $input->param('libopac');
120
	my $libopac          = $input->param('libopac');
120
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
121
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
121
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
122
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
123
    my $important        = $input->param('important')  ? 1 : 0;
122
	my $authorised_value = $input->param('authorised_value');
124
	my $authorised_value = $input->param('authorised_value');
123
    if ($input->param('modif')) {
125
    if ($input->param('modif')) {
124
        $sth = $dbh->prepare(
126
        $sth = $dbh->prepare(
125
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
127
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
126
        );
128
        );
127
        $sth->execute(  $liblibrarian,
129
        $sth->execute(  $liblibrarian,
128
                        $libopac,
130
                        $libopac,
129
                        $repeatable,
131
                        $repeatable,
130
                        $mandatory,
132
                        $mandatory,
133
                        $important,
131
                        $authorised_value,
134
                        $authorised_value,
132
                        $frameworkcode,
135
                        $frameworkcode,
133
                        $tagfield
136
                        $tagfield
134
        );
137
        );
135
    } else {
138
    } else {
136
        $sth = $dbh->prepare(
139
        $sth = $dbh->prepare(
137
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"
140
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,frameworkcode) values (?,?,?,?,?,?,?,?)"
138
        );
141
        );
139
        $sth->execute($tagfield,
142
        $sth->execute($tagfield,
140
                      $liblibrarian,
143
                      $liblibrarian,
141
                      $libopac,
144
                      $libopac,
142
                      $repeatable,
145
                      $repeatable,
143
                      $mandatory,
146
                      $mandatory,
147
                      $important,
144
                      $authorised_value,
148
                      $authorised_value,
145
                      $frameworkcode
149
                      $frameworkcode
146
        );
150
        );
Lines 214-219 if ($op eq 'add_form') { Link Here
214
		              marc_tag_structure.libopac as mts_libopac,
218
		              marc_tag_structure.libopac as mts_libopac,
215
		              marc_tag_structure.repeatable as mts_repeatable,
219
		              marc_tag_structure.repeatable as mts_repeatable,
216
		              marc_tag_structure.mandatory as mts_mandatory,
220
		              marc_tag_structure.mandatory as mts_mandatory,
221
                      marc_tag_structure.important as mts_important,
217
		              marc_tag_structure.authorised_value as mts_authorized_value,
222
		              marc_tag_structure.authorised_value as mts_authorized_value,
218
		              marc_subfield_structure.*
223
		              marc_subfield_structure.*
219
                FROM marc_tag_structure 
224
                FROM marc_tag_structure 
Lines 235-240 if ($op eq 'add_form') { Link Here
235
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
240
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
236
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
241
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
237
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
242
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
243
            $row_data{important}        = $results[$i]->{'mts_important'};
238
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
244
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
239
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
245
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
240
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
246
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
Lines 248-253 if ($op eq 'add_form') { Link Here
248
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
254
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
249
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
255
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
250
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
256
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
257
                $subfield_data{important}        = $results[$j]->{'important'};
251
				$subfield_data{tab}              = $results[$j]->{'tab'};
258
				$subfield_data{tab}              = $results[$j]->{'tab'};
252
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
259
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
253
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
260
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
Lines 280-285 if ($op eq 'add_form') { Link Here
280
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
287
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
281
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
288
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
282
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
289
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
290
            $row_data{important}        = $results->[$i]{'important'};
283
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
291
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
284
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
292
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
285
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
293
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
Lines 313-319 output_html_with_http_headers $input, $cookie, $template->output; Link Here
313
sub StringSearch  {
321
sub StringSearch  {
314
	my ($searchstring,$frameworkcode)=@_;
322
	my ($searchstring,$frameworkcode)=@_;
315
	my $sth = C4::Context->dbh->prepare("
323
	my $sth = C4::Context->dbh->prepare("
316
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value
324
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,important
317
     FROM  marc_tag_structure
325
     FROM  marc_tag_structure
318
     WHERE (tagfield >= ? and frameworkcode=?)
326
     WHERE (tagfield >= ? and frameworkcode=?)
319
    ORDER BY tagfield
327
    ORDER BY tagfield
(-)a/cataloguing/addbiblio.pl (-2 / +7 lines)
Lines 318-323 sub create_input { Link Here
318
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
318
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
319
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
319
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
320
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
320
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
321
        important      => $tagslib->{$tag}->{$subfield}->{important},
321
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
322
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
322
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
323
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
323
        index          => $index_tag,
324
        index          => $index_tag,
Lines 331-343 sub create_input { Link Here
331
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
332
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
332
    }
333
    }
333
    # Subfield is hidden depending of hidden and mandatory flag, and is always
334
    # Subfield is hidden depending of hidden and mandatory flag, and is always
334
    # shown if it contains anything or if its field is mandatory.
335
    # shown if it contains anything or if its field is mandatory or important.
335
    my $tdef = $tagslib->{$tag};
336
    my $tdef = $tagslib->{$tag};
336
    $subfield_data{visibility} = "display:none;"
337
    $subfield_data{visibility} = "display:none;"
337
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
338
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
338
           $value eq '' &&
339
           $value eq '' &&
339
           !$tdef->{$subfield}->{mandatory} &&
340
           !$tdef->{$subfield}->{mandatory} &&
340
           !$tdef->{mandatory};
341
           !$tdef->{mandatory} &&
342
           !$tdef->{$subfield}->{important} &&
343
           !$tdef->{important};
341
    # expand all subfields of 773 if there is a host item provided in the input
344
    # expand all subfields of 773 if there is a host item provided in the input
342
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
345
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
343
346
Lines 617-622 sub build_tabs { Link Here
617
                            tag_lib       => $tagslib->{$tag}->{lib},
620
                            tag_lib       => $tagslib->{$tag}->{lib},
618
                            repeatable       => $tagslib->{$tag}->{repeatable},
621
                            repeatable       => $tagslib->{$tag}->{repeatable},
619
                            mandatory       => $tagslib->{$tag}->{mandatory},
622
                            mandatory       => $tagslib->{$tag}->{mandatory},
623
                            important       => $tagslib->{$tag}->{important},
620
                            subfield_loop => \@subfields_data,
624
                            subfield_loop => \@subfields_data,
621
                            fixedfield    => $tag < 10?1:0,
625
                            fixedfield    => $tag < 10?1:0,
622
                            random        => CreateKey,
626
                            random        => CreateKey,
Lines 663-668 sub build_tabs { Link Here
663
                        tag_lib          => $tagslib->{$tag}->{lib},
667
                        tag_lib          => $tagslib->{$tag}->{lib},
664
                        repeatable       => $tagslib->{$tag}->{repeatable},
668
                        repeatable       => $tagslib->{$tag}->{repeatable},
665
                        mandatory       => $tagslib->{$tag}->{mandatory},
669
                        mandatory       => $tagslib->{$tag}->{mandatory},
670
                        important       => $tagslib->{$tag}->{important},
666
                        indicator1       => $indicator1,
671
                        indicator1       => $indicator1,
667
                        indicator2       => $indicator2,
672
                        indicator2       => $indicator2,
668
                        subfield_loop    => \@subfields_data,
673
                        subfield_loop    => \@subfields_data,
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1108-1113 CREATE TABLE `marc_subfield_structure` ( Link Here
1108
  `libopac` varchar(255) NOT NULL default '',
1108
  `libopac` varchar(255) NOT NULL default '',
1109
  `repeatable` tinyint(4) NOT NULL default 0,
1109
  `repeatable` tinyint(4) NOT NULL default 0,
1110
  `mandatory` tinyint(4) NOT NULL default 0,
1110
  `mandatory` tinyint(4) NOT NULL default 0,
1111
  `important` tinyint(4) NOT NULL DEFAULT '0',
1111
  `kohafield` varchar(40) default NULL,
1112
  `kohafield` varchar(40) default NULL,
1112
  `tab` tinyint(1) default NULL,
1113
  `tab` tinyint(1) default NULL,
1113
  `authorised_value` varchar(32) default NULL,
1114
  `authorised_value` varchar(32) default NULL,
Lines 1140-1145 CREATE TABLE `marc_tag_structure` ( Link Here
1140
  `mandatory` tinyint(4) NOT NULL default 0,
1141
  `mandatory` tinyint(4) NOT NULL default 0,
1141
  `authorised_value` varchar(10) default NULL,
1142
  `authorised_value` varchar(10) default NULL,
1142
  `frameworkcode` varchar(4) NOT NULL default '',
1143
  `frameworkcode` varchar(4) NOT NULL default '',
1144
  `important` tinyint(4) NOT NULL DEFAULT '0',
1143
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1145
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1144
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1146
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1145
1147
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (+9 lines)
Lines 86-91 Link Here
86
                                <input type="checkbox" id="mandatory[% loo.row %]" name="mandatory[% loo.row %]" value="1" />
86
                                <input type="checkbox" id="mandatory[% loo.row %]" name="mandatory[% loo.row %]" value="1" />
87
                            [% END %]
87
                            [% END %]
88
                        </li>
88
                        </li>
89
                        <li>
90
                            <label for="important[% loo.row %]">Important: </label>
91
                            [% IF loo.important %]
92
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" checked="checked" value="1" />
93
                            [% ELSE %]
94
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" value="1" />
95
                            [% END %]
96
                        </li>
89
                        <li><label for="tab[% loo.row %]">Managed in tab: </label>
97
                        <li><label for="tab[% loo.row %]">Managed in tab: </label>
90
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row %]">
98
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row %]">
91
                            [%- IF ( loo.tab ==  -1 ) -%]
99
                            [%- IF ( loo.tab ==  -1 ) -%]
Lines 280-285 Link Here
280
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield %], [% END %]
288
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield %], [% END %]
281
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
289
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
282
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
290
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
291
            [% IF ( loo.important ) %]Important, [% ELSE %]Not important,[% END %]
283
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso %],[% END %]
292
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso %],[% END %]
284
            [% IF ( loo.hidden ) %]hidden,[% END %]
293
            [% IF ( loo.hidden ) %]hidden,[% END %]
285
            [% IF ( loo.isurl ) %]is a URL,[% END %]
294
            [% IF ( loo.isurl ) %]is a URL,[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt (+21 lines)
Lines 85-90 Link Here
85
            [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
85
            [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
86
        </select>
86
        </select>
87
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
87
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
88
    <li><label for="important">Important: </label>
89
        [% IF ( important ) %]
90
            <input type="checkbox" name="important" id="important" value="1" checked="checked" />
91
        [% ELSE %]
92
            <input type="checkbox" name="important" id="important" value="1" />
93
        [% END %]
94
    </li>
95
    <li><label for="authorised_value">Authorized value: </label>[% authorised_value %] (if you select a value here, the indicators will be limited to the authorized value list)</li>
88
</ol></fieldset> 
96
</ol></fieldset> 
89
    <fieldset class="action">
97
    <fieldset class="action">
90
        <input type="submit" value="Save changes" />
98
        <input type="submit" value="Save changes" />
Lines 169-174 Link Here
169
        <th>Lib</th>
177
        <th>Lib</th>
170
        <th>Repeatable</th>
178
        <th>Repeatable</th>
171
        <th>Mandatory</th>
179
        <th>Mandatory</th>
180
        <th>Important</th>
172
        <th>Auth value</th>
181
        <th>Auth value</th>
173
        <th>&nbsp;</th>
182
        <th>&nbsp;</th>
174
        </tr>
183
        </tr>
Lines 189-194 Link Here
189
            </td>
198
            </td>
190
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
199
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
191
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
200
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
201
            <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
192
            <td>[% loo.authorised_value %]</td>
202
            <td>[% loo.authorised_value %]</td>
193
            <td>
203
            <td>
194
                <div class="dropdown">
204
                <div class="dropdown">
Lines 202-207 Link Here
202
                </div>
212
                </div>
203
            </td>
213
            </td>
204
        </tr>
214
        </tr>
215
        [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
216
            <td>&nbsp;</td>
217
            <td colspan="7">
218
                [% FOREACH subfield IN loo.subfields %]
219
                    <p style="text-indent: 5em">Tab:[% subfield.tab %] | $[% subfield.tagsubfield %]
220
                            [% subfield.liblibrarian %] [% IF ( subfield.kohafield ) %][% subfield.kohafield %][% END %][% IF ( subfield.repeatable ) %], repeatable[% END %][% IF ( subfield.mandatory ) %], Mandatory[% END %][% IF ( subfield.important ) %], Important[% END %][% IF ( subfield.seealso ) %], See [% subfield.seealso %][% END %][% IF ( subfield.authorised_value ) %], [% subfield.authorised_value %][% END %][% IF ( subfield.authtypecode ) %], [% subfield.authtypecode %][% END %][% IF ( subfield.value_builder ) %], [% subfield.value_builder %][% END %]
221
                    </p>
222
                [% END %]
223
            </td>
224
        </tr>
205
        [% END %]
225
        [% END %]
206
    [% ELSE %]
226
    [% ELSE %]
207
    [% FOREACH loo IN loop %]
227
    [% FOREACH loo IN loop %]
Lines 210-215 Link Here
210
        <td>[% loo.liblibrarian %]</td>
230
        <td>[% loo.liblibrarian %]</td>
211
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
231
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
212
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
232
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
233
        <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
213
        <td>[% loo.authorised_value %]</td>
234
        <td>[% loo.authorised_value %]</td>
214
        <td>
235
        <td>
215
            <div class="dropdown">
236
            <div class="dropdown">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-4 / +121 lines)
Lines 240-246 function AreMandatoriesNotOk(){ Link Here
240
    var flag=0;
240
    var flag=0;
241
    var tabflag= new Array();  
241
    var tabflag= new Array();  
242
    [% FOREACH BIG_LOO IN BIG_LOOP %]
242
    [% FOREACH BIG_LOO IN BIG_LOOP %]
243
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
243
        [% FOREACH innerloo IN BIG_LOO.innerloop %]
244
	        [% IF ( innerloo.mandatory ) %]
244
	        [% IF ( innerloo.mandatory ) %]
245
    	    	mandatoriesfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
245
    	    	mandatoriesfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
246
        	[% END %]
246
        	[% END %]
Lines 326-332 function AreMandatoriesNotOk(){ Link Here
326
    	
326
    	
327
    	if(isempty){
327
    	if(isempty){
328
    		flag = 1;
328
    		flag = 1;
329
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
329
            StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
330
    	}
330
    	}
331
    	
331
    	
332
    }
332
    }
Lines 345-350 function AreMandatoriesNotOk(){ Link Here
345
function Check(){
345
function Check(){
346
    var StrAlert = AreMandatoriesNotOk();
346
    var StrAlert = AreMandatoriesNotOk();
347
    if( ! StrAlert ){
347
    if( ! StrAlert ){
348
        var StrWarning = AreImportantsNotOk();
349
        if (StrWarning){
350
            var r=confirm(StrWarning);
351
            if (! r){
352
                return false;
353
            }
354
        }
348
        document.f.submit();
355
        document.f.submit();
349
        return true;
356
        return true;
350
    } else {
357
    } else {
Lines 354-359 function Check(){ Link Here
354
}
361
}
355
362
356
/** 
363
/** 
364
 * check if mandatory subfields are written
365
 */
366
function AreImportantsNotOk(){
367
    var importants = new Array();
368
    var importantsfields = new Array();
369
    var tab = new Array();
370
    var label = new Array();
371
    var flag=0;
372
    var tabflag= new Array();
373
    [% FOREACH BIG_LOO IN BIG_LOOP %]
374
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
375
        [% IF ( innerloo.important ) %]
376
           importantsfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
377
        [% END %]
378
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
379
            [% IF ( subfield_loo.important ) %]importants.push("[% subfield_loo.id %]");
380
                tab.push("[% subfield_loo.number %]");
381
                label.push("[% subfield_loo.marc_lib %]");
382
                [% END %]
383
            [% END %]
384
        [% END %]
385
    [% END %]
386
    var StrWarning = _("A few important fields are not filled:");
387
    StrWarning += "\n\n";
388
    for(var i=0,len=importants.length; i<len ; i++){
389
        var tag=importants[i].substr(4,3);
390
        var subfield=importants[i].substr(17,1);
391
        var tagnumber=importants[i].substr(19,importants[i].lastIndexOf("_")-19);
392
        tabflag[tag+subfield+tagnumber]=new Array();
393
        tabflag[tag+subfield+tagnumber][0]=0;
394
        if( ! document.getElementById(importants[i]).value){
395
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
396
            document.getElementById(importants[i]).setAttribute('class','subfield_not_filled');
397
            document.getElementById(importants[i]).focus();
398
            tabflag[tag+subfield+tagnumber][1]=label[i];
399
            tabflag[tag+subfield+tagnumber][2]=tab[i];
400
        } else {
401
            tabflag[tag+subfield+tagnumber][0] = 1;
402
        }
403
    }
404
    for (var tagsubfieldid in tabflag){
405
      if (tabflag[tagsubfieldid][0]==0){
406
        var tag=tagsubfieldid.substr(0,3);
407
        var subfield=tagsubfieldid.substr(3,1);
408
        StrWarning += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
409
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
410
        flag=1;
411
      }
412
    }
413
414
    /* Check for mandatories field(not subfields) */
415
    for(var i=0,len=importantsfields.length; i<len; i++){
416
        isempty  = true;
417
        arr      = importantsfields[i];
418
        divid    = "tag_" + arr[0] + "_" + arr[1];
419
        varegexp = new RegExp("^tag_" + arr[0] + "_code_");
420
421
        if(parseInt(arr[0]) >= 10){
422
           elem = document.getElementById(divid);
423
           eleminputs = elem.getElementsByTagName('input');
424
           for(var j=0,len2=eleminputs.length; j<len2; j++){
425
426
              if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
427
                 inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
428
429
                   for( var k=0; k<len2; k++){
430
                        if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
431
                            isempty = false
432
                        }
433
                    }
434
435
                    elemselect = elem.getElementsByTagName('select');
436
                    for( var k=0; k<elemselect.length; k++){
437
                        if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
438
                           isempty = false
439
                        }
440
                    }
441
              }
442
           }
443
444
           elemtextareas = elem.getElementsByTagName('textarea');
445
           for(var j=0,len2=elemtextareas.length; j<len2; j++){
446
                // this bit assumes that the only textareas in this context would be for subfields
447
               if (elemtextareas[j].value) {
448
                   isempty = false;
449
               }
450
           }
451
       }else{
452
          isempty = false;
453
       }
454
455
       if(isempty){
456
          flag = 1;
457
          StrWarning += _("\t* Field ") + arr[0] + _(" is important, at least one of its subfields should be filled.") + "\n";
458
       }
459
    }
460
461
    StrWarning += "\n" + _("Are you sure you want to save?");
462
463
    if(flag){
464
        return StrWarning;
465
    } else {
466
        return flag;
467
    }
468
}
469
470
/**
357
 * check if z3950 mandatories are set or not
471
 * check if z3950 mandatories are set or not
358
 */
472
 */
359
function GetZ3950Terms(){
473
function GetZ3950Terms(){
Lines 664-670 function Changefwk() { Link Here
664
                [% UNLESS advancedMARCEditor %]
778
                [% UNLESS advancedMARCEditor %]
665
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
779
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
666
                        [% subfield_loo.marc_lib %]
780
                        [% subfield_loo.marc_lib %]
667
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
781
                        [% IF ( subfield_loo.mandatory ) %]
782
                        <span class="mandatory_marker" title="This field is mandatory">*</span>
783
                        [% ELSIF ( subfield_loo.important ) %]
784
                        <span style="color:black" title="This field is important">*</span>
785
                        [% END %]
668
                    </span>
786
                    </span>
669
                    </label>
787
                    </label>
670
                [% END %]
788
                [% END %]
671
- 

Return to bug 8643