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

(-)a/C4/Biblio.pm (-5 / +7 lines)
Lines 1114-1136 sub GetMarcStructure { Link Here
1114
1114
1115
    my $dbh = C4::Context->dbh;
1115
    my $dbh = C4::Context->dbh;
1116
    my $sth = $dbh->prepare(
1116
    my $sth = $dbh->prepare(
1117
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
1117
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,important
1118
        FROM marc_tag_structure 
1118
        FROM marc_tag_structure 
1119
        WHERE frameworkcode=? 
1119
        WHERE frameworkcode=? 
1120
        ORDER BY tagfield"
1120
        ORDER BY tagfield"
1121
    );
1121
    );
1122
    $sth->execute($frameworkcode);
1122
    $sth->execute($frameworkcode);
1123
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
1123
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $important );
1124
1124
1125
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
1125
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $important ) = $sth->fetchrow ) {
1126
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1126
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1127
        $res->{$tag}->{tab}        = "";
1127
        $res->{$tag}->{tab}        = "";
1128
        $res->{$tag}->{mandatory}  = $mandatory;
1128
        $res->{$tag}->{mandatory}  = $mandatory;
1129
        $res->{$tag}->{important}  = $important;
1129
        $res->{$tag}->{repeatable} = $repeatable;
1130
        $res->{$tag}->{repeatable} = $repeatable;
1130
    }
1131
    }
1131
1132
1132
    $sth = $dbh->prepare(
1133
    $sth = $dbh->prepare(
1133
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength
1134
        "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue,maxlength,important
1134
         FROM   marc_subfield_structure 
1135
         FROM   marc_subfield_structure 
1135
         WHERE  frameworkcode=? 
1136
         WHERE  frameworkcode=? 
1136
         ORDER BY tagfield,tagsubfield
1137
         ORDER BY tagfield,tagsubfield
Lines 1154-1166 sub GetMarcStructure { Link Here
1154
    while (
1155
    while (
1155
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1156
        (   $tag,          $subfield,      $liblibrarian, $libopac, $tab,    $mandatory, $repeatable, $authorised_value,
1156
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1157
            $authtypecode, $value_builder, $kohafield,    $seealso, $hidden, $isurl,     $link,       $defaultvalue,
1157
            $maxlength
1158
            $maxlength, $important
1158
        )
1159
        )
1159
        = $sth->fetchrow
1160
        = $sth->fetchrow
1160
      ) {
1161
      ) {
1161
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1162
        $res->{$tag}->{$subfield}->{lib}              = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1162
        $res->{$tag}->{$subfield}->{tab}              = $tab;
1163
        $res->{$tag}->{$subfield}->{tab}              = $tab;
1163
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
1164
        $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
1165
        $res->{$tag}->{$subfield}->{important}        = $important;
1164
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
1166
        $res->{$tag}->{$subfield}->{repeatable}       = $repeatable;
1165
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
1167
        $res->{$tag}->{$subfield}->{authorised_value} = $authorised_value;
1166
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
1168
        $res->{$tag}->{$subfield}->{authtypecode}     = $authtypecode;
(-)a/admin/marc_subfields_structure.pl (-3 / +9 lines)
Lines 190-195 if ( $op eq 'add_form' ) { Link Here
190
        $row_data{isurl}             = $data->{isurl};
190
        $row_data{isurl}             = $data->{isurl};
191
        $row_data{row}               = $i;
191
        $row_data{row}               = $i;
192
        $row_data{link}              = $data->{'link'};
192
        $row_data{link}              = $data->{'link'};
193
        $row_data{important}         = $data->{important};
193
        push( @loop_data, \%row_data );
194
        push( @loop_data, \%row_data );
194
        $i++;
195
        $i++;
195
    }
196
    }
Lines 214-219 if ( $op eq 'add_form' ) { Link Here
214
    $row_data{authtypes}         = \@authtypes;
215
    $row_data{authtypes}         = \@authtypes;
215
    $row_data{link}              = "";
216
    $row_data{link}              = "";
216
    $row_data{row}               = $i;
217
    $row_data{row}               = $i;
218
    $row_data{important}         = "";
217
    push( @loop_data, \%row_data );
219
    push( @loop_data, \%row_data );
218
220
219
    $template->param( 'use_heading_flags_p'      => 1 );
221
    $template->param( 'use_heading_flags_p'      => 1 );
Lines 237-247 elsif ( $op eq 'add_validate' ) { Link Here
237
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
239
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
238
#     );
240
#     );
239
    my $sth_insert = $dbh->prepare(qq{
241
    my $sth_insert = $dbh->prepare(qq{
240
        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)
242
        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)
241
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
243
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
242
    });
244
    });
243
    my $sth_update = $dbh->prepare(qq{
245
    my $sth_update = $dbh->prepare(qq{
244
        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=?
246
        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=?
245
        where tagfield=? and tagsubfield=? and frameworkcode=?
247
        where tagfield=? and tagsubfield=? and frameworkcode=?
246
    });
248
    });
247
    my @tagsubfield       = $input->multi_param('tagsubfield');
249
    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 290-295 elsif ( $op eq 'add_validate' ) { Link Here
290
                        $libopac,
293
                        $libopac,
291
                        $repeatable,
294
                        $repeatable,
292
                        $mandatory,
295
                        $mandatory,
296
                        $important,
293
                        $kohafield,
297
                        $kohafield,
294
                        $tab,
298
                        $tab,
295
                        $seealso,
299
                        $seealso,
Lines 316-321 elsif ( $op eq 'add_validate' ) { Link Here
316
                        $libopac,
320
                        $libopac,
317
                        $repeatable,
321
                        $repeatable,
318
                        $mandatory,
322
                        $mandatory,
323
                        $important,
319
                        $kohafield,
324
                        $kohafield,
320
                        $tab,
325
                        $tab,
321
                        $seealso,
326
                        $seealso,
Lines 402-407 else { # DEFAULT Link Here
402
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
407
        $row_data{kohafield}        = $results->[$i]{'kohafield'};
403
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
408
        $row_data{repeatable}       = $results->[$i]{'repeatable'};
404
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
409
        $row_data{mandatory}        = $results->[$i]{'mandatory'};
410
        $row_data{important}        = $results->[$i]{'important'};
405
        $row_data{tab}              = $results->[$i]{'tab'};
411
        $row_data{tab}              = $results->[$i]{'tab'};
406
        $row_data{seealso}          = $results->[$i]{'seealso'};
412
        $row_data{seealso}          = $results->[$i]{'seealso'};
407
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
413
        $row_data{authorised_value} = $results->[$i]{'authorised_value'};
(-)a/admin/marctagstructure.pl (-5 / +13 lines)
Lines 90-96 if ($op eq 'add_form') { Link Here
90
	#---- if primkey exists, it's a modify action, so read values to modify...
90
	#---- if primkey exists, it's a modify action, so read values to modify...
91
	my $data;
91
	my $data;
92
	if ($searchfield) {
92
	if ($searchfield) {
93
		$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?");
93
        $sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value, important from marc_tag_structure where tagfield=? and frameworkcode=?");
94
		$sth->execute($searchfield,$frameworkcode);
94
		$sth->execute($searchfield,$frameworkcode);
95
		$data=$sth->fetchrow_hashref;
95
		$data=$sth->fetchrow_hashref;
96
	}
96
	}
Lines 109-114 if ($op eq 'add_form') { Link Here
109
            repeatable => $data->{'repeatable'},
109
            repeatable => $data->{'repeatable'},
110
            mandatory => $data->{'mandatory'},
110
            mandatory => $data->{'mandatory'},
111
            authorised_value => $data->{authorised_value},
111
            authorised_value => $data->{authorised_value},
112
            important => $data->{'important'},
112
			frameworkcode => $frameworkcode,
113
			frameworkcode => $frameworkcode,
113
    );  # FIXME: move checkboxes to presentation layer
114
    );  # FIXME: move checkboxes to presentation layer
114
													# END $OP eq ADD_FORM
115
													# END $OP eq ADD_FORM
Lines 120-142 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
    unless (C4::Context->config('demo')) {
126
    unless (C4::Context->config('demo')) {
125
        if ($input->param('modif')) {
127
        if ($input->param('modif')) {
126
            $sth = $dbh->prepare(
128
            $sth = $dbh->prepare(
127
            "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
129
            "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=?, authorised_value=? WHERE frameworkcode=? AND tagfield=?"
128
            );
130
            );
129
            $sth->execute(  $liblibrarian,
131
            $sth->execute(  $liblibrarian,
130
                            $libopac,
132
                            $libopac,
131
                            $repeatable,
133
                            $repeatable,
132
                            $mandatory,
134
                            $mandatory,
135
                            $important,
133
                            $authorised_value,
136
                            $authorised_value,
134
                            $frameworkcode,
137
                            $frameworkcode,
135
                            $tagfield
138
                            $tagfield
136
            );
139
            );
137
        } else {
140
        } else {
138
            $sth = $dbh->prepare(
141
            $sth = $dbh->prepare(
139
            "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"
142
            "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode,important) values (?,?,?,?,?,?,?,?)"
140
            );
143
            );
141
            $sth->execute($tagfield,
144
            $sth->execute($tagfield,
142
                          $liblibrarian,
145
                          $liblibrarian,
Lines 144-150 if ($op eq 'add_form') { Link Here
144
                          $repeatable,
147
                          $repeatable,
145
                          $mandatory,
148
                          $mandatory,
146
                          $authorised_value,
149
                          $authorised_value,
147
                          $frameworkcode
150
                          $frameworkcode,
151
                          $important
148
            );
152
            );
149
        }
153
        }
150
        $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
154
        $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
Lines 219-224 if ($op eq 'add_form') { Link Here
219
		              marc_tag_structure.libopac as mts_libopac,
223
		              marc_tag_structure.libopac as mts_libopac,
220
		              marc_tag_structure.repeatable as mts_repeatable,
224
		              marc_tag_structure.repeatable as mts_repeatable,
221
		              marc_tag_structure.mandatory as mts_mandatory,
225
		              marc_tag_structure.mandatory as mts_mandatory,
226
                      marc_tag_structure.important as mts_important,
222
		              marc_tag_structure.authorised_value as mts_authorized_value,
227
		              marc_tag_structure.authorised_value as mts_authorized_value,
223
		              marc_subfield_structure.*
228
		              marc_subfield_structure.*
224
                FROM marc_tag_structure 
229
                FROM marc_tag_structure 
Lines 240-245 if ($op eq 'add_form') { Link Here
240
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
245
			$row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
241
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
246
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
242
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
247
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
248
            $row_data{important}        = $results[$i]->{'mts_important'};
243
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
249
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
244
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
250
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
245
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
251
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
Lines 253-258 if ($op eq 'add_form') { Link Here
253
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
259
				$subfield_data{kohafield}        = $results[$j]->{'kohafield'};
254
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
260
				$subfield_data{repeatable}       = $results[$j]->{'repeatable'};
255
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
261
				$subfield_data{mandatory}        = $results[$j]->{'mandatory'};
262
                $subfield_data{important}        = $results[$j]->{'important'};
256
				$subfield_data{tab}              = $results[$j]->{'tab'};
263
				$subfield_data{tab}              = $results[$j]->{'tab'};
257
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
264
				$subfield_data{seealso}          = $results[$j]->{'seealso'};
258
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
265
				$subfield_data{authorised_value} = $results[$j]->{'authorised_value'};
Lines 285-290 if ($op eq 'add_form') { Link Here
285
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
292
			$row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};
286
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
293
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
287
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
294
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
295
            $row_data{important}        = $results->[$i]{'important'};
288
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
296
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
289
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
297
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
290
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
298
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
Lines 318-324 output_html_with_http_headers $input, $cookie, $template->output; Link Here
318
sub StringSearch  {
326
sub StringSearch  {
319
	my ($searchstring,$frameworkcode)=@_;
327
	my ($searchstring,$frameworkcode)=@_;
320
	my $sth = C4::Context->dbh->prepare("
328
	my $sth = C4::Context->dbh->prepare("
321
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value
329
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,important
322
     FROM  marc_tag_structure
330
     FROM  marc_tag_structure
323
     WHERE (tagfield >= ? and frameworkcode=?)
331
     WHERE (tagfield >= ? and frameworkcode=?)
324
    ORDER BY tagfield
332
    ORDER BY tagfield
(-)a/cataloguing/addbiblio.pl (-2 / +7 lines)
Lines 317-322 sub create_input { Link Here
317
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
317
        marc_lib       => $tagslib->{$tag}->{$subfield}->{lib},
318
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
318
        tag_mandatory  => $tagslib->{$tag}->{mandatory},
319
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
319
        mandatory      => $tagslib->{$tag}->{$subfield}->{mandatory},
320
        important      => $tagslib->{$tag}->{$subfield}->{important},
320
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
321
        repeatable     => $tagslib->{$tag}->{$subfield}->{repeatable},
321
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
322
        kohafield      => $tagslib->{$tag}->{$subfield}->{kohafield},
322
        index          => $index_tag,
323
        index          => $index_tag,
Lines 330-342 sub create_input { Link Here
330
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
331
        $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
331
    }
332
    }
332
    # Subfield is hidden depending of hidden and mandatory flag, and is always
333
    # Subfield is hidden depending of hidden and mandatory flag, and is always
333
    # shown if it contains anything or if its field is mandatory.
334
    # shown if it contains anything or if its field is mandatory or important.
334
    my $tdef = $tagslib->{$tag};
335
    my $tdef = $tagslib->{$tag};
335
    $subfield_data{visibility} = "display:none;"
336
    $subfield_data{visibility} = "display:none;"
336
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
337
        if $tdef->{$subfield}->{hidden} % 2 == 1 &&
337
           $value eq '' &&
338
           $value eq '' &&
338
           !$tdef->{$subfield}->{mandatory} &&
339
           !$tdef->{$subfield}->{mandatory} &&
339
           !$tdef->{mandatory};
340
           !$tdef->{mandatory} &&
341
           !$tdef->{$subfield}->{important} &&
342
           !$tdef->{important};
340
    # expand all subfields of 773 if there is a host item provided in the input
343
    # expand all subfields of 773 if there is a host item provided in the input
341
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
344
    $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
342
345
Lines 616-621 sub build_tabs { Link Here
616
                            tag_lib       => $tagslib->{$tag}->{lib},
619
                            tag_lib       => $tagslib->{$tag}->{lib},
617
                            repeatable       => $tagslib->{$tag}->{repeatable},
620
                            repeatable       => $tagslib->{$tag}->{repeatable},
618
                            mandatory       => $tagslib->{$tag}->{mandatory},
621
                            mandatory       => $tagslib->{$tag}->{mandatory},
622
                            important       => $tagslib->{$tag}->{important},
619
                            subfield_loop => \@subfields_data,
623
                            subfield_loop => \@subfields_data,
620
                            fixedfield    => $tag < 10?1:0,
624
                            fixedfield    => $tag < 10?1:0,
621
                            random        => CreateKey,
625
                            random        => CreateKey,
Lines 662-667 sub build_tabs { Link Here
662
                        tag_lib          => $tagslib->{$tag}->{lib},
666
                        tag_lib          => $tagslib->{$tag}->{lib},
663
                        repeatable       => $tagslib->{$tag}->{repeatable},
667
                        repeatable       => $tagslib->{$tag}->{repeatable},
664
                        mandatory       => $tagslib->{$tag}->{mandatory},
668
                        mandatory       => $tagslib->{$tag}->{mandatory},
669
                        important       => $tagslib->{$tag}->{important},
665
                        indicator1       => $indicator1,
670
                        indicator1       => $indicator1,
666
                        indicator2       => $indicator2,
671
                        indicator2       => $indicator2,
667
                        subfield_loop    => \@subfields_data,
672
                        subfield_loop    => \@subfields_data,
(-)a/installer/data/mysql/kohastructure.sql (-6 / +8 lines)
Lines 1119-1124 CREATE TABLE `marc_subfield_structure` ( Link Here
1119
  `libopac` varchar(255) NOT NULL default '',
1119
  `libopac` varchar(255) NOT NULL default '',
1120
  `repeatable` tinyint(4) NOT NULL default 0,
1120
  `repeatable` tinyint(4) NOT NULL default 0,
1121
  `mandatory` tinyint(4) NOT NULL default 0,
1121
  `mandatory` tinyint(4) NOT NULL default 0,
1122
  `important` tinyint(4) NOT NULL DEFAULT '0',
1122
  `kohafield` varchar(40) default NULL,
1123
  `kohafield` varchar(40) default NULL,
1123
  `tab` tinyint(1) default NULL,
1124
  `tab` tinyint(1) default NULL,
1124
  `authorised_value` varchar(32) default NULL,
1125
  `authorised_value` varchar(32) default NULL,
Lines 1151-1156 CREATE TABLE `marc_tag_structure` ( Link Here
1151
  `mandatory` tinyint(4) NOT NULL default 0,
1152
  `mandatory` tinyint(4) NOT NULL default 0,
1152
  `authorised_value` varchar(10) default NULL,
1153
  `authorised_value` varchar(10) default NULL,
1153
  `frameworkcode` varchar(4) NOT NULL default '',
1154
  `frameworkcode` varchar(4) NOT NULL default '',
1155
  `important` tinyint(4) NOT NULL DEFAULT '0',
1154
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1156
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1155
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1157
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1156
1158
Lines 2433-2444 CREATE TABLE `permissions` ( Link Here
2433
2435
2434
DROP TABLE IF EXISTS `serialitems`;
2436
DROP TABLE IF EXISTS `serialitems`;
2435
CREATE TABLE `serialitems` (
2437
CREATE TABLE `serialitems` (
2436
	`itemnumber` int(11) NOT NULL,
2438
    `itemnumber` int(11) NOT NULL,
2437
	`serialid` int(11) NOT NULL,
2439
    `serialid` int(11) NOT NULL,
2438
	UNIQUE KEY `serialitemsidx` (`itemnumber`),
2440
    UNIQUE KEY `serialitemsidx` (`itemnumber`),
2439
	KEY `serialitems_sfk_1` (`serialid`),
2441
    KEY `serialitems_sfk_1` (`serialid`),
2440
	CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2442
    CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2441
	CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2443
    CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2442
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2444
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2443
2445
2444
--
2446
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt (+9 lines)
Lines 85-90 Link Here
85
                                <input type="checkbox" id="mandatory[% loo.row %]" name="mandatory[% loo.row %]" value="1" />
85
                                <input type="checkbox" id="mandatory[% loo.row %]" name="mandatory[% loo.row %]" value="1" />
86
                            [% END %]
86
                            [% END %]
87
                        </li>
87
                        </li>
88
                        <li>
89
                            <label for="important[% loo.row %]">Important: </label>
90
                            [% IF loo.important %]
91
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" checked="checked" value="1" />
92
                            [% ELSE %]
93
                                <input type="checkbox" id="important[% loo.row %]" name="important[% loo.row %]" value="1" />
94
                            [% END %]
95
                        </li>
88
                        <li><label for="tab[% loo.row %]">Managed in tab: </label>
96
                        <li><label for="tab[% loo.row %]">Managed in tab: </label>
89
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row %]">
97
                            <select name="tab" tabindex="" size="1" id="tab[% loo.row %]">
90
                            [%- IF ( loo.tab ==  -1 ) -%]
98
                            [%- IF ( loo.tab ==  -1 ) -%]
Lines 276-281 Link Here
276
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield %], [% END %]
284
            [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield %], [% END %]
277
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
285
            [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
278
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
286
            [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
287
            [% IF ( loo.important ) %]Important, [% ELSE %]Not important,[% END %]
279
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso %],[% END %]
288
            [% IF ( loo.seealso ) %] | See Also: [% loo.seealso %],[% END %]
280
            [% IF ( loo.hidden ) %]hidden,[% END %]
289
            [% IF ( loo.hidden ) %]hidden,[% END %]
281
            [% IF ( loo.isurl ) %]is a URL,[% END %]
290
            [% IF ( loo.isurl ) %]is a URL,[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt (+21 lines)
Lines 105-110 $(document).ready(function() { Link Here
105
            [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
105
            [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
106
        </select>
106
        </select>
107
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
107
        (if you select a value here, the indicators will be limited to the authorized value list)</li>
108
    <li><label for="important">Important: </label>
109
        [% IF ( important ) %]
110
            <input type="checkbox" name="important" id="important" value="1" checked="checked" />
111
        [% ELSE %]
112
            <input type="checkbox" name="important" id="important" value="1" />
113
        [% END %]
114
    </li>
115
    <li><label for="authorised_value">Authorized value: </label>[% authorised_value %] (if you select a value here, the indicators will be limited to the authorized value list)</li>
108
</ol></fieldset> 
116
</ol></fieldset> 
109
    <fieldset class="action">
117
    <fieldset class="action">
110
        <input type="submit" value="Save changes" />
118
        <input type="submit" value="Save changes" />
Lines 189-194 $(document).ready(function() { Link Here
189
        <th>Lib</th>
197
        <th>Lib</th>
190
        <th>Repeatable</th>
198
        <th>Repeatable</th>
191
        <th>Mandatory</th>
199
        <th>Mandatory</th>
200
        <th>Important</th>
192
        <th>Auth value</th>
201
        <th>Auth value</th>
193
        <th>&nbsp;</th>
202
        <th>&nbsp;</th>
194
        </tr>
203
        </tr>
Lines 209-214 $(document).ready(function() { Link Here
209
            </td>
218
            </td>
210
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
219
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
211
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
220
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
221
            <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
212
            <td>[% loo.authorised_value %]</td>
222
            <td>[% loo.authorised_value %]</td>
213
            <td>
223
            <td>
214
                <div class="dropdown">
224
                <div class="dropdown">
Lines 222-227 $(document).ready(function() { Link Here
222
                </div>
232
                </div>
223
            </td>
233
            </td>
224
        </tr>
234
        </tr>
235
        [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
236
            <td>&nbsp;</td>
237
            <td colspan="7">
238
                [% FOREACH subfield IN loo.subfields %]
239
                    <p style="text-indent: 5em">Tab:[% subfield.tab %] | $[% subfield.tagsubfield %]
240
                            [% subfield.liblibrarian %] [% IF ( subfield.kohafield ) %][% subfield.kohafield %][% END %][% IF ( subfield.repeatable ) %], repeatable[% END %][% IF ( subfield.mandatory ) %], Mandatory[% END %][% IF ( subfield.important ) %], Important[% END %][% IF ( subfield.seealso ) %], See [% subfield.seealso %][% END %][% IF ( subfield.authorised_value ) %], [% subfield.authorised_value %][% END %][% IF ( subfield.authtypecode ) %], [% subfield.authtypecode %][% END %][% IF ( subfield.value_builder ) %], [% subfield.value_builder %][% END %]
241
                    </p>
242
                [% END %]
243
            </td>
244
        </tr>
225
        [% END %]
245
        [% END %]
226
    [% ELSE %]
246
    [% ELSE %]
227
    [% FOREACH loo IN loop %]
247
    [% FOREACH loo IN loop %]
Lines 230-235 $(document).ready(function() { Link Here
230
        <td>[% loo.liblibrarian %]</td>
250
        <td>[% loo.liblibrarian %]</td>
231
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
251
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
232
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
252
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
253
        <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
233
        <td>[% loo.authorised_value %]</td>
254
        <td>[% loo.authorised_value %]</td>
234
        <td>
255
        <td>
235
            <div class="dropdown">
256
            <div class="dropdown">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-4 / +121 lines)
Lines 237-243 function AreMandatoriesNotOk(){ Link Here
237
    var flag=0;
237
    var flag=0;
238
    var tabflag= new Array();  
238
    var tabflag= new Array();  
239
    [% FOREACH BIG_LOO IN BIG_LOOP %]
239
    [% FOREACH BIG_LOO IN BIG_LOOP %]
240
    	[% FOREACH innerloo IN BIG_LOO.innerloop %]
240
        [% FOREACH innerloo IN BIG_LOO.innerloop %]
241
	        [% IF ( innerloo.mandatory ) %]
241
	        [% IF ( innerloo.mandatory ) %]
242
    	    	mandatoriesfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
242
    	    	mandatoriesfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
243
        	[% END %]
243
        	[% END %]
Lines 323-329 function AreMandatoriesNotOk(){ Link Here
323
    	
323
    	
324
    	if(isempty){
324
    	if(isempty){
325
    		flag = 1;
325
    		flag = 1;
326
                StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
326
            StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
327
    	}
327
    	}
328
    	
328
    	
329
    }
329
    }
Lines 342-347 function AreMandatoriesNotOk(){ Link Here
342
function Check(){
342
function Check(){
343
    var StrAlert = AreMandatoriesNotOk();
343
    var StrAlert = AreMandatoriesNotOk();
344
    if( ! StrAlert ){
344
    if( ! StrAlert ){
345
        var StrWarning = AreImportantsNotOk();
346
        if (StrWarning){
347
            var r=confirm(StrWarning);
348
            if (! r){
349
                return false;
350
            }
351
        }
345
        document.f.submit();
352
        document.f.submit();
346
        return true;
353
        return true;
347
    } else {
354
    } else {
Lines 351-356 function Check(){ Link Here
351
}
358
}
352
359
353
/** 
360
/** 
361
 * check if mandatory subfields are written
362
 */
363
function AreImportantsNotOk(){
364
    var importants = new Array();
365
    var importantsfields = new Array();
366
    var tab = new Array();
367
    var label = new Array();
368
    var flag=0;
369
    var tabflag= new Array();
370
    [% FOREACH BIG_LOO IN BIG_LOOP %]
371
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
372
        [% IF ( innerloo.important ) %]
373
           importantsfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
374
        [% END %]
375
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
376
            [% IF ( subfield_loo.important ) %]importants.push("[% subfield_loo.id %]");
377
                tab.push("[% subfield_loo.number %]");
378
                label.push("[% subfield_loo.marc_lib %]");
379
                [% END %]
380
            [% END %]
381
        [% END %]
382
    [% END %]
383
    var StrWarning = _("A few important fields are not filled:");
384
    StrWarning += "\n\n";
385
    for(var i=0,len=importants.length; i<len ; i++){
386
        var tag=importants[i].substr(4,3);
387
        var subfield=importants[i].substr(17,1);
388
        var tagnumber=importants[i].substr(19,importants[i].lastIndexOf("_")-19);
389
        tabflag[tag+subfield+tagnumber]=new Array();
390
        tabflag[tag+subfield+tagnumber][0]=0;
391
        if( ! document.getElementById(importants[i]).value){
392
            tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
393
            document.getElementById(importants[i]).setAttribute('class','subfield_not_filled');
394
            document.getElementById(importants[i]).focus();
395
            tabflag[tag+subfield+tagnumber][1]=label[i];
396
            tabflag[tag+subfield+tagnumber][2]=tab[i];
397
        } else {
398
            tabflag[tag+subfield+tagnumber][0] = 1;
399
        }
400
    }
401
    for (var tagsubfieldid in tabflag){
402
      if (tabflag[tagsubfieldid][0]==0){
403
        var tag=tagsubfieldid.substr(0,3);
404
        var subfield=tagsubfieldid.substr(3,1);
405
        StrWarning += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
406
        //StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
407
        flag=1;
408
      }
409
    }
410
411
    /* Check for mandatories field(not subfields) */
412
    for(var i=0,len=importantsfields.length; i<len; i++){
413
        isempty  = true;
414
        arr      = importantsfields[i];
415
        divid    = "tag_" + arr[0] + "_" + arr[1];
416
        varegexp = new RegExp("^tag_" + arr[0] + "_code_");
417
418
        if(parseInt(arr[0]) >= 10){
419
           elem = document.getElementById(divid);
420
           eleminputs = elem.getElementsByTagName('input');
421
           for(var j=0,len2=eleminputs.length; j<len2; j++){
422
423
              if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
424
                 inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
425
426
                   for( var k=0; k<len2; k++){
427
                        if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
428
                            isempty = false
429
                        }
430
                    }
431
432
                    elemselect = elem.getElementsByTagName('select');
433
                    for( var k=0; k<elemselect.length; k++){
434
                        if(elemselect[k].id.match(inputregexp) && elemselect[k].value){
435
                           isempty = false
436
                        }
437
                    }
438
              }
439
           }
440
441
           elemtextareas = elem.getElementsByTagName('textarea');
442
           for(var j=0,len2=elemtextareas.length; j<len2; j++){
443
                // this bit assumes that the only textareas in this context would be for subfields
444
               if (elemtextareas[j].value) {
445
                   isempty = false;
446
               }
447
           }
448
       }else{
449
          isempty = false;
450
       }
451
452
       if(isempty){
453
          flag = 1;
454
          StrWarning += _("\t* Field ") + arr[0] + _(" is important, at least one of its subfields should be filled.") + "\n";
455
       }
456
    }
457
458
    StrWarning += "\n" + _("Are you sure you want to save?");
459
460
    if(flag){
461
        return StrWarning;
462
    } else {
463
        return flag;
464
    }
465
}
466
467
/**
354
 * check if z3950 mandatories are set or not
468
 * check if z3950 mandatories are set or not
355
 */
469
 */
356
function GetZ3950Terms(){
470
function GetZ3950Terms(){
Lines 649-655 function Changefwk() { Link Here
649
                [% UNLESS advancedMARCEditor %]
763
                [% UNLESS advancedMARCEditor %]
650
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
764
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
651
                        [% subfield_loo.marc_lib %]
765
                        [% subfield_loo.marc_lib %]
652
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
766
                        [% IF ( subfield_loo.mandatory ) %]
767
                        <span class="mandatory_marker" title="This field is mandatory">*</span>
768
                        [% ELSIF ( subfield_loo.important ) %]
769
                        <span style="color:black" title="This field is important">*</span>
770
                        [% END %]
653
                    </span>
771
                    </span>
654
                    </label>
772
                    </label>
655
                [% END %]
773
                [% END %]
656
- 

Return to bug 8643