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

(-)a/C4/Biblio.pm (-5 / +7 lines)
Lines 893-917 sub GetMarcStructure { Link Here
893
893
894
    my $dbh = C4::Context->dbh;
894
    my $dbh = C4::Context->dbh;
895
    my $sth = $dbh->prepare(
895
    my $sth = $dbh->prepare(
896
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,ind1_defaultvalue,ind2_defaultvalue
896
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,important,ind1_defaultvalue,ind2_defaultvalue
897
        FROM marc_tag_structure 
897
        FROM marc_tag_structure 
898
        WHERE frameworkcode=? 
898
        WHERE frameworkcode=? 
899
        ORDER BY tagfield"
899
        ORDER BY tagfield"
900
    );
900
    );
901
    $sth->execute($frameworkcode);
901
    $sth->execute($frameworkcode);
902
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue );
902
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue );
903
903
904
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
904
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
905
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
905
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
906
        $res->{$tag}->{tab}        = "";
906
        $res->{$tag}->{tab}        = "";
907
        $res->{$tag}->{mandatory}  = $mandatory;
907
        $res->{$tag}->{mandatory}  = $mandatory;
908
        $res->{$tag}->{important}  = $important;
908
        $res->{$tag}->{repeatable} = $repeatable;
909
        $res->{$tag}->{repeatable} = $repeatable;
909
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
910
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
910
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
911
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
911
    }
912
    }
912
913
913
    $sth = $dbh->prepare(
914
    $sth = $dbh->prepare(
914
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
915
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,important
915
         FROM   marc_subfield_structure 
916
         FROM   marc_subfield_structure 
916
         WHERE  frameworkcode=? 
917
         WHERE  frameworkcode=? 
917
         ORDER BY tagfield,tagsubfield
918
         ORDER BY tagfield,tagsubfield
Lines 935-947 sub GetMarcStructure { Link Here
935
    while (
936
    while (
936
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
937
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
937
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
938
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
938
            $maxlength
939
            $maxlength, $important
939
        )
940
        )
940
        = $sth->fetchrow
941
        = $sth->fetchrow
941
      ) {
942
      ) {
942
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
943
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
943
        $res->{$tag}->{$subfield}->{tab}              = $tab;
944
        $res->{$tag}->{$subfield}->{tab}              = $tab;
944
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
945
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
946
        $res->{$tag}->{$subfield}->{important}        = $important;
945
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
947
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
946
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
948
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
947
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
949
        $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 267-272 elsif ( $op eq 'add_validate' ) { Link Here
267
        my $libopac          = $libopac[$i];
269
        my $libopac          = $libopac[$i];
268
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
270
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
269
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
271
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
272
        my $important        = $input->param("important$i") ? 1 : 0;
270
        my $kohafield        = $kohafield[$i];
273
        my $kohafield        = $kohafield[$i];
271
        my $tab              = $tab[$i];
274
        my $tab              = $tab[$i];
272
        my $seealso          = $seealso[$i];
275
        my $seealso          = $seealso[$i];
Lines 288-293 elsif ( $op eq 'add_validate' ) { Link Here
288
                    $libopac,
291
                    $libopac,
289
                    $repeatable,
292
                    $repeatable,
290
                    $mandatory,
293
                    $mandatory,
294
                    $important,
291
                    $kohafield,
295
                    $kohafield,
292
                    $tab,
296
                    $tab,
293
                    $seealso,
297
                    $seealso,
Lines 319-324 elsif ( $op eq 'add_validate' ) { Link Here
319
                    $libopac,
323
                    $libopac,
320
                    $repeatable,
324
                    $repeatable,
321
                    $mandatory,
325
                    $mandatory,
326
                    $important,
322
                    $kohafield,
327
                    $kohafield,
323
                    $tab,
328
                    $tab,
324
                    $seealso,
329
                    $seealso,
Lines 401-406 else { # DEFAULT Link Here
401
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
406
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
402
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
407
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
403
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
408
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
409
        $row_data{important}        = $results->[$i]{'important'};
404
        $row_data{tab}              = $results->[$i]{'tab'};
410
        $row_data{tab}              = $results->[$i]{'tab'};
405
        $row_data{seealso}          = $results->[$i]{'seealso'};
411
        $row_data{seealso}          = $results->[$i]{'seealso'};
406
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
412
        $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
    );  # FIXME: move checkboxes to presentation layer
114
    );  # FIXME: move checkboxes to presentation layer
Lines 120-136 if ($op eq 'add_form') { Link Here
120
	my $libopac          = $input->param('libopac');
121
	my $libopac          = $input->param('libopac');
121
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
122
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
122
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
123
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
124
        my $important        = $input->param('important')  ? 1 : 0;
123
	my $authorised_value = $input->param('authorised_value');
125
	my $authorised_value = $input->param('authorised_value');
124
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
126
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
125
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
127
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
126
    if ($input->param('modif')) {
128
    if ($input->param('modif')) {
127
        $sth = $dbh->prepare(
129
        $sth = $dbh->prepare(
128
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
130
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
129
        );
131
        );
130
        $sth->execute(  $liblibrarian,
132
        $sth->execute(  $liblibrarian,
131
                        $libopac,
133
                        $libopac,
132
                        $repeatable,
134
                        $repeatable,
133
                        $mandatory,
135
                        $mandatory,
136
                        $important,
134
                        $authorised_value,
137
                        $authorised_value,
135
                        $ind1_defaultvalue,
138
                        $ind1_defaultvalue,
136
                        $ind2_defaultvalue,
139
                        $ind2_defaultvalue,
Lines 139-151 if ($op eq 'add_form') { Link Here
139
        );
142
        );
140
    } else {
143
    } else {
141
        $sth = $dbh->prepare(
144
        $sth = $dbh->prepare(
142
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?)"
145
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
143
        );
146
        );
144
        $sth->execute($tagfield,
147
        $sth->execute($tagfield,
145
                      $liblibrarian,
148
                      $liblibrarian,
146
                      $libopac,
149
                      $libopac,
147
                      $repeatable,
150
                      $repeatable,
148
                      $mandatory,
151
                      $mandatory,
152
                      $important,
149
                      $authorised_value,
153
                      $authorised_value,
150
                      $ind1_defaultvalue,
154
                      $ind1_defaultvalue,
151
                      $ind2_defaultvalue,
155
                      $ind2_defaultvalue,
Lines 216-221 if ($op eq 'add_form') { Link Here
216
		              marc_tag_structure.libopac as mts_libopac,
220
		              marc_tag_structure.libopac as mts_libopac,
217
		              marc_tag_structure.repeatable as mts_repeatable,
221
		              marc_tag_structure.repeatable as mts_repeatable,
218
		              marc_tag_structure.mandatory as mts_mandatory,
222
		              marc_tag_structure.mandatory as mts_mandatory,
223
                      marc_tag_structure.important as mts_important,
219
		              marc_tag_structure.authorised_value as mts_authorized_value,
224
		              marc_tag_structure.authorised_value as mts_authorized_value,
220
                  marc_tag_structure.ind1_defaultvalue as mts_ind1_defaultvalue,
225
                  marc_tag_structure.ind1_defaultvalue as mts_ind1_defaultvalue,
221
                  marc_tag_structure.ind1_defaultvalue as mts_ind2_defaultvalue,
226
                  marc_tag_structure.ind1_defaultvalue as mts_ind2_defaultvalue,
Lines 239-244 if ($op eq 'add_form') { Link Here
239
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
244
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
240
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
245
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
241
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
246
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
247
            $row_data{important}        = $results[$i]->{'mts_important'};
242
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
248
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
243
            $row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'};
249
            $row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'};
244
            $row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'};
250
            $row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'};
Lines 251-256 if ($op eq 'add_form') { Link Here
251
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
257
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
252
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
258
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
253
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
259
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
260
                $subfield_data{important}        = $results[$j]->{'important'};
254
				$subfield_data{tab}              = $results[$j]->{'tab'};
261
				$subfield_data{tab}              = $results[$j]->{'tab'};
255
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
262
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
256
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
263
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
Lines 283-288 if ($op eq 'add_form') { Link Here
283
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
290
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
284
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
291
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
285
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
292
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
293
            $row_data{important}        = $results->[$i]{'important'};
286
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
294
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
287
            $row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'};
295
            $row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'};
288
            $row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'};
296
            $row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'};
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,ind1_defaultvalue,ind2_defaultvalue
324
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,important,ind1_defaultvalue,ind2_defaultvalue
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 305-310 sub create_input { Link Here
305
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
305
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
306
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
306
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
307
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
307
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
308
        important      => $tagslib->{$tag}->{$subfield}->{important},
308
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
309
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
309
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
310
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
310
        index          => $index_tag,
311
        index          => $index_tag,
Lines 318-330 sub create_input { Link Here
318
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
319
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
319
    }
320
    }
320
    # Subfield is hidden depending of hidden and mandatory flag, and is always
321
    # Subfield is hidden depending of hidden and mandatory flag, and is always
321
    # shown if it contains anything or if its field is mandatory.
322
    # shown if it contains anything or if its field is mandatory or important.
322
    my $tdef = $tagslib->{$tag};
323
    my $tdef = $tagslib->{$tag};
323
    $subfield_data{visibility} = "display:none;"
324
    $subfield_data{visibility} = "display:none;"
324
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
325
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
325
           $value eq '' &&
326
           $value eq '' &&
326
           !$tdef->{$subfield}->{mandatory} &&
327
           !$tdef->{$subfield}->{mandatory} &&
327
           !$tdef->{mandatory};
328
           !$tdef->{mandatory} &&
329
           !$tdef->{$subfield}->{important} &&
330
           !$tdef->{important};
328
    # expand all subfields of 773 if there is a host item provided in the input
331
    # expand all subfields of 773 if there is a host item provided in the input
329
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
332
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
330
333
Lines 604-609 sub build_tabs { Link Here
604
                            tag_lib       => $tagslib->{$tag}->{lib},
607
                            tag_lib       => $tagslib->{$tag}->{lib},
605
                            repeatable       => $tagslib->{$tag}->{repeatable},
608
                            repeatable       => $tagslib->{$tag}->{repeatable},
606
                            mandatory       => $tagslib->{$tag}->{mandatory},
609
                            mandatory       => $tagslib->{$tag}->{mandatory},
610
                            important       => $tagslib->{$tag}->{important},
607
                            subfield_loop => \@subfields_data,
611
                            subfield_loop => \@subfields_data,
608
                            fixedfield    => $tag < 10?1:0,
612
                            fixedfield    => $tag < 10?1:0,
609
                            random        => CreateKey,
613
                            random        => CreateKey,
Lines 650-655 sub build_tabs { Link Here
650
                        tag_lib          => $tagslib->{$tag}->{lib},
654
                        tag_lib          => $tagslib->{$tag}->{lib},
651
                        repeatable       => $tagslib->{$tag}->{repeatable},
655
                        repeatable       => $tagslib->{$tag}->{repeatable},
652
                        mandatory       => $tagslib->{$tag}->{mandatory},
656
                        mandatory       => $tagslib->{$tag}->{mandatory},
657
                        important       => $tagslib->{$tag}->{important},
653
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
658
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
654
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
659
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
655
                        subfield_loop    => \@subfields_data,
660
                        subfield_loop    => \@subfields_data,
(-)a/cataloguing/additem.pl (+1 lines)
Lines 130-135 sub generate_subfield_form { Link Here
130
        $subfield_data{subfield}   = $subfieldtag;
130
        $subfield_data{subfield}   = $subfieldtag;
131
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
131
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
132
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
132
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
133
        $subfield_data{important}  = $subfieldlib->{important};
133
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
134
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
134
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
135
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
135
        
136
        
(-)a/installer/data/mysql/atomicupdate/bug-8643-add_important_constraint.perl (+11 lines)
Line 0 Link Here
1
$DBversion = "XXX";
2
if ( CheckVersion($DBversion) ) {
3
    if ( !column_exists( 'marc_subfield_structure', 'important') ){
4
        $dbh->do("ALTER TABLE marc_subfield_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory");
5
    }
6
    if ( !column_exists( 'marc_subfield_structure', 'important') ){
7
        $dbh->do("ALTER TABLE marc_tag_structure ADD COLUMN important TINYINT(4) NOT NULL DEFAULT 0  AFTER mandatory");
8
    }
9
    SetVersion($DBversion);
10
    print "Upgrade to $DBversion done (Bug 8643 - Add important constraint to marc subfields)\n";
11
}
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1141-1146 CREATE TABLE `marc_subfield_structure` ( Link Here
1141
  `libopac` varchar(255) NOT NULL default '',
1141
  `libopac` varchar(255) NOT NULL default '',
1142
  `repeatable` tinyint(4) NOT NULL default 0,
1142
  `repeatable` tinyint(4) NOT NULL default 0,
1143
  `mandatory` tinyint(4) NOT NULL default 0,
1143
  `mandatory` tinyint(4) NOT NULL default 0,
1144
  `important` tinyint(4) NOT NULL DEFAULT '0',
1144
  `kohafield` varchar(40) default NULL,
1145
  `kohafield` varchar(40) default NULL,
1145
  `tab` tinyint(1) default NULL,
1146
  `tab` tinyint(1) default NULL,
1146
  `authorised_value` varchar(32) default NULL,
1147
  `authorised_value` varchar(32) default NULL,
Lines 1171-1176 CREATE TABLE `marc_tag_structure` ( Link Here
1171
  `libopac` varchar(255) NOT NULL default '',
1172
  `libopac` varchar(255) NOT NULL default '',
1172
  `repeatable` tinyint(4) NOT NULL default 0,
1173
  `repeatable` tinyint(4) NOT NULL default 0,
1173
  `mandatory` tinyint(4) NOT NULL default 0,
1174
  `mandatory` tinyint(4) NOT NULL default 0,
1175
  `important` tinyint(4) NOT NULL DEFAULT '0',
1174
  `authorised_value` varchar(10) default NULL,
1176
  `authorised_value` varchar(10) default NULL,
1175
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1177
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1176
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
1178
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
(-)a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css (+4 lines)
Lines 119-124 a.tagnum { Link Here
119
.mandatory_marker {
119
.mandatory_marker {
120
	color: red;
120
	color: red;
121
}
121
}
122
123
.important_marker {
124
    color: black;
125
}
122
.linktools { display: block; white-space: nowrap; }
126
.linktools { display: block; white-space: nowrap; }
123
.linktools a { font-size : 75%; display:block;text-decoration:none;}
127
.linktools a { font-size : 75%; display:block;text-decoration:none;}
124
.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; }
128
.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 1928-1933 dd { Link Here
1928
    background-color: #FFFF99;
1928
    background-color: #FFFF99;
1929
}
1929
}
1930
1930
1931
.important_subfield_not_filled {
1932
       background-color : #FFFFCC;
1933
}
1934
1931
.content_hidden {
1935
.content_hidden {
1932
    display: none;
1936
    display: none;
1933
    visibility: hidden; // you propably don't need to change this one
1937
    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 | html %]">Important: </label>
92
                            [% IF loo.important %]
93
                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" checked="checked" value="1" />
94
                            [% ELSE %]
95
                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" 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 (+10 lines)
Lines 80-91 Link Here
80
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
80
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
81
        [% END %]
81
        [% END %]
82
    </li>
82
    </li>
83
    <li><label for="important">Important: </label>
84
        [% IF ( important ) %]
85
            <input type="checkbox" name="important" id="important" value="1" checked="checked" />
86
        [% ELSE %]
87
            <input type="checkbox" name="important" id="important" value="1" />
88
        [% END %]
89
    </li>
83
    <li><label for="ind1_defaultvalue">First indicator default value: </label>
90
    <li><label for="ind1_defaultvalue">First indicator default value: </label>
84
        <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
91
        <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
85
    </li>
92
    </li>
86
    <li><label for="ind2_defaultvalue">Second indicator default value: </label>
93
    <li><label for="ind2_defaultvalue">Second indicator default value: </label>
87
        <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
94
        <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
88
    </li>
95
    </li>
96
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
89
    <li><label for="authorised_value">Authorized value: </label>
97
    <li><label for="authorised_value">Authorized value: </label>
90
        <select name="authorised_value" id="authorised_value" size="1">
98
        <select name="authorised_value" id="authorised_value" size="1">
91
            <option value=""></option>
99
            <option value=""></option>
Lines 176-181 Link Here
176
        <th>Lib</th>
184
        <th>Lib</th>
177
        <th>Repeatable</th>
185
        <th>Repeatable</th>
178
        <th>Mandatory</th>
186
        <th>Mandatory</th>
187
        <th>Important</th>
179
        <th>Auth value</th>
188
        <th>Auth value</th>
180
        <th>Indicator 1</th>
189
        <th>Indicator 1</th>
181
        <th>Indicator 2</th>
190
        <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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-3 / +126 lines)
Lines 253-259 function AreMandatoriesNotOk(){ Link Here
253
    var flag=0;
253
    var flag=0;
254
    var tabflag= new Array();  
254
    var tabflag= new Array();  
255
    [% FOREACH BIG_LOO IN BIG_LOOP %]
255
    [% FOREACH BIG_LOO IN BIG_LOOP %]
256
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
256
        [% FOREACH innerloo IN BIG_LOO.innerloop %]
257
	        [% IF ( innerloo.mandatory ) %]
257
	        [% IF ( innerloo.mandatory ) %]
258
    	    	mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
258
    	    	mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
259
        	[% END %]
259
        	[% END %]
Lines 339-345 function AreMandatoriesNotOk(){ Link Here
339
    	
339
    	
340
    	if(isempty){
340
    	if(isempty){
341
    		flag = 1;
341
    		flag = 1;
342
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
342
            StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
343
    	}
343
    	}
344
    	
344
    	
345
    }
345
    }
Lines 358-363 function AreMandatoriesNotOk(){ Link Here
358
function Check(){
358
function Check(){
359
    var StrAlert = AreMandatoriesNotOk();
359
    var StrAlert = AreMandatoriesNotOk();
360
    if( ! StrAlert ){
360
    if( ! StrAlert ){
361
        var StrWarning = AreImportantsNotOk();
362
        if (StrWarning){
363
            var r=confirm(StrWarning);
364
            if (! r){
365
                return false;
366
            }
367
        }
361
        document.f.submit();
368
        document.f.submit();
362
        return true;
369
        return true;
363
    } else {
370
    } else {
Lines 367-372 function Check(){ Link Here
367
}
374
}
368
375
369
/** 
376
/** 
377
 * check if mandatory subfields are written
378
 */
379
function AreImportantsNotOk(){
380
    var importants = new Array();
381
    var importantsfields = new Array();
382
    var tab = new Array();
383
    var label = new Array();
384
    var flag=0;
385
    var tabflag= new Array();
386
    [% FOREACH BIG_LOO IN BIG_LOOP %]
387
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
388
        [% IF ( innerloo.important ) %]
389
           importantsfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
390
        [% END %]
391
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
392
            [% IF ( subfield_loo.important ) %]importants.push("[% subfield_loo.id | html %]");
393
                tab.push("[% BIG_LOO.number | html %]");
394
                label.push("[% subfield_loo.marc_lib | html %]");
395
                [% END %]
396
            [% END %]
397
        [% END %]
398
    [% END %]
399
    var StrWarning = _("A few important fields are not filled:");
400
    StrWarning += "\n\n";
401
    for(var i=0,len=importants.length; i<len ; i++){
402
        var tag=importants[i].substr(4,3);
403
        var subfield=importants[i].substr(17,1);
404
        var tagnumber=importants[i].substr(19,importants[i].lastIndexOf("_")-19);
405
        tabflag[tag+subfield+tagnumber]=new Array();
406
        tabflag[tag+subfield+tagnumber][0]=0;
407
        if( ! document.getElementById(importants[i]).value){
408
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
409
            document.getElementById(importants[i]).setAttribute('class','important_subfield_not_filled');
410
            document.getElementById(importants[i]).focus();
411
            tabflag[tag+subfield+tagnumber][1]=label[i];
412
            tabflag[tag+subfield+tagnumber][2]=tab[i];
413
        } else {
414
            tabflag[tag+subfield+tagnumber][0] = 1;
415
        }
416
    }
417
    for (var tagsubfieldid in tabflag){
418
      if (tabflag[tagsubfieldid][0]==0){
419
        var tag=tagsubfieldid.substr(0,3);
420
        var subfield=tagsubfieldid.substr(3,1);
421
        StrWarning += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
422
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
423
        flag=1;
424
      }
425
    }
426
427
    /* Check for mandatories field(not subfields) */
428
    for(var i=0,len=importantsfields.length; i<len; i++){
429
        isempty  = true;
430
        arr      = importantsfields[i];
431
        divid    = "tag_" + arr[0] + "_" + arr[1];
432
        varegexp = new RegExp("^tag_" + arr[0] + "_code_");
433
434
        if(parseInt(arr[0]) >= 10){
435
           elem = document.getElementById(divid);
436
           eleminputs = elem.getElementsByTagName('input');
437
           for(var j=0,len2=eleminputs.length; j<len2; j++){
438
439
              if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
440
                 inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
441
442
                   for( var k=0; k<len2; k++){
443
                        if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
444
                            isempty = false
445
                        }
446
                    }
447
448
                    elemselect = elem.getElementsByTagName('select');
449
                    for( var k=0; k<elemselect.length; k++){
450
                        if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
451
                           isempty = false
452
                        }
453
                    }
454
              }
455
           }
456
457
           elemtextareas = elem.getElementsByTagName('textarea');
458
           for(var j=0,len2=elemtextareas.length; j<len2; j++){
459
                // this bit assumes that the only textareas in this context would be for subfields
460
               if (elemtextareas[j].value) {
461
                   isempty = false;
462
               }
463
           }
464
       }else{
465
          isempty = false;
466
       }
467
468
       if(isempty){
469
          flag = 1;
470
          StrWarning += _("\t* Field ") + arr[0] + _(" is important, at least one of its subfields should be filled.") + "\n";
471
       }
472
    }
473
474
    StrWarning += "\n" + _("Are you sure you want to save?");
475
476
    if(flag){
477
        return StrWarning;
478
    } else {
479
        return flag;
480
    }
481
}
482
483
/**
370
 * check if z3950 mandatories are set or not
484
 * check if z3950 mandatories are set or not
371
 */
485
 */
372
function GetZ3950Terms(){
486
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 89-96 $(document).ready(function(){ Link Here
89
});
89
});
90
90
91
function Check(f) {
91
function Check(f) {
92
    var total_errors = CheckMandatorySubfields(f);
92
    var total_mandatory = CheckMandatorySubfields(f);
93
    if (total_errors==0) {
93
    var total_important = CheckImportantSubfields(f);
94
    var alertString2;
95
    if (total_mandatory==0) {
94
        // Explanation about this line:
96
        // Explanation about this line:
95
        // In case of limited edition permission, we have to prevent user from modifying some fields.
97
        // In case of limited edition permission, we have to prevent user from modifying some fields.
96
        // But there is no such thing as readonly attribute for select elements.
98
        // But there is no such thing as readonly attribute for select elements.
Lines 98-109 function Check(f) { Link Here
98
        // So we "un-disable" the elements just before submitting.
100
        // So we "un-disable" the elements just before submitting.
99
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
101
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
100
        $("select[name=field_value]").prop('disabled', false);
102
        $("select[name=field_value]").prop('disabled', false);
101
        return true;
102
    } else {
103
    } else {
103
        var alertString2 = _("Form not submitted because of the following problem(s)");
104
        alertString2 = _("Form not submitted because of the following problem(s)");
104
        alertString2 += "\n------------------------------------------------------------------------------------\n";
105
        alertString2 += "\n------------------------------------------------------------------------------------\n";
105
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
106
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory);
106
        alert(alertString2);
107
    }
108
    if(total_important > 0){
109
        if( !alertString2 ){
110
            alertString2 = "";
111
        }
112
        alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important);
113
        alertString2 += "\n\n " + _("Are you sure you want to save?");
114
    }
115
    if(alertString2){
116
        if(total_mandatory){
117
             alert(alertString2);
118
        }else{
119
            var a = confirm(alertString2);
120
            if( a ){
121
                return true;
122
            }
123
        }
107
        return false;
124
        return false;
108
    }
125
    }
109
    return true;
126
    return true;
Lines 318-329 function confirm_deletion() { Link Here
318
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
335
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
319
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
336
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
320
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
337
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
338
                <input type="hidden" name="important" value="[% ite.important | html %]" />
321
                [% IF ( ite.repeatable ) %]
339
                [% IF ( ite.repeatable ) %]
322
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
340
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
323
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
341
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
324
                    </a>
342
                    </a>
325
                [% END %]
343
                [% END %]
326
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
344
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>
345
                [% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span>
346
                [% END %]
327
            </div></li>
347
            </div></li>
328
        [% END %]
348
        [% END %]
329
    </ol>
349
    </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