X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FBranch.pm;h=21530287fbecf355db417e2c9690b1fd9fd8d181;hb=937480abe03863215c8134e67f56e1b968aaf229;hp=b402ab89745c16cf8068fe9d5e057da9173a325a;hpb=29eadaa1f7be053c347e02825a3080ba6cbfd9db;p=koha_gimpoz diff --git a/C4/Branch.pm b/C4/Branch.pm index b402ab8974..21530287fb 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -20,7 +20,6 @@ use strict; #use warnings; FIXME - Bug 2505 require Exporter; use C4::Context; -use C4::Koha; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -46,6 +45,7 @@ BEGIN { &DelBranch &DelBranchCategory &CheckCategoryUnique + &mybranch ); @EXPORT_OK = qw( &onlymine &mybranch get_branch_code_from_name ); } @@ -68,11 +68,12 @@ The functions in this module deal with branches. $branches = &GetBranches(); - Returns informations about ALL branches, IndependantBranches Insensitive. - GetBranchInfo() returns the same information without the problems of this function - (namespace collision, mainly). - Create a branch selector with the following code. - +Returns informations about ALL branches, IndependantBranches Insensitive. +GetBranchInfo() returns the same information without the problems of this function +(namespace collision, mainly). + +Create a branch selector with the following code. + =head3 in PERL SCRIPT my $branches = GetBranches; @@ -158,7 +159,7 @@ sub GetBranchesLoop (;$$) { # since this is what most pages want anyway my $onlymine = @_ ? shift : onlymine(); my $branches = GetBranches($onlymine); my @loop; - foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { + foreach ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches ) { push @loop, { value => $_, selected => ($_ eq $branch) ? 1 : 0, @@ -201,21 +202,22 @@ sub ModBranch { my $query = " INSERT INTO branches (branchcode,branchname,branchaddress1, - branchaddress2,branchaddress3,branchzip,branchcity, + branchaddress2,branchaddress3,branchzip,branchcity,branchstate, branchcountry,branchphone,branchfax,branchemail, - branchurl,branchip,branchprinter,branchnotes) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + branchurl,branchip,branchprinter,branchnotes,opac_info) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; my $sth = $dbh->prepare($query); $sth->execute( $data->{'branchcode'}, $data->{'branchname'}, $data->{'branchaddress1'}, $data->{'branchaddress2'}, $data->{'branchaddress3'}, $data->{'branchzip'}, - $data->{'branchcity'}, $data->{'branchcountry'}, + $data->{'branchcity'}, $data->{'branchstate'}, + $data->{'branchcountry'}, $data->{'branchphone'}, $data->{'branchfax'}, $data->{'branchemail'}, $data->{'branchurl'}, $data->{'branchip'}, $data->{'branchprinter'}, - $data->{'branchnotes'}, + $data->{'branchnotes'}, $data->{opac_info}, ); return 1 if $dbh->err; } else { @@ -223,9 +225,9 @@ sub ModBranch { UPDATE branches SET branchname=?,branchaddress1=?, branchaddress2=?,branchaddress3=?,branchzip=?, - branchcity=?,branchcountry=?,branchphone=?, + branchcity=?,branchstate=?,branchcountry=?,branchphone=?, branchfax=?,branchemail=?,branchurl=?,branchip=?, - branchprinter=?,branchnotes=? + branchprinter=?,branchnotes=?,opac_info=? WHERE branchcode=? "; my $sth = $dbh->prepare($query); @@ -233,11 +235,12 @@ sub ModBranch { $data->{'branchname'}, $data->{'branchaddress1'}, $data->{'branchaddress2'}, $data->{'branchaddress3'}, $data->{'branchzip'}, - $data->{'branchcity'}, $data->{'branchcountry'}, + $data->{'branchcity'}, $data->{'branchstate'}, + $data->{'branchcountry'}, $data->{'branchphone'}, $data->{'branchfax'}, $data->{'branchemail'}, $data->{'branchurl'}, $data->{'branchip'}, $data->{'branchprinter'}, - $data->{'branchnotes'}, + $data->{'branchnotes'}, $data->{opac_info}, $data->{'branchcode'}, ); } @@ -404,34 +407,6 @@ sub GetBranchDetail { return $sth->fetchrow_hashref(); } -=head2 get_branchinfos_of - - my $branchinfos_of = get_branchinfos_of(@branchcodes); - -Associates a list of branchcodes to the information of the branch, taken in -branches table. - -Returns a href where keys are branchcodes and values are href where keys are -branch information key. - - print 'branchname is ', $branchinfos_of->{$code}->{branchname}; - -=cut - -sub get_branchinfos_of { - my @branchcodes = @_; - - my $query = ' - SELECT branchcode, - branchname - FROM branches - WHERE branchcode IN (' - . join( ',', map( { "'" . $_ . "'" } @branchcodes ) ) . ') -'; - return C4::Koha::get_infos_of( $query, 'branchcode' ); -} - - =head2 GetBranchesInCategory my $branches = GetBranchesInCategory($categorycode); @@ -610,6 +585,6 @@ __END__ =head1 AUTHOR -Koha Development Team +Koha Development Team =cut