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

(-)a/admin/marc_subfields_structure.pl (-30 / +22 lines)
Lines 233-246 if ( $op eq 'add_form' ) { Link Here
233
elsif ( $op eq 'add_validate' ) {
233
elsif ( $op eq 'add_validate' ) {
234
    my $dbh = C4::Context->dbh;
234
    my $dbh = C4::Context->dbh;
235
    $template->param( tagfield => "$input->param('tagfield')" );
235
    $template->param( tagfield => "$input->param('tagfield')" );
236
#     my $sth = $dbh->prepare(
237
# "replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode, link,defaultvalue)
238
#                                     values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
239
#     );
240
    my $sth_insert = $dbh->prepare(qq{
241
        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
        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
243
    });
244
    my $sth_update = $dbh->prepare(qq{
236
    my $sth_update = $dbh->prepare(qq{
245
        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=?
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=?
246
        where tagfield=? and tagsubfield=? and frameworkcode=?
238
        where tagfield=? and tagsubfield=? and frameworkcode=?
Lines 312-341 elsif ( $op eq 'add_validate' ) { Link Here
312
                     my $rec = Koha::MarcSubfieldStructures->find( q{}, $tagfield, $tagsubfield );
304
                     my $rec = Koha::MarcSubfieldStructures->find( q{}, $tagfield, $tagsubfield );
313
                    $kohafield = $rec->kohafield if $rec;
305
                    $kohafield = $rec->kohafield if $rec;
314
                }
306
                }
315
                $sth_insert->execute(
307
                Koha::MarcSubfieldStructure->new(
316
                    $tagfield,
308
                    {
317
                    $tagsubfield,
309
                        tagfield         => $tagfield,
318
                    $liblibrarian,
310
                        tagsubfield      => $tagsubfield,
319
                    $libopac,
311
                        liblibrarian     => $liblibrarian,
320
                    $repeatable,
312
                        libopac          => $libopac,
321
                    $mandatory,
313
                        repeatable       => $repeatable,
322
                    $kohafield,
314
                        mandatory        => $mandatory,
323
                    $tab,
315
                        kohafield        => $kohafield,
324
                    $seealso,
316
                        tab              => $tab,
325
                    $authorised_value,
317
                        seealso          => $seealso,
326
                    $authtypecode,
318
                        authorised_value => $authorised_value,
327
                    $value_builder,
319
                        authtypecode     => $authtypecode,
328
                    $hidden,
320
                        value_builder    => $value_builder,
329
                    $isurl,
321
                        hidden           => $hidden,
330
                    $frameworkcode,
322
                        isurl            => $isurl,
331
                    $link,
323
                        frameworkcode    => $frameworkcode,
332
                    $defaultvalue,
324
                        link             => $link,
333
                    $maxlength,
325
                        defaultvalue     => $defaultvalue,
334
                );
326
                        maxlength        => $maxlength,
327
                    }
328
                )->store;
335
            }
329
            }
336
        }
330
        }
337
    }
331
    }
338
    $sth_insert->finish;
339
    $sth_update->finish;
332
    $sth_update->finish;
340
    $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
333
    $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
341
    $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
334
    $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
342
- 

Return to bug 23309