Bugzilla – Attachment 3202 Details for
Bug 3469
Lost patron card tracking
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Squashed commit
patch.txt (text/plain), 16.24 KB, created by
Marcel de Rooy
on 2011-02-24 12:16:56 UTC
(
hide
)
Description:
Squashed commit
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2011-02-24 12:16:56 UTC
Size:
16.24 KB
patch
obsolete
>From 9ea3deb1ee592a3a0466cd018636e48b311bb3d8 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 24 Feb 2011 13:09:00 +0100 >Subject: [PATCH] Squashed commit of the following: >Content-Type: text/plain; charset="utf-8" > >commit ff1b86f6504031020964bc187d5a204cc37d05d6 >Merge: 3d49ed2... efc9e3a... >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Wed Jul 7 19:56:32 2010 +1200 > > Merge commit 'kc/master' into new_features_ptfs_lost_cards > >commit 3d49ed249b53c51e71d0af999941ba820788b4dc >Merge: e9a3b27... b6fc0d1... >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Tue May 18 19:59:21 2010 +1200 > > Merge branch 'new_features' into new_features_ptfs_lost_cards > >commit e9a3b2731b34b8a097a3c7797d8ae00aa2ab5581 >Merge: fc46177... 8a1cb95... >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Tue May 11 21:58:36 2010 +1200 > > Merge branch 'new_features' into new_features_ptfs_lost_cards > >commit fc461778ace4e566a19cebbe3ed4cf4abe25bdea >Author: J. David Bavousett <dbavousett@ptfs.com> >Date: Tue Nov 17 17:19:04 2009 -0500 > > Added granular permission check to previous cardnumber feature > >commit dbf71d30d0068776432f488e81d8127db0830af8 >Author: PTFS <koha-dev@ptfs.com> >Date: Fri Aug 7 08:30:33 2009 -0400 > > Added warnings so librarians will know that a borrower was found by searching on a previous cardnumber. > >commit ad395f6da7295c526dd74d21bfaa59e25b9ee4be >Author: PTFS <koha-dev@ptfs.com> >Date: Mon Jun 29 08:28:51 2009 -0400 > > Bugfix for non-cardnumbers being pulled as previous cardnumbers. > >commit 7d9326326d801a03d328b3ef7677a93f7f2e42af >Author: J. David Bavousett <dbavousett@ptfs.com> >Date: Sat Jun 20 11:36:41 2009 -0400 > > Removed extra "my" in routine causing warning on run. > >commit 157ec910c6428f0f4a408c6f6cb8eaf79c79e506 >Author: PTFS <koha-dev@ptfs.com> >Date: Sat Jun 13 15:02:47 2009 -0400 > > Added date to the previous cardnumber list. > >commit c1d6d31ac2f5713e55dc02f56c0a78bb17003d4d >Author: PTFS <koha-dev@ptfs.com> >Date: Fri May 8 17:41:42 2009 -0400 > > 1-1 Added ability to search on previous cardnumbers. > >commit 8bbf70ff1b817a0bb5d452bfc59fb924bfbd9f47 >Author: PTFS <koha-dev@ptfs.com> >Date: Tue Mar 3 05:51:37 2009 -0500 > > Previous Cardnumber Tracking > > Tracks previous cardnumbers and adds to ability to quickly revert a borrower to a previous cardnumber from the borrower details page. > TODO: Allow searching on previous cardnumbers >--- > C4/Members.pm | 45 +++++++++++++++++ > C4/Stats.pm | 20 ++++++++ > circ/circulation.pl | 3 +- > .../prog/en/modules/circ/circulation.tmpl | 1 + > .../prog/en/modules/members/member.tmpl | 52 ++++++++++++++++++++ > .../prog/en/modules/members/moremember.tmpl | 25 +++++++++ > members/moremember.pl | 11 ++++- > members/restore_cardnumber.pl | 50 +++++++++++++++++++ > 8 files changed, 205 insertions(+), 2 deletions(-) > create mode 100755 members/restore_cardnumber.pl > >diff --git a/C4/Members.pm b/C4/Members.pm >index fafc99b..20eaf46 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -242,6 +242,21 @@ sub SearchMember { > my @results; > $data = $sth->fetchall_arrayref({}); > >+ $sth->finish; >+ >+ $query = "SELECT borrowers.*, categories.* FROM borrowers >+ LEFT JOIN categories ON borrowers.categorycode=categories.categorycode >+ LEFT JOIN statistics ON borrowers.borrowernumber = statistics.borrowernumber >+ WHERE statistics.type = 'card_replaced' AND statistics.other = ? GROUP BY statistics.other"; >+ $sth = $dbh->prepare( $query ); >+ $sth->execute( $searchstring ); >+ my $prevcards_data = $sth->fetchall_arrayref({}); >+ foreach my $row ( @$prevcards_data ) { >+ $row->{'PreviousCardnumber'} = 1; >+ } >+ >+ $data = [ @$prevcards_data, @$data ]; >+ > return ( scalar(@$data), $data ); > } > >@@ -705,6 +720,36 @@ true on success, or false on failure > > sub ModMember { > my (%data) = @_; >+ my $dbh = C4::Context->dbh; >+ >+ my $member = GetMemberDetails( $data{'borrowernumber'} ); >+ >+ if ( $member->{'cardnumber'} ne $data{'cardnumber'} ) { >+ C4::Stats::UpdateStats( C4::Context->userenv->{branch}, 'card_replaced', '', $member->{'cardnumber'}, '', '', $data{'borrowernumber'} ); >+ } >+ >+ my $iso_re = C4::Dates->new()->regexp('iso'); >+ foreach (qw(dateofbirth dateexpiry dateenrolled)) { >+ if (my $tempdate = $data{$_}) { # assignment, not comparison >+ ($tempdate =~ /$iso_re/) and next; # Congatulations, you sent a valid ISO date. >+ warn "ModMember given $_ not in ISO format ($tempdate)"; >+ my $tempdate2 = format_date_in_iso($tempdate); >+ if (!$tempdate2 or $tempdate2 eq '0000-00-00') { >+ warn "ModMember cannot convert '$tempdate' (from syspref to ISO)"; >+ next; >+ } >+ $data{$_} = $tempdate2; >+ } >+ } >+ if (!$data{'dateofbirth'}){ >+ delete $data{'dateofbirth'}; >+ } >+ my @columns = &columns; >+ my %hashborrowerfields = (map {$_=>1} @columns); >+ my $query = "UPDATE borrowers SET \n"; >+ my $sth; >+ my @parameters; >+ > # test to know if you must update or not the borrower password > if (exists $data{password}) { > if ($data{password} eq '****' or $data{password} eq '') { >diff --git a/C4/Stats.pm b/C4/Stats.pm >index 11710f8..f6ad16e 100644 >--- a/C4/Stats.pm >+++ b/C4/Stats.pm >@@ -118,6 +118,26 @@ sub TotalPaid { > return @{$sth->fetchall_arrayref({})}; > } > >+sub GetPreviousCardnumbers { >+ my ( $borrowernumber ) = @_; >+ my $dbh = C4::Context->dbh; >+ >+ my $member = C4::Members::GetMember( $borrowernumber ); >+ my $cardnumber = $member->{'cardnumber'}; >+ >+ my $query = "SELECT DISTINCT(other) AS previous_cardnumber, DATE_FORMAT( datetime, '%m/%e/%Y') as previous_cardnumber_date FROM statistics WHERE type = 'card_replaced' AND borrowernumber = ? AND other != ? AND other !='' "; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $borrowernumber, $cardnumber ); >+ >+ my @results; >+ while ( my $data = $sth->fetchrow_hashref ) { >+ push( @results, $data ); >+ } >+ $sth->finish; >+ >+ return @results; >+} >+ > 1; > __END__ > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ab681f1..7364217 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -215,8 +215,9 @@ if ($findborrower) { > } > elsif ( $#borrowers == 0 ) { > $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} ); >- $query->param( 'barcode', '' ); >+ $query->param( 'barcode', '' ); > $borrowernumber = $borrowers[0]->{'borrowernumber'}; >+ $template->param( PreviousCardnumber => $borrowers[0]->{'PreviousCardnumber'} ); > } > else { > $borrowerslist = \@borrowers; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >index df78c54..0c37c08 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >@@ -418,6 +418,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- /TMPL_IF --> > > <label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->) </label> >+ <!-- TMPL_IF NAME="PreviousCardnumber" --><div><span class="circ-hlt">Warning: Scanned Old Card</span></div><!-- /TMPL_IF --> > <div class="hint">Enter item barcode:</div> > > <!-- TMPL_IF NAME="NEEDSCONFIRMATION" --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl >index 50a73da..7102e1d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl >@@ -87,6 +87,58 @@ > <div class="dialog alert">No results found</div> > <!-- /TMPL_IF --> > <!-- /TMPL_IF --> >+ <table style="width:100%"> >+ <tr> >+ <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=cardnumber">Card</a></th> >+ <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=surname">Name</a></th> >+ <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=borrowers.categorycode">Cat</a></th> >+ <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=branchcode">Library</a></th> >+ <th>Expires on</th> >+ <th>OD/Issues</th> >+ <th>Fines</th> >+ <th>Circ note</th> >+ <th> </th> >+ </tr> >+ <!-- TMPL_LOOP NAME="resultsloop" --> >+ <!-- TMPL_IF name="overdue" --> >+ <tr class="problem"> >+ <!-- TMPL_ELSE --> >+ <!-- TMPL_UNLESS name="__odd__" --> >+ <tr class="highlight"> >+ <!-- TMPL_ELSE --> >+ <tr> >+ <!-- /TMPL_UNLESS --> >+ <!-- /TMPL_IF --> >+ <td> >+ <!-- TMPL_VAR NAME="cardnumber" --> >+ <!-- TMPL_IF NAME="PreviousCardnumber" --><p class="overdue">Warning: Found With Previous Cardnumber</p><!-- /TMPL_IF --> >+ </td> >+ <td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></a> <br /> <!-- TMPL_VAR NAME="address" --><!-- TMPL_IF NAME="address2" --><br /><!-- TMPL_VAR NAME="address2" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="city" --><br /><!-- TMPL_VAR NAME=city --><!-- /TMPL_IF --><!-- TMPL_IF NAME="zipcode" --> <!-- TMPL_VAR NAME="zipcode" --><!-- /TMPL_IF --></td> >+ <td><!-- TMPL_VAR NAME="category_description" --> (<!-- TMPL_VAR name="category_type" -->)</td> >+ <td><!-- TMPL_VAR NAME="branchcode" --></td> >+ <td><!-- TMPL_VAR NAME="dateexpiry" --></td> >+ <td><!-- TMPL_IF "overdues" --><span class="overdue"><strong><!-- TMPL_VAR NAME="overdues" --></strong></span><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="overdues" --><!-- /TMPL_IF -->/<!-- TMPL_VAR NAME="issues" --></td> >+ <td><!-- TMPL_VAR NAME="fines" --></td> >+ <td><!-- TMPL_VAR NAME="borrowernotes" --></td> >+ <td><!-- TMPL_IF NAME="category_type" --> >+ <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&category_type=<!-- TMPL_VAR NAME="category_type"-->">Edit</a> >+<!-- TMPL_ELSE --> <!-- try with categorycode if no category_type --> >+ <!-- TMPL_IF NAME="categorycode" --> >+ <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&categorycode=<!-- TMPL_VAR NAME="categorycode"-->">Edit</a> >+ <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default --> >+ <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&category_type=A">Edit</a> >+ <!-- /TMPL_IF --> >+<!-- /TMPL_IF --></td> >+ </tr> >+ <!-- /TMPL_LOOP --> >+ </table> >+ <div class="pages"><!--TMPL_IF Name="multipage"--><!--TMPL_VAR Name="paginationbar" --><!--/TMPL_IF--></div> >+</div> >+<!-- TMPL_ELSE --> >+<!-- TMPL_IF NAME="searching" --> >+No results found >+<!-- /TMPL_IF --> >+<!-- /TMPL_IF --> > > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >index 2cdc13a..fe35040 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >@@ -342,6 +342,29 @@ function validate1(date) { > </div> > <div class="action"><a href="memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&step=3">Edit</a></div> > >+ <!-- TMPL_IF NAME="CAN_user_borrowers_edit_borrowers" --> >+ <!-- TMPL_IF NAME="previousCardnumbersLoop" --> >+ <div id="previouscardnumbers" > >+ <h3>Previous Cardnumbers</h3> >+ <ul> >+ <form method="post" action="restore_cardnumber.pl"> >+ <table border="0"><tr><td> >+ <select name="previous_cardnumber" id="previous_cardnumber" size="<!-- TMPL_VAR NAME="previousCardnumbersCount" -->"> >+ <!-- TMPL_LOOP NAME="previousCardnumbersLoop" --> >+ <!--TMPL_IF NAME="previous_cardnumber" --> >+ <option value="<!-- TMPL_VAR NAME="previous_cardnumber" -->"><!-- TMPL_VAR NAME="previous_cardnumber" --> : <!-- TMPL_VAR NAME="previous_cardnumber_date" --></option> >+ <!-- /TMPL_IF --> >+ <!-- /TMPL_LOOP --> >+ </select></td> >+ <input type="hidden" name="borrowernumber" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" /> >+ <td><input type="submit" value="Restore" /></td> >+ </table> >+ </form> >+ </ul> >+ </div> >+ <!-- /TMPL_IF --> >+ <!-- /TMPL_IF --> >+ > <div id="patron-alternate-address" style="padding-top: 1em;"> > <h3>Alternate Address</h3> > <!-- TMPL_UNLESS NAME="I"--><!-- TMPL_UNLESS NAME="C"--> >@@ -376,6 +399,7 @@ function validate1(date) { > </div> > <div class="action"><a href="memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&step=2">Edit</a></div> > >+ > </div> > </div> > >@@ -398,6 +422,7 @@ function validate1(date) { > <!-- /TMPL_IF --> > </div> > >+ > <div id="checkedout"> > <!-- TMPL_IF NAME="issueloop" --> > <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post" class="checkboxed"> >diff --git a/members/moremember.pl b/members/moremember.pl >index cc2f153..9c7cff4 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -52,7 +52,7 @@ use C4::Form::MessagingPreferences; > use C4::NewsChannels; #get slip news > > #use Smart::Comments; >-#use Data::Dumper; >+use Data::Dumper; > > use vars qw($debug); > >@@ -422,6 +422,15 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > $template->param(SMSnumber => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'}); > } > >+my @previousCardnumbers = C4::Stats::GetPreviousCardnumbers( $borrowernumber ); >+ >+if ( @previousCardnumbers ) { >+ $template->param( >+ previousCardnumbersLoop => \@previousCardnumbers, >+ previousCardnumbersCount => scalar( @previousCardnumbers ) >+ ); >+} >+ > $template->param( > detailview => 1, > AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), >diff --git a/members/restore_cardnumber.pl b/members/restore_cardnumber.pl >new file mode 100755 >index 0000000..1b3ea75 >--- /dev/null >+++ b/members/restore_cardnumber.pl >@@ -0,0 +1,50 @@ >+#!/usr/bin/perl >+ >+#script to delete items >+#written 2/5/00 >+#by chris@katipo.co.nz >+ >+# Copyright 2000-2002 Katipo Communications >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along with >+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA >+ >+use strict; >+ >+use CGI; >+use C4::Context; >+use C4::Output; >+use C4::Auth; >+use C4::Members; >+ >+my $input = new CGI; >+ >+my ($template, $borrowernumber, $cookie) >+ = get_template_and_user({template_name => "members/deletemem.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => {borrowers => 1}, >+ debug => 1, >+ }); >+ >+my $borrowernumber = $input->param('borrowernumber'); >+my $previous_cardnumber = $input->param('previous_cardnumber'); >+ >+ModMember( borrowernumber => $borrowernumber, cardnumber => $previous_cardnumber ); >+ >+print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); >+ >+ >-- >1.6.0.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3469
:
1326
| 3202 |
3205