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

(-)a/admin/marctagstructure.pl (-19 / +18 lines)
Lines 139-174 if ($op eq 'add_form') { Link Here
139
        );
139
        );
140
    } else {
140
    } else {
141
        my $schema = Koha::Database->new()->schema();
141
        my $schema = Koha::Database->new()->schema();
142
        my $rs = $schema->resultset('MarcTagStructure');
142
        my $rs     = $schema->resultset('MarcTagStructure');
143
        my $field = $rs->find({ tagfield => $tagfield, frameworkcode => $frameworkcode });
143
        my $field  = $rs->find( { tagfield => $tagfield, frameworkcode => $frameworkcode } );
144
        if (!$field){
144
        if ( !$field ) {
145
            $sth = $dbh->prepare(
145
            $sth = $dbh->prepare(
146
            "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
146
                "INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,important,authorised_value,ind1_defaultvalue,ind2_defaultvalue,frameworkcode) values (?,?,?,?,?,?,?,?,?,?)"
147
            );
147
            );
148
            $sth->execute($tagfield,
148
            $sth->execute(
149
                          $liblibrarian,
149
                $tagfield,
150
                          $libopac,
150
                $liblibrarian,
151
                          $repeatable,
151
                $libopac,
152
                          $mandatory,
152
                $repeatable,
153
                          $important,
153
                $mandatory,
154
                          $authorised_value,
154
                $important,
155
                          $ind1_defaultvalue,
155
                $authorised_value,
156
                          $ind2_defaultvalue,
156
                $ind1_defaultvalue,
157
                          $frameworkcode
157
                $ind2_defaultvalue,
158
                $frameworkcode
158
            );
159
            );
159
        }
160
        } else {
160
        else {
161
            $error = 'duplicate_tagfield';
161
            $error = 'duplicate_tagfield';
162
        }
162
        }
163
    }
163
    }
164
    if (!$error){
164
    if ( !$error ) {
165
        $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
165
        $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
166
        $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
166
        $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
167
        $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
167
        $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
168
        $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
168
        $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
169
    }
169
    }
170
    my $redirect_url = "/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode";
170
    my $redirect_url = "/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode";
171
    if ($error){
171
    if ($error) {
172
        $redirect_url .= "&error=$error";
172
        $redirect_url .= "&error=$error";
173
    }
173
    }
174
    print $input->redirect($redirect_url);
174
    print $input->redirect($redirect_url);
175
- 

Return to bug 34346