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

(-)a/C4/Biblio.pm (-5 / +7 lines)
Lines 862-886 sub GetMarcStructure { Link Here
862
862
863
    my $dbh = C4::Context->dbh;
863
    my $dbh = C4::Context->dbh;
864
    my $sth = $dbh->prepare(
864
    my $sth = $dbh->prepare(
865
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,ind1_defaultvalue,ind2_defaultvalue
865
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,important,ind1_defaultvalue,ind2_defaultvalue
866
        FROM marc_tag_structure 
866
        FROM marc_tag_structure 
867
        WHERE frameworkcode=? 
867
        WHERE frameworkcode=? 
868
        ORDER BY tagfield"
868
        ORDER BY tagfield"
869
    );
869
    );
870
    $sth->execute($frameworkcode);
870
    $sth->execute($frameworkcode);
871
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue );
871
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue );
872
872
873
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
873
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $important, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
874
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
874
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
875
        $res->{$tag}->{tab}        = "";
875
        $res->{$tag}->{tab}        = "";
876
        $res->{$tag}->{mandatory}  = $mandatory;
876
        $res->{$tag}->{mandatory}  = $mandatory;
877
        $res->{$tag}->{important}  = $important;
877
        $res->{$tag}->{repeatable} = $repeatable;
878
        $res->{$tag}->{repeatable} = $repeatable;
878
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
879
    $res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
879
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
880
    $res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
880
    }
881
    }
881
882
882
    $sth = $dbh->prepare(
883
    $sth = $dbh->prepare(
883
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
884
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,important
884
         FROM   marc_subfield_structure 
885
         FROM   marc_subfield_structure 
885
         WHERE  frameworkcode=? 
886
         WHERE  frameworkcode=? 
886
         ORDER BY tagfield,tagsubfield
887
         ORDER BY tagfield,tagsubfield
Lines 904-916 sub GetMarcStructure { Link Here
904
    while (
905
    while (
905
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
906
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
906
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
907
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
907
            $maxlength
908
            $maxlength, $important
908
        )
909
        )
909
        = $sth->fetchrow
910
        = $sth->fetchrow
910
      ) {
911
      ) {
911
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
912
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
912
        $res->{$tag}->{$subfield}->{tab}              = $tab;
913
        $res->{$tag}->{$subfield}->{tab}              = $tab;
913
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
914
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
915
        $res->{$tag}->{$subfield}->{important}        = $important;
914
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
916
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
915
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
917
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
916
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
918
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
(-)a/admin/marc_subfields_structure.pl (-1 / +7 lines)
Lines 187-192 if ( $op eq 'add_form' ) { Link Here
187
        $row_data{authtypecode}      = $data->{'authtypecode'};
187
        $row_data{authtypecode}      = $data->{'authtypecode'};
188
        $row_data{repeatable}        = $data->{repeatable};
188
        $row_data{repeatable}        = $data->{repeatable};
189
        $row_data{mandatory}         = $data->{mandatory};
189
        $row_data{mandatory}         = $data->{mandatory};
190
        $row_data{important}         = $data->{important};
190
        $row_data{hidden}            = $data->{hidden};
191
        $row_data{hidden}            = $data->{hidden};
191
        $row_data{isurl}             = $data->{isurl};
192
        $row_data{isurl}             = $data->{isurl};
192
        $row_data{row}               = $i;
193
        $row_data{row}               = $i;
Lines 208-213 if ( $op eq 'add_form' ) { Link Here
208
    $row_data{hidden}            = "";
209
    $row_data{hidden}            = "";
209
    $row_data{repeatable}        = 0;
210
    $row_data{repeatable}        = 0;
210
    $row_data{mandatory}         = 0;
211
    $row_data{mandatory}         = 0;
212
    $row_data{important}         = 0;
211
    $row_data{isurl}             = 0;
213
    $row_data{isurl}             = 0;
212
    $row_data{kohafields}        = \@kohafields;
214
    $row_data{kohafields}        = \@kohafields;
213
    $row_data{authorised_values} = \@authorised_values;
215
    $row_data{authorised_values} = \@authorised_values;
Lines 234-240 elsif ( $op eq 'add_validate' ) { Link Here
234
    my $dbh = C4::Context->dbh;
236
    my $dbh = C4::Context->dbh;
235
    $template->param( tagfield => "$input->param('tagfield')" );
237
    $template->param( tagfield => "$input->param('tagfield')" );
236
    my $sth_update = $dbh->prepare(qq{
238
    my $sth_update = $dbh->prepare(qq{
237
        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=?
239
        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=?
238
        where tagfield=? and tagsubfield=? and frameworkcode=?
240
        where tagfield=? and tagsubfield=? and frameworkcode=?
239
    });
241
    });
240
    my @tagsubfield       = $input->multi_param('tagsubfield');
242
    my @tagsubfield       = $input->multi_param('tagsubfield');
Lines 259-264 elsif ( $op eq 'add_validate' ) { Link Here
259
        my $libopac          = $libopac[$i];
261
        my $libopac          = $libopac[$i];
260
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
262
        my $repeatable       = $input->param("repeatable$i") ? 1 : 0;
261
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
263
        my $mandatory        = $input->param("mandatory$i") ? 1 : 0;
264
        my $important        = $input->param("important$i") ? 1 : 0;
262
        my $kohafield        = $kohafield[$i];
265
        my $kohafield        = $kohafield[$i];
263
        my $tab              = $tab[$i];
266
        my $tab              = $tab[$i];
264
        my $seealso          = $seealso[$i];
267
        my $seealso          = $seealso[$i];
Lines 280-285 elsif ( $op eq 'add_validate' ) { Link Here
280
                    $libopac,
283
                    $libopac,
281
                    $repeatable,
284
                    $repeatable,
282
                    $mandatory,
285
                    $mandatory,
286
                    $important,
283
                    $kohafield,
287
                    $kohafield,
284
                    $tab,
288
                    $tab,
285
                    $seealso,
289
                    $seealso,
Lines 312-317 elsif ( $op eq 'add_validate' ) { Link Here
312
                        libopac          => $libopac,
316
                        libopac          => $libopac,
313
                        repeatable       => $repeatable,
317
                        repeatable       => $repeatable,
314
                        mandatory        => $mandatory,
318
                        mandatory        => $mandatory,
319
                        important        => $important,
315
                        kohafield        => $kohafield,
320
                        kohafield        => $kohafield,
316
                        tab              => $tab,
321
                        tab              => $tab,
317
                        seealso          => $seealso,
322
                        seealso          => $seealso,
Lines 394-399 else { # DEFAULT Link Here
394
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
399
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
395
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
400
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
396
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
401
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
402
        $row_data{important}        = $results->[$i]{'important'};
397
        $row_data{tab}              = $results->[$i]{'tab'};
403
        $row_data{tab}              = $results->[$i]{'tab'};
398
        $row_data{seealso}          = $results->[$i]{'seealso'};
404
        $row_data{seealso}          = $results->[$i]{'seealso'};
399
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
405
        $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,important,authorised_value,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 107-112 if ($op eq 'add_form') { Link Here
107
			libopac => $data->{'libopac'},
107
			libopac => $data->{'libopac'},
108
            repeatable => $data->{'repeatable'},
108
            repeatable => $data->{'repeatable'},
109
            mandatory => $data->{'mandatory'},
109
            mandatory => $data->{'mandatory'},
110
            important => $data->{'important'},
110
            authorised_value => $data->{authorised_value},
111
            authorised_value => $data->{authorised_value},
111
            ind1_defaultvalue => $data->{'ind1_defaultvalue'},
112
            ind1_defaultvalue => $data->{'ind1_defaultvalue'},
112
            ind2_defaultvalue => $data->{'ind2_defaultvalue'}
113
            ind2_defaultvalue => $data->{'ind2_defaultvalue'}
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,important,authorised_value,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 607-612 sub build_tabs { Link Here
607
                            tag_lib       => $tagslib->{$tag}->{lib},
610
                            tag_lib       => $tagslib->{$tag}->{lib},
608
                            repeatable       => $tagslib->{$tag}->{repeatable},
611
                            repeatable       => $tagslib->{$tag}->{repeatable},
609
                            mandatory       => $tagslib->{$tag}->{mandatory},
612
                            mandatory       => $tagslib->{$tag}->{mandatory},
613
                            important       => $tagslib->{$tag}->{important},
610
                            subfield_loop => \@subfields_data,
614
                            subfield_loop => \@subfields_data,
611
                            fixedfield    => $tag < 10?1:0,
615
                            fixedfield    => $tag < 10?1:0,
612
                            random        => CreateKey,
616
                            random        => CreateKey,
Lines 653-658 sub build_tabs { Link Here
653
                        tag_lib          => $tagslib->{$tag}->{lib},
657
                        tag_lib          => $tagslib->{$tag}->{lib},
654
                        repeatable       => $tagslib->{$tag}->{repeatable},
658
                        repeatable       => $tagslib->{$tag}->{repeatable},
655
                        mandatory       => $tagslib->{$tag}->{mandatory},
659
                        mandatory       => $tagslib->{$tag}->{mandatory},
660
                        important       => $tagslib->{$tag}->{important},
656
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
661
                        indicator1       => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
657
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
662
                        indicator2       => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
658
                        subfield_loop    => \@subfields_data,
663
                        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_tag_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 1000-1005 CREATE TABLE `marc_subfield_structure` ( Link Here
1000
  `libopac` varchar(255) NOT NULL default '',
1000
  `libopac` varchar(255) NOT NULL default '',
1001
  `repeatable` tinyint(4) NOT NULL default 0,
1001
  `repeatable` tinyint(4) NOT NULL default 0,
1002
  `mandatory` tinyint(4) NOT NULL default 0,
1002
  `mandatory` tinyint(4) NOT NULL default 0,
1003
  `important` tinyint(4) NOT NULL DEFAULT '0',
1003
  `kohafield` varchar(40) default NULL,
1004
  `kohafield` varchar(40) default NULL,
1004
  `tab` tinyint(1) default NULL,
1005
  `tab` tinyint(1) default NULL,
1005
  `authorised_value` varchar(32) default NULL,
1006
  `authorised_value` varchar(32) default NULL,
Lines 1030-1035 CREATE TABLE `marc_tag_structure` ( Link Here
1030
  `libopac` varchar(255) NOT NULL default '',
1031
  `libopac` varchar(255) NOT NULL default '',
1031
  `repeatable` tinyint(4) NOT NULL default 0,
1032
  `repeatable` tinyint(4) NOT NULL default 0,
1032
  `mandatory` tinyint(4) NOT NULL default 0,
1033
  `mandatory` tinyint(4) NOT NULL default 0,
1034
  `important` tinyint(4) NOT NULL DEFAULT '0',
1033
  `authorised_value` varchar(10) default NULL,
1035
  `authorised_value` varchar(10) default NULL,
1034
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1036
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1035
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
1037
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
(-)a/koha-tmpl/intranet-tmpl/prog/css/right-to-left.css (-1 / +3 lines)
Lines 68-73 fieldset.rows textarea, Link Here
68
ol.bibliodetails,
68
ol.bibliodetails,
69
ol.bibliodetails span.label,
69
ol.bibliodetails span.label,
70
span.required,
70
span.required,
71
span.important,
71
#marcDocsSelect,
72
#marcDocsSelect,
72
#toplevelnav,
73
#toplevelnav,
73
.ui-tabs-nav li,
74
.ui-tabs-nav li,
Lines 140-146 div.patroninfo h5, Link Here
140
   margin-left: 0.5em;
141
   margin-left: 0.5em;
141
}
142
}
142
fieldset.rows img,
143
fieldset.rows img,
143
span.required
144
span.required,
145
span.important
144
{
146
{
145
   margin-right: 0.5em;
147
   margin-right: 0.5em;
146
}
148
}
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+10 lines)
Lines 1534-1539 input[type='text']:read-only:focus { Link Here
1534
    background-color: #FFFF99;
1534
    background-color: #FFFF99;
1535
}
1535
}
1536
1536
1537
.important_subfield_not_filled {
1538
    background-color : #FFFFCC;
1539
}
1540
1537
.content_hidden {
1541
.content_hidden {
1538
    display: none;
1542
    display: none;
1539
    visibility: hidden; // you propably don't need to change this one
1543
    visibility: hidden; // you propably don't need to change this one
Lines 3435-3440 span { Link Here
3435
        margin-left: .5em;
3439
        margin-left: .5em;
3436
    }
3440
    }
3437
3441
3442
    &.important {
3443
        color: #EAC117;
3444
        font-style: italic;
3445
        margin-left: .5em;
3446
    }
3447
3438
    &[class*=" label-"] {
3448
    &[class*=" label-"] {
3439
        color: #FFF;
3449
        color: #FFF;
3440
        display: inline;
3450
        display: inline;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/str/cataloging_additem.inc (+2 lines)
Lines 13-21 Link Here
13
    var LABEL_DELETE_ITEM = _("Delete item");
13
    var LABEL_DELETE_ITEM = _("Delete item");
14
    var MSG_FORM_NOT_SUBMITTED = _("Form not submitted because of the following problem(s)");
14
    var MSG_FORM_NOT_SUBMITTED = _("Form not submitted because of the following problem(s)");
15
    var MSG_MANDATORY_FIELDS_EMPTY = _("%s mandatory fields empty (highlighted)");
15
    var MSG_MANDATORY_FIELDS_EMPTY = _("%s mandatory fields empty (highlighted)");
16
    var MSG_IMPORTANT_FIELDS_EMPTY = _("%s important fields empty (highlighted)");
16
    var MSG_ADD_MULTIPLE_ITEMS = _("You are about to add %s items. Continue?");
17
    var MSG_ADD_MULTIPLE_ITEMS = _("You are about to add %s items. Continue?");
17
    var MSG_ENTER_NUM_ITEMS = _("Please enter a number of items to create.");
18
    var MSG_ENTER_NUM_ITEMS = _("Please enter a number of items to create.");
18
    var MSG_CONFIRM_DELETE_ITEM = _("Are you sure you want to delete this item?");
19
    var MSG_CONFIRM_DELETE_ITEM = _("Are you sure you want to delete this item?");
19
    var MSG_CONFIRM_ADD_ITEM = _("Are you sure you want to add a new item? Any changes made on this page will be lost.");
20
    var MSG_CONFIRM_ADD_ITEM = _("Are you sure you want to add a new item? Any changes made on this page will be lost.");
21
    var MSG_CONFIRM_SAVE = _("Are you sure you want to save?");
20
    var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'additem', 'itemst', 'json' ) | $raw %];
22
    var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'additem', 'itemst', 'json' ) | $raw %];
21
</script>
23
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (+9 lines)
Lines 88-93 Link Here
88
                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
88
                                <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
89
                            [% END %]
89
                            [% END %]
90
                        </li>
90
                        </li>
91
                        <li>
92
                            <label for="important[% loo.row | html %]">Important: </label>
93
                            [% IF loo.important %]
94
                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" checked="checked" value="1" />
95
                            [% ELSE %]
96
                                <input type="checkbox" id="important[% loo.row | html %]" name="important[% loo.row | html %]" value="1" />
97
                            [% END %]
98
                        </li>
91
                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
99
                        <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
92
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row | html %]">
100
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row | html %]">
93
                            [%- IF ( loo.tab ==  -1 ) -%]
101
                            [%- IF ( loo.tab ==  -1 ) -%]
Lines 283-288 Link Here
283
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield | html %], [% END %]
291
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield | html %], [% END %]
284
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
292
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
285
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
293
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
294
            [% IF ( loo.important ) %]Important, [% ELSE %]Not important,[% END %]
286
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso | html %],[% END %]
295
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso | html %],[% END %]
287
            [% IF ( loo.hidden ) %]hidden,[% END %]
296
            [% IF ( loo.hidden ) %]hidden,[% END %]
288
            [% IF ( loo.isurl ) %]is a URL,[% END %]
297
            [% IF ( loo.isurl ) %]is a URL,[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt (+9 lines)
Lines 80-85 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>
Lines 176-181 Link Here
176
        <th>Lib</th>
183
        <th>Lib</th>
177
        <th>Repeatable</th>
184
        <th>Repeatable</th>
178
        <th>Mandatory</th>
185
        <th>Mandatory</th>
186
        <th>Important</th>
179
        <th>Auth value</th>
187
        <th>Auth value</th>
180
        <th>Indicator 1</th>
188
        <th>Indicator 1</th>
181
        <th>Indicator 2</th>
189
        <th>Indicator 2</th>
Lines 199-204 Link Here
199
            </td>
207
            </td>
200
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
208
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
201
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
209
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
210
            <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
202
            <td>[% loo.authorised_value | html %]</td>
211
            <td>[% loo.authorised_value | html %]</td>
203
            <td>[% loo.ind1_defaultvalue | html %]</td>
212
            <td>[% loo.ind1_defaultvalue | html %]</td>
204
            <td>[% loo.ind2_defaultvalue | html %]</td>
213
            <td>[% loo.ind2_defaultvalue | html %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+120 lines)
Lines 399-404 Link Here
399
    function Check(){
399
    function Check(){
400
        var StrAlert = AreMandatoriesNotOk();
400
        var StrAlert = AreMandatoriesNotOk();
401
        if( ! StrAlert ){
401
        if( ! StrAlert ){
402
            var StrWarning = AreImportantsNotOk();
403
            if (StrWarning){
404
                var r=confirm(StrWarning);
405
                if (! r){
406
                    return false;
407
                }
408
            }
402
            document.f.submit();
409
            document.f.submit();
403
            return true;
410
            return true;
404
        } else {
411
        } else {
Lines 408-413 Link Here
408
    }
415
    }
409
416
410
    /**
417
    /**
418
     * check if important subfields are written
419
     */
420
    function AreImportantsNotOk(){
421
        var importants = new Array();
422
        var importantsfields = new Array();
423
        var tab = new Array();
424
        var label = new Array();
425
        var flag=0;
426
        var tabflag= new Array();
427
        [% FOREACH BIG_LOO IN BIG_LOOP %]
428
            [% FOREACH innerloo IN BIG_LOO.innerloop %]
429
                [% IF ( innerloo.important ) %]
430
                importantsfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]"));
431
                [% END %]
432
                [% FOREACH subfield_loo IN innerloo.subfield_loop %]
433
                    [% IF ( subfield_loo.important ) %]importants.push("[% subfield_loo.id | html %]");
434
                        tab.push("[% BIG_LOO.number | html %]");
435
                        label.push("[% subfield_loo.marc_lib | $raw %]");
436
                    [% END %]
437
                [% END %]
438
            [% END %]
439
        [% END %]
440
        var StrWarning = _("A few important fields are not filled:");
441
        StrWarning += "\n\n";
442
        for(var i=0,len=importants.length; i<len ; i++){
443
            var tag=importants[i].substr(4,3);
444
            var subfield=importants[i].substr(17,1);
445
            var tagnumber=importants[i].substr(19,importants[i].lastIndexOf("_")-19);
446
            if (tabflag[tag+subfield+tagnumber] ==  null) {
447
                tabflag[tag+subfield+tagnumber]=new Array();
448
                tabflag[tag+subfield+tagnumber][0]=0;
449
            }
450
            if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(importants[i]) != null && ! document.getElementById(importants[i]).value || document.getElementById(importants[i]) == null)){
451
                tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
452
                document.getElementById(importants[i]).setAttribute('class','input_marceditor noEnterSubmit important_subfield_not_filled');
453
                $('#' + importants[i]).focus();
454
                tabflag[tag+subfield+tagnumber][1]=label[i];
455
                tabflag[tag+subfield+tagnumber][2]=tab[i];
456
            } else {
457
                tabflag[tag+subfield+tagnumber][0] = 1;
458
            }
459
        }
460
        for (var tagsubfieldid in tabflag){
461
            if (tabflag[tagsubfieldid][0]==0){
462
                var tag=tagsubfieldid.substr(0,3);
463
                var subfield=tagsubfieldid.substr(3,1);
464
                StrWarning += "\t* "+_("tag %s subfield %s %s in tab %s").format(tag, subfield, tabflag[tagsubfieldid][1], tabflag[tagsubfieldid][2]) + "\n";
465
                //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
466
                flag=1;
467
            }
468
        }
469
470
        /* Check for importants field(not subfields) */
471
        for(var i=0,len=importantsfields.length; i<len; i++){
472
            isempty  = true;
473
            arr      = importantsfields[i];
474
            divid    = "tag_" + arr[0] + "_" + arr[1];
475
            varegexp = new RegExp("^tag_" + arr[0] + "_code_");
476
477
            if(parseInt(arr[0]) >= 10){
478
                elem = document.getElementById(divid);
479
                eleminputs = elem.getElementsByTagName('input');
480
                for(var j=0,len2=eleminputs.length; j<len2; j++){
481
482
                    if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
483
                        inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
484
485
                        for( var k=0; k<len2; k++){
486
                            if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
487
                                isempty = false
488
                            }
489
                        }
490
491
                        elemselect = elem.getElementsByTagName('select');
492
                        for( var k=0; k<elemselect.length; k++){
493
                            if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
494
                                isempty = false
495
                            }
496
                        }
497
                    }
498
                }
499
500
                elemtextareas = elem.getElementsByTagName('textarea');
501
                for(var j=0,len2=elemtextareas.length; j<len2; j++){
502
                    // this bit assumes that the only textareas in this context would be for subfields
503
                    if (elemtextareas[j].value) {
504
                        isempty = false;
505
                    }
506
                }
507
            } else {
508
                isempty = false;
509
            }
510
511
            if(isempty){
512
                flag = 1;
513
                StrWarning += "\t* " + _("Field %s is important, at least one of its subfields must be filled.").format(arr[0]) + "\n";
514
            }
515
        }
516
517
        StrWarning += "\n" + _("Are you sure you want to save?");
518
519
        if(flag){
520
            return StrWarning;
521
        } else {
522
            return flag;
523
        }
524
    }
525
526
    /**
411
     * check if z3950 mandatories are set or not
527
     * check if z3950 mandatories are set or not
412
     */
528
     */
413
    function GetZ3950Terms(){
529
    function GetZ3950Terms(){
Lines 776-781 Link Here
776
                                                [% UNLESS advancedMARCEditor %]
892
                                                [% UNLESS advancedMARCEditor %]
777
                                                        [% IF ( subfield_loo.mandatory ) %]
893
                                                        [% IF ( subfield_loo.mandatory ) %]
778
                                                            <span class="subfield subfield_mandatory">
894
                                                            <span class="subfield subfield_mandatory">
895
                                                        [% ELSIF ( subfield_loo.important ) %]
896
                                                            <span class="subfield subfield_important">
779
                                                        [% ELSE %]
897
                                                        [% ELSE %]
780
                                                            <span class="subfield">
898
                                                            <span class="subfield">
781
                                                        [% END %]
899
                                                        [% END %]
Lines 822-827 Link Here
822
                                                [% END  # /IF (mv.type...) %]
940
                                                [% END  # /IF (mv.type...) %]
823
                                                [% IF ( subfield_loo.mandatory ) %]
941
                                                [% IF ( subfield_loo.mandatory ) %]
824
                                                    <span class="required">Required</span>
942
                                                    <span class="required">Required</span>
943
                                                [% ELSIF ( subfield_loo.important ) %]
944
                                                    <span class="important">Important</span>
825
                                                [% END %]
945
                                                [% END %]
826
                                                <span class="subfield_controls">
946
                                                <span class="subfield_controls">
827
                                                    [% IF ( subfield_loo.repeatable ) %]
947
                                                    [% IF ( subfield_loo.repeatable ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +4 lines)
Lines 196-207 Link Here
196
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
196
                <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
197
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
197
                <input type="hidden" name="subfield"  value="[% ite.subfield | html %]" />
198
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
198
                <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
199
                <input type="hidden" name="important" value="[% ite.important | html %]" />
199
                [% IF ( ite.repeatable ) %]
200
                [% IF ( ite.repeatable ) %]
200
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
201
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
201
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
202
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
202
                    </a>
203
                    </a>
203
                [% END %]
204
                [% END %]
204
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
205
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>
206
                [% ELSIF ( ite.important ) %] <span class="important">Important</span>
207
                [% END %]
205
            </div></li>
208
            </div></li>
206
        [% END %]
209
        [% END %]
207
    </ol>
210
    </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-1 / +13 lines)
Lines 547-553 function CheckMandatorySubfields(p){ Link Here
547
    return total;
547
    return total;
548
}
548
}
549
549
550
$(document).ready(function() {
550
function CheckImportantSubfields(p){
551
    var total = 0;
552
    $(p).find(".subfield_line input[name='important'][value='1']").each(function(i){
553
        var editor = $(this).siblings("[name='field_value']");
554
        if (!editor.val()) {
555
            editor.addClass("missing");
556
            total++;
557
        }
558
    });
559
    return total;
560
}
561
562
 $(document).ready(function() {
551
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
563
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
552
    $(document).ajaxSuccess(function() {
564
    $(document).ajaxSuccess(function() {
553
        $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
565
        $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js (-7 / +24 lines)
Lines 76-83 $(document).ready(function(){ Link Here
76
});
76
});
77
77
78
function Check(f) {
78
function Check(f) {
79
    var total_errors = CheckMandatorySubfields(f);
79
    var total_mandatory = CheckMandatorySubfields(f);
80
    if (total_errors==0) {
80
    var total_important = CheckImportantSubfields(f);
81
    var alertString2;
82
    if (total_mandatory==0) {
81
        // Explanation about this line:
83
        // Explanation about this line:
82
        // In case of limited edition permission, we have to prevent user from modifying some fields.
84
        // In case of limited edition permission, we have to prevent user from modifying some fields.
83
        // But there is no such thing as readonly attribute for select elements.
85
        // But there is no such thing as readonly attribute for select elements.
Lines 85-98 function Check(f) { Link Here
85
        // So we "un-disable" the elements just before submitting.
87
        // So we "un-disable" the elements just before submitting.
86
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
88
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
87
        $("select[name=field_value]").prop('disabled', false);
89
        $("select[name=field_value]").prop('disabled', false);
88
        return true;
89
    } else {
90
    } else {
90
        var alertString2 = MSG_FORM_NOT_SUBMITTED;
91
        alertString2 = MSG_FORM_NOT_SUBMITTED;
91
        alertString2 += "\n------------------------------------------------------------------------------------\n";
92
        alertString2 += "\n------------------------------------------------------------------------------------\n";
92
        alertString2 += "\n- " + "%s " + MSG_MANDATORY_FIELDS_EMPTY.format(total_errors);
93
        alertString2 += "\n- " + "%s " + MSG_MANDATORY_FIELDS_EMPTY.format(total_mandatory);
93
        alert(alertString2);
94
    }
95
    if(total_important > 0){
96
        if( !alertString2 ){
97
            alertString2 = "";
98
        }
99
        alertString2 += "\n\n " + MSG_IMPORTANT_FIELDS_EMPTY.format(total_important);
100
        alertString2 += "\n\n " + MSG_CONFIRM_SAVE;
101
    }
102
    if(alertString2){
103
        if(total_mandatory){
104
             alert(alertString2);
105
        }else{
106
            var a = confirm(alertString2);
107
            if( a ){
108
                return true;
109
            }
110
        }
94
        return false;
111
        return false;
95
    }
112
    }
113
    return true;
96
}
114
}
97
115
98
function CheckMultipleAdd(f) {
116
function CheckMultipleAdd(f) {
99
- 

Return to bug 8643