From 15356575c2fb1f86d67b970e761ad2e47f8154fa Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 12 Nov 2007 14:33:33 -0600 Subject: [PATCH] Fix so that if you edit a borrower from circ, or change a password from circ you are taken back there Toolbar needs to be made for members too, its using the same one as circ, which isnt right, will do this next Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .../prog/en/includes/circ-toolbar.inc | 2 +- .../en/modules/members/member-password.tmpl | 3 +- members/member-password.pl | 62 +++++++++++-------- members/memberentry.pl | 17 +++-- 4 files changed, 51 insertions(+), 33 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index fb6041c6ef..76e45104eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -91,7 +91,7 @@ function confirm_reregistration() {
  • ">Add Note
  • -
  • ">Change Password
  • +
  • &destination=circ">Change Password
  • &print=page">Print Page
  • &print=slip">Print Slip
  • ">Renew Account
  • ">Set Permissions
  • Delete
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tmpl index e66dc5f3d8..a6aee9df89 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tmpl @@ -21,7 +21,8 @@
    - +"> +">

    You have entered a User ID that already exists. Please choose another one.

    diff --git a/members/member-password.pl b/members/member-password.pl index e4c0fca9c0..8db7c477cc 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -33,6 +33,9 @@ $flagsrequired->{borrowers}=1; my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); my $member=$input->param('member'); +my $cardnumber = $input->param('cardnumber'); +my $destination = $input->param('destination'); + my %member2; $member2{'borrowernumber'}=$member; # my $issues=GetBorrowerIssues(\%member2); @@ -45,19 +48,26 @@ my ($bor,$flags)=GetMemberDetails( $member,''); my $newpassword = $input->param('newpassword'); if ( $newpassword ) { - my $digest=md5_base64($input->param('newpassword')); - my $uid = $input->param('newuserid'); - my $dbh=C4::Context->dbh; - if (changepassword($uid,$member,$digest)) { - $template->param(newpassword => $newpassword); - print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member"); - } else { + my $digest=md5_base64($input->param('newpassword')); + my $uid = $input->param('newuserid'); + my $dbh=C4::Context->dbh; + warn $destination; + if (changepassword($uid,$member,$digest)) { + $template->param(newpassword => $newpassword); + if ($destination eq 'circ') { + print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$cardnumber"); + } + else { + print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member"); + } + } + else { $template->param(othernames => $bor->{'othernames'}, surname => $bor->{'surname'}, firstname => $bor->{'firstname'}, userid => $bor->{'userid'}, defaultnewpassword => $newpassword ); - } + } } else { my $userid = $bor->{'userid'}; @@ -67,23 +77,25 @@ if ( $newpassword ) { for (my $i=0; $i<$length; $i++) { $defaultnewpassword.=substr($chars, int(rand(length($chars))),1); } - $template->param( othernames => $bor->{'othernames'}, - surname => $bor->{'surname'}, - firstname => $bor->{'firstname'}, - borrowernumber => $bor->{'borrowernumber'}, - cardnumber => $bor->{'cardnumber'}, - categorycode => $bor->{'categorycode'}, - category_type => $bor->{'category_type'}, - category_description => $bor->{'description'}, - address => $bor->{'address'}, - address2 => $bor->{'address2'}, - city => $bor->{'city'}, - zipcode => $bor->{'zipcode'}, - phone => $bor->{'phone'}, - email => $bor->{'email'}, - branchcode => $bor->{'branchcode'}, - userid => $bor->{'userid'}, - defaultnewpassword => $defaultnewpassword ); + $template->param( othernames => $bor->{'othernames'}, + surname => $bor->{'surname'}, + firstname => $bor->{'firstname'}, + borrowernumber => $bor->{'borrowernumber'}, + cardnumber => $bor->{'cardnumber'}, + categorycode => $bor->{'categorycode'}, + category_type => $bor->{'category_type'}, + category_description => $bor->{'description'}, + address => $bor->{'address'}, + address2 => $bor->{'address2'}, + city => $bor->{'city'}, + zipcode => $bor->{'zipcode'}, + phone => $bor->{'phone'}, + email => $bor->{'email'}, + branchcode => $bor->{'branchcode'}, + userid => $bor->{'userid'}, + destination => $destination, + defaultnewpassword => $defaultnewpassword + ); } diff --git a/members/memberentry.pl b/members/memberentry.pl index cd36c1ccd4..f3fbd97aa6 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -206,20 +206,25 @@ if ($op eq 'insert'){ my @orgs=split(/\|/,$data{'organisations'}); add_member_orgs($borrowernumber,\@orgs); } - if($destination eq "circ"){ - print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}"); + if ($destination eq "circ") { + print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}"); } else { - if ($loginexist == 0) { - print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); - } + if ($loginexist == 0) { + print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); + } } } } if ($op eq 'save'){ # test to know if another user have the same password and same login unless ($nok){ - &ModMember(%newdata); + &ModMember(%newdata); + if ($destination eq "circ") { + print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}"); + } + else { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); + } } } -- 2.39.5