From f43a56dd15776dbe919d528a5440f55ff013970b Mon Sep 17 00:00:00 2001 From: tonnesen Date: Mon, 28 Oct 2002 17:46:18 +0000 Subject: [PATCH] Merging from rel-1-2 to trunk --- admin-home.pl | 2 +- catalogue-home.pl | 2 +- charges.pl | 8 +++++ deletemem.pl | 9 ++++++ delitem.pl | 5 +++ groups.pl | 7 +++- member-flags.pl | 80 ++++++++++++++++++++++++++++++++++++++++++++++ member-password.pl | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 190 insertions(+), 3 deletions(-) create mode 100755 member-flags.pl create mode 100755 member-password.pl diff --git a/admin-home.pl b/admin-home.pl index 0d233054dd..54dfeb1a1d 100755 --- a/admin-home.pl +++ b/admin-home.pl @@ -13,4 +13,4 @@ my ($loggedinuser, $cookie, $sessionID) = checkauth($query); my $template = gettemplate("parameters/admin-home.tmpl"); $template->param(loggeninuser => $loggedinuser); -print $query->header(-cookie => $cookie),$template->output; \ No newline at end of file +print $query->header(-cookie => $cookie),$template->output; diff --git a/catalogue-home.pl b/catalogue-home.pl index 9cb903d089..0365d19f3c 100755 --- a/catalogue-home.pl +++ b/catalogue-home.pl @@ -8,7 +8,7 @@ use C4::Database; use HTML::Template; my $query = new CGI; -my ($loggedinuser, $cookie, $sessionID) = checkauth($query,1); +my ($loggedinuser, $cookie, $sessionID) = checkauth($query); my $template = gettemplate("catalogue/catalogue-home.tmpl"); my $classlist=''; diff --git a/charges.pl b/charges.pl index 7a8f219c71..4fedcc8ea3 100755 --- a/charges.pl +++ b/charges.pl @@ -25,8 +25,16 @@ use strict; use CGI; use C4::Context; use C4::Output; +use C4::Database; +use C4::Auth; my $input = new CGI; + +my $flagsrequired; +$flagsrequired->{circulation}=1; +my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); + + print $input->header; my $type=$input->param('type'); print startpage(); diff --git a/deletemem.pl b/deletemem.pl index d9d1b97675..8744ee3094 100755 --- a/deletemem.pl +++ b/deletemem.pl @@ -32,8 +32,17 @@ use C4::Search; use C4::Output; use C4::Circulation::Circ2; #use C4::Acquisitions; +use C4::Auth; + my $input = new CGI; + +my $flagsrequired; +$flagsrequired->{borrower}=1; +my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); + + + #print $input->header; my $member=$input->param('member'); my %env; diff --git a/delitem.pl b/delitem.pl index afdd5bd9fd..c0a3242d37 100755 --- a/delitem.pl +++ b/delitem.pl @@ -29,8 +29,13 @@ use CGI; use C4::Output; use C4::Acquisitions; use C4::Biblio; +use C4::Auth; my $input = new CGI; +my $flagsrequired; +$flagsrequired->{editcatalogue}=1; +my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); + #print $input->header; my $item=$input->param('itemnum'); delitem($item); diff --git a/groups.pl b/groups.pl index ab0657c6b1..be38e4148a 100755 --- a/groups.pl +++ b/groups.pl @@ -29,6 +29,11 @@ use C4::Groups; use C4::Circulation::Circ2; use C4::Print; use DBI; +use C4::Database; + +my $configfile=configfile(); +my $intranetdir=$configfile->{'intranetdir'}; + my $input=new CGI; my $time=$input->param('time'); @@ -233,7 +238,7 @@ sub printgroup { my $type=shift; $output= "Overdue list for $groups->{$group}
\n"; my $members=groupmembers($env, $group); - ($type eq 'overdues') && ($output.="
\n"); + ($type eq 'overdues') && ($output.="
\n"); $output.= "\n"; my $typetext=''; ($type eq 'overdues') ? ($typetext="Overdues") : ($typetext="Issues"); diff --git a/member-flags.pl b/member-flags.pl new file mode 100755 index 0000000000..66658aad30 --- /dev/null +++ b/member-flags.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl + +# script to edit a member's flags +# Written by Steve Tonnesen +# July 26, 2002 (my birthday!) + +use strict; + +use C4::Search; +use CGI; +use C4::Output; +use C4::Auth; +use C4::Database; +use C4::Circulation::Circ2; +#use C4::Acquisitions; + +my $input = new CGI; + +my $flagsrequired; +$flagsrequired->{borrowers}=1; +$flagsrequired->{permissions}=1; +my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); + +my $member=$input->param('member'); +my %env; +$env{'nottodayissues'}=1; +my %member2; +$member2{'borrowernumber'}=$member; +my $issues=currentissues(\%env,\%member2); +my $i=0; +foreach (sort keys %$issues) { + $i++; +} +if ($input->param('newflags')) { + my $dbh=C4Connect(); + my $flags=0; + foreach ($input->param) { + if (/flag-(\d+)/) { + my $flag=$1; + $flags=$flags+2**$flag; + } + } + my $sth=$dbh->prepare("update borrowers set flags=? where borrowernumber=?"); + $sth->execute($flags, $member); + print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$member"); +} else { + my ($bor,$flags,$accessflags)=getpatroninformation(\%env, $member,''); + + my $dbh=C4Connect(); + my $sth=$dbh->prepare("select bit,flag,flagdesc from userflags order by bit"); + $sth->execute; + my $flagtext=''; + while (my ($bit, $flag, $flagdesc) = $sth->fetchrow) { + my $checked=''; + if ($accessflags->{$flag}) { + $checked='checked'; + } + $flagtext.="\n"; + } + print $input->header(-cookie => $cookie); + print startpage(); + print startmenu('member'); + print qq| +

$bor->{'surname'}, $bor->{'firstname'}

+ + + +
$flag$flagdesc
+ + $flagtext +
FLAGS
+ +

+ + + |; + + print endmenu('member'); + print endpage(); +} diff --git a/member-password.pl b/member-password.pl new file mode 100755 index 0000000000..5e8601f0c4 --- /dev/null +++ b/member-password.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl + +#script to delete items +#written 2/5/00 +#by chris@katipo.co.nz + +use strict; + +use C4::Search; +use CGI; +use Digest::MD5 qw(md5_base64); +use C4::Output; +use C4::Auth; +use C4::Database; +use C4::Circulation::Circ2; +#use C4::Acquisitions; + +my $input = new CGI; + +my $flagsrequired; +$flagsrequired->{borrowers}=1; +my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); + +#print $input->header; +my $member=$input->param('member'); +my %env; +$env{'nottodayissues'}=1; +my %member2; +$member2{'borrowernumber'}=$member; +my $issues=currentissues(\%env,\%member2); +my $i=0; +foreach (sort keys %$issues) { + $i++; +} +if ($input->param('newpassword')) { + my $digest=md5_base64($input->param('newpassword')); + my $uid = $input->param('newuserid'); + my $dbh=C4Connect(); + my $sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?"); + $sth->execute($uid, $digest, $member); + print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$member"); +} else { + my ($bor,$flags)=getpatroninformation(\%env, $member,''); + my $userid = $bor->{'userid'}; + + my $chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + my $length=int(rand(2))+4; + my $defaultnewpassword=''; + for (my $i=0; $i<$length; $i++) { + $defaultnewpassword.=substr($chars, int(rand(length($chars))),1); + } + my $spellitout=$defaultnewpassword; + $spellitout=~s/l/\001/g; + $spellitout=~s/1/\002/g; + $spellitout=~s/O/\003/g; + $spellitout=~s/o/\004/g; + $spellitout=~s/0/\005/g; + $spellitout=~s/\001/ el<\/b> /g; + $spellitout=~s/\002/ one<\/b> /g; + $spellitout=~s/\003/ Oh<\/b> /g; + $spellitout=~s/\004/ oh<\/b> /g; + $spellitout=~s/\005/ zero<\/b> /g; + + print $input->header(-cookie => $cookie); + print startpage(); + print startmenu('member'); + print qq| +

$bor->{'surname'}, $bor->{'firstname'}

+
+ + New UserID:
+ New Password: +

+ +

+ |; + + print endmenu('member'); + print endpage(); +} -- 2.39.5