koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/Members.pm koha-tmpl/intranet-tmpl/prog...


From: Chris Cormack
Subject: [Koha-cvs] koha C4/Members.pm koha-tmpl/intranet-tmpl/prog...
Date: Sun, 08 Jul 2007 23:07:34 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Chris Cormack <rangi>   07/07/08 23:07:33

Modified files:
        C4             : Members.pm 
        koha-tmpl/intranet-tmpl/prog/en/members: memberentryA.tmpl 
                                                 memberentryC.tmpl 
                                                 memberentryI.tmpl 
        members        : memberentry.pl 

Log message:
        Fix for bug 1295 adding a borrower with the same cardnumber

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl?cvsroot=koha&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl?cvsroot=koha&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl?cvsroot=koha&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/koha/members/memberentry.pl?cvsroot=koha&r1=1.46&r2=1.47

Patches:
Index: C4/Members.pm
===================================================================
RCS file: /sources/koha/koha/C4/Members.pm,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- C4/Members.pm       2 Jul 2007 00:38:17 -0000       1.54
+++ C4/Members.pm       8 Jul 2007 23:07:31 -0000       1.55
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Members.pm,v 1.54 2007/07/02 00:38:17 rangi Exp $
+# $Id: Members.pm,v 1.55 2007/07/08 23:07:31 rangi Exp $
 
 use strict;
 require Exporter;
@@ -31,7 +31,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.54 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.55 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -116,6 +116,7 @@
   &fixEthnicity
   &ethnicitycategories 
   &fixup_cardnumber
+       &checkcardnumber
 );
 =item SearchMember
 
@@ -1234,6 +1235,22 @@
     }
 }
 
+sub checkcardnumber {
+       my ($cardnumber) = @_;
+       my $dbh = C4::Context->dbh;
+       my $query = "SELECT * FROM borrowers WHERE cardnumber=?";
+       my $sth = $dbh->prepare($query);
+       $sth->execute($cardnumber);
+       if (my $data= $sth->fetchrow_hashref()){
+               return 1;
+       }
+       else {
+               return 0;
+       }
+       $sth->finish();
+}  
+
+
 =head2 getzipnamecity (OUEST-PROVENCE)
 
 take all info from table city for the fields city and  zip
@@ -1606,6 +1623,7 @@
 sub DelMember {
     my $dbh            = C4::Context->dbh;
     my $borrowernumber = shift;
+       warn "in delmember with $borrowernumber";
     return unless $borrowernumber;    # borrowernumber is mandatory.
 
     my $query = qq|DELETE 
@@ -1619,7 +1637,7 @@
        FROM borrowers
        WHERE borrowernumber = ?
    ";
-    $sth = $dbh->prepare($query);
+    my $sth = $dbh->prepare($query);
     $sth->execute($borrowernumber);
     $sth->finish;
     
&logaction(C4::Context->userenv->{'number'},"MEMBERS","DELETE",$borrowernumber,"")
 

Index: koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl   3 Jul 2007 
18:19:50 -0000       1.20
+++ koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl   8 Jul 2007 
23:07:33 -0000       1.21
@@ -43,6 +43,9 @@
                        <!-- TMPL_IF NAME="ERROR_login_exist" -->
                                <p>login/password already exist</p>
                        <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_cardnumber" -->
+                               <p>Cardnumber already in use</p>
+                       <!-- /TMPL_IF -->
                         <!-- TMPL_IF NAME="ERROR_age_limitations" -->
                                 Patron is too young or too old for this 
category
                         <!-- /TMPL_IF -->
@@ -138,7 +141,7 @@
                <label>
                <!-- /TMPL_IF-->
                Surname</label>
-               <! --TMPL_IF NAME="uppercasesurnames" -->
+               <!-- TMPL_IF NAME="uppercasesurnames" -->
                <input style="text-transform:uppercase;" type="text" 
name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >
                <!-- TMPL_ELSE -->
                <input style="text-transform:capitalize;" type="text" 
name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >

Index: koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl   3 Jul 2007 
18:19:51 -0000       1.20
+++ koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl   8 Jul 2007 
23:07:33 -0000       1.21
@@ -40,6 +40,9 @@
                        <!-- TMPL_IF NAME="ERROR_login_exist" -->
                                <p>login/password already exist</p>
                        <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_cardnumber" -->                
         
+                          <p>Cardnumber already in use</p>                 
+                        <!-- /TMPL_IF -->
                        <!-- TMPL_IF NAME="ERROR_age_limitations" -->
                                 Patron is too young or too old for this 
category
                         <!-- /TMPL_IF -->

Index: koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl   3 Jul 2007 
18:19:51 -0000       1.15
+++ koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl   8 Jul 2007 
23:07:33 -0000       1.16
@@ -37,6 +37,9 @@
             <h1>ERROR</h1>
             <div id="problem">
                 <p>The following fields are wrong. Please fix it/them</p>
+                                <!-- TMPL_IF NAME="ERROR_cardnumber" -->       
        
+                                  <p>Cardnumber already in use</p>         
+                                <!-- /TMPL_IF -->
                 <!-- TMPL_IF NAME="ERROR_login_exist" -->
                     <p>login/password already exist</p>
                 <!-- /TMPL_IF -->

Index: members/memberentry.pl
===================================================================
RCS file: /sources/koha/koha/members/memberentry.pl,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- members/memberentry.pl      2 Jul 2007 02:30:16 -0000       1.46
+++ members/memberentry.pl      8 Jul 2007 23:07:33 -0000       1.47
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: memberentry.pl,v 1.46 2007/07/02 02:30:16 rangi Exp $
+# $Id: memberentry.pl,v 1.47 2007/07/08 23:07:33 rangi Exp $
 
 # Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
 #
@@ -83,6 +83,7 @@
 # NOTE: Alert for ethnicity and ethnotes fields, they are unvalided in all 
borrowers form
 my $borrower_data;
 
+
 $template->param("uppercasesurnames" => 
C4::Context->preference('uppercasesurnames'));
 
 #function  to automatic setup the mandatory  fields (visual with css)
@@ -148,6 +149,10 @@
        # CHECKS step by step
 # STEP 1
     if ($step eq 1) {
+               if (checkcardnumber($cardnumber)){ 
+                       push @errors, 'ERROR_cardnumber';
+                       $nok = 1;
+               } 
         ###############test to take the right zipcode and city name 
##############
         if ( $guarantorid eq ''){
           if ($select_city){




reply via email to

[Prev in Thread] Current Thread [Next in Thread]