View | Details | Raw Unified | Return to bug 3469
Collapse All | Expand All

(-)a/C4/Members.pm (+45 lines)
Lines 242-247 sub SearchMember { Link Here
242
    my @results;
242
    my @results;
243
    $data = $sth->fetchall_arrayref({});
243
    $data = $sth->fetchall_arrayref({});
244
244
245
    $sth->finish;
246
247
    $query = "SELECT borrowers.*, categories.* FROM borrowers 
248
    LEFT JOIN categories ON borrowers.categorycode=categories.categorycode
249
    LEFT JOIN statistics ON borrowers.borrowernumber = statistics.borrowernumber
250
    WHERE statistics.type = 'card_replaced' AND statistics.other = ? GROUP BY statistics.other";
251
    $sth = $dbh->prepare( $query );
252
    $sth->execute( $searchstring );
253
    my $prevcards_data = $sth->fetchall_arrayref({});
254
    foreach my $row ( @$prevcards_data ) {
255
      $row->{'PreviousCardnumber'} = 1;
256
    }
257
        
258
    $data = [ @$prevcards_data, @$data ];
259
245
    return ( scalar(@$data), $data );
260
    return ( scalar(@$data), $data );
246
}
261
}
247
262
Lines 705-710 true on success, or false on failure Link Here
705
720
706
sub ModMember {
721
sub ModMember {
707
    my (%data) = @_;
722
    my (%data) = @_;
723
    my $dbh = C4::Context->dbh;
724
    
725
    my $member = GetMemberDetails( $data{'borrowernumber'} );
726
    
727
    if ( $member->{'cardnumber'} ne  $data{'cardnumber'} ) {
728
      C4::Stats::UpdateStats( C4::Context->userenv->{branch}, 'card_replaced', '', $member->{'cardnumber'}, '', '', $data{'borrowernumber'} );
729
    }
730
731
    my $iso_re = C4::Dates->new()->regexp('iso');
732
    foreach (qw(dateofbirth dateexpiry dateenrolled)) {
733
        if (my $tempdate = $data{$_}) {                                 # assignment, not comparison
734
            ($tempdate =~ /$iso_re/) and next;                          # Congatulations, you sent a valid ISO date.
735
            warn "ModMember given $_ not in ISO format ($tempdate)";
736
            my $tempdate2 = format_date_in_iso($tempdate);
737
            if (!$tempdate2 or $tempdate2 eq '0000-00-00') {
738
                warn "ModMember cannot convert '$tempdate' (from syspref to ISO)";
739
                next;
740
            }
741
            $data{$_} = $tempdate2;
742
        }
743
    }
744
    if (!$data{'dateofbirth'}){
745
        delete $data{'dateofbirth'};
746
    }
747
    my @columns = &columns;
748
    my %hashborrowerfields = (map {$_=>1} @columns);
749
    my $query = "UPDATE borrowers SET \n";
750
    my $sth;
751
    my @parameters;  
752
    
708
    # test to know if you must update or not the borrower password
753
    # test to know if you must update or not the borrower password
709
    if (exists $data{password}) {
754
    if (exists $data{password}) {
710
        if ($data{password} eq '****' or $data{password} eq '') {
755
        if ($data{password} eq '****' or $data{password} eq '') {
(-)a/C4/Stats.pm (+20 lines)
Lines 118-123 sub TotalPaid { Link Here
118
    return @{$sth->fetchall_arrayref({})};
118
    return @{$sth->fetchall_arrayref({})};
119
}
119
}
120
120
121
sub GetPreviousCardnumbers {
122
  my ( $borrowernumber ) = @_;
123
  my $dbh = C4::Context->dbh;
124
  
125
  my $member = C4::Members::GetMember( $borrowernumber );
126
  my $cardnumber = $member->{'cardnumber'};
127
  
128
  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 !='' ";
129
  my $sth = $dbh->prepare( $query );
130
  $sth->execute( $borrowernumber, $cardnumber );
131
132
  my @results;
133
  while ( my $data = $sth->fetchrow_hashref ) {
134
    push( @results, $data );
135
  }
136
  $sth->finish;
137
138
  return @results;  
139
}
140
                          
121
1;
141
1;
122
__END__
142
__END__
123
143
(-)a/circ/circulation.pl (-1 / +2 lines)
Lines 215-222 if ($findborrower) { Link Here
215
    }
215
    }
216
    elsif ( $#borrowers == 0 ) {
216
    elsif ( $#borrowers == 0 ) {
217
        $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
217
        $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
218
        $query->param( 'barcode',           '' );
218
        $query->param( 'barcode', '' );
219
        $borrowernumber = $borrowers[0]->{'borrowernumber'};
219
        $borrowernumber = $borrowers[0]->{'borrowernumber'};
220
        $template->param( PreviousCardnumber => $borrowers[0]->{'PreviousCardnumber'} );
220
    }
221
    }
221
    else {
222
    else {
222
        $borrowerslist = \@borrowers;
223
        $borrowerslist = \@borrowers;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl (+1 lines)
Lines 418-423 No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> Link Here
418
    <!-- /TMPL_IF -->
418
    <!-- /TMPL_IF -->
419
419
420
    <label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->) </label>
420
    <label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->) </label>
421
    <!-- TMPL_IF NAME="PreviousCardnumber" --><div><span class="circ-hlt">Warning: Scanned Old Card</span></div><!-- /TMPL_IF -->
421
	<div class="hint">Enter item barcode:</div>
422
	<div class="hint">Enter item barcode:</div>
422
423
423
    <!-- TMPL_IF NAME="NEEDSCONFIRMATION" -->
424
    <!-- TMPL_IF NAME="NEEDSCONFIRMATION" -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl (+52 lines)
Lines 87-92 Link Here
87
						<div class="dialog alert">No results found</div>
87
						<div class="dialog alert">No results found</div>
88
						<!-- /TMPL_IF -->
88
						<!-- /TMPL_IF -->
89
						<!-- /TMPL_IF -->
89
						<!-- /TMPL_IF -->
90
    <table style="width:100%">
91
    <tr>
92
    <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&amp;orderby=cardnumber">Card</a></th>
93
    <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&amp;orderby=surname">Name</a></th>
94
    <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&amp;orderby=borrowers.categorycode">Cat</a></th>
95
    <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&amp;orderby=branchcode">Library</a></th>
96
    <th>Expires on</th>
97
    <th>OD/Issues</th>
98
    <th>Fines</th>
99
    <th>Circ note</th>
100
	<th>&nbsp;</th>
101
    </tr>
102
    <!-- TMPL_LOOP NAME="resultsloop" -->
103
    <!-- TMPL_IF name="overdue" -->
104
    <tr class="problem">
105
    <!-- TMPL_ELSE -->
106
    <!-- TMPL_UNLESS name="__odd__" -->
107
    <tr class="highlight">
108
    <!-- TMPL_ELSE -->
109
    <tr>
110
    <!-- /TMPL_UNLESS -->
111
    <!-- /TMPL_IF -->
112
    <td>
113
	<!-- TMPL_VAR NAME="cardnumber" -->
114
        <!-- TMPL_IF NAME="PreviousCardnumber" --><p class="overdue">Warning: Found With Previous Cardnumber</p><!-- /TMPL_IF -->
115
    </td>
116
    <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>
117
    <td><!-- TMPL_VAR NAME="category_description" --> (<!-- TMPL_VAR name="category_type" -->)</td>
118
    <td><!-- TMPL_VAR NAME="branchcode" --></td>
119
    <td><!-- TMPL_VAR NAME="dateexpiry" --></td>
120
    <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>
121
    <td><!-- TMPL_VAR NAME="fines" --></td>
122
    <td><!-- TMPL_VAR NAME="borrowernotes" --></td>
123
	<td><!-- TMPL_IF NAME="category_type" -->
124
            <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">Edit</a>
125
<!-- TMPL_ELSE --> <!-- try with categorycode if no category_type -->
126
 	<!-- TMPL_IF NAME="categorycode" -->
127
            <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode"-->">Edit</a>
128
    <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default -->
129
            <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=A">Edit</a>
130
    <!-- /TMPL_IF -->
131
<!-- /TMPL_IF --></td>
132
    </tr>
133
    <!-- /TMPL_LOOP -->
134
    </table>
135
	<div class="pages"><!--TMPL_IF Name="multipage"--><!--TMPL_VAR Name="paginationbar" --><!--/TMPL_IF--></div>
136
</div>
137
<!-- TMPL_ELSE -->
138
<!-- TMPL_IF NAME="searching" -->
139
No results found
140
<!-- /TMPL_IF -->
141
<!-- /TMPL_IF -->
90
142
91
					</div>
143
					</div>
92
				</div>
144
				</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl (+25 lines)
Lines 342-347 function validate1(date) { Link Here
342
 </div>
342
 </div>
343
    <div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;step=3">Edit</a></div>
343
    <div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;step=3">Edit</a></div>
344
 
344
 
345
 <!-- TMPL_IF NAME="CAN_user_borrowers_edit_borrowers" -->
346
 <!-- TMPL_IF NAME="previousCardnumbersLoop" -->
347
  <div id="previouscardnumbers" >
348
      <h3>Previous Cardnumbers</h3>
349
        <ul>
350
		<form method="post" action="restore_cardnumber.pl">
351
			<table border="0"><tr><td>
352
			<select name="previous_cardnumber" id="previous_cardnumber" size="<!-- TMPL_VAR NAME="previousCardnumbersCount" -->">
353
			        <!-- TMPL_LOOP NAME="previousCardnumbersLoop" -->
354
			    	  <!--TMPL_IF NAME="previous_cardnumber" -->
355
			            <option value="<!-- TMPL_VAR NAME="previous_cardnumber" -->"><!-- TMPL_VAR NAME="previous_cardnumber" --> : <!-- TMPL_VAR NAME="previous_cardnumber_date" --></option>
356
			          <!-- /TMPL_IF -->
357
			        <!-- /TMPL_LOOP -->
358
			</select></td>
359
			<input type="hidden" name="borrowernumber" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
360
			<td><input type="submit" value="Restore" /></td>
361
			</table>
362
		</form>
363
      </ul>
364
  </div>    
365
 <!-- /TMPL_IF -->
366
 <!-- /TMPL_IF -->
367
345
 <div id="patron-alternate-address" style="padding-top: 1em;">
368
 <div id="patron-alternate-address" style="padding-top: 1em;">
346
    <h3>Alternate Address</h3>
369
    <h3>Alternate Address</h3>
347
    <!-- TMPL_UNLESS NAME="I"--><!-- TMPL_UNLESS NAME="C"-->
370
    <!-- TMPL_UNLESS NAME="I"--><!-- TMPL_UNLESS NAME="C"-->
Lines 376-381 function validate1(date) { Link Here
376
</div>
399
</div>
377
<div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;step=2">Edit</a></div>
400
<div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;step=2">Edit</a></div>
378
401
402
379
</div>
403
</div>
380
</div>
404
</div>
381
405
Lines 398-403 function validate1(date) { Link Here
398
    <!-- /TMPL_IF -->
422
    <!-- /TMPL_IF -->
399
</div>
423
</div>
400
424
425
401
<div id="checkedout">
426
<div id="checkedout">
402
    <!-- TMPL_IF NAME="issueloop" -->
427
    <!-- TMPL_IF NAME="issueloop" -->
403
    <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post" class="checkboxed">
428
    <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post" class="checkboxed">
(-)a/members/moremember.pl (-1 / +10 lines)
Lines 52-58 use C4::Form::MessagingPreferences; Link Here
52
use C4::NewsChannels; #get slip news
52
use C4::NewsChannels; #get slip news
53
53
54
#use Smart::Comments;
54
#use Smart::Comments;
55
#use Data::Dumper;
55
use Data::Dumper;
56
56
57
use vars qw($debug);
57
use vars qw($debug);
58
58
Lines 422-427 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
422
    $template->param(SMSnumber     => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'});
422
    $template->param(SMSnumber     => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'});
423
}
423
}
424
424
425
my @previousCardnumbers = C4::Stats::GetPreviousCardnumbers( $borrowernumber );
426
427
if ( @previousCardnumbers ) {
428
  $template->param(
429
    previousCardnumbersLoop => \@previousCardnumbers,
430
    previousCardnumbersCount => scalar( @previousCardnumbers )
431
  );
432
}
433
425
$template->param(
434
$template->param(
426
    detailview => 1,
435
    detailview => 1,
427
    AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
436
    AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
(-)a/members/restore_cardnumber.pl (-1 / +50 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
#script to delete items
4
#written 2/5/00
5
#by chris@katipo.co.nz
6
7
# Copyright 2000-2002 Katipo Communications
8
#
9
# This file is part of Koha.
10
#
11
# Koha is free software; you can redistribute it and/or modify it under the
12
# terms of the GNU General Public License as published by the Free Software
13
# Foundation; either version 2 of the License, or (at your option) any later
14
# version.
15
#
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License along with
21
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22
# Suite 330, Boston, MA  02111-1307 USA
23
24
use strict;
25
26
use CGI;
27
use C4::Context;
28
use C4::Output;
29
use C4::Auth;
30
use C4::Members;
31
32
my $input = new CGI;
33
34
my ($template, $borrowernumber, $cookie)
35
                = get_template_and_user({template_name => "members/deletemem.tmpl",
36
                                        query => $input,
37
                                        type => "intranet",
38
                                        authnotrequired => 0,
39
                                        flagsrequired => {borrowers => 1},
40
                                        debug => 1,
41
                                        });
42
43
my $borrowernumber = $input->param('borrowernumber');
44
my $previous_cardnumber = $input->param('previous_cardnumber');
45
46
ModMember( borrowernumber => $borrowernumber, cardnumber => $previous_cardnumber );
47
48
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
49
50

Return to bug 3469