projects
/
koha.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ffzg/recall_notices.pl: added --interval and --dedup
[koha.git]
/
admin
/
marc_subfields_structure.pl
diff --git
a/admin/marc_subfields_structure.pl
b/admin/marc_subfields_structure.pl
index
24c8005
..
2519649
100755
(executable)
--- a/
admin/marc_subfields_structure.pl
+++ b/
admin/marc_subfields_structure.pl
@@
-65,7
+65,8
@@
my $tagfield = $input->param('tagfield');
my $tagsubfield = $input->param('tagsubfield');
my $frameworkcode = $input->param('frameworkcode');
my $pkfield = "tagfield";
my $tagsubfield = $input->param('tagsubfield');
my $frameworkcode = $input->param('frameworkcode');
my $pkfield = "tagfield";
-my $offset = $input->param('offset') || 0;
+my $offset = $input->param('offset');
+$offset = 0 if not defined $offset or $offset < 0;
my $script_name = "/cgi-bin/koha/admin/marc_subfields_structure.pl";
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $script_name = "/cgi-bin/koha/admin/marc_subfields_structure.pl";
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@
-74,7
+75,7
@@
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
query => $input,
type => "intranet",
authnotrequired => 0,
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { parameters => '
parameters_remaining_permission
s' },
+ flagsrequired => { parameters => '
manage_marc_framework
s' },
debug => 1,
}
);
debug => 1,
}
);
@@
-171,7
+172,7
@@
if ( $op eq 'add_form' ) {
$row_data{maxlength} = $data->{maxlength};
$row_data{tab} = $data->{tab};
$row_data{tagsubfield} = $data->{tagsubfield};
$row_data{maxlength} = $data->{maxlength};
$row_data{tab} = $data->{tab};
$row_data{tagsubfield} = $data->{tagsubfield};
- $row_data{subfieldcode} = $data->{'tagsubfield'}
eq '@' ? '_' : $data->{'tagsubfield'}
;
+ $row_data{subfieldcode} = $data->{'tagsubfield'};
$row_data{urisubfieldcode} = $row_data{subfieldcode} eq '%' ? 'pct' : $row_data{subfieldcode};
$row_data{liblibrarian} = $data->{'liblibrarian'};
$row_data{libopac} = $data->{'libopac'};
$row_data{urisubfieldcode} = $row_data{subfieldcode} eq '%' ? 'pct' : $row_data{subfieldcode};
$row_data{liblibrarian} = $data->{'liblibrarian'};
$row_data{libopac} = $data->{'libopac'};
@@
-262,7
+263,6
@@
elsif ( $op eq 'add_validate' ) {
my $tagfield = $input->param('tagfield');
my $tagsubfield = $tagsubfield[$i];
$tagsubfield = "@" unless $tagsubfield ne '';
my $tagfield = $input->param('tagfield');
my $tagsubfield = $tagsubfield[$i];
$tagsubfield = "@" unless $tagsubfield ne '';
- $tagsubfield = "@" if $tagsubfield eq '_';
my $liblibrarian = $liblibrarian[$i];
my $libopac = $libopac[$i];
my $repeatable = $input->param("repeatable$i") ? 1 : 0;
my $liblibrarian = $liblibrarian[$i];
my $libopac = $libopac[$i];
my $repeatable = $input->param("repeatable$i") ? 1 : 0;
@@
-280,56
+280,58
@@
elsif ( $op eq 'add_validate' ) {
my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
if (defined($liblibrarian) && $liblibrarian ne "") {
my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
if (defined($liblibrarian) && $liblibrarian ne "") {
- my $is_demo = C4::Context->config('demo') || '';
- if ( $is_demo ne '1' ) {
- if (marc_subfield_structure_exists($tagfield, $tagsubfield, $frameworkcode)) {
- $sth_update->execute(
+ if (marc_subfield_structure_exists($tagfield, $tagsubfield, $frameworkcode)) {
+ $sth_update->execute(
+ $tagfield,
+ $tagsubfield,
+ $liblibrarian,
+ $libopac,
+ $repeatable,
+ $mandatory,
+ $kohafield,
+ $tab,
+ $seealso,
+ $authorised_value,
+ $authtypecode,
+ $value_builder,
+ $hidden,
+ $isurl,
+ $frameworkcode,
+ $link,
+ $defaultvalue,
+ $maxlength,
+ (
$tagfield,
$tagsubfield,
$tagfield,
$tagsubfield,
- $liblibrarian,
- $libopac,
- $repeatable,
- $mandatory,
- $kohafield,
- $tab,
- $seealso,
- $authorised_value,
- $authtypecode,
- $value_builder,
- $hidden,
- $isurl,
$frameworkcode,
$frameworkcode,
- $link,
- $defaultvalue,
- $maxlength,
- (
- $tagfield,
- $tagsubfield,
- $frameworkcode,
- ),
- );
- } else {
- $sth_insert->execute(
- $tagfield,
- $tagsubfield,
- $liblibrarian,
- $libopac,
- $repeatable,
- $mandatory,
- $kohafield,
- $tab,
- $seealso,
- $authorised_value,
- $authtypecode,
- $value_builder,
- $hidden,
- $isurl,
- $frameworkcode,
- $link,
- $defaultvalue,
- $maxlength,
- );
+ )
+ );
+ } else {
+ if( $frameworkcode ne q{} ) {
+ # BZ 19096: Overwrite kohafield from Default when adding a new record
+ my $rec = Koha::MarcSubfieldStructures->find( q{}, $tagfield, $tagsubfield );
+ $kohafield = $rec->kohafield if $rec;
}
}
+ $sth_insert->execute(
+ $tagfield,
+ $tagsubfield,
+ $liblibrarian,
+ $libopac,
+ $repeatable,
+ $mandatory,
+ $kohafield,
+ $tab,
+ $seealso,
+ $authorised_value,
+ $authtypecode,
+ $value_builder,
+ $hidden,
+ $isurl,
+ $frameworkcode,
+ $link,
+ $defaultvalue,
+ $maxlength,
+ );
}
}
}
}
}
}
@@
-337,7
+339,7
@@
elsif ( $op eq 'add_validate' ) {
$sth_update->finish;
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$sth_update->finish;
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
- $cache->clear_from_cache("default_value_for_mod_marc-
$frameworkcode
");
+ $cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
@@
-372,18
+374,15
@@
elsif ( $op eq 'delete_confirm' ) {
}
elsif ( $op eq 'delete_confirmed' ) {
my $dbh = C4::Context->dbh;
}
elsif ( $op eq 'delete_confirmed' ) {
my $dbh = C4::Context->dbh;
- my $is_demo = C4::Context->config('demo') || '';
- if ( $is_demo ne '1' ) {
- my $sth =
- $dbh->prepare(
+ my $sth =
+ $dbh->prepare(
"delete from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?"
"delete from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?"
- );
- $sth->execute( $tagfield, $tagsubfield, $frameworkcode );
- $sth->finish;
- }
+ );
+ $sth->execute( $tagfield, $tagsubfield, $frameworkcode );
+ $sth->finish;
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
- $cache->clear_from_cache("default_value_for_mod_marc-
$frameworkcode
");
+ $cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
exit;
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&frameworkcode=$frameworkcode");
exit;