koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/C4 Auth.pm AuthoritiesMarc.pm Biblio.pm Me...


From: Tumer Garip
Subject: [Koha-cvs] koha/C4 Auth.pm AuthoritiesMarc.pm Biblio.pm Me...
Date: Mon, 11 Sep 2006 17:10:00 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Tumer Garip <tgarip1957>        06/09/11 17:10:00

Modified files:
        C4             : Auth.pm AuthoritiesMarc.pm Biblio.pm Members.pm 
        C4/Circulation : Fines.pm 
Removed files:
        C4/Circulation : Date.pm 

Log message:
        Fixes bug with MARChtml2xml in Biblio.pm
        synching with dev_week

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&r1=1.181&r2=1.182
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Fines.pm?cvsroot=koha&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Date.pm?cvsroot=koha&r1=1.2&r2=0

Patches:
Index: Auth.pm
===================================================================
RCS file: /sources/koha/koha/C4/Auth.pm,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- Auth.pm     21 Jul 2006 10:15:25 -0000      1.54
+++ Auth.pm     11 Sep 2006 17:09:59 -0000      1.55
@@ -27,9 +27,7 @@
 use C4::Context;
 use C4::Output;    # to get the template
 use C4::Interface::CGI::Output;
-use C4::Circulation::Circ2;    # getpatroninformation
-use C4::Koha;
-
+use C4::Members;  # getpatroninformation
 # use Net::LDAP;
 # use Net::LDAP qw(:all);
 
@@ -58,7 +56,8 @@
                          });
 
   print $query->header(
-    -type => guesstype($template->output),
+    -type => "text/html",
+    -charset=>"utf-8",
     -cookie => $cookie
   ), $template->output;
 
@@ -76,6 +75,8 @@
 
 =cut
 
+
+
 @ISA    = qw(Exporter);
 @EXPORT = qw(
   &checkauth
@@ -108,105 +109,104 @@
 
 =cut
 
+
 sub get_template_and_user {
     my $in       = shift;
-    my $template =
-      gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
-    my ( $user, $cookie, $sessionID, $flags ) = checkauth(
-        $in->{'query'},
-        $in->{'authnotrequired'},
-        $in->{'flagsrequired'},
-        $in->{'type'}
-    );
+       my $template = gettemplate($in->{'template_name'}, 
$in->{'type'},$in->{'query'});
+       my ($user, $cookie, $sessionID, $flags)
+               = checkauth($in->{'query'}, $in->{'authnotrequired'}, 
$in->{'flagsrequired'}, $in->{'type'});
 
     my $borrowernumber;
     if ($user) {
-        $template->param( loggedinusername => $user );
-        $template->param( sessionID        => $sessionID );
+               $template->param(loggedinusername => $user);
+               $template->param(sessionID => $sessionID);
 
         $borrowernumber = getborrowernumber($user);
-        my ( $borr, $alternativeflags ) =
-          getpatroninformation( undef, $borrowernumber );
+               my ($borr, $alternativeflags) = getpatroninformation(undef, 
$borrowernumber);
         my @bordat;
         $bordat[0] = $borr;
-        $template->param( USER_INFO => address@hidden, );
+               $template->param(USER_INFO => address@hidden,
+               );
 
         # We are going to use the $flags returned by checkauth
         # to create the template's parameters that will indicate
         # which menus the user can access.
-        if ( $flags && $flags->{superlibrarian} == 1 ) {
-            $template->param( CAN_user_circulate        => 1 );
-            $template->param( CAN_user_catalogue        => 1 );
-            $template->param( CAN_user_parameters       => 1 );
-            $template->param( CAN_user_borrowers        => 1 );
-            $template->param( CAN_user_permission       => 1 );
-            $template->param( CAN_user_reserveforothers => 1 );
-            $template->param( CAN_user_borrow           => 1 );
-            $template->param( CAN_user_reserveforself   => 1 );
-            $template->param( CAN_user_editcatalogue    => 1 );
-            $template->param( CAN_user_updatecharge     => 1 );
-            $template->param( CAN_user_acquisition      => 1 );
-            $template->param( CAN_user_management       => 1 );
-            $template->param( CAN_user_tools            => 1 );
-        }
+               if ($flags && $flags->{superlibrarian} == 1)
+               {
+                       $template->param(CAN_user_circulate => 1);
+                       $template->param(CAN_user_catalogue => 1);
+                       $template->param(CAN_user_parameters => 1);
+                       $template->param(CAN_user_borrowers => 1);
+                       $template->param(CAN_user_permission => 1);
+                       $template->param(CAN_user_reserveforothers => 1);
+                       $template->param(CAN_user_borrow => 1);
+                       $template->param(CAN_user_reserveforself => 1);
+                       $template->param(CAN_user_editcatalogue => 1);
+                       $template->param(CAN_user_updatecharge => 1);
+                       $template->param(CAN_user_acquisition => 1);
+                       $template->param(CAN_user_management => 1);
+                       $template->param(CAN_user_tools => 1); }
 
-        if ( $flags && $flags->{circulate} == 1 ) {
-            $template->param( CAN_user_circulate => 1 );
-        }
+               if ($flags && $flags->{circulate} == 1) {
+                       $template->param(CAN_user_circulate => 1); }
 
-        if ( $flags && $flags->{catalogue} == 1 ) {
-            $template->param( CAN_user_catalogue => 1 );
-        }
+               if ($flags && $flags->{catalogue} == 1) {
+                       $template->param(CAN_user_catalogue => 1); }
 
-        if ( $flags && $flags->{parameters} == 1 ) {
-            $template->param( CAN_user_parameters => 1 );
-            $template->param( CAN_user_management => 1 );
-            $template->param( CAN_user_tools      => 1 );
-        }
 
-        if ( $flags && $flags->{borrowers} == 1 ) {
-            $template->param( CAN_user_borrowers => 1 );
-        }
+               if ($flags && $flags->{parameters} == 1) {
+                       $template->param(CAN_user_parameters => 1);     
+                       $template->param(CAN_user_management => 1);
+                       $template->param(CAN_user_tools => 1); }
 
-        if ( $flags && $flags->{permissions} == 1 ) {
-            $template->param( CAN_user_permission => 1 );
-        }
 
-        if ( $flags && $flags->{reserveforothers} == 1 ) {
-            $template->param( CAN_user_reserveforothers => 1 );
-        }
+               if ($flags && $flags->{borrowers} == 1) {
+                       $template->param(CAN_user_borrowers => 1); }
 
-        if ( $flags && $flags->{borrow} == 1 ) {
-            $template->param( CAN_user_borrow => 1 );
-        }
 
-        if ( $flags && $flags->{reserveforself} == 1 ) {
-            $template->param( CAN_user_reserveforself => 1 );
-        }
+               if ($flags && $flags->{permissions} == 1) {
+                       $template->param(CAN_user_permission => 1); }
 
-        if ( $flags && $flags->{editcatalogue} == 1 ) {
-            $template->param( CAN_user_editcatalogue => 1 );
-        }
+               if ($flags && $flags->{reserveforothers} == 1) {
+                       $template->param(CAN_user_reserveforothers => 1); }
 
-        if ( $flags && $flags->{updatecharges} == 1 ) {
-            $template->param( CAN_user_updatecharge => 1 );
-        }
 
-        if ( $flags && $flags->{acquisition} == 1 ) {
-            $template->param( CAN_user_acquisition => 1 );
-        }
+               if ($flags && $flags->{borrow} == 1) {
+                       $template->param(CAN_user_borrow => 1); }
 
-        if ( $flags && $flags->{management} == 1 ) {
-            $template->param( CAN_user_management => 1 );
-            $template->param( CAN_user_tools      => 1 );
-        }
 
-        if ( $flags && $flags->{tools} == 1 ) {
-            $template->param( CAN_user_tools => 1 );
+               if ($flags && $flags->{reserveforself} == 1) {
+                       $template->param(CAN_user_reserveforself => 1); }
+               
+
+               if ($flags && $flags->{editcatalogue} == 1) {
+                       $template->param(CAN_user_editcatalogue => 1); }
+               
+
+               if ($flags && $flags->{updatecharges} == 1) {
+                       $template->param(CAN_user_updatecharge => 1); }
+               
+               if ($flags && $flags->{acquisition} == 1) {
+                       $template->param(CAN_user_acquisition => 1); }
+               
+               if ($flags && $flags->{management} == 1) {
+                       $template->param(CAN_user_management => 1);
+                       $template->param(CAN_user_tools => 1); }
+               
+               if ($flags && $flags->{tools} == 1) {
+                       $template->param(CAN_user_tools => 1); }
+               
         }
+       if  ($in->{'type'} eq "intranet") {
+        $template->param(
+                        intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),  
+                        intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
+                        IntranetNav => C4::Context->preference("IntranetNav"),
+
+        );
 
     }
-    unless ( $in->{'type'} eq "intranet" ) {
+        else {
         $template->param(
             suggestion           => C4::Context->preference("suggestion"),
             virtualshelves       => C4::Context->preference("virtualshelves"),
@@ -214,26 +214,23 @@
             opacheader           => C4::Context->preference("opacheader"),
             opaccredits          => C4::Context->preference("opaccredits"),
             opacsmallimage       => C4::Context->preference("opacsmallimage"),
-            opaclayoutstylesheet =>
-              C4::Context->preference("opaclayoutstylesheet"),
-            opaccolorstylesheet =>
-              C4::Context->preference("opaccolorstylesheet"),
-            opaclanguagesdisplay =>
-              C4::Context->preference("opaclanguagesdisplay"),
+                               opaclayoutstylesheet => 
C4::Context->preference("opaclayoutstylesheet"),
+                               opaccolorstylesheet => 
C4::Context->preference("opaccolorstylesheet"),
+                               opaclanguagesdisplay => 
C4::Context->preference("opaclanguagesdisplay"),
             TemplateEncoding => C4::Context->preference("TemplateEncoding"),
             opacuserlogin    => C4::Context->preference("opacuserlogin"),
             opacbookbag      => C4::Context->preference("opacbookbag"),
         );
     }
     $template->param(
-        TemplateEncoding => C4::Context->preference('TemplateEncoding'),
-        AmazonContent    => C4::Context->preference('AmazonContent'),
-        LibraryName      => C4::Context->preference('LibraryName'),
-        branchname       => C4::Context->userenv->{'branchname'},
+                               TemplateEncoding => 
C4::Context->preference("TemplateEncoding"),
+                               AmazonContent => 
C4::Context->preference("AmazonContent"),
+                            LibraryName => 
C4::Context->preference("LibraryName"),
     );
-    return ( $template, $borrowernumber, $cookie );
+       return ($template, $borrowernumber, $cookie);
 }
 
+
 =item checkauth
 
   ($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, 
$type);
@@ -292,10 +289,11 @@
 
 =cut
 
-sub checkauth {
-    my $query = shift;
 
-# $authnotrequired will be set for scripts which will run without 
authentication
+
+sub checkauth {
+       my $query=shift;
+       # $authnotrequired will be set for scripts which will run without 
authentication
     my $authnotrequired = shift;
     my $flagsrequired   = shift;
     my $type            = shift;
@@ -306,240 +304,164 @@
     $timeout = 600 unless $timeout;
 
     my $template_name;
-    if ( $type eq 'opac' ) {
+       if ($type eq 'opac') {
         $template_name = "opac-auth.tmpl";
-    }
-    else {
+       } else {
         $template_name = "auth.tmpl";
     }
 
     # state variables
     my $loggedin = 0;
     my %info;
-    my ( $userid, $cookie, $sessionID, $flags, $envcookie );
+       my ($userid, $cookie, $sessionID, $flags,$envcookie);
     my $logout = $query->param('logout.x');
-    if ( $userid = $ENV{'REMOTE_USER'} ) {
-
+       if ($userid = $ENV{'REMOTE_USER'}) {
         # Using Basic Authentication, no cookies required
-        $cookie = $query->cookie(
-            -name    => 'sessionID',
+               $cookie=$query->cookie(-name => 'sessionID',
             -value   => '',
-            -expires => ''
-        );
+                               -expires => '');
         $loggedin = 1;
-    }
-    elsif ( $sessionID = $query->cookie('sessionID') ) {
+       } elsif ($sessionID=$query->cookie('sessionID')) {
         C4::Context->_new_userenv($sessionID);
-        if ( my %hash = $query->cookie('userenv') ) {
+               if (my %hash=$query->cookie('userenv')){
             C4::Context::set_userenv(
-                $hash{number},       $hash{id},
-                $hash{cardnumber},   $hash{firstname},
-                $hash{surname},      $hash{branch},
-                $hash{branchname},   $hash{flags},
-                $hash{emailaddress}, $hash{branchprinter}
+                                       $hash{number},
+                                       $hash{id},
+                                       $hash{cardnumber},
+                                       $hash{firstname},
+                                       $hash{surname},
+                                       $hash{branch},
+                                       $hash{branchname},
+                                       $hash{flags},
+                                       $hash{emailaddress},
             );
         }
-        my ( $ip, $lasttime );
+               my ($ip , $lasttime);
 
-        ( $userid, $ip, $lasttime ) =
-          $dbh->selectrow_array(
+               ($userid, $ip, $lasttime) = $dbh->selectrow_array(
             "SELECT userid,ip,lasttime FROM sessions WHERE sessionid=?",
-            undef, $sessionID );
+                                                               undef, 
$sessionID);
         if ($logout) {
-
             # voluntary logout the user
-            $dbh->do( "DELETE FROM sessions WHERE sessionID=?",
-                undef, $sessionID );
+               $dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, 
$sessionID);
             C4::Context->_unset_userenv($sessionID);
             $sessionID = undef;
             $userid    = undef;
             open L, ">>/tmp/sessionlog";
-            my $time = localtime( time() );
-            printf L "%20s from %16s logged out at %30s (manually).\n", 
$userid,
-              $ip, $time;
+               my $time=localtime(time());
+               printf L "%20s from %16s logged out at %30s (manually).\n", 
$userid, $ip, $time;
             close L;
         }
         if ($userid) {
-            if ( $lasttime < time() - $timeout ) {
-
+                       if ($lasttime<time()-$timeout) {
                 # timed logout
                 $info{'timed_out'} = 1;
-                $dbh->do( "DELETE FROM sessions WHERE sessionID=?",
-                    undef, $sessionID );
+                               $dbh->do("DELETE FROM sessions WHERE 
sessionID=?", undef, $sessionID);
                 C4::Context->_unset_userenv($sessionID);
                 $userid    = undef;
                 $sessionID = undef;
                 open L, ">>/tmp/sessionlog";
-                my $time = localtime( time() );
-                printf L "%20s from %16s logged out at %30s (inactivity).\n",
-                  $userid, $ip, $time;
+                               my $time=localtime(time());
+                               printf L "%20s from %16s logged out at %30s 
(inactivity).\n", $userid, $ip, $time;
                 close L;
-            }
-            elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
-
+                       } elsif ($ip ne $ENV{'REMOTE_ADDR'}) {
                 # Different ip than originally logged in from
                 $info{'oldip'}        = $ip;
                 $info{'newip'}        = $ENV{'REMOTE_ADDR'};
                 $info{'different_ip'} = 1;
-                $dbh->do( "DELETE FROM sessions WHERE sessionID=?",
-                    undef, $sessionID );
+                               $dbh->do("DELETE FROM sessions WHERE 
sessionID=?", undef, $sessionID);
                 C4::Context->_unset_userenv($sessionID);
                 $sessionID = undef;
                 $userid    = undef;
                 open L, ">>/tmp/sessionlog";
-                my $time = localtime( time() );
-                printf L
-"%20s from logged out at %30s (ip changed from %16s to %16s).\n",
-                  $userid, $time, $ip, $info{'newip'};
+                               my $time=localtime(time());
+                               printf L "%20s from logged out at %30s (ip 
changed from %16s to %16s).\n", $userid, $time, $ip, $info{'newip'};
                 close L;
-            }
-            else {
-                $cookie = $query->cookie(
-                    -name    => 'sessionID',
+                       } else {
+                               $cookie=$query->cookie(-name => 'sessionID',
                     -value   => $sessionID,
-                    -expires => ''
-                );
-                $dbh->do( "UPDATE sessions SET lasttime=? WHERE sessionID=?",
-                    undef, ( time(), $sessionID ) );
-                $flags = haspermission( $dbh, $userid, $flagsrequired );
+                                               -expires => '');
+                               $dbh->do("UPDATE sessions SET lasttime=? WHERE 
sessionID=?",
+                                       undef, (time(), $sessionID));
+                               $flags = haspermission($dbh, $userid, 
$flagsrequired);
                 if ($flags) {
                     $loggedin = 1;
-                }
-                else {
+                               } else {
                     $info{'nopermission'} = 1;
                 }
             }
         }
     }
     unless ($userid) {
-        $sessionID = int( rand() * 100000 ) . '-' . time();
-        $userid    = $query->param('userid');
+               $sessionID=int(rand()*100000).'-'.time();
+               $userid=$query->param('userid');
+               my $password=$query->param('password');
         C4::Context->_new_userenv($sessionID);
-        my $password = $query->param('password');
-        C4::Context->_new_userenv($sessionID);
-        my ( $return, $cardnumber ) = checkpw( $dbh, $userid, $password );
+               my ($return, $cardnumber) = checkpw($dbh,$userid,$password);
         if ($return) {
-            $dbh->do( "DELETE FROM sessions WHERE sessionID=? AND userid=?",
-                undef, ( $sessionID, $userid ) );
-            $dbh->do(
-"INSERT INTO sessions (sessionID, userid, ip,lasttime) VALUES (?, ?, ?, ?)",
-                undef,
-                ( $sessionID, $userid, $ENV{'REMOTE_ADDR'}, time() )
-            );
+                       $dbh->do("DELETE FROM sessions WHERE sessionID=? AND 
userid=?",
+                               undef, ($sessionID, $userid));
+                       $dbh->do("INSERT INTO sessions (sessionID, userid, 
ip,lasttime) VALUES (?, ?, ?, ?)",
+                               undef, ($sessionID, $userid, 
$ENV{'REMOTE_ADDR'}, time()));
             open L, ">>/tmp/sessionlog";
-            my $time = localtime( time() );
-            printf L "%20s from %16s logged in  at %30s.\n", $userid,
-              $ENV{'REMOTE_ADDR'}, $time;
+                       my $time=localtime(time());
+                       printf L "%20s from %16s logged in  at %30s.\n", 
$userid, $ENV{'REMOTE_ADDR'}, $time;
             close L;
-            $cookie = $query->cookie(
-                -name    => 'sessionID',
+                       $cookie=$query->cookie(-name => 'sessionID',
                 -value   => $sessionID,
-                -expires => ''
-            );
-            if ( $flags = haspermission( $dbh, $userid, $flagsrequired ) ) {
+                                               -expires => '');
+                       if ($flags = haspermission($dbh, $userid, 
$flagsrequired)) {
                 $loggedin = 1;
-            }
-            else {
+                       } else {
                 $info{'nopermission'} = 1;
                 C4::Context->_unset_userenv($sessionID);
             }
-            if ( $return == 1 ) {
-                my ( $bornum, $firstname, $surname, $userflags, $branchcode,
-                    $branchname, $branchprinter, $emailaddress );
-                my $sth =
-                  $dbh->prepare(
-"select borrowernumber, firstname, surname, flags, borrowers.branchcode, 
branches.branchname as branchname,branches.branchprinter as branchprinter, 
email from borrowers left join branches on 
borrowers.branchcode=branches.branchcode where userid=?"
-                  );
+                       if ($return == 1){
+                               my 
($bornum,$firstname,$surname,$userflags,$branchcode,$branchname,$emailaddress);
+                               my $sth=$dbh->prepare("select 
borrowernumber,firstname,surname,flags,borrowers.branchcode,branchname,emailaddress
 from borrowers left join branches on borrowers.branchcode=branches.branchcode 
where userid=?");
                 $sth->execute($userid);
-                (
-                    $bornum, $firstname, $surname, $userflags, $branchcode,
-                    $branchname, $branchprinter, $emailaddress
-                  )
-                  = $sth->fetchrow
-                  if ( $sth->rows );
-
+                               
($bornum,$firstname,$surname,$userflags,$branchcode,$branchname, $emailaddress) 
= $sth->fetchrow if ($sth->rows);
 #                              warn 
"$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-                unless ( $sth->rows ) {
-                    my $sth =
-                      $dbh->prepare(
-"select borrowernumber, firstname, surname, flags, borrowers.branchcode, 
branches.branchname as branchname, branches.branchprinter as branchprinter, 
email from borrowers left join branches on 
borrowers.branchcode=branches.branchcode where cardnumber=?"
-                      );
+                               unless ($sth->rows){
+                                       my $sth=$dbh->prepare("select 
borrowernumber,firstname,surname,flags,borrowers.branchcode,branchname,emailaddress
 from borrowers left join branches on borrowers.branchcode=branches.branchcode 
where cardnumber=?");
                     $sth->execute($cardnumber);
-                    (
-                        $bornum, $firstname, $surname, $userflags, $branchcode,
-                        $branchcode, $branchprinter, $emailaddress
-                      )
-                      = $sth->fetchrow
-                      if ( $sth->rows );
-
+                                       
($bornum,$firstname,$surname,$userflags,$branchcode, $branchname,$emailaddress) 
= $sth->fetchrow if ($sth->rows);
 #                                      warn 
"$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
-                    unless ( $sth->rows ) {
+                                       unless ($sth->rows){
                         $sth->execute($userid);
-                        (
-                            $bornum, $firstname, $surname, $userflags,
-                            $branchcode, $branchprinter, $emailaddress
-                          )
-                          = $sth->fetchrow
-                          if ( $sth->rows );
+                                               
($bornum,$firstname,$surname,$userflags,$branchcode, $branchname, 
$emailaddress) = $sth->fetchrow if ($sth->rows);
                     }
-
 #                                      warn 
"$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
                 }
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# # # # # # # #
-#  new op dev :
-# launch a sequence to check if we have a ip for the branch, if we have one we 
replace the branchcode of the userenv by the branch bound in the ip.
-                my $ip       = $ENV{'REMOTE_ADDR'};
-                my $branches = GetBranches('IS');
-                my @branchesloop;
-                my $branchprinter;
-                foreach my $br ( keys %$branches ) {
-
-                    #          now we work with the treatment of ip
-                    my $domain = $branches->{$br}->{branchip};
-                    if ( $domain && $ip =~ /^$domain/ ) {
-                        $branchcode = $branches->{$br}->{'branchcode'};
-
-            #                  new op dev : add the branchprinter and 
branchname in the cookie
-                        $branchprinter = $branches->{$br}->{'branchprinter'};
-                        $branchname    = $branches->{$br}->{'branchname'};
-                    }
-                }
-
                 my $hash = C4::Context::set_userenv(
-                    $bornum,     $userid,    $cardnumber,
-                    $firstname,  $surname,   $branchcode,
-                    $branchname, $userflags, $emailaddress,
-                    $branchprinter,
+                                       $bornum,
+                                       $userid,
+                                       $cardnumber,
+                                       $firstname,
+                                       $surname,
+                                       $branchcode,
+                                       $branchname, 
+                                       $userflags,
+                                       $emailaddress,
                 );
-
-                $envcookie = $query->cookie(
-                    -name    => 'userenv',
+#                              warn 
"$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress";
+                               $envcookie=$query->cookie(-name => 'userenv',
                     -value   => $hash,
-                    -expires => ''
-                );
-            }
-            elsif ( $return == 2 ) {
-
+                                               -expires => '');
+                       } elsif ($return == 2) {
                 #We suppose the user is the superlibrarian
                 my $hash = C4::Context::set_userenv(
-                    0,
-                    0,
+                                       0,0,
                     C4::Context->config('user'),
                     C4::Context->config('user'),
                     C4::Context->config('user'),
-                    "",
-                    1,
-                    C4::Context->preference('KohaAdminEmailAddress')
+                                       
"","",1,C4::Context->preference('KohaAdminEmailAddress')
                 );
-                $envcookie = $query->cookie(
-                    -name    => 'userenv',
+                               $envcookie=$query->cookie(-name => 'userenv',
                     -value   => $hash,
-                    -expires => ''
-                );
-            }
+                                               -expires => '');
         }
-        else {
+               } else {
             if ($userid) {
                 $info{'invalid_username_or_password'} = 1;
                 C4::Context->_unset_userenv($sessionID);
@@ -547,155 +469,124 @@
         }
     }
     my $insecure = C4::Context->boolean_preference('insecure');
-
     # finished authentification, now respond
-    if ( $loggedin || $authnotrequired || ( defined($insecure) && $insecure ) )
-    {
-
+       if ($loggedin || $authnotrequired || (defined($insecure) && $insecure)) 
{
         # successful login
         unless ($cookie) {
-            $cookie = $query->cookie(
-                -name    => 'sessionID',
+               $cookie=$query->cookie(-name => 'sessionID',
                 -value   => '',
-                -expires => ''
-            );
+                                       -expires => '');
         }
-        if ($envcookie) {
-            return ( $userid, [ $cookie, $envcookie ], $sessionID, $flags );
-        }
-        else {
-            return ( $userid, $cookie, $sessionID, $flags );
+               if ($envcookie){
+                       return ($userid, [$cookie,$envcookie], $sessionID, 
$flags)
+               } else {
+                       return ($userid, $cookie, $sessionID, $flags);
         }
     }
-
     # else we have a problem...
     # get the inputs from the incoming query
-    my @inputs = ();
-    foreach my $name ( param $query) {
-        (next) if ( $name eq 'userid' || $name eq 'password' );
+       my @inputs =();
+       foreach my $name (param $query) {
+               (next) if ($name eq 'userid' || $name eq 'password');
         my $value = $query->param($name);
-        push @inputs, { name => $name, value => $value };
+               push @inputs, {name => $name , value => $value};
     }
 
-    my $template = gettemplate( $template_name, $type, $query );
-    $template->param(
-        INPUTS                  => address@hidden,
-        intranetcolorstylesheet =>
-          C4::Context->preference("intranetcolorstylesheet"),
+       my $template = gettemplate($template_name, $type,$query);
+       $template->param(INPUTS => address@hidden,
+                       intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
         intranetstylesheet => C4::Context->preference("intranetstylesheet"),
         IntranetNav        => C4::Context->preference("IntranetNav"),
+                       opacnav => C4::Context->preference("OpacNav"),
         TemplateEncoding   => C4::Context->preference("TemplateEncoding"),
 
     );
-    $template->param( loginprompt => 1 ) unless $info{'nopermission'};
+       $template->param(loginprompt => 1) unless $info{'nopermission'};
 
-    my $self_url = $query->url( -absolute => 1 );
-    $template->param(
-        url         => $self_url,
-        LibraryName => => C4::Context->preference("LibraryName"),
-    );
-    $template->param( \%info );
-    $cookie = $query->cookie(
-        -name    => 'sessionID',
+       my $self_url = $query->url(-absolute => 1);
+       $template->param(url => $self_url, LibraryName=> => 
C4::Context->preference("LibraryName"),);
+       $template->param(\%info);
+       $cookie=$query->cookie(-name => 'sessionID',
         -value   => $sessionID,
-        -expires => ''
-    );
+                                       -expires => '');
     print $query->header(
-        -type   => guesstype( $template->output ),
+               -type => "text/html",
+               -charset=>"utf-8",
         -cookie => $cookie
-      ),
-      $template->output;
+               ), $template->output;
     exit;
 }
 
-sub checkpw {
 
-    my ( $dbh, $userid, $password ) = @_;
 
-    # INTERNAL AUTH
-    my $sth =
-      $dbh->prepare("select password,cardnumber from borrowers where 
userid=?");
-    $sth->execute($userid);
-    if ( $sth->rows ) {
-        my ( $md5password, $cardnumber ) = $sth->fetchrow;
-        if ( md5_base64($password) eq $md5password ) {
 
-#                      
C4::Context->set_userenv("$bornum",$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
-            return 1, $cardnumber;
+sub checkpw {
+
+       my ($dbh, $userid, $password) = @_;
+# INTERNAL AUTH
+       my $sth=$dbh->prepare("select password,cardnumber from borrowers where 
userid=?");
+       $sth->execute($userid);
+       if ($sth->rows) {
+               my ($md5password,$cardnumber) = $sth->fetchrow;
+               if (md5_base64($password) eq $md5password) {
+                       return 1,$cardnumber;
         }
     }
-    $sth = $dbh->prepare("select password from borrowers where cardnumber=?");
+       my $sth=$dbh->prepare("select password from borrowers where 
cardnumber=?");
     $sth->execute($userid);
-    if ( $sth->rows ) {
+       if ($sth->rows) {
         my ($md5password) = $sth->fetchrow;
-        if ( md5_base64($password) eq $md5password ) {
-
-#                      
C4::Context->set_userenv($bornum,$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
-            return 1, $userid;
+               if (md5_base64($password) eq $md5password) {
+                       return 1,$userid;
         }
     }
-    if (   $userid eq C4::Context->config('user')
-        && $password eq C4::Context->config('pass') )
-    {
-
-# Koha superuser account
-#              
C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"",1);
+       if ($userid eq C4::Context->config('user') && $password eq 
C4::Context->config('pass')) {
+               # Koha superuser account
         return 2;
     }
-    if (   $userid eq 'demo'
-        && $password eq 'demo'
-        && C4::Context->config('demo') )
-    {
-
-# DEMO => the demo user is allowed to do everything (if demo set to 1 in 
koha.conf
-# some features won't be effective : modify systempref, modify MARC structure,
+       if ($userid eq 'demo' && $password eq 'demo' && 
C4::Context->config('demo')) {
+               # DEMO => the demo user is allowed to do everything (if demo 
set to 1 in koha.conf
+               # some features won't be effective : modify systempref, modify 
MARC structure,
         return 2;
     }
     return 0;
 }
 
 sub getuserflags {
-    my $cardnumber = shift;
-    my $dbh        = shift;
+    my $cardnumber=shift;
+    my $dbh=shift;
     my $userflags;
-    my $sth = $dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?");
+    my $sth=$dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?");
     $sth->execute($cardnumber);
     my ($flags) = $sth->fetchrow;
-    $flags = 0 unless $flags;
-    $sth = $dbh->prepare("SELECT bit, flag, defaulton FROM userflags");
+    $sth=$dbh->prepare("SELECT bit, flag, defaulton FROM userflags");
     $sth->execute;
-
-    while ( my ( $bit, $flag, $defaulton ) = $sth->fetchrow ) {
-        if ( ( $flags & ( 2**$bit ) ) || $defaulton ) {
-            $userflags->{$flag} = 1;
-        }
-        else {
-            $userflags->{$flag} = 0;
+    while (my ($bit, $flag, $defaulton) = $sth->fetchrow) {
+       if (($flags & (2**$bit)) || $defaulton) {
+           $userflags->{$flag}=1;
         }
     }
     return $userflags;
 }
 
 sub haspermission {
-    my ( $dbh, $userid, $flagsrequired ) = @_;
-    my $sth = $dbh->prepare("SELECT cardnumber FROM borrowers WHERE userid=?");
+    my ($dbh, $userid, $flagsrequired) = @_;
+    my $sth=$dbh->prepare("SELECT cardnumber FROM borrowers WHERE userid=?");
     $sth->execute($userid);
     my ($cardnumber) = $sth->fetchrow;
-    ($cardnumber) || ( $cardnumber = $userid );
-    my $flags = getuserflags( $cardnumber, $dbh );
+    ($cardnumber) || ($cardnumber=$userid);
+    my $flags=getuserflags($cardnumber,$dbh);
     my $configfile;
-    if ( $userid eq C4::Context->config('user') ) {
-
+    if ($userid eq C4::Context->config('user')) {
         # Super User Account from /etc/koha.conf
-        $flags->{'superlibrarian'} = 1;
+       $flags->{'superlibrarian'}=1;
     }
-    if ( $userid eq 'demo' && C4::Context->config('demo') ) {
-
+     if ($userid eq 'demo' && C4::Context->config('demo')) {
         # Demo user that can do "anything" (demo=1 in /etc/koha.conf)
-        $flags->{'superlibrarian'} = 1;
+       $flags->{'superlibrarian'}=1;
     }
     return $flags if $flags->{superlibrarian};
-    foreach ( keys %$flagsrequired ) {
+    foreach (keys %$flagsrequired) {
         return $flags if $flags->{$_};
     }
     return 0;
@@ -704,11 +595,11 @@
 sub getborrowernumber {
     my ($userid) = @_;
     my $dbh = C4::Context->dbh;
-    for my $field ( 'userid', 'cardnumber' ) {
-        my $sth =
-          $dbh->prepare("select borrowernumber from borrowers where $field=?");
+    for my $field ('userid', 'cardnumber') {
+      my $sth=$dbh->prepare
+         ("select borrowernumber from borrowers where $field=?");
         $sth->execute($userid);
-        if ( $sth->rows ) {
+      if ($sth->rows) {
             my ($bnumber) = $sth->fetchrow;
             return $bnumber;
         }

Index: AuthoritiesMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- AuthoritiesMarc.pm  6 Sep 2006 16:21:03 -0000       1.30
+++ AuthoritiesMarc.pm  11 Sep 2006 17:09:59 -0000      1.31
@@ -167,8 +167,8 @@
        
        foreach my $linkid (@linkid){
                my $linktype=AUTHfind_authtypecode($dbh,$linkid);
-#              my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
-#              $linksummary.="<br>&nbsp;&nbsp;&nbsp;&nbsp;<a 
href='detail.pl?authid=$linkid'>".getsummary($dbh,$linkrecord,$linkid,$linktype).".</a>".$separator;
+               my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
+               $linksummary.="<br>&nbsp;&nbsp;&nbsp;&nbsp;<a 
href='detail.pl?authid=$linkid'>".getsummary($dbh,$linkrecord,$linkid,$linktype).".</a>".$separator;
                
        }
 my  $summary;
@@ -322,7 +322,7 @@
 XML_writeline($record,"auth_authid",$authid,"authorities");
 XML_writeline($record,"auth_authtypecode",$authtypecode,"authorities");
 my $xml=XML_hash2xml($record);
-       my $sth=$dbh->prepare("REPLACE auth_header set marcxml=?  
authid=?,authtypecode=?,datecreated=now()");
+       my $sth=$dbh->prepare("REPLACE auth_header set marcxml=?,  
authid=?,authtypecode=?,datecreated=now()");
        $sth->execute($xml,$authid,$authtypecode);
        $sth->finish;
        
@@ -387,10 +387,10 @@
 sub AUTHmodauthority {
 ## $record is expected to be an xmlhash
        my ($dbh,$authid,$record,$authtypecode)address@hidden;
-       my ($oldrecord)=&AUTHgetauthorityhash($dbh,$authid);
+       my ($oldrecord)=&XMLgetauthorityhash($dbh,$authid);
 ### This equality is very dodgy ,It porobaby wont work
        if ($oldrecord eq $record) {
-               return;
+               return $authid;
        }
 ##
 my $sth=$dbh->prepare("update auth_header set marcxml=? where authid=?");
@@ -399,7 +399,7 @@
 
        foreach my $linkid (@linkids){
                ##Modify the record of linked 
-               my $linkrecord=AUTHgetauthorityhash($dbh,$linkid);
+               my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
                my $linktypecode=AUTHfind_authtypecode($dbh,$linkid);
                my 
@linkfields=XML_readline_asarray($linkrecord,"auth_linkid","authorities");
                my $updated;
@@ -607,30 +607,28 @@
 return $summary;
 }
 sub getdictsummary{
-## give this a Marc record to return summary
+## give this a XML record to return a brief summary
 my ($dbh,$record,$authid,$authtypecode)address@hidden;
  my $authref = getauthtype($authtypecode);
                my $summary = $authref->{summary};
-               my @fields = $record->fields();
-#              chop $tags_using_authtype;
+               my $fields = $record->{'datafield'};
                # if the library has a summary defined, use it. Otherwise, 
build a standard one
                if ($summary) {
-                       my @fields = $record->fields();
-                       foreach my $field (@fields) {
-                               my $tag = $field->tag();
-                               my $tagvalue = $field->as_string();
-                               $summary =~ 
s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
+                       foreach my $field (@$fields) {
+                               my $tag = $field->{'tag'};                      
        
                                if ($tag<10) {
+                               my $tagvalue = 
XML_readline_onerecord($record,"","",$field->{tag});
+                               $summary =~ 
s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
                                } else {
-                                       my @subf = $field->subfields;
+                                       my @subf = 
XML_readline_withtags($record,"","",$tag);
                                        for my $i (0..$#subf) {
                                                my $subfieldcode = $subf[$i][0];
                                                my $subfieldvalue = 
$subf[$i][1];
                                                my $tagsubf = 
$tag.$subfieldcode;
                                                $summary =~ 
s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
-                                       }#for $i
+                                       }## each subf
                                }#tag >10
-                       }## each field
+                       }##each field
                        $summary =~ s/\[(.*?)]//g;
                        $summary =~ s/\n/<br>/g;
                } else {
@@ -641,27 +639,16 @@
                        my @fields = $record->{datafields};
                        if (C4::Context->preference('marcflavour') eq 
'UNIMARC') {
                        # construct UNIMARC summary, that is quite different 
from MARC21 one
+                       foreach my $field (@$fields) {
                                # accepted form
-                               foreach my $field ($record->field('2..')) {
-                                       $heading.= $field->as_string();
-                               }
-                               # rejected form(s)
-                               foreach my $field ($record->field('4..')) {
-                                       $summary.= 
"&nbsp;&nbsp;&nbsp;<i>".$field->as_string()."</i><br/>";
-                                       $summary.= 
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see:</i> ".$heading."<br/>";
-                               }
-                               # see :
-                               foreach my $field ($record->field('5..')) {
-                                       $summary.= 
"&nbsp;&nbsp;&nbsp;<i>".$field->as_string()."</i><br/>";
-                                       $summary.= 
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see:</i> ".$heading."<br/>";
+                               if ($field->{tag} = ~/'2..'/) {
+                                       foreach my $subfield ("a".."z"){
+                                       ## Fixme-- if UNICODE uses numeric 
subfields as well add them
+                                       
$heading.=XML_readline_onerecord($record,"","",$field->{tag},$subfield); 
                                }
-                               # // form
-                               foreach my $field ($record->field('7..')) {
-                                       $seeheading.= 
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> 
".$field->as_string()."<br />";     
-                                       $altheading.= 
"&nbsp;&nbsp;&nbsp;".$field->as_string()."<br />";
-                                       $altheading.= 
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$heading."<br />";
+                               }##tag 2..
                                }
-                               $summary = "<b>".$heading."</b><br 
/>".$seeheading.$altheading.$summary;        
+                               $summary = $heading;    
                        } else {
                        # construct MARC21 summary
                                foreach my $field (@fields) {   
@@ -862,8 +849,8 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.30 2006/09/06 16:21:03 tgarip1957 Exp $
-# $Log: AuthoritiesMarc.pm,v $
+# $Id: AuthoritiesMarc.pm,v 1.31 2006/09/11 17:09:59 tgarip1957 Exp $
+
 # Revision 1.30  2006/09/06 16:21:03  tgarip1957
 # Clean up before final commits
 #
@@ -916,3 +903,4 @@
 # Revision 1.1  2004/06/07 07:35:01  tipaul
 # MARC authority management package
 #
+>>>>>>> 1.30

Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -b -r1.181 -r1.182
--- Biblio.pm   6 Sep 2006 16:21:03 -0000       1.181
+++ Biblio.pm   11 Sep 2006 17:09:59 -0000      1.182
@@ -282,7 +282,7 @@
                   }                                                            
           }## created now
     }else{
-       foreach my $control(@$controlfield){
+       foreach my $control (@$controlfield){
                if ($control->{'tag'} eq $tag){
                        $control->{'content'}=$newvalue;
                        $updated=1;
@@ -621,7 +621,7 @@
     $sth->execute($frameworkcode);
     my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
 
-    while ( my ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = 
$sth->fetchrow ) {
+    while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = 
$sth->fetchrow ) {
         $res->{$tag}->{lib}        = ($forlibrarian or 
!$libopac)?$liblibrarian:$libopac;
         $res->{$tab}->{tab}        = "";            # XXX
         $res->{$tag}->{mandatory}  = $mandatory;
@@ -767,9 +767,8 @@
 
 sub MARChtml2xml {
 # warn "MARChtml2xml ";
-       my ($tags,$subfields,$values,$indicator,$ind_tag) = @_;        
-#      use MARC::File::XML;
-       my $xml= marc_record_header('UTF-8'); #### we do not need a collection 
wrapper
+       my ($tags,$subfields,$values,$indicator,$ind_tag,$tagindex) = @_;       
 
+       my $xml= "<record>";
 
     my $prevvalue;
     my $prevtag=-1;
@@ -782,8 +781,8 @@
                @$values[$i] =~ s/"/&quot;/g;
                @$values[$i] =~ s/'/&apos;/g;
 
-               if ((@$tags[$i] ne $prevtag)){
-                       my $tag=substr(@$tags[$i],0,3);
+               if ((@address@hidden ne $prevtag)){
+                       my address@hidden;
                        $j++ unless ($tag eq "");
                        ## warn 
"IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." 
"address@hidden;
                        if (!$first){
@@ -820,7 +819,7 @@
                        }
                } else { # @$tags[$i] eq $prevtag
                                  unless (@$values[$i] eq "") {
-                       my $tag=substr(@$tags[$i],0,3);
+                       my address@hidden;
                                        if ($first){
                                                my $ind1 = 
substr(@$indicator[$j],0,1);                        
                                                my $ind2 = 
substr(@$indicator[$j],1,1);
@@ -830,7 +829,7 @@
                        $xml.="<subfield 
code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
                                }
                }
-               $prevtag = @$tags[$i];
+               $prevtag = @address@hidden;
        }
        $xml.="</record>";
        # warn $xml;
@@ -968,7 +967,6 @@
 my 
$itemcallnumber=XML_readline_onerecord($xmlhash,"itemcallnumber","holdings");
 if ($itemcallnumber){
 my ($cutterextra)=itemcalculator($dbh,$biblionumber,$itemcallnumber);
-warn $cutterextra;
 $xmlhash=XML_writeline($xmlhash,"cutterextra",$cutterextra,"holdings");
 }
 
@@ -987,7 +985,7 @@
 $sth->execute($itemnumber);
 my $biblionumber=$sth->fetchrow;
 OLDdelitem( $dbh, $itemnumber ) ;
-ZEBRAop($dbh,$biblionumber,"recordDelete","biblioserver");
+ZEBRAop($dbh,$biblionumber,"specialUpdate","biblioserver");
 
 }
 
@@ -1132,7 +1130,6 @@
 my $author=XML_readline_onerecord($xmlhash,"author","biblios");
 my $xml=XML_hash2xml($xmlhash);
 
-#my $marc=MARC::Record->new_from_xml($xml,'UTF-8');## this will be depreceated
 $isbn=~ s/(\.|\?|\;|\=|\-|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/)//g;
 $issn=~ s/(\.|\?|\;|\=|\-|\/|\\|\||\:|\*|\!|\,|\(|\)|\[|\]|\{|\}|\/)//g;
 $isbn=~s/^\s+|\s+$//g;
@@ -1214,14 +1211,14 @@
 sub ZEBRAopserver{
 
 ###Accepts a $server variable thus we can use it to update  biblios, 
authorities or other zebra dbs
-my ($record,$op,$server)address@hidden;
+my ($record,$op,$server,$biblionumber)address@hidden;
 my @Zconnbiblio;
 my @port;
 my $Zpackage;
 my $tried=0;
 my $recon=0;
 my $reconnect=0;
-$record=Encode::encode("utf8",$record);
+$record=Encode::encode("UTF-8",$record);
 my $shadow=$server."shadow";
 reconnect:
 
@@ -1230,6 +1227,7 @@
 my $Zpackage = $Zconnbiblio[0]->package();
 $Zpackage->option(action => $op);
        $Zpackage->option(record => $record);
+       $Zpackage->option(recordIdOpaque => $biblionumber);
 retry:
                $Zpackage->send("update");
 my $i;
@@ -1290,16 +1288,15 @@
 my $biblioxml=XMLgetbiblio($dbh,$biblionumber);
 my @itemxml=XMLgetallitems($dbh,$biblionumber);
 my $zebraxml=collection_header();
-$zebraxml.="<koharecord>\n";
+$zebraxml.="<koharecord>";
 $zebraxml.=$biblioxml;
-$zebraxml.="<holdings>\n";
+$zebraxml.="<holdings>";
       foreach my $item(@itemxml){
-       $zebraxml.=$item;
+       $zebraxml.=$item if $item;
      }
-$zebraxml.="</holdings>\n";
-$zebraxml.="</koharecord>\n";
-$zebraxml.="</kohacollection>\n";
-
+$zebraxml.="</holdings>";
+$zebraxml.="</koharecord>";
+$zebraxml.="</kohacollection>";
 return $zebraxml;
 }
 

Index: Members.pm
===================================================================
RCS file: /sources/koha/koha/C4/Members.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Members.pm  6 Sep 2006 16:21:03 -0000       1.35
+++ Members.pm  11 Sep 2006 17:09:59 -0000      1.36
@@ -19,7 +19,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.35 2006/09/06 16:21:03 tgarip1957 Exp $
+# $Id: Members.pm,v 1.36 2006/09/11 17:09:59 tgarip1957 Exp $
 
 use strict;
 require Exporter;
@@ -36,7 +36,7 @@
 use Date::Manip;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.35 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.36 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -381,9 +381,7 @@
 =cut
 #'
 sub borrissues {
-
   my ($bornum)address@hidden;
-warn $bornum;
   my $dbh = C4::Context->dbh;
   my $sth=$dbh->prepare("Select * from issues,biblio,items where 
borrowernumber=?
    and items.itemnumber=issues.itemnumber
@@ -981,7 +979,7 @@
 my $dbh = C4::Context->dbh;
 my $sth;
     if (! $cardnumber  && $autonumber_members && $categorycode) {
-       if ($categorycode eq "A" || $categorycode eq "W" || $categorycode eq 
"C"){
+       if ($categorycode eq "A" || $categorycode eq "W" ){
         $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '5%' ");
        }elsif ($categorycode eq "L"){  
         $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '10%' ");
@@ -989,6 +987,9 @@
         $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '30%' ");
        }elsif ($categorycode eq "N"){  
         $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '40%' ");
+       }elsif ($categorycode eq "C"){  
+        $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '80%' ");
+
        }else{
         $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers 
where borrowers.cardnumber like '6%' ");
        }
@@ -1004,9 +1005,10 @@
        # determine the 1st and 9th digits and return the full string.
 
        if (! $cardnumber) {                    # If DB has no values,
-        if ($categorycode eq "A" || $categorycode eq "W" || $categorycode eq 
"C"){   $cardnumber = 5000000;}   
+        if ($categorycode eq "A" || $categorycode eq "W" ){   $cardnumber = 
5000000;}  
         elsif ($categorycode eq "L"){   $cardnumber = 1000000;}
         elsif ($categorycode  eq "F"){   $cardnumber = 3000000;}
+       elsif ($categorycode  eq "C"){   $cardnumber = 8000000;}
        else{$cardnumber = 6000000;}    
        # start at 1000000 or 3000000 or 5000000
        } else {
@@ -1209,6 +1211,127 @@
                $sth->execute($uid, $digest, $member);
                return 1;
        }
+=head2 checkuniquemember (OUEST-PROVENCE)
+
+  $result = 
&checkuniquemember($collectivity,$surname,$categorycode,$firstname,$dateofbirth);
+
+Checks that a member exists or not in the database.
+
+C<&result> is 1 (=exist) or 0 (=does not exist)
+C<&collectivity> is 1 (= we add a collectivity) or 0 (= we add a physical 
member)
+C<&surname> is the surname
+C<&categorycode> is from categorycode table
+C<&firstname> is the firstname (only if collectivity=0)
+C<&dateofbirth> is the date of birth (only if collectivity=0)
+
+=cut
+
+sub checkuniquemember {
+    my ( $collectivity, $surname, $firstname, $dateofbirth ) = @_;
+    my $dbh = C4::Context->dbh;
+    my $request;
+    if ($collectivity) {
+
+#                              $request="select count(*) from borrowers where 
surname=? and categorycode=?";
+        $request =
+          "select borrowernumber,categorycode from borrowers where surname=? ";
+    }
+    else {
+
+#                              $request="select count(*) from borrowers where 
surname=? and categorycode=? and firstname=? and dateofbirth=?";
+        $request =
+"select borrowernumber,categorycode from borrowers where surname=?  and 
firstname=? and dateofbirth=?";
+    }
+    my $sth = $dbh->prepare($request);
+    if ($collectivity) {
+        $sth->execute( uc($surname) );
+    }
+    else {
+        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
+    }
+    my @data = $sth->fetchrow;
+    if ( $data[0] ) {
+        $sth->finish;
+        return $data[0], $data[1];
+
+        #
+    }
+    else {
+        $sth->finish;
+        return 0;
+    }
+}
+=head2 getzipnamecity (OUEST-PROVENCE)
+
+take all info from table city for the fields city and  zip
+check for the name and the zip code of the city selected
+
+=cut
+
+sub getzipnamecity {
+    my ($cityid) = @_;
+    my $dbh      = C4::Context->dbh;
+    my $sth      =
+      $dbh->prepare(
+        "select city_name,city_zipcode from cities where cityid=? ");
+    $sth->execute($cityid);
+    my @data = $sth->fetchrow;
+    return $data[0], $data[1];
+}
+
+=head2 updatechildguarantor (OUEST-PROVENCE)
+
+check for title,firstname,surname,adress,zip code and city  from guarantor to 
+guarantorchild
+
+=cut
+
+#'
+
+sub getguarantordata {
+    my ($borrowerid) = @_;
+    my $dbh          = C4::Context->dbh;
+    my $sth          =
+      $dbh->prepare(
+"Select 
title,firstname,surname,streetnumber,address,streettype,address2,zipcode,city,phone,phonepro,mobile,email,emailpro,fax
  from borrowers where borrowernumber =? "
+      );
+    $sth->execute($borrowerid);
+    my $guarantor_data = $sth->fetchrow_hashref;
+    $sth->finish;
+    return $guarantor_data;
+}
+
+=head2 getdcity (OUEST-PROVENCE)
+recover cityid  with city_name condition
+=cut
+
+sub getidcity {
+    my ($city_name) = @_;
+    my $dbh = C4::Context->dbh;
+    my $sth = $dbh->prepare("select cityid from cities where city_name=? ");
+    $sth->execute($city_name);
+    my $data = $sth->fetchrow;
+    return $data;
+}
+
+=head2 getcategorytype (OUEST-PROVENCE)
+
+check for the category_type with categorycode
+and return the category_type 
+
+=cut
+
+sub getcategorytype {
+    my ($categorycode) = @_;
+    my $dbh            = C4::Context->dbh;
+    my $sth            =
+      $dbh->prepare(
+"Select category_type,description from categories where categorycode=?  "
+      );
+    $sth->execute($categorycode);
+    my ( $category_type, $description ) = $sth->fetchrow;
+    return $category_type, $description;
+}
 }
 
 

Index: Circulation/Fines.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Fines.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- Circulation/Fines.pm        1 Sep 2006 22:05:51 -0000       1.16
+++ Circulation/Fines.pm        11 Sep 2006 17:10:00 -0000      1.17
@@ -1,6 +1,6 @@
-package C4::Circulation::Fines2;
+package C4::Circulation::Fines;
 
-# $Id: Fines.pm,v 1.16 2006/09/01 22:05:51 tgarip1957 Exp $
+# $Id: Fines.pm,v 1.17 2006/09/11 17:10:00 tgarip1957 Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #

Index: Circulation/Date.pm
===================================================================
RCS file: Circulation/Date.pm
diff -N Circulation/Date.pm
--- Circulation/Date.pm 3 Sep 2005 00:54:23 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,134 +0,0 @@
-#!/usr/bin/perl -w
-
-package C4::Circulation::Date;
-
-# $id:
-
-# Copyright 2005 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 C4::Context;
-
-require Exporter;
-
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-$VERSION = do { my @v = '$Revision: 1.2 $' =~ /\d+/g;
-    shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
-};
-
address@hidden = qw(Exporter);
-
address@hidden = qw(
-  &display_date_format
-  &format_date
-  &format_date_in_iso
-);
-
-=head1 DESCRIPTION
-
-C4::Circulation::Date provides routines for format dates to display in human 
readable forms.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-=head2 get_date_format
-
-  $dateformat = get_date_format();
-
-Takes no input, and returns the format that the library prefers dates 
displayed in
-
-
-=cut
-
-sub get_date_format {
-
-    # Get the database handle
-    my $dbh = C4::Context->dbh;
-    return C4::Context->preference('dateformat');
-}
-
-=head2 display_date_format
-
-  $displaydateformat = display_date_format();
-
-Takes no input, and returns a string showing the format the library likes 
dates displayed in
-
-
-=cut
-
-sub display_date_format {
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq "us" ) {
-        return "mm/dd/yyyy";
-    }
-    elsif ( $dateformat eq "metric" ) {
-        return "dd/mm/yyyy";
-    }
-    elsif ( $dateformat eq "iso" ) {
-        return "yyyy-mm-dd";
-    }
-    else {
-        return
-"Invalid date format: $dateformat. Please change in system preferences";
-    }
-}
-
-=head2 format_date
-
-  $formatteddate = format_date($date);
-
-Takes a date, from mysql and returns it in the format specified by the library
-This is less flexible than C4::Date::format_date, which can handle dates of 
many formats 
-if you need that flexibility use C4::Date, if you are just using it to format 
the output from mysql as
-in circulation.pl use this one, it is much faster.
-=cut
-
-
-sub format_date {
-    my $olddate = shift;
-    my $newdate;
-
-    if ( !$olddate ) {
-        return "";
-    }
-
-    my $dateformat = get_date_format();
-
-    if ( $dateformat eq "us" ) {
-       my @datearray=split('-',$olddate);
-       $newdate = "$datearray[1]/$datearray[2]/$datearray[0]";
-    }
-    elsif ( $dateformat eq "metric" ) {
-       my @datearray=split('-',$olddate);
-       $newdate = "$datearray[2]/$datearray[1]/$datearray[0]";
-    }
-    elsif ( $dateformat eq "iso" ) {
-        $newdate = $olddate;
-    }
-    else {
-        return
-"Invalid date format: $dateformat. Please change in system preferences";
-    }
-}
-
-1;




reply via email to

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