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

(-)a/C4/Context.pm (-13 / +12 lines)
Lines 276-282 sub memcached { Link Here
276
    if ($ismemcached) {
276
    if ($ismemcached) {
277
      return $memcached;
277
      return $memcached;
278
    } else {
278
    } else {
279
      return undef;
279
      return;
280
    }
280
    }
281
}
281
}
282
282
Lines 293-299 sub db_scheme2dbi { Link Here
293
        if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
293
        if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
294
        if (/oracle/) { return("Oracle"); }
294
        if (/oracle/) { return("Oracle"); }
295
    }
295
    }
296
    return undef;         # Just in case
296
    return;         # Just in case
297
}
297
}
298
298
299
sub import {
299
sub import {
Lines 358-364 sub new { Link Here
358
            $conf_fname = CONFIG_FNAME;
358
            $conf_fname = CONFIG_FNAME;
359
        } else {
359
        } else {
360
            warn "unable to locate Koha configuration file koha-conf.xml";
360
            warn "unable to locate Koha configuration file koha-conf.xml";
361
            return undef;
361
            return;
362
        }
362
        }
363
    }
363
    }
364
    
364
    
Lines 376-382 sub new { Link Here
376
376
377
    $self->{"config_file"} = $conf_fname;
377
    $self->{"config_file"} = $conf_fname;
378
    warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
378
    warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"});
379
    return undef if !defined($self->{"config"});
379
    return if !defined($self->{"config"});
380
380
381
    $self->{"dbh"} = undef;        # Database handle
381
    $self->{"dbh"} = undef;        # Database handle
382
    $self->{"Zconn"} = undef;    # Zebra Connections
382
    $self->{"Zconn"} = undef;    # Zebra Connections
Lines 480-489 C<C4::Config-E<gt>new> will not return it. Link Here
480
480
481
=cut
481
=cut
482
482
483
sub _common_config ($$) {
483
sub _common_config {
484
	my $var = shift;
484
	my $var = shift;
485
	my $term = shift;
485
	my $term = shift;
486
    return undef if !defined($context->{$term});
486
    return if !defined($context->{$term});
487
       # Presumably $self->{$term} might be
487
       # Presumably $self->{$term} might be
488
       # undefined if the config file given to &new
488
       # undefined if the config file given to &new
489
       # didn't exist, and the caller didn't bother
489
       # didn't exist, and the caller didn't bother
Lines 545-551 END_SQL Link Here
545
    return $sysprefs{$var};
545
    return $sysprefs{$var};
546
}
546
}
547
547
548
sub boolean_preference ($) {
548
sub boolean_preference {
549
    my $self = shift;
549
    my $self = shift;
550
    my $var = shift;        # The system preference to return
550
    my $var = shift;        # The system preference to return
551
    my $it = preference($self, $var);
551
    my $it = preference($self, $var);
Lines 1027-1045 sub set_userenv { Link Here
1027
    return $cell;
1027
    return $cell;
1028
}
1028
}
1029
1029
1030
sub set_shelves_userenv ($$) {
1030
sub set_shelves_userenv {
1031
	my ($type, $shelves) = @_ or return undef;
1031
	my ($type, $shelves) = @_ or return;
1032
	my $activeuser = $context->{activeuser} or return undef;
1032
	my $activeuser = $context->{activeuser} or return;
1033
	$context->{userenv}->{$activeuser}->{barshelves} = $shelves if $type eq 'bar';
1033
	$context->{userenv}->{$activeuser}->{barshelves} = $shelves if $type eq 'bar';
1034
	$context->{userenv}->{$activeuser}->{pubshelves} = $shelves if $type eq 'pub';
1034
	$context->{userenv}->{$activeuser}->{pubshelves} = $shelves if $type eq 'pub';
1035
	$context->{userenv}->{$activeuser}->{totshelves} = $shelves if $type eq 'tot';
1035
	$context->{userenv}->{$activeuser}->{totshelves} = $shelves if $type eq 'tot';
1036
}
1036
}
1037
1037
1038
sub get_shelves_userenv () {
1038
sub get_shelves_userenv {
1039
	my $active;
1039
	my $active;
1040
	unless ($active = $context->{userenv}->{$context->{activeuser}}) {
1040
	unless ($active = $context->{userenv}->{$context->{activeuser}}) {
1041
		$debug and warn "get_shelves_userenv cannot retrieve context->{userenv}->{context->{activeuser}}";
1041
		$debug and warn "get_shelves_userenv cannot retrieve context->{userenv}->{context->{activeuser}}";
1042
		return undef;
1042
		return;
1043
	}
1043
	}
1044
	my $totshelves = $active->{totshelves} or undef;
1044
	my $totshelves = $active->{totshelves} or undef;
1045
	my $pubshelves = $active->{pubshelves} or undef;
1045
	my $pubshelves = $active->{pubshelves} or undef;
1046
- 

Return to bug 6679