preferences and picking out only what's needed.
EOP
;
-my %systemprefs=systemprefs();
-if ($systemprefs{'autoBarcode'} eq '1') {
+my $auto_barcode = C4::Context->preference("autoBarcode") || 0;
+ # See whether barcodes should be automatically allocated.
+ # Defaults to 0, meaning "no".
+if ($auto_barcode eq '1') {
my $dbh = C4::Context->dbh;
my $query="Select barcode from items order by barcode desc";
my $sth=$dbh->prepare($query);
printend
;
-my %systemprefs=systemprefs();
-if ($systemprefs{'autoBarcode'} eq '1') {
+my $auto_barcode = C4::Context->preference("autoBarcode") || 0;
+ # See whether barcodes should be automatically allocated.
+ # Defaults to 0, meaning "no".
+if ($auto_barcode eq '1') {
my $dbh = C4::Context->dbh;
my $query="Select barcode from items order by barcode desc";
my $sth=$dbh->prepare($query);
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
+use C4::Context;
use C4::Acquisitions;
use C4::Biblio;
use C4::Search;
sub acquisitions {
- # FIXME
- # instead of getting a hash, then reading/writing to it at least twice
- # and up to four times, maybe this should be a different function -
- # areAquisitionsSimple() which returns a boolean
- my %systemprefs=systemprefs();
- ($systemprefs{'acquisitions'}) || ($systemprefs{'acquisitions'}='normal');
- if ($systemprefs{'acquisitions'} eq 'simple') {
+ my $aq_type = C4::Context->preference("acquisitions") || "normal";
+ # Get the acquisition preference. This should be:
+ # "simple" - minimal information required
+ # "normal" - full information required
+ # other - Same as "normal"
+
+ if ($aq_type eq 'simple') {
print $input->redirect("/cgi-bin/koha/acqui.simple/addbooks.pl");
- } elsif ($systemprefs{'acquisitions'} eq 'normal') {
+ } elsif ($aq_type eq 'normal') {
print $input ->redirect("/acquisitions");
} else {
print $input ->redirect("/acquisitions");
}
my $cardnumber=$data->{'cardnumber'};
- my %systemprefs=systemprefs();
+ my $autonumber_members = C4::Context->preference("autoMemberNum") || 0;
+ # Find out whether member numbers should be generated
+ # automatically. Should be either "1" or something else.
+ # Defaults to "0", which is interpreted as "no".
# FIXME
# This logic should probably be moved out of the presentation code.
# Not tonight though.
#
- if ($cardnumber eq '' && $systemprefs{'autoMemberNum'} eq '1') {
+ if ($cardnumber eq '' && $autonumber_members eq '1') {
my $dbh = C4::Context->dbh;
my $query="select max(substring(borrowers.cardnumber,2,7)) from borrowers";
my $sth=$dbh->prepare($query);