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

(-)a/C4/Biblio.pm (-5 / +7 lines)
Lines 906-930 sub GetMarcStructure { Link Here
906
906
907
    my $dbh = C4::Context->dbh;
907
    my $dbh = C4::Context->dbh;
908
    my $sth = $dbh->prepare(
908
    my $sth = $dbh->prepare(
909
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,ind1_defaultvalue,ind2_defaultvalue
909
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,important,ind1_defaultvalue,ind2_defaultvalue
910
        FROM marc_tag_structure 
910
        FROM marc_tag_structure 
911
        WHERE frameworkcode=? 
911
        WHERE frameworkcode=? 
912
        ORDER BY tagfield"
912
        ORDER BY tagfield"
913
    );
913
    );
914
    $sth->execute($frameworkcode);
914
    $sth->execute($frameworkcode);
915
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue );
915
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue );
916
916
917
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
917
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
918
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
918
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
919
        $res->{$tag}->{tab}        = "";
919
        $res->{$tag}->{tab}        = "";
920
        $res->{$tag}->{mandatory}  = $mandatory;
920
        $res->{$tag}->{mandatory}  = $mandatory;
921
        $res->{$tag}->{important}  = $important;
921
        $res->{$tag}->{repeatable} = $repeatable;
922
        $res->{$tag}->{repeatable} = $repeatable;
922
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
923
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
923
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
924
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
924
    }
925
    }
925
926
926
    $sth = $dbh->prepare(
927
    $sth = $dbh->prepare(
927
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
928
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,important
928
         FROM   marc_subfield_structure 
929
         FROM   marc_subfield_structure 
929
         WHERE  frameworkcode=? 
930
         WHERE  frameworkcode=? 
930
         ORDER BY tagfield,tagsubfield
931
         ORDER BY tagfield,tagsubfield
Lines 948-960 sub GetMarcStructure { Link Here
948
    while (
949
    while (
949
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
950
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
950
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
951
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
951
            $maxlength
952
            $maxlength, $important
952
        )
953
        )
953
        = $sth->fetchrow
954
        = $sth->fetchrow
954
      ) {
955
      ) {
955
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
956
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
956
        $res->{$tag}->{$subfield}->{tab}              = $tab;
957
        $res->{$tag}->{$subfield}->{tab}              = $tab;
957
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
958
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
959
        $res->{$tag}->{$subfield}->{important}        = $important;
958
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
960
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
959
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
961
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
960
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
962
        $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,ind1_defaultvalue,ind2_defaultvalue from marc_tag_structure where tagfield=? and frameworkcode=?");
92
        $sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,important,ind1_defaultvalue,ind2_defaultvalue 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
            ind1_defaultvalue => $data->{'ind1_defaultvalue'},
112
            ind1_defaultvalue => $data->{'ind1_defaultvalue'},
112
            ind2_defaultvalue => $data->{'ind2_defaultvalue'},
113
            ind2_defaultvalue => $data->{'ind2_defaultvalue'},
113
			frameworkcode => $frameworkcode,
114
			frameworkcode => $frameworkcode,
Lines 121-137 if ($op eq 'add_form') { Link Here
121
	my $libopac          = $input->param('libopac');
122
	my $libopac          = $input->param('libopac');
122
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
123
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
123
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
124
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
125
        my $important        = $input->param('important')  ? 1 : 0;
124
	my $authorised_value = $input->param('authorised_value');
126
	my $authorised_value = $input->param('authorised_value');
125
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
127
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
126
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
128
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
127
    if ($input->param('modif')) {
129
    if ($input->param('modif')) {
128
        $sth = $dbh->prepare(
130
        $sth = $dbh->prepare(
129
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
131
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
130
        );
132
        );
131
        $sth->execute(  $liblibrarian,
133
        $sth->execute(  $liblibrarian,
132
                        $libopac,
134
                        $libopac,
133
                        $repeatable,
135
                        $repeatable,
134
                        $mandatory,
136
                        $mandatory,
137
                        $important,
135
                        $authorised_value,
138
                        $authorised_value,
136
                        $ind1_defaultvalue,
139
                        $ind1_defaultvalue,
137
                        $ind2_defaultvalue,
140
                        $ind2_defaultvalue,
Lines 140-152 if ($op eq 'add_form') { Link Here
140
        );
143
        );
141
    } else {
144
    } else {
142
        $sth = $dbh->prepare(
145
        $sth = $dbh->prepare(
143
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?)"
146
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
144
        );
147
        );
145
        $sth->execute($tagfield,
148
        $sth->execute($tagfield,
146
                      $liblibrarian,
149
                      $liblibrarian,
147
                      $libopac,
150
                      $libopac,
148
                      $repeatable,
151
                      $repeatable,
149
                      $mandatory,
152
                      $mandatory,
153
                      $important,
150
                      $authorised_value,
154
                      $authorised_value,
151
                      $ind1_defaultvalue,
155
                      $ind1_defaultvalue,
152
                      $ind2_defaultvalue,
156
                      $ind2_defaultvalue,
Lines 222-227 if ($op eq 'add_form') { Link Here
222
		              marc_tag_structure.libopac as mts_libopac,
226
		              marc_tag_structure.libopac as mts_libopac,
223
		              marc_tag_structure.repeatable as mts_repeatable,
227
		              marc_tag_structure.repeatable as mts_repeatable,
224
		              marc_tag_structure.mandatory as mts_mandatory,
228
		              marc_tag_structure.mandatory as mts_mandatory,
229
                      marc_tag_structure.important as mts_important,
225
		              marc_tag_structure.authorised_value as mts_authorized_value,
230
		              marc_tag_structure.authorised_value as mts_authorized_value,
226
                  marc_tag_structure.ind1_defaultvalue as mts_ind1_defaultvalue,
231
                  marc_tag_structure.ind1_defaultvalue as mts_ind1_defaultvalue,
227
                  marc_tag_structure.ind1_defaultvalue as mts_ind2_defaultvalue,
232
                  marc_tag_structure.ind1_defaultvalue as mts_ind2_defaultvalue,
Lines 245-250 if ($op eq 'add_form') { Link Here
245
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
250
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
246
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
251
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
247
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
252
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
253
            $row_data{important}        = $results[$i]->{'mts_important'};
248
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
254
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
249
            $row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'};
255
            $row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'};
250
            $row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'};
256
            $row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'};
Lines 260-265 if ($op eq 'add_form') { Link Here
260
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
266
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
261
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
267
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
262
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
268
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
269
                $subfield_data{important}        = $results[$j]->{'important'};
263
				$subfield_data{tab}              = $results[$j]->{'tab'};
270
				$subfield_data{tab}              = $results[$j]->{'tab'};
264
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
271
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
265
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
272
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
Lines 292-297 if ($op eq 'add_form') { Link Here
292
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
299
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
293
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
300
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
294
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
301
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
302
            $row_data{important}        = $results->[$i]{'important'};
295
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
303
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
296
            $row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'};
304
            $row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'};
297
            $row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'};
305
            $row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'};
Lines 327-333 output_html_with_http_headers $input, $cookie, $template->output; Link Here
327
sub StringSearch  {
335
sub StringSearch  {
328
	my ($searchstring,$frameworkcode)=@_;
336
	my ($searchstring,$frameworkcode)=@_;
329
	my $sth = C4::Context->dbh->prepare("
337
	my $sth = C4::Context->dbh->prepare("
330
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue
338
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,important,ind1_defaultvalue,ind2_defaultvalue
331
     FROM  marc_tag_structure
339
     FROM  marc_tag_structure
332
     WHERE (tagfield >= ? and frameworkcode=?)
340
     WHERE (tagfield >= ? and frameworkcode=?)
333
    ORDER BY tagfield
341
    ORDER BY tagfield
(-)a/cataloguing/addbiblio.pl (-2 / +7 lines)
Lines 307-312 sub create_input { Link Here
307
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
307
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
308
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
308
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
309
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
309
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
310
        important      => $tagslib->{$tag}->{$subfield}->{important},
310
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
311
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
311
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
312
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
312
        index          => $index_tag,
313
        index          => $index_tag,
Lines 320-332 sub create_input { Link Here
320
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
321
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
321
    }
322
    }
322
    # Subfield is hidden depending of hidden and mandatory flag, and is always
323
    # Subfield is hidden depending of hidden and mandatory flag, and is always
323
    # shown if it contains anything or if its field is mandatory.
324
    # shown if it contains anything or if its field is mandatory or important.
324
    my $tdef = $tagslib->{$tag};
325
    my $tdef = $tagslib->{$tag};
325
    $subfield_data{visibility} = "display:none;"
326
    $subfield_data{visibility} = "display:none;"
326
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
327
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
327
           $value eq '' &&
328
           $value eq '' &&
328
           !$tdef->{$subfield}->{mandatory} &&
329
           !$tdef->{$subfield}->{mandatory} &&
329
           !$tdef->{mandatory};
330
           !$tdef->{mandatory} &&
331
           !$tdef->{$subfield}->{important} &&
332
           !$tdef->{important};
330
    # expand all subfields of 773 if there is a host item provided in the input
333
    # expand all subfields of 773 if there is a host item provided in the input
331
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
334
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
332
335
Lines 606-611 sub build_tabs { Link Here
606
                            tag_lib       => $tagslib->{$tag}->{lib},
609
                            tag_lib       => $tagslib->{$tag}->{lib},
607
                            repeatable       => $tagslib->{$tag}->{repeatable},
610
                            repeatable       => $tagslib->{$tag}->{repeatable},
608
                            mandatory       => $tagslib->{$tag}->{mandatory},
611
                            mandatory       => $tagslib->{$tag}->{mandatory},
612
                            important       => $tagslib->{$tag}->{important},
609
                            subfield_loop => \@subfields_data,
613
                            subfield_loop => \@subfields_data,
610
                            fixedfield    => $tag < 10?1:0,
614
                            fixedfield    => $tag < 10?1:0,
611
                            random        => CreateKey,
615
                            random        => CreateKey,
Lines 652-657 sub build_tabs { Link Here
652
                        tag_lib          => $tagslib->{$tag}->{lib},
656
                        tag_lib          => $tagslib->{$tag}->{lib},
653
                        repeatable       => $tagslib->{$tag}->{repeatable},
657
                        repeatable       => $tagslib->{$tag}->{repeatable},
654
                        mandatory       => $tagslib->{$tag}->{mandatory},
658
                        mandatory       => $tagslib->{$tag}->{mandatory},
659
                        important       => $tagslib->{$tag}->{important},
655
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
660
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
656
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
661
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
657
                        subfield_loop    => \@subfields_data,
662
                        subfield_loop    => \@subfields_data,
(-)a/cataloguing/additem.pl (+1 lines)
Lines 125-130 sub generate_subfield_form { Link Here
125
        $subfield_data{subfield}   = $subfieldtag;
125
        $subfield_data{subfield}   = $subfieldtag;
126
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
126
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
127
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
127
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
128
        $subfield_data{important}  = $subfieldlib->{important};
128
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
129
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
129
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
130
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
130
        
131
        
(-)a/installer/data/mysql/atomicupdate/bug-8643-add_important_constraint.sql (+10 lines)
Line 0 Link Here
1
ALTER TABLE marc_subfield_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory;
2
ALTER TABLE marc_tag_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory;
3
4
-- $DBversion = "3.23.00.XXX";
5
-- if ( CheckVersion($DBversion) ) {
6
--     $dbh->do("ALTER TABLE marc_subfield_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory");
7
--     $dbh->do("ALTER TABLE marc_tag_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory");
8
--     print "Upgrade to $DBversion done (Bug 8643 - Add important constraint to marc subfields)\n";
9
--     SetVersion($DBversion);
10
-- }
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1113-1118 CREATE TABLE `marc_subfield_structure` ( Link Here
1113
  `libopac` varchar(255) NOT NULL default '',
1113
  `libopac` varchar(255) NOT NULL default '',
1114
  `repeatable` tinyint(4) NOT NULL default 0,
1114
  `repeatable` tinyint(4) NOT NULL default 0,
1115
  `mandatory` tinyint(4) NOT NULL default 0,
1115
  `mandatory` tinyint(4) NOT NULL default 0,
1116
  `important` tinyint(4) NOT NULL DEFAULT '0',
1116
  `kohafield` varchar(40) default NULL,
1117
  `kohafield` varchar(40) default NULL,
1117
  `tab` tinyint(1) default NULL,
1118
  `tab` tinyint(1) default NULL,
1118
  `authorised_value` varchar(32) default NULL,
1119
  `authorised_value` varchar(32) default NULL,
Lines 1143-1148 CREATE TABLE `marc_tag_structure` ( Link Here
1143
  `libopac` varchar(255) NOT NULL default '',
1144
  `libopac` varchar(255) NOT NULL default '',
1144
  `repeatable` tinyint(4) NOT NULL default 0,
1145
  `repeatable` tinyint(4) NOT NULL default 0,
1145
  `mandatory` tinyint(4) NOT NULL default 0,
1146
  `mandatory` tinyint(4) NOT NULL default 0,
1147
  `important` tinyint(4) NOT NULL DEFAULT '0',
1146
  `authorised_value` varchar(10) default NULL,
1148
  `authorised_value` varchar(10) default NULL,
1147
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1149
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1148
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
1150
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
(-)a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css (+4 lines)
Lines 122-127 a.tagnum { Link Here
122
.mandatory_marker {
122
.mandatory_marker {
123
	color: red;
123
	color: red;
124
}
124
}
125
126
.important_marker {
127
    color: black;
128
}
125
.linktools { display: block; white-space: nowrap; }
129
.linktools { display: block; white-space: nowrap; }
126
.linktools a { font-size : 75%; display:block;text-decoration:none;}
130
.linktools a { font-size : 75%; display:block;text-decoration:none;}
127
.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; }
131
.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; }
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+4 lines)
Lines 1858-1863 dd { Link Here
1858
    background-color: #FFFF99;
1858
    background-color: #FFFF99;
1859
}
1859
}
1860
1860
1861
.important_subfield_not_filled {
1862
       background-color : #FFFFCC;
1863
}
1864
1861
.content_hidden {
1865
.content_hidden {
1862
    display: none;
1866
    display: none;
1863
    visibility: hidden; // you propably don't need to change this one
1867
    visibility: hidden; // you propably don't need to change this one
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (+9 lines)
Lines 87-92 Link Here
87
                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
87
                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
88
                            [% END %]
88
                            [% END %]
89
                        </li>
89
                        </li>
90
                        <li>
91
                            <label for="important[% loo.row %]">Important: </label>
92
                            [% IF loo.important %]
93
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" checked="checked" value="1" />
94
                            [% ELSE %]
95
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" value="1" />
96
                            [% END %]
97
                        </li>
90
                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
98
                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
91
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row | html %]">
99
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row | html %]">
92
                            [%- IF ( loo.tab ==  -1 ) -%]
100
                            [%- IF ( loo.tab ==  -1 ) -%]
Lines 281-286 Link Here
281
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield | html %], [% END %]
289
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield | html %], [% END %]
282
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
290
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
283
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
291
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
292
            [% IF ( loo.important ) %]Important, [% ELSE %]Not important,[% END %]
284
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso | html %],[% END %]
293
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso | html %],[% END %]
285
            [% IF ( loo.hidden ) %]hidden,[% END %]
294
            [% IF ( loo.hidden ) %]hidden,[% END %]
286
            [% IF ( loo.isurl ) %]is a URL,[% END %]
295
            [% IF ( loo.isurl ) %]is a URL,[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt (+21 lines)
Lines 81-92 Link Here
81
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
81
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
82
        [% END %]
82
        [% END %]
83
    </li>
83
    </li>
84
    <li><label for="important">Important: </label>
85
        [% IF ( important ) %]
86
            <input type="checkbox" name="important" id="important" value="1" checked="checked" />
87
        [% ELSE %]
88
            <input type="checkbox" name="important" id="important" value="1" />
89
        [% END %]
90
    </li>
84
    <li><label for="ind1_defaultvalue">First indicator default value: </label>
91
    <li><label for="ind1_defaultvalue">First indicator default value: </label>
85
        <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
92
        <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
86
    </li>
93
    </li>
87
    <li><label for="ind2_defaultvalue">Second indicator default value: </label>
94
    <li><label for="ind2_defaultvalue">Second indicator default value: </label>
88
        <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
95
        <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
89
    </li>
96
    </li>
97
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
90
    <li><label for="authorised_value">Authorized value: </label>
98
    <li><label for="authorised_value">Authorized value: </label>
91
        <select name="authorised_value" id="authorised_value" size="1">
99
        <select name="authorised_value" id="authorised_value" size="1">
92
            <option value=""></option>
100
            <option value=""></option>
Lines 177-182 Link Here
177
        <th>Lib</th>
185
        <th>Lib</th>
178
        <th>Repeatable</th>
186
        <th>Repeatable</th>
179
        <th>Mandatory</th>
187
        <th>Mandatory</th>
188
        <th>Important</th>
180
        <th>Auth value</th>
189
        <th>Auth value</th>
181
        <th>Indicator 1</th>
190
        <th>Indicator 1</th>
182
        <th>Indicator 2</th>
191
        <th>Indicator 2</th>
Lines 199-204 Link Here
199
            </td>
208
            </td>
200
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
209
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
201
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
210
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
211
            <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
202
            <td>[% loo.authorised_value | html %]</td>
212
            <td>[% loo.authorised_value | html %]</td>
203
            <td>[% loo.ind1_defaultvalue | html %]</td>
213
            <td>[% loo.ind1_defaultvalue | html %]</td>
204
            <td>[% loo.ind2_defaultvalue | html %]</td>
214
            <td>[% loo.ind2_defaultvalue | html %]</td>
Lines 214-219 Link Here
214
                </div>
224
                </div>
215
            </td>
225
            </td>
216
        </tr>
226
        </tr>
227
        [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
228
            <td>&nbsp;</td>
229
            <td colspan="7">
230
                [% FOREACH subfield IN loo.subfields %]
231
                    <p style="text-indent: 5em">Tab:[% subfield.tab %] | $[% subfield.tagsubfield %]
232
                            [% 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 %]
233
                    </p>
234
                [% END %]
235
            </td>
236
        </tr>
217
        [% END %]
237
        [% END %]
218
    [% ELSE %]
238
    [% ELSE %]
219
    [% FOREACH loo IN loop %]
239
    [% FOREACH loo IN loop %]
Lines 222-227 Link Here
222
        <td>[% loo.liblibrarian | html %]</td>
242
        <td>[% loo.liblibrarian | html %]</td>
223
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
243
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
224
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
244
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
245
        <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
225
        <td>[% loo.authorised_value | html %]</td>
246
        <td>[% loo.authorised_value | html %]</td>
226
        <td>[% loo.ind1_defaultvalue | html %]</td>
247
        <td>[% loo.ind1_defaultvalue | html %]</td>
227
        <td>[% loo.ind2_defaultvalue | html %]</td>
248
        <td>[% loo.ind2_defaultvalue | html %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-3 / +126 lines)
Lines 248-254 function AreMandatoriesNotOk(){ Link Here
248
    var flag=0;
248
    var flag=0;
249
    var tabflag= new Array();  
249
    var tabflag= new Array();  
250
    [% FOREACH BIG_LOO IN BIG_LOOP %]
250
    [% FOREACH BIG_LOO IN BIG_LOOP %]
251
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
251
        [% FOREACH innerloo IN BIG_LOO.innerloop %]
252
	        [% IF ( innerloo.mandatory ) %]
252
	        [% IF ( innerloo.mandatory ) %]
253
    	    	mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
253
    	    	mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
254
        	[% END %]
254
        	[% END %]
Lines 334-340 function AreMandatoriesNotOk(){ Link Here
334
    	
334
    	
335
    	if(isempty){
335
    	if(isempty){
336
    		flag = 1;
336
    		flag = 1;
337
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
337
            StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
338
    	}
338
    	}
339
    	
339
    	
340
    }
340
    }
Lines 353-358 function AreMandatoriesNotOk(){ Link Here
353
function Check(){
353
function Check(){
354
    var StrAlert = AreMandatoriesNotOk();
354
    var StrAlert = AreMandatoriesNotOk();
355
    if( ! StrAlert ){
355
    if( ! StrAlert ){
356
        var StrWarning = AreImportantsNotOk();
357
        if (StrWarning){
358
            var r=confirm(StrWarning);
359
            if (! r){
360
                return false;
361
            }
362
        }
356
        document.f.submit();
363
        document.f.submit();
357
        return true;
364
        return true;
358
    } else {
365
    } else {
Lines 362-367 function Check(){ Link Here
362
}
369
}
363
370
364
/** 
371
/** 
372
 * check if mandatory subfields are written
373
 */
374
function AreImportantsNotOk(){
375
    var importants = new Array();
376
    var importantsfields = new Array();
377
    var tab = new Array();
378
    var label = new Array();
379
    var flag=0;
380
    var tabflag= new Array();
381
    [% FOREACH BIG_LOO IN BIG_LOOP %]
382
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
383
        [% IF ( innerloo.important ) %]
384
           importantsfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
385
        [% END %]
386
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
387
            [% IF ( subfield_loo.important ) %]importants.push("[% subfield_loo.id %]");
388
                tab.push("[% BIG_LOO.number %]");
389
                label.push("[% subfield_loo.marc_lib %]");
390
                [% END %]
391
            [% END %]
392
        [% END %]
393
    [% END %]
394
    var StrWarning = _("A few important fields are not filled:");
395
    StrWarning += "\n\n";
396
    for(var i=0,len=importants.length; i<len ; i++){
397
        var tag=importants[i].substr(4,3);
398
        var subfield=importants[i].substr(17,1);
399
        var tagnumber=importants[i].substr(19,importants[i].lastIndexOf("_")-19);
400
        tabflag[tag+subfield+tagnumber]=new Array();
401
        tabflag[tag+subfield+tagnumber][0]=0;
402
        if( ! document.getElementById(importants[i]).value){
403
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
404
            document.getElementById(importants[i]).setAttribute('class','important_subfield_not_filled');
405
            document.getElementById(importants[i]).focus();
406
            tabflag[tag+subfield+tagnumber][1]=label[i];
407
            tabflag[tag+subfield+tagnumber][2]=tab[i];
408
        } else {
409
            tabflag[tag+subfield+tagnumber][0] = 1;
410
        }
411
    }
412
    for (var tagsubfieldid in tabflag){
413
      if (tabflag[tagsubfieldid][0]==0){
414
        var tag=tagsubfieldid.substr(0,3);
415
        var subfield=tagsubfieldid.substr(3,1);
416
        StrWarning += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
417
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
418
        flag=1;
419
      }
420
    }
421
422
    /* Check for mandatories field(not subfields) */
423
    for(var i=0,len=importantsfields.length; i<len; i++){
424
        isempty  = true;
425
        arr      = importantsfields[i];
426
        divid    = "tag_" + arr[0] + "_" + arr[1];
427
        varegexp = new RegExp("^tag_" + arr[0] + "_code_");
428
429
        if(parseInt(arr[0]) >= 10){
430
           elem = document.getElementById(divid);
431
           eleminputs = elem.getElementsByTagName('input');
432
           for(var j=0,len2=eleminputs.length; j<len2; j++){
433
434
              if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
435
                 inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
436
437
                   for( var k=0; k<len2; k++){
438
                        if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
439
                            isempty = false
440
                        }
441
                    }
442
443
                    elemselect = elem.getElementsByTagName('select');
444
                    for( var k=0; k<elemselect.length; k++){
445
                        if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
446
                           isempty = false
447
                        }
448
                    }
449
              }
450
           }
451
452
           elemtextareas = elem.getElementsByTagName('textarea');
453
           for(var j=0,len2=elemtextareas.length; j<len2; j++){
454
                // this bit assumes that the only textareas in this context would be for subfields
455
               if (elemtextareas[j].value) {
456
                   isempty = false;
457
               }
458
           }
459
       }else{
460
          isempty = false;
461
       }
462
463
       if(isempty){
464
          flag = 1;
465
          StrWarning += _("\t* Field ") + arr[0] + _(" is important, at least one of its subfields should be filled.") + "\n";
466
       }
467
    }
468
469
    StrWarning += "\n" + _("Are you sure you want to save?");
470
471
    if(flag){
472
        return StrWarning;
473
    } else {
474
        return flag;
475
    }
476
}
477
478
/**
365
 * check if z3950 mandatories are set or not
479
 * check if z3950 mandatories are set or not
366
 */
480
 */
367
function GetZ3950Terms(){
481
function GetZ3950Terms(){
Lines 585-590 function Changefwk() { Link Here
585
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag | html %]</a>
699
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag | html %]</a>
586
            [% ELSE %]
700
            [% ELSE %]
587
                <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
701
                <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
702
                [% IF innerloo.mandatory %]
703
                    <span class="mandatory_marker" title="This field is mandatory">*</span>
704
                [% ELSIF innerloo.important %]
705
                    <span title="This field is important">*</span>
706
                [% END %]
588
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
707
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
589
            [% END %]
708
            [% END %]
590
                [% IF ( innerloo.fixedfield ) %]
709
                [% IF ( innerloo.fixedfield ) %]
Lines 667-673 function Changefwk() { Link Here
667
                [% UNLESS advancedMARCEditor %]
786
                [% UNLESS advancedMARCEditor %]
668
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
787
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
669
                        [% subfield_loo.marc_lib | $raw %]
788
                        [% subfield_loo.marc_lib | $raw %]
670
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
789
                        [% IF ( subfield_loo.mandatory ) %]
790
                        <span class="mandatory_marker" title="This field is mandatory">*</span>
791
                        [% ELSIF ( subfield_loo.important ) %]
792
                        <span class="important_marker" title="This field is important">*</span>
793
                        [% END %]
671
                    </span>
794
                    </span>
672
                    </label>
795
                    </label>
673
                [% END %]
796
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-7 / +27 lines)
Lines 90-97 $(document).ready(function(){ Link Here
90
});
90
});
91
91
92
function Check(f) {
92
function Check(f) {
93
    var total_errors = CheckMandatorySubfields(f);
93
    var total_mandatory = CheckMandatorySubfields(f);
94
    if (total_errors==0) {
94
    var total_important = CheckImportantSubfields(f);
95
    var alertString2;
96
    if (total_mandatory==0) {
95
        // Explanation about this line:
97
        // Explanation about this line:
96
        // In case of limited edition permission, we have to prevent user from modifying some fields.
98
        // In case of limited edition permission, we have to prevent user from modifying some fields.
97
        // But there is no such thing as readonly attribute for select elements.
99
        // But there is no such thing as readonly attribute for select elements.
Lines 99-110 function Check(f) { Link Here
99
        // So we "un-disable" the elements just before submitting.
101
        // So we "un-disable" the elements just before submitting.
100
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
102
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
101
        $("select[name=field_value]").prop('disabled', false);
103
        $("select[name=field_value]").prop('disabled', false);
102
        return true;
103
    } else {
104
    } else {
104
        var alertString2 = _("Form not submitted because of the following problem(s)");
105
        alertString2 = _("Form not submitted because of the following problem(s)");
105
        alertString2 += "\n------------------------------------------------------------------------------------\n";
106
        alertString2 += "\n------------------------------------------------------------------------------------\n";
106
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
107
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory);
107
        alert(alertString2);
108
    }
109
    if(total_important > 0){
110
        if( !alertString2 ){
111
            alertString2 = "";
112
        }
113
        alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important);
114
        alertString2 += "\n\n " + _("Are you sure you want to save?");
115
    }
116
    if(alertString2){
117
        if(total_mandatory){
118
             alert(alertString2);
119
        }else{
120
            var a = confirm(alertString2);
121
            if( a ){
122
                return true;
123
            }
124
        }
108
        return false;
125
        return false;
109
    }
126
    }
110
    return true;
127
    return true;
Lines 322-333 function confirm_deletion() { Link Here
322
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
339
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
323
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
340
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
324
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
341
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
342
                <input type="hidden" name="important" value="[% ite.important | html %]" />
325
                [% IF ( ite.repeatable ) %]
343
                [% IF ( ite.repeatable ) %]
326
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
344
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
327
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
345
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
328
                    </a>
346
                    </a>
329
                [% END %]
347
                [% END %]
330
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
348
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>
349
                [% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span>
350
                [% END %]
331
            </div></li>
351
            </div></li>
332
        [% END %]
352
        [% END %]
333
    </ol>
353
    </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-1 / +12 lines)
Lines 557-562 function CheckMandatorySubfields(p){ Link Here
557
    return total;
557
    return total;
558
}
558
}
559
559
560
function CheckImportantSubfields(p){
561
    var total = 0;
562
    $(p).find(".subfield_line input[name='important'][value='1']").each(function(i){
563
        var editor = $(this).siblings("[name='field_value']");
564
        if (!editor.val()) {
565
            editor.addClass("missing");
566
            total++;
567
        }
568
    });
569
    return total;
570
}
571
560
 $(document).ready(function() {
572
 $(document).ready(function() {
561
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
573
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
562
});
574
});
563
- 

Return to bug 8643