use C4::Log;
use C4::Output;
use C4::Templates;
-use C4::Budgets qw(GetCurrency);
+use Koha::Acquisition::Currencies;
use File::Spec;
use IO::File;
use YAML::Syck qw();
use List::MoreUtils qw(any);
$YAML::Syck::ImplicitTyping = 1;
$YAML::Syck::ImplicitUnicode = 1;
-our $lang;
# use Smart::Comments;
#
my $tab_template = C4::Templates::gettemplate( 'admin/preferences/' . $tab . '.pref', 'intranet', $input );
- my $active_currency = GetCurrency();
+ my $active_currency = Koha::Acquisition::Currencies->get_active;
my $local_currency;
if ($active_currency) {
- $local_currency = $active_currency->{currency};
+ $local_currency = $active_currency->currency;
}
$tab_template->param(
local_currency => $local_currency, # currency code is used, because we do not know how a given currency is formatted.
$interface = 'intranet';
$theme = C4::Context->preference('template');
}
- $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, $lang, $current_languages );
+ $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, undef, $current_languages );
$chunk->{'type'} = 'languages';
} elsif ( $options{ 'choices' } ) {
if ( $options{'choices'} && ref( $options{ 'choices' } ) eq '' ) {
keys %{ $options{'choices'} }
];
} elsif ( $options{'multiple'} ) {
- my @values = split /,/, $value;
+ my @values;
+ @values = split /,/, $value if defined($value);
$chunk->{type} = 'multiple';
$chunk->{CHOICES} = [
sort { $a->{'text'} cmp $b->{'text'} }
{
text => $options{multiple}->{$option_value},
value => $option_value,
- selected => grep /^$option_value$/, @values,
+ selected => (grep /^$option_value$/, @values) ? 1 : 0,
}
}
keys %{ $options{multiple} }
push @chunks, $piece;
}
} else {
+ if ( $piece ) {
+ my $version = Koha::version();
+ my ( $major, $minor, $maintenance, $development ) = split( '\.', $version );
+ if ( $minor % 2 ) {
+ $piece =~ s|__VERSION__|${major}_${minor}|g;
+ } else {
+ $piece =~ s|__VERSION__|master|g;
+ }
+ }
push @chunks, { type_text => 1, contents => $piece };
}
}
our @terms = split( /\s+/, $searchfield );
foreach my $tab_name ( keys %tab_files ) {
- my $data = GetTab( $input, $tab_name );
+ # Force list context to remove 'uninitialized value in goto' warn coming from YAML::Syck; note that the other GetTab call is in list context too. The actual cause however is the null value for the pref OpacRenewalBranch in opac.pref
+ my ($data) = GetTab( $input, $tab_name );
my $title = ( keys( %$data ) )[0];
my $tab = $data->{ $title };
$tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );
}
);
-$lang = $template->param( 'lang' );
my $op = $input->param( 'op' ) || '';
my $tab = $input->param( 'tab' );
$tab ||= 'acquisitions'; # Ideally this should be "local-use" but preferences.pl
my $highlighted;
if ( $op eq 'save' ) {
- unless ( C4::Context->config( 'demo' ) ) {
- foreach my $param ( $input->param() ) {
- my ( $pref ) = ( $param =~ /pref_(.*)/ );
+ foreach my $param ( $input->param() ) {
+ my ( $pref ) = ( $param =~ /pref_(.*)/ );
- next if ( !defined( $pref ) );
+ next if ( !defined( $pref ) );
- my $value = join( ',', $input->param( $param ) );
+ my $value = join( ',', $input->param( $param ) );
- C4::Context->set_preference( $pref, $value );
- logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
- }
+ C4::Context->set_preference( $pref, $value );
}
print $input->redirect( '/cgi-bin/koha/admin/preferences.pl?tab=' . $tab );