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

(-)a/admin/marctagstructure.pl (-19 / +41 lines)
Lines 28-33 use C4::Context; Link Here
28
use Koha::Caches;
28
use Koha::Caches;
29
use Koha::AuthorisedValues;
29
use Koha::AuthorisedValues;
30
use Koha::BiblioFrameworks;
30
use Koha::BiblioFrameworks;
31
use Koha::Database;
31
32
32
# retrieve parameters
33
# retrieve parameters
33
my $input = CGI->new;
34
my $input = CGI->new;
Lines 120-125 if ($op eq 'add_form') { Link Here
120
	my $authorised_value = $input->param('authorised_value');
121
	my $authorised_value = $input->param('authorised_value');
121
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
122
    my $ind1_defaultvalue = $input->param('ind1_defaultvalue');
122
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
123
    my $ind2_defaultvalue = $input->param('ind2_defaultvalue');
124
    my $error;
123
    if ($input->param('modif')) {
125
    if ($input->param('modif')) {
124
        $sth = $dbh->prepare(
126
        $sth = $dbh->prepare(
125
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
127
        "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,important=? ,authorised_value=?, ind1_defaultvalue=?, ind2_defaultvalue=? WHERE frameworkcode=? AND tagfield=?"
Lines 136-161 if ($op eq 'add_form') { Link Here
136
                        $tagfield
138
                        $tagfield
137
        );
139
        );
138
    } else {
140
    } else {
139
        $sth = $dbh->prepare(
141
        my $schema = Koha::Database->new()->schema();
140
        "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
142
        my $rs     = $schema->resultset('MarcTagStructure');
141
        );
143
        my $field  = $rs->find( { tagfield => $tagfield, frameworkcode => $frameworkcode } );
142
        $sth->execute($tagfield,
144
        if ( !$field ) {
143
                      $liblibrarian,
145
            $sth = $dbh->prepare(
144
                      $libopac,
146
                "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
145
                      $repeatable,
147
            );
146
                      $mandatory,
148
            $sth->execute(
147
                      $important,
149
                $tagfield,
148
                      $authorised_value,
150
                $liblibrarian,
149
                      $ind1_defaultvalue,
151
                $libopac,
150
                      $ind2_defaultvalue,
152
                $repeatable,
151
                      $frameworkcode
153
                $mandatory,
152
        );
154
                $important,
155
                $authorised_value,
156
                $ind1_defaultvalue,
157
                $ind2_defaultvalue,
158
                $frameworkcode
159
            );
160
        } else {
161
            $error = 'duplicate_tagfield';
162
        }
153
    }
163
    }
154
    $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
164
    if ( !$error ) {
155
    $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
165
        $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
156
    $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
166
        $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
157
    $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
167
        $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
158
    print $input->redirect("/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode");
168
        $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
169
    }
170
    my $redirect_url = "/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode";
171
    if ($error) {
172
        $redirect_url .= "&error=$error";
173
    }
174
    print $input->redirect($redirect_url);
159
    exit;
175
    exit;
160
													# END $OP eq ADD_VALIDATE
176
													# END $OP eq ADD_VALIDATE
161
################## DELETE_CONFIRM ##################################
177
################## DELETE_CONFIRM ##################################
Lines 200-205 if ($op eq 'add_form') { Link Here
200
216
201
################## DEFAULT ##################################
217
################## DEFAULT ##################################
202
} else { # DEFAULT
218
} else { # DEFAULT
219
    my $error_code = $input->param('error');
220
    if ($error_code){
221
        if ($error_code eq 'duplicate_tagfield'){
222
            $template->param('blocking_error' => $error_code);
223
        }
224
    }
203
	# here, $op can be unset or set to "cud-framework_create_confirm".
225
	# here, $op can be unset or set to "cud-framework_create_confirm".
204
    if ($searchfield ne '') {
226
    if ($searchfield ne '') {
205
        $template->param(searchfield => $searchfield);
227
        $template->param(searchfield => $searchfield);
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc (-1 / +2 lines)
Lines 25-30 Link Here
25
        <div class="dialog message">Necessary Elasticsearch packages are not installed on your server. Please contact your server admin if you wish to configure Elasticsearch</div>
25
        <div class="dialog message">Necessary Elasticsearch packages are not installed on your server. Please contact your server admin if you wish to configure Elasticsearch</div>
26
    [% CASE 'insufficient_permission' %]
26
    [% CASE 'insufficient_permission' %]
27
        <div class="dialog message">You do not have sufficient permission to continue.</div>
27
        <div class="dialog message">You do not have sufficient permission to continue.</div>
28
    [% CASE 'duplicate_tagfield' %]
29
        <div class="dialog message">MARC field not added to MARC bibliographic framework. MARC tag already exists in framework field.</div>
28
    [% CASE %]
30
    [% CASE %]
29
        <div class="dialog alert">[% blocking_error | html %]</div>
31
        <div class="dialog alert">[% blocking_error | html %]</div>
30
    [% END %]
32
    [% END %]
31
- 

Return to bug 34346