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

(-)a/C4/Biblio.pm (-3 / +5 lines)
Lines 1129-1147 sub GetMarcStructure { Link Here
1129
1129
1130
    my $dbh = C4::Context->dbh;
1130
    my $dbh = C4::Context->dbh;
1131
    my $sth = $dbh->prepare(
1131
    my $sth = $dbh->prepare(
1132
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
1132
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable,ind1_defaultvalue,ind2_defaultvalue 
1133
        FROM marc_tag_structure 
1133
        FROM marc_tag_structure 
1134
        WHERE frameworkcode=? 
1134
        WHERE frameworkcode=? 
1135
        ORDER BY tagfield"
1135
        ORDER BY tagfield"
1136
    );
1136
    );
1137
    $sth->execute($frameworkcode);
1137
    $sth->execute($frameworkcode);
1138
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
1138
    my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue );
1139
1139
1140
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
1140
    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable, $ind1_defaultvalue, $ind2_defaultvalue ) = $sth->fetchrow ) {
1141
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1141
        $res->{$tag}->{lib}        = ( $forlibrarian or !$libopac ) ? $liblibrarian : $libopac;
1142
        $res->{$tag}->{tab}        = "";
1142
        $res->{$tag}->{tab}        = "";
1143
        $res->{$tag}->{mandatory}  = $mandatory;
1143
        $res->{$tag}->{mandatory}  = $mandatory;
1144
        $res->{$tag}->{repeatable} = $repeatable;
1144
        $res->{$tag}->{repeatable} = $repeatable;
1145
	$res->{$tag}->{ind1_defaultvalue} = $ind1_defaultvalue;
1146
	$res->{$tag}->{ind2_defaultvalue} = $ind2_defaultvalue;
1145
    }
1147
    }
1146
1148
1147
    $sth = $dbh->prepare(
1149
    $sth = $dbh->prepare(
(-)a/admin/marctagstructure.pl (-11 / +25 lines)
Lines 98-104 if ($op eq 'add_form') { Link Here
98
	#---- if primkey exists, it's a modify action, so read values to modify...
98
	#---- if primkey exists, it's a modify action, so read values to modify...
99
	my $data;
99
	my $data;
100
	if ($searchfield) {
100
	if ($searchfield) {
101
		$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?");
101
		$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue from marc_tag_structure where tagfield=? and frameworkcode=?");
102
		$sth->execute($searchfield,$frameworkcode);
102
		$sth->execute($searchfield,$frameworkcode);
103
		$data=$sth->fetchrow_hashref;
103
		$data=$sth->fetchrow_hashref;
104
	}
104
	}
Lines 121-129 if ($op eq 'add_form') { Link Here
121
	$template->param('use_heading_flags_p' => 1);
121
	$template->param('use_heading_flags_p' => 1);
122
	$template->param(liblibrarian => $data->{'liblibrarian'},
122
	$template->param(liblibrarian => $data->{'liblibrarian'},
123
			libopac => $data->{'libopac'},
123
			libopac => $data->{'libopac'},
124
            repeatable => $data->{'repeatable'},
124
            		repeatable => $data->{'repeatable'},
125
            mandatory => $data->{'mandatory'},
125
            		mandatory => $data->{'mandatory'},
126
			authorised_value => $authorised_value,
126
			authorised_value => $authorised_value,
127
			ind1_defaultvalue => $data->{'ind1_defaultvalue'},
128
			ind2_defaultvalue => $data->{'ind2_defaultvalue'},
127
			frameworkcode => $frameworkcode,
129
			frameworkcode => $frameworkcode,
128
    );  # FIXME: move checkboxes to presentation layer
130
    );  # FIXME: move checkboxes to presentation layer
129
													# END $OP eq ADD_FORM
131
													# END $OP eq ADD_FORM
Lines 136-157 if ($op eq 'add_form') { Link Here
136
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
138
	my $repeatable       = $input->param('repeatable') ? 1 : 0;
137
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
139
	my $mandatory        = $input->param('mandatory')  ? 1 : 0;
138
	my $authorised_value = $input->param('authorised_value');
140
	my $authorised_value = $input->param('authorised_value');
141
	my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
142
	my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
139
    unless (C4::Context->config('demo')) {
143
    unless (C4::Context->config('demo')) {
140
        if ($input->param('modif')) {
144
        if ($input->param('modif')) {
141
            $sth = $dbh->prepare(
145
            $sth = $dbh->prepare(
142
            "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
146
            "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
143
            );
147
            );
144
            $sth->execute(  $liblibrarian,
148
            $sth->execute(  $liblibrarian,
145
                            $libopac,
149
                            $libopac,
146
                            $repeatable,
150
                            $repeatable,
147
                            $mandatory,
151
                            $mandatory,
148
                            $authorised_value,
152
                            $authorised_value,
153
			    $ind1_defaultvalue,
154
			    $ind2_defaultvalue,
149
                            $frameworkcode,
155
                            $frameworkcode,
150
                            $tagfield
156
                            $tagfield
151
            );
157
            );
152
        } else {
158
        } else {
153
            $sth = $dbh->prepare(
159
            $sth = $dbh->prepare(
154
            "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"
160
            "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?)"
155
            );
161
            );
156
            $sth->execute($tagfield,
162
            $sth->execute($tagfield,
157
                          $liblibrarian,
163
                          $liblibrarian,
Lines 159-164 if ($op eq 'add_form') { Link Here
159
                          $repeatable,
165
                          $repeatable,
160
                          $mandatory,
166
                          $mandatory,
161
                          $authorised_value,
167
                          $authorised_value,
168
			  $ind1_defaultvalue,
169
			  $ind2_defaultvalue,
162
                          $frameworkcode
170
                          $frameworkcode
163
            );
171
            );
164
        }
172
        }
Lines 171-177 if ($op eq 'add_form') { Link Here
171
################## DELETE_CONFIRM ##################################
179
################## DELETE_CONFIRM ##################################
172
# called by default form, used to confirm deletion of data in DB
180
# called by default form, used to confirm deletion of data in DB
173
} elsif ($op eq 'delete_confirm') {
181
} elsif ($op eq 'delete_confirm') {
174
	$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?");
182
	$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue from marc_tag_structure where tagfield=? and frameworkcode=?");
175
    $sth->execute($searchfield, $frameworkcode);
183
    $sth->execute($searchfield, $frameworkcode);
176
    my $data = $sth->fetchrow_hashref;
184
    my $data = $sth->fetchrow_hashref;
177
	$template->param(
185
	$template->param(
Lines 232-237 if ($op eq 'add_form') { Link Here
232
		              marc_tag_structure.repeatable as mts_repeatable,
240
		              marc_tag_structure.repeatable as mts_repeatable,
233
		              marc_tag_structure.mandatory as mts_mandatory,
241
		              marc_tag_structure.mandatory as mts_mandatory,
234
		              marc_tag_structure.authorised_value as mts_authorized_value,
242
		              marc_tag_structure.authorised_value as mts_authorized_value,
243
			      marc_tag_structure.ind1_defaultvalue as mts_ind1_defaultvalue,
244
			      marc_tag_structure.ind1_defaultvalue as mts_ind2_defaultvalue,
235
		              marc_subfield_structure.*
245
		              marc_subfield_structure.*
236
                FROM marc_tag_structure 
246
                FROM marc_tag_structure 
237
                LEFT JOIN marc_subfield_structure ON (marc_tag_structure.tagfield=marc_subfield_structure.tagfield AND marc_tag_structure.frameworkcode=marc_subfield_structure.frameworkcode) WHERE (marc_tag_structure.tagfield >= ? and marc_tag_structure.frameworkcode=?) AND marc_subfield_structure.tab>=0 ORDER BY marc_tag_structure.tagfield,marc_subfield_structure.tagsubfield");
247
                LEFT JOIN marc_subfield_structure ON (marc_tag_structure.tagfield=marc_subfield_structure.tagfield AND marc_tag_structure.frameworkcode=marc_subfield_structure.frameworkcode) WHERE (marc_tag_structure.tagfield >= ? and marc_tag_structure.frameworkcode=?) AND marc_subfield_structure.tab>=0 ORDER BY marc_tag_structure.tagfield,marc_subfield_structure.tagsubfield");
Lines 253-258 if ($op eq 'add_form') { Link Here
253
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
263
			$row_data{repeatable}       = $results[$i]->{'mts_repeatable'};
254
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
264
			$row_data{mandatory}        = $results[$i]->{'mts_mandatory'};
255
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
265
			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
266
			$row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'};
267
			$row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'};
256
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
268
			$row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
257
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
269
			$row_data{edit}          = "$script_name?op=add_form&searchfield="            .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
258
			$row_data{delete}        = "$script_name?op=delete_confirm&searchfield="      .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
270
			$row_data{delete}        = "$script_name?op=delete_confirm&searchfield="      .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
Lines 292-297 if ($op eq 'add_form') { Link Here
292
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
304
			$row_data{repeatable}       = $results->[$i]{'repeatable'};
293
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
305
			$row_data{mandatory}        = $results->[$i]{'mandatory'};
294
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
306
			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
307
			$row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'};
308
			$row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'};
295
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
309
			$row_data{subfield_link}    = "marc_subfields_structure.pl?tagfield="          .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
296
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
310
			$row_data{edit}             = "$script_name?op=add_form&searchfield="      .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
297
			$row_data{delete}           = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
311
			$row_data{delete}           = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
Lines 324-330 output_html_with_http_headers $input, $cookie, $template->output; Link Here
324
sub StringSearch  {
338
sub StringSearch  {
325
	my ($searchstring,$frameworkcode)=@_;
339
	my ($searchstring,$frameworkcode)=@_;
326
	my $sth = C4::Context->dbh->prepare("
340
	my $sth = C4::Context->dbh->prepare("
327
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value
341
    SELECT tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaultvalue
328
     FROM  marc_tag_structure
342
     FROM  marc_tag_structure
329
     WHERE (tagfield >= ? and frameworkcode=?)
343
     WHERE (tagfield >= ? and frameworkcode=?)
330
    ORDER BY tagfield
344
    ORDER BY tagfield
Lines 340-350 sub StringSearch { Link Here
340
sub duplicate_framework {
354
sub duplicate_framework {
341
	my ($newframeworkcode,$oldframeworkcode) = @_;
355
	my ($newframeworkcode,$oldframeworkcode) = @_;
342
	my $dbh = C4::Context->dbh;
356
	my $dbh = C4::Context->dbh;
343
	my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where frameworkcode=?");
357
	my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,ind1_defaultvalue,ind2_defaulvalue from marc_tag_structure where frameworkcode=?");
344
	$sth->execute($oldframeworkcode);
358
	$sth->execute($oldframeworkcode);
345
	my $sth_insert = $dbh->prepare("insert into marc_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, frameworkcode) values (?,?,?,?,?,?,?)");
359
	my $sth_insert = $dbh->prepare("insert into marc_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, ind1_defaultvalue, ind2_defaultvalue, frameworkcode) values (?,?,?,?,?,?,?,?,?)");
346
	while ( my ($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) = $sth->fetchrow) {
360
	while ( my ($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$ind1_defaultvalue,$ind2_defaultvalue) = $sth->fetchrow) {
347
		$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newframeworkcode);
361
		$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$ind1_defaultvalue,$ind2_defaultvalue,$newframeworkcode);
348
	}
362
	}
349
363
350
	$sth = $dbh->prepare("select frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,authtypecode,value_builder,seealso,hidden from marc_subfield_structure where frameworkcode=?");
364
	$sth = $dbh->prepare("select frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,authtypecode,value_builder,seealso,hidden from marc_subfield_structure where frameworkcode=?");
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1121-1126 CREATE TABLE `marc_tag_structure` ( Link Here
1121
  `repeatable` tinyint(4) NOT NULL default 0,
1121
  `repeatable` tinyint(4) NOT NULL default 0,
1122
  `mandatory` tinyint(4) NOT NULL default 0,
1122
  `mandatory` tinyint(4) NOT NULL default 0,
1123
  `authorised_value` varchar(10) default NULL,
1123
  `authorised_value` varchar(10) default NULL,
1124
  `ind1_defaultvalue` varchar(1) NOT NULL default '',
1125
  `ind2_defaultvalue` varchar(1) NOT NULL default '',
1124
  `frameworkcode` varchar(4) NOT NULL default '',
1126
  `frameworkcode` varchar(4) NOT NULL default '',
1125
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1127
  PRIMARY KEY  (`frameworkcode`,`tagfield`)
1126
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1128
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 12614-12619 if ( CheckVersion($DBversion) ) { Link Here
12614
                SetVersion($DBversion);
12614
                SetVersion($DBversion);
12615
}
12615
}
12616
12616
12617
$DBversion = "16.06.00.002";
12618
if (CheckVersion($DBversion) ) {
12619
	$dbh->do(q{
12620
		ALTER TABLE marc_tag_structure ADD COLUMN ind2_defaultvalue VARCHAR(1) NOT NULL DEFAULT '' AFTER authorized_value;
12621
    });
12622
	$dbh->do(q{
12623
		ALTER TABLE marc_tag_structure ADD COLUMN ind1_defaultvalue VARCHAR(1) NOT NULL DEFAULT '' AFTER authorized_value;
12624
    });
12625
	    print "Upgrade to $DBversion done (Bug 9701 - Configure default indicator)"
12626
		SetVersion($DBversion)
12627
}
12628
12617
12629
12618
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
12630
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
12619
# SEE bug 13068
12631
# SEE bug 13068
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt (-1 / +12 lines)
Lines 93-98 $(document).ready(function() { Link Here
93
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
93
            <input type="checkbox" name="mandatory" id="mandatory" value="1" />
94
        [% END %]
94
        [% END %]
95
    </li>
95
    </li>
96
    <li><label for="ind1_defaultvalue">First indicator default value: </label>
97
	    <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue |html %]" maxlength="1" size="1" />	
98
    </li>
99
    <li><label for="ind2_defaultvalue">Second indicator default value: </label>
100
	    <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue |html %]" maxlength="1" size="1" />
101
    </li>
96
    <li><label for="authorised_value">Authorized value: </label>
102
    <li><label for="authorised_value">Authorized value: </label>
97
        <select name="authorised_value" id="authorised_value" size="1">
103
        <select name="authorised_value" id="authorised_value" size="1">
98
        [% FOREACH value IN authorised_value.values %]
104
        [% FOREACH value IN authorised_value.values %]
Lines 189-194 $(document).ready(function() { Link Here
189
        <th>Repeatable</th>
195
        <th>Repeatable</th>
190
        <th>Mandatory</th>
196
        <th>Mandatory</th>
191
        <th>Auth value</th>
197
        <th>Auth value</th>
198
	<th>Indic1</th>
199
	<th>Indic2</th>
192
        <th>Subfields</th>
200
        <th>Subfields</th>
193
        <th>Edit</th>
201
        <th>Edit</th>
194
        <th>Delete</th>
202
        <th>Delete</th>
Lines 211-216 $(document).ready(function() { Link Here
211
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
219
            <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
212
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
220
            <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
213
            <td>[% loo.authorised_value %]</td>
221
            <td>[% loo.authorised_value %]</td>
222
	    <td>[% loo.ind1_defaultvalue %]</td>
223
	    <td>[% loo.ind2_defaultvalue %]</td>
214
            <td><a href="[% loo.subfield_link %]">subfields</a></td>
224
            <td><a href="[% loo.subfield_link %]">subfields</a></td>
215
            <td><a href="[% loo.edit %]">Edit</a></td>
225
            <td><a href="[% loo.edit %]">Edit</a></td>
216
            <td><a href="[% loo.delete %]">Delete</a></td>
226
            <td><a href="[% loo.delete %]">Delete</a></td>
Lines 224-229 $(document).ready(function() { Link Here
224
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
234
        <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
225
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
235
        <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
226
        <td>[% loo.authorised_value %]</td>
236
        <td>[% loo.authorised_value %]</td>
237
	<td>[% loo.ind1_defaultvalue %]</td>
238
	<td>[% loo.ind2_defaultvalue %]</td>
227
        <td><a href="[% loo.subfield_link %]">Subfields</a></td>
239
        <td><a href="[% loo.subfield_link %]">Subfields</a></td>
228
        <td><a href="[% loo.edit %]">Edit</a></td>
240
        <td><a href="[% loo.edit %]">Edit</a></td>
229
        <td><a href="[% loo.delete %]">Delete</a></td>
241
        <td><a href="[% loo.delete %]">Delete</a></td>
230
- 

Return to bug 9701