From cc1d55c13691748308d38a145fc4309a8ce6b5cf Mon Sep 17 00:00:00 2001 From: arensb Date: Sat, 5 Oct 2002 23:56:13 +0000 Subject: [PATCH] Use C4::Context->preference, rather than getting all system preferences and picking out only what's needed. --- acqui/acquire.pl | 6 ++++-- acqui/newbiblio.pl | 6 ++++-- loadmodules.pl | 17 +++++++++-------- memberentry.pl | 7 +++++-- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/acqui/acquire.pl b/acqui/acquire.pl index edb3ffe956..53cc6c6c0c 100755 --- a/acqui/acquire.pl +++ b/acqui/acquire.pl @@ -171,8 +171,10 @@ print <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); diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index cd12eb42d1..97d11eb984 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -231,8 +231,10 @@ print <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); diff --git a/loadmodules.pl b/loadmodules.pl index 93e9115f2e..7d36887123 100755 --- a/loadmodules.pl +++ b/loadmodules.pl @@ -22,6 +22,7 @@ # 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; @@ -37,15 +38,15 @@ SWITCH: { 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"); diff --git a/memberentry.pl b/memberentry.pl index d1c56adc1a..d9c0804a70 100755 --- a/memberentry.pl +++ b/memberentry.pl @@ -61,12 +61,15 @@ if ($delete){ } 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); -- 2.39.2