[Koha-cvs] koha C4/Auth.pm C4/Koha.pm C4/Circulation/Circ2... [rel_3_0]
Antoine Farnault
antoine at koha-fr.org
Thu Dec 14 16:41:57 CET 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/12/14 15:41:55
Modified files:
C4 : Auth.pm Koha.pm
C4/Circulation : Circ2.pm
acqui : lateorders.pl neworderempty.pl orderreceive.pl
admin : aqbookfund.pl aqbudget.pl branches.pl
issuingrules.pl
catalogue : ISBDdetail.pl MARCdetail.pl search.pl
cataloguing : additem-nomarc.pl
cataloguing/value_builder: unimarc_field_4XX.pl
circ : bookcount.pl branchreserves.pl
branchtransfers.pl circulation.pl returns.pl
selectbranchprinter.pl
waitingreservestransfers.pl
export : marc.pl
koha-tmpl/intranet-tmpl/prog/en/acqui: supplier.tmpl
koha-tmpl/intranet-tmpl/prog/en/admin: branches.tmpl
members : memberentry.pl moremember.pl pay.pl
opac : opac-ISBDdetail.pl opac-MARCdetail.pl
opac-main.pl opac-reserve.pl opac-search.pl
opac-user.pl
reports : bor_issues_top.pl borrowers_stats.pl
cat_issues_top.pl catalogue_out.pl
catalogue_stats.pl issues_avg_stats.pl
issues_by_borrower_category.plugin
issues_stats.pl itemtypes.plugin
reservereport.pl
reserve : request.pl
serials : serials-recieve.pl subscription-add.pl
tools : export.pl inventory.pl itemslost.pl
overduerules.pl
Added files:
C4 : Branch.pm
Log message:
admin/branches.pl works now with mod_perl.
New module : Branch.pm containt all functions dealings with branches.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.54.2.16&r2=1.54.2.17
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.40.2.27&r2=1.40.2.28
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Branch.pm?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.25&r2=1.114.2.26
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/lateorders.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.1&r2=1.6.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/neworderempty.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/orderreceive.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2&r2=1.2.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/admin/aqbookfund.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.29.2.2&r2=1.29.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/admin/aqbudget.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.22.2.2&r2=1.22.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/admin/branches.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.34.2.2&r2=1.34.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/admin/issuingrules.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.9&r2=1.9.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/ISBDdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.2&r2=1.2.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/MARCdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.6&r2=1.5.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.9&r2=1.1.2.10
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/additem-nomarc.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.2&r2=1.4.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/value_builder/unimarc_field_4XX.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.8&r2=1.1.2.9
http://cvs.savannah.gnu.org/viewcvs/koha/circ/bookcount.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.6&r2=1.1.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/circ/branchreserves.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.10&r2=1.2.2.11
http://cvs.savannah.gnu.org/viewcvs/koha/circ/branchtransfers.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.24.2.6&r2=1.24.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/circ/circulation.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.97.2.15&r2=1.97.2.16
http://cvs.savannah.gnu.org/viewcvs/koha/circ/returns.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.43.2.9&r2=1.43.2.10
http://cvs.savannah.gnu.org/viewcvs/koha/circ/selectbranchprinter.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.16.2.2&r2=1.16.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/circ/waitingreservestransfers.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.4&r2=1.4.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/export/marc.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.7.2.3&r2=1.7.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/acqui/supplier.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.3&r2=1.2.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/members/memberentry.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.38.2.17&r2=1.38.2.18
http://cvs.savannah.gnu.org/viewcvs/koha/members/moremember.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.28.2.15&r2=1.28.2.16
http://cvs.savannah.gnu.org/viewcvs/koha/members/pay.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.5&r2=1.4.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-ISBDdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.16.2.4&r2=1.16.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-MARCdetail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.14.2.4&r2=1.14.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-main.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.23.2.4&r2=1.23.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-reserve.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.29.2.7&r2=1.29.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.38.2.8&r2=1.38.2.9
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-user.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.23.2.5&r2=1.23.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/reports/bor_issues_top.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.8.2.4&r2=1.8.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/reports/borrowers_stats.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.10.2.3&r2=1.10.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/reports/cat_issues_top.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.10.2.4&r2=1.10.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/reports/catalogue_out.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.3&r2=1.5.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/reports/catalogue_stats.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.17.2.2&r2=1.17.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/reports/issues_avg_stats.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.4&r2=1.5.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/reports/issues_by_borrower_category.plugin?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.1&r2=1.4.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/reports/issues_stats.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.13.2.2&r2=1.13.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/reports/itemtypes.plugin?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.1&r2=1.3.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/reports/reservereport.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.9.2.2&r2=1.9.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/reserve/request.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.12&r2=1.6.2.13
http://cvs.savannah.gnu.org/viewcvs/koha/serials/serials-recieve.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.5&r2=1.4.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-add.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.9&r2=1.6.2.10
http://cvs.savannah.gnu.org/viewcvs/koha/tools/export.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.4&r2=1.1.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/tools/inventory.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/tools/itemslost.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/overduerules.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
Patches:
Index: C4/Auth.pm
===================================================================
RCS file: /sources/koha/koha/C4/Auth.pm,v
retrieving revision 1.54.2.16
retrieving revision 1.54.2.17
diff -u -b -r1.54.2.16 -r1.54.2.17
--- C4/Auth.pm 29 Nov 2006 17:24:56 -0000 1.54.2.16
+++ C4/Auth.pm 14 Dec 2006 15:41:53 -0000 1.54.2.17
@@ -29,6 +29,7 @@
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # getpatroninformation
use C4::Koha;
+use C4::Branch; # GetBranches
# use Net::LDAP;
# use Net::LDAP qw(:all);
@@ -36,7 +37,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.54.2.16 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.54.2.17 $' =~ /\d+/g;
shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
};
Index: C4/Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.40.2.27
retrieving revision 1.40.2.28
diff -u -b -r1.40.2.27 -r1.40.2.28
--- C4/Koha.pm 8 Dec 2006 17:33:27 -0000 1.40.2.27
+++ C4/Koha.pm 14 Dec 2006 15:41:53 -0000 1.40.2.28
@@ -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: Koha.pm,v 1.40.2.27 2006/12/08 17:33:27 toins Exp $
+# $Id: Koha.pm,v 1.40.2.28 2006/12/14 15:41:53 toins Exp $
use strict;
require Exporter;
@@ -25,7 +25,7 @@
use C4::Output;
use vars qw($VERSION @ISA @EXPORT);
-$VERSION = do { my @v = '$Revision: 1.40.2.27 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.40.2.28 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -50,9 +50,7 @@
@EXPORT = qw(
&slashifyDate
&DisplayISBN
- &borrowercategories
&subfield_is_koha_internal_p
- &GetBranches &GetBranch &getbranchdetail
&GetPrinters &GetPrinter
&GetItemTypes &getitemtypeinfo
&GetCcodes
@@ -73,19 +71,15 @@
&getnbpages
&getitemtypeimagesrcfromurl
&get_infos_of
- &get_branchinfos_of
&get_notforloan_label_of
&GetDepartements
&GetDepartementLib
&getitemtypeimagedir
&getitemtypeimagesrc
- &getbranchname
&GetAuthorisedValues
$DEBUG
);
-use vars qw();
-
my $DEBUG = 0;
=head2 slashifyDate
@@ -169,79 +163,6 @@
return length $subfield != 1;
}
-=head2 GetBranches
-
- $branches = &GetBranches();
- returns informations about ALL branches.
- Create a branch selector with the following code
- IndependantBranches Insensitive...
-
-=head3 in PERL SCRIPT
-
-my $branches = GetBranches;
-my @branchloop;
-foreach my $thisbranch (keys %$branches) {
- my $selected = 1 if $thisbranch eq $branch;
- my %row =(value => $thisbranch,
- selected => $selected,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- push @branchloop, \%row;
-}
-
-
-=head3 in TEMPLATE
- <select name="branch">
- <option value="">Default</option>
- <!-- TMPL_LOOP name="branchloop" -->
- <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
- <!-- /TMPL_LOOP -->
- </select>
-
-=cut
-
-sub GetBranches {
-
- # returns a reference to a hash of references to ALL branches...
- my %branches;
- my $dbh = C4::Context->dbh;
- my $sth;
- $sth = $dbh->prepare("Select * from branches order by branchname");
- $sth->execute;
- while ( my $branch = $sth->fetchrow_hashref ) {
- my $nsth =
- $dbh->prepare(
- "select categorycode from branchrelations where branchcode = ?");
- $nsth->execute( $branch->{'branchcode'} );
- while ( my ($cat) = $nsth->fetchrow_array ) {
-
- # FIXME - This seems wrong. It ought to be
- # $branch->{categorycodes}{$cat} = 1;
- # otherwise, there's a namespace collision if there's a
- # category with the same name as a field in the 'branches'
- # table (i.e., don't create a category called "issuing").
- # In addition, the current structure doesn't really allow
- # you to list the categories that a branch belongs to:
- # you'd have to list keys %$branch, and remove those keys
- # that aren't fields in the "branches" table.
- $branch->{$cat} = 1;
- }
- $branches{ $branch->{'branchcode'} } = $branch;
- }
- return ( \%branches );
-}
-
-sub getbranchname {
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth;
- $sth = $dbh->prepare("Select branchname from branches where branchcode=?");
- $sth->execute($branchcode);
- my $branchname = $sth->fetchrow_array;
- $sth->finish;
- return ($branchname);
-}
-
=head2 GetItemTypes
$itemtypes = &GetItemTypes();
@@ -592,40 +513,6 @@
return ( \%printers );
}
-=head2 GetBranch
-
-$branch = GetBranch( $query, $branches );
-
-=cut
-
-sub GetBranch ($$) {
- my ( $query, $branches ) = @_; # get branch for this query from branches
- my $branch = $query->param('branch');
- my %cookie = $query->cookie('userenv');
- ($branch) || ($branch = $cookie{'branchname'});
- ( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] );
- return $branch;
-}
-
-=item getbranchdetail
-
- $branchname = &getbranchdetail($branchcode);
-
-Given the branch code, the function returns the corresponding
-branch name for a comprehensive information display
-
-=cut
-
-sub getbranchdetail {
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
- $sth->execute($branchcode);
- my $branchname = $sth->fetchrow_hashref();
- $sth->finish();
- return $branchname;
-}
-
=head2 GetPrinter
$printer = GetPrinter( $query, $printers );
@@ -901,33 +788,6 @@
return $facets;
}
-=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 get_infos_of( $query, 'branchcode' );
-}
-
=head2 get_infos_of
Return a href where a key is associated to a href. You give a query, the
Index: C4/Circulation/Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.25
retrieving revision 1.114.2.26
diff -u -b -r1.114.2.25 -r1.114.2.26
--- C4/Circulation/Circ2.pm 11 Dec 2006 11:10:12 -0000 1.114.2.25
+++ C4/Circulation/Circ2.pm 14 Dec 2006 15:41:53 -0000 1.114.2.26
@@ -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: Circ2.pm,v 1.114.2.25 2006/12/11 11:10:12 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.26 2006/12/14 15:41:53 toins Exp $
use strict;
require Exporter;
@@ -35,11 +35,12 @@
Date_to_Days
);
use POSIX qw(strftime);
+use C4::Branch; # GetBranches
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.25 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.26 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
Index: acqui/lateorders.pl
===================================================================
RCS file: /sources/koha/koha/acqui/lateorders.pl,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -b -r1.6.2.1 -r1.6.2.2
--- acqui/lateorders.pl 13 Dec 2006 14:14:11 -0000 1.6.2.1
+++ acqui/lateorders.pl 14 Dec 2006 15:41:54 -0000 1.6.2.2
@@ -15,7 +15,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: lateorders.pl,v 1.6.2.1 2006/12/13 14:14:11 hdl Exp $
+# $Id: lateorders.pl,v 1.6.2.2 2006/12/14 15:41:54 toins Exp $
=head1 NAME
@@ -53,6 +53,7 @@
use C4::Context;
use C4::Acquisition;
use C4::Letters;
+use C4::Branch; # GetBranches
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
Index: acqui/neworderempty.pl
===================================================================
RCS file: /sources/koha/koha/acqui/neworderempty.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- acqui/neworderempty.pl 30 Nov 2006 18:23:50 -0000 1.1.2.1
+++ acqui/neworderempty.pl 14 Dec 2006 15:41:54 -0000 1.1.2.2
@@ -77,7 +77,7 @@
use C4::Input;
use C4::Koha;
use C4::Interface::CGI::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Members;
my $input = new CGI;
Index: acqui/orderreceive.pl
===================================================================
RCS file: /sources/koha/koha/acqui/Attic/orderreceive.pl,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -b -r1.2 -r1.2.2.1
--- acqui/orderreceive.pl 31 Jul 2006 14:40:54 -0000 1.2
+++ acqui/orderreceive.pl 14 Dec 2006 15:41:54 -0000 1.2.2.1
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: orderreceive.pl,v 1.2 2006/07/31 14:40:54 toins Exp $
+# $Id: orderreceive.pl,v 1.2.2.1 2006/12/14 15:41:54 toins Exp $
#script to recieve orders
#written by chris at katipo.co.nz 24/2/2000
@@ -65,6 +65,7 @@
use C4::Date;
use C4::Bookseller;
use C4::Members;
+use C4::Branch; # GetBranches
my $input = new CGI;
my $supplierid = $input->param('supplierid');
Index: admin/aqbookfund.pl
===================================================================
RCS file: /sources/koha/koha/admin/aqbookfund.pl,v
retrieving revision 1.29.2.2
retrieving revision 1.29.2.3
diff -u -b -r1.29.2.2 -r1.29.2.3
--- admin/aqbookfund.pl 30 Nov 2006 18:23:51 -0000 1.29.2.2
+++ admin/aqbookfund.pl 14 Dec 2006 15:41:54 -0000 1.29.2.3
@@ -52,7 +52,7 @@
use strict;
use CGI;
-use HTML::Template;
+use C4::Branch; # GetBranches
use List::Util qw/min/;
use C4::Auth;
use C4::Koha;
Index: admin/aqbudget.pl
===================================================================
RCS file: /sources/koha/koha/admin/aqbudget.pl,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -u -b -r1.22.2.2 -r1.22.2.3
--- admin/aqbudget.pl 30 Nov 2006 18:23:51 -0000 1.22.2.2
+++ admin/aqbudget.pl 14 Dec 2006 15:41:54 -0000 1.22.2.3
@@ -39,7 +39,7 @@
use strict;
use CGI;
-use HTML::Template;
+use C4::Branch; # GetBranches
use List::Util qw/min/;
use C4::Date;
Index: admin/branches.pl
===================================================================
RCS file: /sources/koha/koha/admin/branches.pl,v
retrieving revision 1.34.2.2
retrieving revision 1.34.2.3
diff -u -b -r1.34.2.2 -r1.34.2.3
--- admin/branches.pl 28 Nov 2006 14:07:37 -0000 1.34.2.2
+++ admin/branches.pl 14 Dec 2006 15:41:54 -0000 1.34.2.3
@@ -49,8 +49,8 @@
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
-use HTML::Template;
use C4::Koha;
+use C4::Branch;
# Fixed variables
my $script_name = "/cgi-bin/koha/admin/branches.pl";
@@ -90,18 +90,18 @@
if ( $op eq 'add' ) {
# If the user has pressed the "add new branch" button.
- heading("Branches: Add Branch");
+ heading("Branches: Add Branch",$template);
$template->param( 'heading-branches-add-branch-p' => 1 );
- editbranchform();
+ editbranchform($branchcode,$template);
}
elsif ( $op eq 'edit' ) {
# if the user has pressed the "edit branch settings" button.
- heading("Branches: Edit Branch");
+ heading("Branches: Edit Branch",$template);
$template->param( 'heading-branches-edit-branch-p' => 1 );
$template->param( add => 1 );
- editbranchform($branchcode);
+ editbranchform($branchcode,$template);
}
elsif ( $op eq 'add_validate' ) {
@@ -109,21 +109,33 @@
my $params = $input->Vars;
unless ( $params->{'branchcode'} && $params->{'branchname'} ) {
$template->param( else => 1 );
- default("MESSAGE1");
+ default("MESSAGE1",$template);
}
else {
- setbranchinfo($params);
+ ModBranch($params);
$template->param( else => 1 );
- default("MESSAGE2");
+ default("MESSAGE2",$template);
}
}
elsif ( $op eq 'delete' ) {
-
# if the user has pressed the "delete branch" button.
- my $message = checkdatabasefor($branchcode);
+
+ # check to see if the branchcode is being used in the database somewhere....
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("select count(*) from items where holdingbranch=? or homebranch=?");
+ $sth->execute( $branchcode, $branchcode );
+ my ($total) = $sth->fetchrow_array;
+ $sth->finish;
+
+ my $message;
+
+ if ($total) {
+ $message = "MESSAGE7";
+ }
+
if ($message) {
$template->param( else => 1 );
- default($message);
+ default($message,$template);
}
else {
$template->param( branchname => $branchname );
@@ -134,15 +146,15 @@
elsif ( $op eq 'delete_confirmed' ) {
# actually delete branch and return to the main screen....
- deletebranch($branchcode);
+ DelBranch($branchcode);
$template->param( else => 1 );
- default("MESSAGE3");
+ default("MESSAGE3",$template);
}
elsif ( $op eq 'editcategory' ) {
# If the user has pressed the "add new category" or "modify" buttons.
$template->param( 'heading-branches-edit-category-p' => 1 );
- editcatform($categorycode);
+ editcatform($categorycode,$template);
}
elsif ( $op eq 'addcategory_validate' ) {
@@ -150,21 +162,21 @@
my $params = $input->Vars;
unless ( $params->{'categorycode'} && $params->{'categoryname'} ) {
$template->param( else => 1 );
- default("MESSAGE4");
+ default("MESSAGE4",$template);
}
else {
- setcategoryinfo($params);
+ ModBranchCategoryInfo($params);
$template->param( else => 1 );
- default("MESSAGE5");
+ default("MESSAGE5",$template);
}
}
elsif ( $op eq 'delete_category' ) {
# if the user has pressed the "delete branch" button.
- my $message = checkcategorycode($categorycode);
+ my $message = "MESSAGE8" if CheckBranchCategorycode($categorycode);
if ($message) {
$template->param( else => 1 );
- default($message);
+ default($message,$template);
}
else {
$template->param( delete_category => 1 );
@@ -174,15 +186,15 @@
elsif ( $op eq 'categorydelete_confirmed' ) {
# actually delete branch and return to the main screen....
- deletecategory($categorycode);
+ DeleteBranchCategory($categorycode);
$template->param( else => 1 );
- default("MESSAGE6");
+ default("MESSAGE6",$template);
}
else {
# if no operation has been set...
- default();
+ default("",$template);
}
################################################################################
@@ -190,24 +202,22 @@
# html output functions....
sub default {
- my ($message) = @_;
- heading("Branches");
- $template->param( 'heading-branches-p' => 1 );
- $template->param( "$message" => 1 );
- $template->param( action => $script_name );
- branchinfotable();
+ my ($message,$innertemplate) = @_;
+ heading("Branches",$innertemplate);
+ $innertemplate->param( 'heading-branches-p' => 1 );
+ $innertemplate->param( "$message" => 1 );
+ $innertemplate->param( action => $script_name );
+ branchinfotable("",$innertemplate);
}
# FIXME: this function should not exist; otherwise headings are untranslatable
sub heading {
- my ($head) = @_;
- $template->param( head => $head );
+ my ($head,$innertemplate) = @_;
+ $innertemplate->param( head => $head );
}
sub editbranchform {
-
- # prepares the edit form...
-
+ my ($branchcode,$innertemplate) = @_;
# initiate the scrolling-list to select the printers
my %env;
my $printers = GetPrinters( \%env );
@@ -215,11 +225,11 @@
my $printercount = 0;
my $oldprinter;
my $CGIprinter;
- my ($branchcode) = @_;
+
my $data;
if ($branchcode) {
- $data = getbranchinfo($branchcode);
+ $data = GetBranchInfo($branchcode);
$data = $data->[0];
# get the old printer of the branch
@@ -237,16 +247,18 @@
push @printerloop, \%row;
}
- $template->param( printerloop => \@printerloop );
- $template->param( branchcode => $data->{'branchcode'} );
- $template->param( branch_name => $data->{'branchname'} );
- $template->param( branchaddress1 => $data->{'branchaddress1'} );
- $template->param( branchaddress2 => $data->{'branchaddress2'} );
- $template->param( branchaddress3 => $data->{'branchaddress3'} );
- $template->param( branchphone => $data->{'branchphone'} );
- $template->param( branchfax => $data->{'branchfax'} );
- $template->param( branchemail => $data->{'branchemail'} );
- $template->param( branchip => $data->{'branchip'} );
+ $innertemplate->param(
+ printerloop => \@printerloop,
+ branchcode => $data->{'branchcode'},
+ branch_name => $data->{'branchname'},
+ branchaddress1 => $data->{'branchaddress1'},
+ branchaddress2 => $data->{'branchaddress2'},
+ branchaddress3 => $data->{'branchaddress3'},
+ branchphone => $data->{'branchphone'},
+ branchfax => $data->{'branchfax'},
+ branchemail => $data->{'branchemail'},
+ branchip => $data->{'branchip'}
+ );
}
else { #case of an add branch select printer
foreach my $thisprinter ( keys %$printers ) {
@@ -256,7 +268,7 @@
);
push @printerloop, \%row;
}
- $template->param( printerloop => \@printerloop );
+ $innertemplate->param( printerloop => \@printerloop );
}
# make the checkboxs.....
@@ -266,7 +278,7 @@
# 'checked' fields. The $checked field is either '' or 'checked'
# (see bug 130)
#
- my $catinfo = getcategoryinfo();
+ my $catinfo = GetBranchCategory();
my $catcheckbox;
# print DEBUG "catinfo=".cvs($catinfo)."\n";
@@ -285,11 +297,11 @@
checked => $checked,
};
}
- $template->param( categoryloop => \@categoryloop );
+ $innertemplate->param( categoryloop => \@categoryloop );
# {{{ Leave this here until bug 130 is completely resolved in the templates
for my $obsolete ( 'categoryname', 'categorycode', 'codedescription' ) {
- $template->param(
+ $innertemplate->param(
$obsolete => 'Your template is out of date (bug 130)' );
}
@@ -299,15 +311,15 @@
sub editcatform {
# prepares the edit form...
- my ($categorycode) = @_;
+ my ($categorycode,$innertemplate) = @_;
warn "cat : $categorycode";
my $data;
if ($categorycode) {
- $data = getcategoryinfo($categorycode);
+ $data = GetBranchCategory($categorycode);
$data = $data->[0];
- $template->param( categorycode => $data->{'categorycode'} );
- $template->param( categoryname => $data->{'categoryname'} );
- $template->param( codedescription => $data->{'codedescription'} );
+ $innertemplate->param( categorycode => $data->{'categorycode'} );
+ $innertemplate->param( categoryname => $data->{'categoryname'} );
+ $innertemplate->param( codedescription => $data->{'codedescription'} );
}
}
@@ -321,13 +333,13 @@
# makes the html for a table of branch info from reference to an array of hashs.
- my ($branchcode) = @_;
+ my ($branchcode,$innertemplate) = @_;
my $branchinfo;
if ($branchcode) {
- $branchinfo = getbranchinfo($branchcode);
+ $branchinfo = GetBranchInfo($branchcode);
}
else {
- $branchinfo = getbranchinfo();
+ $branchinfo = GetBranchInfo();
}
my $toggle;
my $i;
@@ -384,7 +396,7 @@
my $no_categories_p = 1;
my @categories = '';
foreach my $cat ( @{ $branch->{'categories'} } ) {
- my ($catinfo) = @{ getcategoryinfo($cat) };
+ my ($catinfo) = @{ GetBranchCategory($cat) };
push @categories, { 'categoryname' => $catinfo->{'categoryname'} };
$no_categories_p = 0;
}
@@ -407,7 +419,7 @@
$i++;
}
my @branchcategories = ();
- my $catinfo = getcategoryinfo();
+ my $catinfo = GetBranchCategory();
$i = 0;
foreach my $cat (@$catinfo) {
( $i % 2 ) ? ( $toggle = 1 ) : ( $toggle = 0 );
@@ -421,7 +433,7 @@
$i++;
}
- $template->param(
+ $innertemplate->param(
branches => \@loop_data,
branchcategories => \@branchcategories
);
@@ -430,230 +442,18 @@
# FIXME logic seems wrong
sub branchcategoriestable {
-
+ my $innertemplate = shift;
#Needs to be implemented...
- my $categoryinfo = getcategoryinfo();
+ my $categoryinfo = GetBranchCategory();
my $color;
foreach my $cat (@$categoryinfo) {
- $template->param( categoryname => $cat->{'categoryname'} );
- $template->param( categorycode => $cat->{'categorycode'} );
- $template->param( codedescription => $cat->{'codedescription'} );
- }
-}
-
-################################################################################
-#
-# Database functions....
-
-sub getbranchinfo {
-
- # returns a reference to an array of hashes containing branches,
-
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth;
- if ($branchcode) {
- $sth =
- $dbh->prepare(
- "Select * from branches where branchcode = ? order by branchcode");
- $sth->execute($branchcode);
- }
- else {
- $sth = $dbh->prepare("Select * from branches order by branchcode");
- $sth->execute();
- }
- my @results;
- while ( my $data = $sth->fetchrow_hashref ) {
- my $nsth =
- $dbh->prepare(
- "select categorycode from branchrelations where branchcode = ?");
- $nsth->execute( $data->{'branchcode'} );
- my @cats = ();
- while ( my ($cat) = $nsth->fetchrow_array ) {
- push( @cats, $cat );
- }
- $nsth->finish;
- $data->{'categories'} = \@cats;
- push( @results, $data );
- }
- $sth->finish;
- return \@results;
-}
-
-# FIXME This doesn't belong here; it should be moved into a module
-sub getcategoryinfo {
-
- # returns a reference to an array of hashes containing branches,
- my ($catcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth;
-
- # print DEBUG "getcategoryinfo: entry: catcode=".cvs($catcode)."\n";
- if ($catcode) {
- $sth =
- $dbh->prepare(
- "select * from branchcategories where categorycode = ?");
- $sth->execute($catcode);
- }
- else {
- $sth = $dbh->prepare("Select * from branchcategories");
- $sth->execute();
- }
- my @results;
- while ( my $data = $sth->fetchrow_hashref ) {
- push( @results, $data );
- }
- $sth->finish;
-
- # print DEBUG "getcategoryinfo: exit: returning ".cvs(\@results)."\n";
- return \@results;
-}
-
-# FIXME This doesn't belong here; it should be moved into a module
-sub setbranchinfo {
-
- # sets the data from the editbranch form, and writes to the database...
- my ($data) = @_;
- my $dbh = C4::Context->dbh;
- my $sth =
- $dbh->prepare(
-"replace branches (branchcode,branchname,branchaddress1,branchaddress2,branchaddress3,branchphone,branchfax,branchemail,branchip,branchprinter) values (?,?,?,?,?,?,?,?,?,?)"
- );
- $sth->execute(
- uc( $data->{'branchcode'} ), $data->{'branchname'},
- $data->{'branchaddress1'}, $data->{'branchaddress2'},
- $data->{'branchaddress3'}, $data->{'branchphone'},
- $data->{'branchfax'}, $data->{'branchemail'},
- $data->{'branchip'}, $data->{'branchprinter'}
- );
-
- $sth->finish;
-
- # sort out the categories....
- my @checkedcats;
- my $cats = getcategoryinfo();
- foreach my $cat (@$cats) {
- my $code = $cat->{'categorycode'};
- if ( $data->{$code} ) {
- push( @checkedcats, $code );
- }
- }
- my $branchcode = uc( $data->{'branchcode'} );
- my $branch = getbranchinfo($branchcode);
- $branch = $branch->[0];
- my $branchcats = $branch->{'categories'};
- my @addcats;
- my @removecats;
- foreach my $bcat (@$branchcats) {
-
- unless ( grep { /^$bcat$/ } @checkedcats ) {
- push( @removecats, $bcat );
- }
- }
- foreach my $ccat (@checkedcats) {
- unless ( grep { /^$ccat$/ } @$branchcats ) {
- push( @addcats, $ccat );
- }
- }
- foreach my $cat (@addcats) {
- my $sth =
- $dbh->prepare(
-"insert into branchrelations (branchcode, categorycode) values(?, ?)"
- );
- $sth->execute( $branchcode, $cat );
- $sth->finish;
+ $innertemplate->param( categoryname => $cat->{'categoryname'} );
+ $innertemplate->param( categorycode => $cat->{'categorycode'} );
+ $innertemplate->param( codedescription => $cat->{'codedescription'} );
}
- foreach my $cat (@removecats) {
- my $sth =
- $dbh->prepare(
- "delete from branchrelations where branchcode=? and categorycode=?"
- );
- $sth->execute( $branchcode, $cat );
- $sth->finish;
- }
-}
-
-sub deletebranch {
-
- # delete branch...
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("delete from branches where branchcode = ?");
- $sth->execute($branchcode);
- $sth->finish;
-}
-
-sub setcategoryinfo {
-
- # sets the data from the editbranch form, and writes to the database...
- my ($data) = @_;
- my $dbh = C4::Context->dbh;
- my $sth =
- $dbh->prepare(
-"replace branchcategories (categorycode,categoryname,codedescription) values (?,?,?)"
- );
- $sth->execute(
- uc( $data->{'categorycode'} ),
- $data->{'categoryname'},
- $data->{'codedescription'}
- );
-
- $sth->finish;
}
-sub deletecategory {
-
- # delete branch...
- my ($categorycode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth =
- $dbh->prepare("delete from branchcategories where categorycode = ?");
- $sth->execute($categorycode);
- $sth->finish;
-}
-
-sub checkdatabasefor {
-
- # check to see if the branchcode is being used in the database somewhere....
- my ($branchcode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth =
- $dbh->prepare(
- "select count(*) from items where holdingbranch=? or homebranch=?");
- $sth->execute( $branchcode, $branchcode );
- my ($total) = $sth->fetchrow_array;
- $sth->finish;
- my $message;
-
- if ($total) {
-
- # FIXME: need to be replaced by an exported boolean parameter
- $message = "MESSAGE7";
- }
- return $message;
-}
-
-sub checkcategorycode {
-
- # check to see if the branchcode is being used in the database somewhere....
- my ($categorycode) = @_;
- my $dbh = C4::Context->dbh;
- my $sth =
- $dbh->prepare(
- "select count(*) from branchrelations where categorycode=?");
- $sth->execute($categorycode);
- my ($total) = $sth->fetchrow_array;
- $sth->finish;
- my $message;
-
- if ($total) {
-
- # FIXME: need to be replaced by an exported boolean parameter
- $message = "MESSAGE8";
- }
- return $message;
-}
$template->param(
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
Index: admin/issuingrules.pl
===================================================================
RCS file: /sources/koha/koha/admin/issuingrules.pl,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -b -r1.9 -r1.9.2.1
--- admin/issuingrules.pl 21 Jul 2006 13:57:02 -0000 1.9
+++ admin/issuingrules.pl 14 Dec 2006 15:41:54 -0000 1.9.2.1
@@ -26,7 +26,7 @@
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
my $input = new CGI;
my $dbh = C4::Context->dbh;
Index: catalogue/ISBDdetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/ISBDdetail.pl,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -b -r1.2.2.2 -r1.2.2.3
--- catalogue/ISBDdetail.pl 5 Dec 2006 11:35:30 -0000 1.2.2.2
+++ catalogue/ISBDdetail.pl 14 Dec 2006 15:41:54 -0000 1.2.2.3
@@ -42,8 +42,9 @@
use C4::Output;
use C4::Interface::CGI::Output;
use CGI;
-use C4::Koha;
+#use C4::Koha;
use C4::Biblio;
+use C4::Branch; # GetBranchDetail
my $query=new CGI;
@@ -128,7 +129,7 @@
#---- branch
if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
- return getbranchdetail($value)->{branchname};
+ return GetBranchDetail($value)->{branchname};
}
#---- itemtypes
Index: catalogue/MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/MARCdetail.pl,v
retrieving revision 1.5.2.6
retrieving revision 1.5.2.7
diff -u -b -r1.5.2.6 -r1.5.2.7
--- catalogue/MARCdetail.pl 5 Dec 2006 11:35:30 -0000 1.5.2.6
+++ catalogue/MARCdetail.pl 14 Dec 2006 15:41:54 -0000 1.5.2.7
@@ -256,7 +256,7 @@
#---- branch
if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
-# return getbranchdetail($value)->{branchname};
+# return GetBranchDetail($value)->{branchname};
}
#---- itemtypes
Index: catalogue/search.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/Attic/search.pl,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -b -r1.1.2.9 -r1.1.2.10
--- catalogue/search.pl 7 Dec 2006 15:49:22 -0000 1.1.2.9
+++ catalogue/search.pl 14 Dec 2006 15:41:54 -0000 1.1.2.10
@@ -2,7 +2,7 @@
# Script to perform searching
# For documentation try 'perldoc /path/to/search'
#
-# $Header: /sources/koha/koha/catalogue/Attic/search.pl,v 1.1.2.9 2006/12/07 15:49:22 toins Exp $
+# $Header: /sources/koha/koha/catalogue/Attic/search.pl,v 1.1.2.10 2006/12/14 15:41:54 toins Exp $
#
# Copyright 2006 LibLime
#
@@ -151,6 +151,7 @@
use C4::Search;
use C4::Koha;
use POSIX qw(ceil floor);
+use C4::Branch; # GetBranches
# create a new CGI object
# not sure undef_params option is working, need to test
use CGI qw('-no_undef_params');
Index: cataloguing/additem-nomarc.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/Attic/additem-nomarc.pl,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -b -r1.4.2.2 -r1.4.2.3
--- cataloguing/additem-nomarc.pl 5 Dec 2006 11:35:30 -0000 1.4.2.2
+++ cataloguing/additem-nomarc.pl 14 Dec 2006 15:41:54 -0000 1.4.2.3
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: additem-nomarc.pl,v 1.4.2.2 2006/12/05 11:35:30 toins Exp $
+# $Id: additem-nomarc.pl,v 1.4.2.3 2006/12/14 15:41:54 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -20,6 +20,10 @@
# Suite 330, Boston, MA 02111-1307 USA
# $Log: additem-nomarc.pl,v $
+# Revision 1.4.2.3 2006/12/14 15:41:54 toins
+# admin/branches.pl works now with mod_perl.
+# New module : Branch.pm containt all functions dealings with branches.
+#
# Revision 1.4.2.2 2006/12/05 11:35:30 toins
# Biblio.pm cleaned.
# additionalauthors, bibliosubject, bibliosubtitle tables are now unused.
@@ -65,7 +69,7 @@
use C4::Biblio;
use C4::Koha;
use C4::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Auth;
use C4::Interface::CGI::Output;
Index: cataloguing/value_builder/unimarc_field_4XX.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/value_builder/Attic/unimarc_field_4XX.pl,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -b -r1.1.2.8 -r1.1.2.9
--- cataloguing/value_builder/unimarc_field_4XX.pl 12 Dec 2006 08:53:22 -0000 1.1.2.8
+++ cataloguing/value_builder/unimarc_field_4XX.pl 14 Dec 2006 15:41:54 -0000 1.1.2.9
@@ -29,6 +29,7 @@
use C4::Biblio;
use C4::Koha;
use MARC::Record;
+use C4::Branch; # GetBranches
sub plugin_parameters {
my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
Index: circ/bookcount.pl
===================================================================
RCS file: /sources/koha/koha/circ/Attic/bookcount.pl,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- circ/bookcount.pl 5 Dec 2006 11:35:30 -0000 1.1.2.6
+++ circ/bookcount.pl 14 Dec 2006 15:41:54 -0000 1.1.2.7
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: bookcount.pl,v 1.1.2.6 2006/12/05 11:35:30 toins Exp $
+# $Id: bookcount.pl,v 1.1.2.7 2006/12/14 15:41:54 toins Exp $
#written 7/3/2002 by Finlay
#script to display reports
@@ -29,19 +29,14 @@
use C4::Output;
use C4::Koha;
use C4::Auth;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Date;
-# get all the data ....
-my %env;
-my $main = '#cccc99';
-my $secondary = '#ffffcc';
-
my $input = new CGI;
my $itm = $input->param('itm');
my $bi = $input->param('bi');
my $biblionumber = $input->param('biblioitemnumber');
-my $branches = GetBranches( \%env );
+my $branches = GetBranches;
my $idata = itemdatanum($itm);
my $data = GetBiblioItemData($bi);
@@ -103,9 +98,8 @@
IntranetNav => C4::Context->preference("IntranetNav"),
);
-print "Content-Type: text/html\n\n", $template->output;
+output_html_with_http_headers $input, $cookie, $template->output;
-use DBI;
sub itemdatanum {
my ($itemnumber) = @_;
Index: circ/branchreserves.pl
===================================================================
RCS file: /sources/koha/koha/circ/branchreserves.pl,v
retrieving revision 1.2.2.10
retrieving revision 1.2.2.11
diff -u -b -r1.2.2.10 -r1.2.2.11
--- circ/branchreserves.pl 30 Nov 2006 18:23:51 -0000 1.2.2.10
+++ circ/branchreserves.pl 14 Dec 2006 15:41:54 -0000 1.2.2.11
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: branchreserves.pl,v 1.2.2.10 2006/11/30 18:23:51 toins Exp $
+# $Id: branchreserves.pl,v 1.2.2.11 2006/12/14 15:41:54 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Context;
use C4::Output;
use CGI;
-use HTML::Template;
+use C4::Branch; # GetBranchName
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
@@ -80,7 +80,7 @@
my $borrowerinfo = getpatroninformation( \%env, $nextreservinfo );
my $iteminfo = C4::Circulation::Circ2::getiteminformation($item);
if ( $messages->{'transfert'} ) {
- my $branchname = getbranchname( $messages->{'transfert'} );
+ my $branchname = GetBranchName( $messages->{'transfert'} );
$template->param(
messagetransfert => $messages->{'transfert'},
branchname => $branchname,
Index: circ/branchtransfers.pl
===================================================================
RCS file: /sources/koha/koha/circ/branchtransfers.pl,v
retrieving revision 1.24.2.6
retrieving revision 1.24.2.7
diff -u -b -r1.24.2.6 -r1.24.2.7
--- circ/branchtransfers.pl 29 Nov 2006 11:59:07 -0000 1.24.2.6
+++ circ/branchtransfers.pl 14 Dec 2006 15:41:54 -0000 1.24.2.7
@@ -28,14 +28,14 @@
use C4::Reserves2;
use C4::Auth;
use C4::Interface::CGI::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Koha;
###############################################
# constants
my %env;
-my $branches = GetBranches();
+my $branches = GetBranches;
my $printers = GetPrinters( \%env );
###############################################
Index: circ/circulation.pl
===================================================================
RCS file: /sources/koha/koha/circ/circulation.pl,v
retrieving revision 1.97.2.15
retrieving revision 1.97.2.16
diff -u -b -r1.97.2.15 -r1.97.2.16
--- circ/circulation.pl 14 Dec 2006 10:39:35 -0000 1.97.2.15
+++ circ/circulation.pl 14 Dec 2006 15:41:54 -0000 1.97.2.16
@@ -30,8 +30,8 @@
use C4::Print;
use C4::Auth;
use C4::Interface::CGI::Output;
-#use C4::Branch; # GetBranches
-use C4::Koha; # GetBranches
+use C4::Branch; # GetBranches
+use C4::Koha; # GetPrinter
use Date::Calc qw(
Today
Today_and_Now
@@ -49,7 +49,7 @@
#
my $query = new CGI;
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
{
template_name => 'circ/circulation.tmpl',
query => $query,
@@ -303,7 +303,7 @@
$getWaitingReserveInfo{author} = $getiteminfo->{'author'};
$getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} );
if ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'} ) {
- $getWaitingReserveInfo{waitingat} = getbranchname( $num_res->{'branchcode'} );
+ $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} );
}
}
@@ -312,7 +312,7 @@
$getreserv{color} = 'transfered';
$getreserv{transfered} = 1;
$getreserv{datesent} = format_date($transfertwhen);
- $getreserv{frombranch} = getbranchname($transfertfrom);
+ $getreserv{frombranch} = GetBranchName($transfertfrom);
}
if ( ( $getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'} )
@@ -320,7 +320,7 @@
{
$getreserv{nottransfered} = 1;
$getreserv{nottransferedby} =
- getbranchname( $getiteminfo->{'holdingbranch'} );
+ GetBranchName( $getiteminfo->{'holdingbranch'} );
}
# if we don't have a reserv on item, we put the biblio infos and the waiting position
Index: circ/returns.pl
===================================================================
RCS file: /sources/koha/koha/circ/returns.pl,v
retrieving revision 1.43.2.9
retrieving revision 1.43.2.10
diff -u -b -r1.43.2.9 -r1.43.2.10
--- circ/returns.pl 30 Nov 2006 18:23:51 -0000 1.43.2.9
+++ circ/returns.pl 14 Dec 2006 15:41:54 -0000 1.43.2.10
@@ -34,8 +34,8 @@
use C4::Reserves2;
use C4::Auth;
use C4::Interface::CGI::Output;
-use HTML::Template;
-use C4::Koha;
+use C4::Branch; # GetBranchName
+use C4::Koha; # FIXME : is it still useful ?
use C4::Context;
my $query = new CGI;
@@ -120,7 +120,7 @@
# my $branchname = $branches->{$tobranchcd}->{'branchname'}; - not sure if this line + $tobranchcd line do the same thing
# as the $messages{'transfert'} code
- my $branchname = getbranchname( $messages->{'transfert'} );
+ my $branchname = GetBranchName( $messages->{'transfert'} );
my ($borr) = getpatroninformation( \%env, $nextreservinfo, 0 );
my $borcnum = $borr->{'cardnumber'};
my $name =
Index: circ/selectbranchprinter.pl
===================================================================
RCS file: /sources/koha/koha/circ/selectbranchprinter.pl,v
retrieving revision 1.16.2.2
retrieving revision 1.16.2.3
diff -u -b -r1.16.2.2 -r1.16.2.3
--- circ/selectbranchprinter.pl 28 Nov 2006 14:07:38 -0000 1.16.2.2
+++ circ/selectbranchprinter.pl 14 Dec 2006 15:41:54 -0000 1.16.2.3
@@ -24,9 +24,8 @@
use C4::Auth;
use C4::Print;
use C4::Interface::CGI::Output;
-use HTML::Template;
-use DBI;
use C4::Koha;
+use C4::Branch; # GetBranches
# this is a reorganisation of circulationold.pl
# dividing it up into three scripts......
Index: circ/waitingreservestransfers.pl
===================================================================
RCS file: /sources/koha/koha/circ/waitingreservestransfers.pl,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -u -b -r1.4.2.4 -r1.4.2.5
--- circ/waitingreservestransfers.pl 22 Nov 2006 15:39:08 -0000 1.4.2.4
+++ circ/waitingreservestransfers.pl 14 Dec 2006 15:41:54 -0000 1.4.2.5
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: waitingreservestransfers.pl,v 1.4.2.4 2006/11/22 15:39:08 alaurin Exp $
+# $Id: waitingreservestransfers.pl,v 1.4.2.5 2006/12/14 15:41:54 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Context;
use C4::Output;
use CGI;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
Index: export/marc.pl
===================================================================
RCS file: /sources/koha/koha/export/Attic/marc.pl,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -u -b -r1.7.2.3 -r1.7.2.4
--- export/marc.pl 5 Dec 2006 11:35:30 -0000 1.7.2.3
+++ export/marc.pl 14 Dec 2006 15:41:54 -0000 1.7.2.4
@@ -1,5 +1,25 @@
#!/usr/bin/perl
-use HTML::Template;
+
+# 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
+
+# $Id: marc.pl,v 1.7.2.4 2006/12/14 15:41:54 toins Exp $
+
+use C4::Branch; # GetBranches
use strict;
require Exporter;
use C4::Database;
Index: koha-tmpl/intranet-tmpl/prog/en/acqui/supplier.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/acqui/supplier.tmpl,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -b -r1.2.2.3 -r1.2.2.4
--- koha-tmpl/intranet-tmpl/prog/en/acqui/supplier.tmpl 2 Nov 2006 14:58:10 -0000 1.2.2.3
+++ koha-tmpl/intranet-tmpl/prog/en/acqui/supplier.tmpl 14 Dec 2006 15:41:54 -0000 1.2.2.4
@@ -137,7 +137,7 @@
<a href="order.pl?supplier=<!--TMPL_VAR Name="name"-->">
Manage Orders
</a>
- <a href="recieveorder.pl?supplierid=<!--TMPL_VAR Name="id"-->">
+ <a href="/cgi-bin/koha/acqui/orderreceive.pl?supplierid=<!--TMPL_VAR Name="id"-->">
Receive Parcel
</a>
</div>
Index: koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl 15 Nov 2006 16:04:12 -0000 1.3.2.3
+++ koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl 14 Dec 2006 15:41:54 -0000 1.3.2.4
@@ -137,6 +137,7 @@
<input type="submit" value="Add New Branch" /></p>
</form>
+ <!-- TMPL_IF NAME="branchcategories" -->
<table>
<caption>Branches Categories</caption>
<tr>
@@ -166,7 +167,13 @@
</td>
</tr>
<!-- /TMPL_LOOP -->
- </table><form action="<!-- TMPL_VAR name="action" -->" method="post"><p>
+ </table>
+ <!-- TMPL_ELSE -->
+ <p>
+ <b>No Category defined.</b>
+ </p>
+ <!-- /TMPL_IF --> <!-- NAME="branchcategories" -->
+ <form action="<!-- TMPL_VAR name="action" -->" method="post"><p>
<input type="hidden" name="op" value="editcategory" />
<input type="submit" value="Add New Category" /></p>
</form>
Index: members/memberentry.pl
===================================================================
RCS file: /sources/koha/koha/members/memberentry.pl,v
retrieving revision 1.38.2.17
retrieving revision 1.38.2.18
diff -u -b -r1.38.2.17 -r1.38.2.18
--- members/memberentry.pl 6 Dec 2006 14:05:35 -0000 1.38.2.17
+++ members/memberentry.pl 14 Dec 2006 15:41:54 -0000 1.38.2.18
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: memberentry.pl,v 1.38.2.17 2006/12/06 14:05:35 btoumi Exp $
+# $Id: memberentry.pl,v 1.38.2.18 2006/12/14 15:41:54 toins Exp $
# Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
#
@@ -24,7 +24,6 @@
# external modules
use Date::Calc qw/Today/;
use CGI;
-use HTML::Template;
use Date::Manip;
use Digest::MD5 qw(md5_base64);
@@ -38,6 +37,7 @@
use C4::Date;
use C4::Input;
use C4::Log;
+use C4::Branch; # GetBranches
my $input = new CGI;
my %data;
Index: members/moremember.pl
===================================================================
RCS file: /sources/koha/koha/members/moremember.pl,v
retrieving revision 1.28.2.15
retrieving revision 1.28.2.16
diff -u -b -r1.28.2.15 -r1.28.2.16
--- members/moremember.pl 7 Dec 2006 12:59:18 -0000 1.28.2.15
+++ members/moremember.pl 14 Dec 2006 15:41:54 -0000 1.28.2.16
@@ -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: moremember.pl,v 1.28.2.15 2006/12/07 12:59:18 btoumi Exp $
+# $Id: moremember.pl,v 1.28.2.16 2006/12/14 15:41:54 toins Exp $
=head1 moremember.pl
@@ -47,6 +47,7 @@
use C4::Koha;
use C4::Letters;
use C4::Biblio;
+use C4::Branch; # GetBranchName
my $dbh = C4::Context->dbh;
@@ -181,7 +182,7 @@
}
$data->{'branchname'} =
- ( ( getbranchdetail( $data->{'branchcode'} ) )->{'branchname'} );
+ ( ( GetBranchDetail( $data->{'branchcode'} ) )->{'branchname'} );
# Converts the categorycode to the description
( $data->{'categorycode'}, undef, undef ) =
@@ -302,7 +303,7 @@
$getreserv{color} = 'transfered';
$getreserv{transfered} = 1;
$getreserv{datesent} = format_date($transfertwhen);
- $getreserv{frombranch} = getbranchname($transfertfrom);
+ $getreserv{frombranch} = GetBranchName($transfertfrom);
}
if ( ( $getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'} )
Index: members/pay.pl
===================================================================
RCS file: /sources/koha/koha/members/pay.pl,v
retrieving revision 1.4.2.5
retrieving revision 1.4.2.6
diff -u -b -r1.4.2.5 -r1.4.2.6
--- members/pay.pl 28 Nov 2006 14:07:38 -0000 1.4.2.5
+++ members/pay.pl 14 Dec 2006 15:41:54 -0000 1.4.2.6
@@ -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: pay.pl,v 1.4.2.5 2006/11/28 14:07:38 toins Exp $
+# $Id: pay.pl,v 1.4.2.6 2006/12/14 15:41:54 toins Exp $
=head1 pay.pl
@@ -36,7 +36,7 @@
use C4::Stats;
use C4::Koha;
use C4::Circulation::Fines;
-use HTML::Template;
+use C4::Branch; # GetBranches
my $input = new CGI;
Index: opac/opac-ISBDdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-ISBDdetail.pl,v
retrieving revision 1.16.2.4
retrieving revision 1.16.2.5
diff -u -b -r1.16.2.4 -r1.16.2.5
--- opac/opac-ISBDdetail.pl 7 Dec 2006 15:42:15 -0000 1.16.2.4
+++ opac/opac-ISBDdetail.pl 14 Dec 2006 15:41:54 -0000 1.16.2.5
@@ -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: opac-ISBDdetail.pl,v 1.16.2.4 2006/12/07 15:42:15 toins Exp $
+# $Id: opac-ISBDdetail.pl,v 1.16.2.5 2006/12/14 15:41:54 toins Exp $
=head1 NAME
@@ -55,7 +55,7 @@
use C4::Acquisition;
use C4::Serials; # uses getsubscriptionfrom biblionumber
use C4::Koha; # use getitemtypeinfo
-#use HTML::Template;
+use C4::Branch; # use GetBranchName
my $query = new CGI;
@@ -181,7 +181,7 @@
#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
- return getbranchname($value);
+ return GetBranchName($value);
}
#---- itemtypes
Index: opac/opac-MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-MARCdetail.pl,v
retrieving revision 1.14.2.4
retrieving revision 1.14.2.5
diff -u -b -r1.14.2.4 -r1.14.2.5
--- opac/opac-MARCdetail.pl 7 Dec 2006 15:42:15 -0000 1.14.2.4
+++ opac/opac-MARCdetail.pl 14 Dec 2006 15:41:54 -0000 1.14.2.5
@@ -49,7 +49,6 @@
use MARC::Record;
use C4::Biblio;
use C4::Acquisition;
-use HTML::Template;
use C4::Koha;
my $query = new CGI;
@@ -275,7 +274,7 @@
#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
- # return getbranchdetail($value)->{branchname};
+ # return GetBranchDetail($value)->{branchname};
}
#---- itemtypes
Index: opac/opac-main.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-main.pl,v
retrieving revision 1.23.2.4
retrieving revision 1.23.2.5
diff -u -b -r1.23.2.4 -r1.23.2.5
--- opac/opac-main.pl 8 Dec 2006 17:33:27 -0000 1.23.2.4
+++ opac/opac-main.pl 14 Dec 2006 15:41:54 -0000 1.23.2.5
@@ -15,16 +15,15 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: opac-main.pl,v 1.23.2.4 2006/12/08 17:33:27 toins Exp $
+# $Id: opac-main.pl,v 1.23.2.5 2006/12/14 15:41:54 toins Exp $
use strict;
require Exporter;
use CGI;
-use HTML::Template;
use C4::Auth; # get_template_and_user
use C4::Interface::CGI::Output;
use C4::BookShelves;
-use C4::Koha; # GetBranches
+use C4::Branch; # GetBranches
use C4::Members;
use C4::NewsChannels; # get_opac_news
Index: opac/opac-reserve.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.29.2.7
retrieving revision 1.29.2.8
diff -u -b -r1.29.2.7 -r1.29.2.8
--- opac/opac-reserve.pl 7 Dec 2006 18:09:01 -0000 1.29.2.7
+++ opac/opac-reserve.pl 14 Dec 2006 15:41:54 -0000 1.29.2.8
@@ -26,6 +26,7 @@
use C4::Interface::CGI::Output;
use C4::Date;
use C4::Context;
+use C4::Branch; # GetBranches
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
Index: opac/opac-search.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-search.pl,v
retrieving revision 1.38.2.8
retrieving revision 1.38.2.9
diff -u -b -r1.38.2.8 -r1.38.2.9
--- opac/opac-search.pl 8 Dec 2006 15:21:06 -0000 1.38.2.8
+++ opac/opac-search.pl 14 Dec 2006 15:41:54 -0000 1.38.2.9
@@ -3,7 +3,7 @@
# Script to perform searching
# For documentation try 'perldoc /path/to/search'
#
-# $Header: /sources/koha/koha/opac/opac-search.pl,v 1.38.2.8 2006/12/08 15:21:06 toins Exp $
+# $Header: /sources/koha/koha/opac/opac-search.pl,v 1.38.2.9 2006/12/14 15:41:54 toins Exp $
#
# Copyright 2006 LibLime
#
@@ -152,6 +152,7 @@
use C4::Auth;
use C4::Search;
use C4::Koha;
+use C4::Branch; # GetBranches
use POSIX qw(ceil floor);
# create a new CGI object
Index: opac/opac-user.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-user.pl,v
retrieving revision 1.23.2.5
retrieving revision 1.23.2.6
diff -u -b -r1.23.2.5 -r1.23.2.6
--- opac/opac-user.pl 8 Dec 2006 17:33:27 -0000 1.23.2.5
+++ opac/opac-user.pl 14 Dec 2006 15:41:54 -0000 1.23.2.6
@@ -15,7 +15,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: opac-user.pl,v 1.23.2.5 2006/12/08 17:33:27 toins Exp $
+# $Id: opac-user.pl,v 1.23.2.6 2006/12/14 15:41:54 toins Exp $
use strict;
require Exporter;
@@ -30,6 +30,7 @@
use C4::Biblio;
use C4::Date;
use C4::Letters;
+use C4::Branch; # GetBranches
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Index: reports/bor_issues_top.pl
===================================================================
RCS file: /sources/koha/koha/reports/bor_issues_top.pl,v
retrieving revision 1.8.2.4
retrieving revision 1.8.2.5
diff -u -b -r1.8.2.4 -r1.8.2.5
--- reports/bor_issues_top.pl 30 Nov 2006 18:23:51 -0000 1.8.2.4
+++ reports/bor_issues_top.pl 14 Dec 2006 15:41:55 -0000 1.8.2.5
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: bor_issues_top.pl,v 1.8.2.4 2006/11/30 18:23:51 toins Exp $
+# $Id: bor_issues_top.pl,v 1.8.2.5 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
Index: reports/borrowers_stats.pl
===================================================================
RCS file: /sources/koha/koha/reports/borrowers_stats.pl,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -u -b -r1.10.2.3 -r1.10.2.4
--- reports/borrowers_stats.pl 30 Nov 2006 18:23:51 -0000 1.10.2.3
+++ reports/borrowers_stats.pl 14 Dec 2006 15:41:55 -0000 1.10.2.4
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: borrowers_stats.pl,v 1.10.2.3 2006/11/30 18:23:51 toins Exp $
+# $Id: borrowers_stats.pl,v 1.10.2.4 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Acquisition;
Index: reports/cat_issues_top.pl
===================================================================
RCS file: /sources/koha/koha/reports/cat_issues_top.pl,v
retrieving revision 1.10.2.4
retrieving revision 1.10.2.5
diff -u -b -r1.10.2.4 -r1.10.2.5
--- reports/cat_issues_top.pl 30 Nov 2006 18:23:51 -0000 1.10.2.4
+++ reports/cat_issues_top.pl 14 Dec 2006 15:41:55 -0000 1.10.2.5
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: cat_issues_top.pl,v 1.10.2.4 2006/11/30 18:23:51 toins Exp $
+# $Id: cat_issues_top.pl,v 1.10.2.5 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
Index: reports/catalogue_out.pl
===================================================================
RCS file: /sources/koha/koha/reports/catalogue_out.pl,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -b -r1.5.2.3 -r1.5.2.4
--- reports/catalogue_out.pl 30 Nov 2006 18:23:51 -0000 1.5.2.3
+++ reports/catalogue_out.pl 14 Dec 2006 15:41:55 -0000 1.5.2.4
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: catalogue_out.pl,v 1.5.2.3 2006/11/30 18:23:51 toins Exp $
+# $Id: catalogue_out.pl,v 1.5.2.4 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
Index: reports/catalogue_stats.pl
===================================================================
RCS file: /sources/koha/koha/reports/catalogue_stats.pl,v
retrieving revision 1.17.2.2
retrieving revision 1.17.2.3
diff -u -b -r1.17.2.2 -r1.17.2.3
--- reports/catalogue_stats.pl 30 Nov 2006 18:23:51 -0000 1.17.2.2
+++ reports/catalogue_stats.pl 14 Dec 2006 15:41:55 -0000 1.17.2.3
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: catalogue_stats.pl,v 1.17.2.2 2006/11/30 18:23:51 toins Exp $
+# $Id: catalogue_stats.pl,v 1.17.2.3 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
Index: reports/issues_avg_stats.pl
===================================================================
RCS file: /sources/koha/koha/reports/issues_avg_stats.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- reports/issues_avg_stats.pl 7 Dec 2006 16:29:31 -0000 1.5.2.4
+++ reports/issues_avg_stats.pl 14 Dec 2006 15:41:55 -0000 1.5.2.5
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: issues_avg_stats.pl,v 1.5.2.4 2006/12/07 16:29:31 hdl Exp $
+# $Id: issues_avg_stats.pl,v 1.5.2.5 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
Index: reports/issues_by_borrower_category.plugin
===================================================================
RCS file: /sources/koha/koha/reports/issues_by_borrower_category.plugin,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -b -r1.4.2.1 -r1.4.2.2
--- reports/issues_by_borrower_category.plugin 31 Aug 2006 13:15:06 -0000 1.4.2.1
+++ reports/issues_by_borrower_category.plugin 14 Dec 2006 15:41:55 -0000 1.4.2.2
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: issues_by_borrower_category.plugin,v 1.4.2.1 2006/08/31 13:15:06 btoumi Exp $
+# $Id: issues_by_borrower_category.plugin,v 1.4.2.2 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -27,6 +27,7 @@
use C4::Search;
use C4::Output;
use C4::Koha;
+use C4::Branch; # GetBranches
=head1 NAME
Index: reports/issues_stats.pl
===================================================================
RCS file: /sources/koha/koha/reports/issues_stats.pl,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -u -b -r1.13.2.2 -r1.13.2.3
--- reports/issues_stats.pl 30 Nov 2006 18:23:51 -0000 1.13.2.2
+++ reports/issues_stats.pl 14 Dec 2006 15:41:55 -0000 1.13.2.3
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: issues_stats.pl,v 1.13.2.2 2006/11/30 18:23:51 toins Exp $
+# $Id: issues_stats.pl,v 1.13.2.3 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -23,7 +23,7 @@
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
@@ -41,8 +41,6 @@
=cut
-
-
my $input = new CGI;
my $do_it=$input->param('do_it');
my $fullreportname = "reports/issues_stats.tmpl";
Index: reports/itemtypes.plugin
===================================================================
RCS file: /sources/koha/koha/reports/itemtypes.plugin,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -b -r1.3.2.1 -r1.3.2.2
--- reports/itemtypes.plugin 31 Aug 2006 13:15:06 -0000 1.3.2.1
+++ reports/itemtypes.plugin 14 Dec 2006 15:41:55 -0000 1.3.2.2
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: itemtypes.plugin,v 1.3.2.1 2006/08/31 13:15:06 btoumi Exp $
+# $Id: itemtypes.plugin,v 1.3.2.2 2006/12/14 15:41:55 toins Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -27,7 +27,7 @@
use C4::Search;
use C4::Output;
use C4::Koha;
-
+use C4::Branch; # GetBranches
=head1
=cut
Index: reports/reservereport.pl
===================================================================
RCS file: /sources/koha/koha/reports/reservereport.pl,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -b -r1.9.2.2 -r1.9.2.3
--- reports/reservereport.pl 21 Nov 2006 10:45:54 -0000 1.9.2.2
+++ reports/reservereport.pl 14 Dec 2006 15:41:55 -0000 1.9.2.3
@@ -28,7 +28,7 @@
use C4::Date;
use CGI;
use C4::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Koha;
Index: reserve/request.pl
===================================================================
RCS file: /sources/koha/koha/reserve/request.pl,v
retrieving revision 1.6.2.12
retrieving revision 1.6.2.13
diff -u -b -r1.6.2.12 -r1.6.2.13
--- reserve/request.pl 5 Dec 2006 14:39:56 -0000 1.6.2.12
+++ reserve/request.pl 14 Dec 2006 15:41:55 -0000 1.6.2.13
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: request.pl,v 1.6.2.12 2006/12/05 14:39:56 alaurin Exp $
+# $Id: request.pl,v 1.6.2.13 2006/12/14 15:41:55 toins Exp $
#writen 2/1/00 by chris at katipo.oc.nz
# Copyright 2000-2002 Katipo Communications
@@ -27,7 +27,7 @@
=cut
use strict;
-use HTML::Template;
+use C4::Branch; # GetBranches get_branchinfos_of
use CGI;
use List::MoreUtils qw/uniq/;
use Date::Calc qw/Today Date_to_Days/;
@@ -426,8 +426,4 @@
);
# printout the page
-print $input->header(
- -type => C4::Interface::CGI::Output::guesstype( $template->output ),
- -expires => 'now'
- ),
- $template->output;
+output_html_with_http_headers $input, $cookie, $template->output;
Index: serials/serials-recieve.pl
===================================================================
RCS file: /sources/koha/koha/serials/Attic/serials-recieve.pl,v
retrieving revision 1.4.2.5
retrieving revision 1.4.2.6
diff -u -b -r1.4.2.5 -r1.4.2.6
--- serials/serials-recieve.pl 5 Dec 2006 11:35:32 -0000 1.4.2.5
+++ serials/serials-recieve.pl 14 Dec 2006 15:41:55 -0000 1.4.2.6
@@ -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: serials-recieve.pl,v 1.4.2.5 2006/12/05 11:35:32 toins Exp $
+# $Id: serials-recieve.pl,v 1.4.2.6 2006/12/14 15:41:55 toins Exp $
=head1 NAME
@@ -73,7 +73,7 @@
use C4::Interface::CGI::Output;
use C4::Context;
use C4::Serials;
-use HTML::Template;
+use C4::Branch; # GetBranches
my $query = new CGI;
my $op = $query->param('op');
Index: serials/subscription-add.pl
===================================================================
RCS file: /sources/koha/koha/serials/subscription-add.pl,v
retrieving revision 1.6.2.9
retrieving revision 1.6.2.10
diff -u -b -r1.6.2.9 -r1.6.2.10
--- serials/subscription-add.pl 27 Nov 2006 13:36:46 -0000 1.6.2.9
+++ serials/subscription-add.pl 14 Dec 2006 15:41:55 -0000 1.6.2.10
@@ -24,7 +24,7 @@
use C4::Acquisition;
use C4::Interface::CGI::Output;
use C4::Context;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Serials;
use Date::Manip;
use C4::Letters;
Index: tools/export.pl
===================================================================
RCS file: /sources/koha/koha/tools/export.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- tools/export.pl 5 Dec 2006 11:35:32 -0000 1.1.2.4
+++ tools/export.pl 14 Dec 2006 15:41:55 -0000 1.1.2.5
@@ -16,9 +16,8 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: export.pl,v 1.1.2.4 2006/12/05 11:35:32 toins Exp $
+# $Id: export.pl,v 1.1.2.5 2006/12/14 15:41:55 toins Exp $
-use HTML::Template;
use strict;
require Exporter;
use C4::Database;
@@ -28,6 +27,7 @@
use C4::Biblio;
use CGI;
use C4::Koha;
+use C4::Branch; # GetBranches
my $query = new CGI;
my $op=$query->param("op");
Index: tools/inventory.pl
===================================================================
RCS file: /sources/koha/koha/tools/Attic/inventory.pl,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- tools/inventory.pl 5 Dec 2006 11:23:55 -0000 1.1.2.3
+++ tools/inventory.pl 14 Dec 2006 15:41:55 -0000 1.1.2.4
@@ -26,18 +26,8 @@
use C4::Circulation::Circ2;
use C4::Date;
use C4::Koha;
-use HTML::Template;
+use C4::Branch; # GetBranches
-# Fixed variables
-my $linecolor1='#ffffcc';
-my $linecolor2='white';
-my $backgroundimage="/images/background-mem.gif";
-my $script_name="/cgi-bin/koha/admin/branches.pl";
-my $pagepagesize=20;
-
-
-#######################################################################################
-# Main loop....
my $input = new CGI;
my $minlocation=$input->param('minlocation') || 'A';
my $maxlocation=$input->param('maxlocation');
Index: tools/itemslost.pl
===================================================================
RCS file: /sources/koha/koha/tools/Attic/itemslost.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- tools/itemslost.pl 29 Nov 2006 11:56:13 -0000 1.1.2.1
+++ tools/itemslost.pl 14 Dec 2006 15:41:55 -0000 1.1.2.2
@@ -15,7 +15,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-#$Id: itemslost.pl,v 1.1.2.1 2006/11/29 11:56:13 toins Exp $
+#$Id: itemslost.pl,v 1.1.2.2 2006/12/14 15:41:55 toins Exp $
=head1 itemslost
@@ -28,7 +28,8 @@
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # GetLostItems
-use C4::Koha; # GetBranches GetBranch GetItemTypes
+use C4::Koha; # GetItemTypes
+use C4::Branch; # GetBranches
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Index: tools/overduerules.pl
===================================================================
RCS file: /sources/koha/koha/tools/overduerules.pl,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- tools/overduerules.pl 10 Nov 2006 09:55:53 -0000 1.3.2.3
+++ tools/overduerules.pl 14 Dec 2006 15:41:55 -0000 1.3.2.4
@@ -26,7 +26,7 @@
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
-use HTML::Template;
+use C4::Branch; # GetBranches
use C4::Letters;
my $input = new CGI;
Index: C4/Branch.pm
===================================================================
RCS file: C4/Branch.pm
diff -N C4/Branch.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ C4/Branch.pm 14 Dec 2006 15:41:53 -0000 1.1.2.1
@@ -0,0 +1,421 @@
+package C4::Branch;
+
+# 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
+
+# $Id: Branch.pm,v 1.1.2.1 2006/12/14 15:41:53 toins Exp $
+
+use strict;
+require Exporter;
+use C4::Context;
+use C4::Koha;
+
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+# set the version for version checking
+$VERSION = do { my @v = '$Revision: 1.1.2.1 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+
+=head1 NAME
+
+C4::Branch - Koha branch module
+
+=head1 SYNOPSIS
+
+use C4::Branch;
+
+=head1 DESCRIPTION
+
+The functions in this module deal with branches.
+
+=head1 FUNCTIONS
+
+=cut
+
+ at ISA = qw(Exporter);
+ at EXPORT = qw(
+ &GetBranchCategory
+ &GetBranchName
+ &GetBranch
+ &GetBranches
+ &GetBranchDetail
+ &get_branchinfos_of
+ &ModBranch
+ &CheckBranchCategorycode
+ &GetBranchInfo
+ &ModBranchCategoryInfo
+);
+
+=head2 GetBranches
+
+ $branches = &GetBranches();
+ returns informations about ALL branches.
+ Create a branch selector with the following code
+ IndependantBranches Insensitive...
+
+=head3 in PERL SCRIPT
+
+my $branches = GetBranches;
+my @branchloop;
+foreach my $thisbranch (keys %$branches) {
+ my $selected = 1 if $thisbranch eq $branch;
+ my %row =(value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;
+}
+
+
+=head3 in TEMPLATE
+ <select name="branch">
+ <option value="">Default</option>
+ <!-- TMPL_LOOP name="branchloop" -->
+ <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+
+=cut
+
+sub GetBranches {
+
+ # returns a reference to a hash of references to ALL branches...
+ my %branches;
+ my $dbh = C4::Context->dbh;
+ my $sth;
+ $sth = $dbh->prepare("Select * from branches order by branchname");
+ $sth->execute;
+ while ( my $branch = $sth->fetchrow_hashref ) {
+ my $nsth =
+ $dbh->prepare(
+ "select categorycode from branchrelations where branchcode = ?");
+ $nsth->execute( $branch->{'branchcode'} );
+ while ( my ($cat) = $nsth->fetchrow_array ) {
+
+ # FIXME - This seems wrong. It ought to be
+ # $branch->{categorycodes}{$cat} = 1;
+ # otherwise, there's a namespace collision if there's a
+ # category with the same name as a field in the 'branches'
+ # table (i.e., don't create a category called "issuing").
+ # In addition, the current structure doesn't really allow
+ # you to list the categories that a branch belongs to:
+ # you'd have to list keys %$branch, and remove those keys
+ # that aren't fields in the "branches" table.
+ $branch->{$cat} = 1;
+ }
+ $branches{ $branch->{'branchcode'} } = $branch;
+ }
+ return ( \%branches );
+}
+
+=head2 GetBranchName
+
+=cut
+
+sub GetBranchName {
+ my ($branchcode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth;
+ $sth = $dbh->prepare("Select branchname from branches where branchcode=?");
+ $sth->execute($branchcode);
+ my $branchname = $sth->fetchrow_array;
+ $sth->finish;
+ return ($branchname);
+}
+
+=head2 ModBranch
+
+&ModBranch($newvalue);
+
+This function modify an existing branches.
+
+C<$newvalue> is a ref to an array wich is containt all the column from branches table.
+
+=cut
+
+sub ModBranch {
+ my ($data) = @_;
+
+ my $dbh = C4::Context->dbh;
+ my $query = "
+ REPLACE branches
+ (branchcode,branchname,branchaddress1,
+ branchaddress2,branchaddress3,branchphone,
+ branchfax,branchemail,branchip,branchprinter)
+ VALUES (?,?,?,?,?,?,?,?,?,?)
+ ";
+ my $sth = $dbh->prepare($query);
+ $sth->execute(
+ $data->{'branchcode'}, $data->{'branchname'},
+ $data->{'branchaddress1'}, $data->{'branchaddress2'},
+ $data->{'branchaddress3'}, $data->{'branchphone'},
+ $data->{'branchfax'}, $data->{'branchemail'},
+ $data->{'branchip'}, $data->{'branchprinter'},
+ );
+
+ # sort out the categories....
+ my @checkedcats;
+ my $cats = GetBranchCategory();
+ foreach my $cat (@$cats) {
+ my $code = $cat->{'categorycode'};
+ if ( $data->{$code} ) {
+ push( @checkedcats, $code );
+ }
+ }
+ my $branchcode = uc( $data->{'branchcode'} );
+ my $branch = GetBranchInfo($branchcode);
+ $branch = $branch->[0];
+ my $branchcats = $branch->{'categories'};
+ my @addcats;
+ my @removecats;
+ foreach my $bcat (@$branchcats) {
+
+ unless ( grep { /^$bcat$/ } @checkedcats ) {
+ push( @removecats, $bcat );
+ }
+ }
+ foreach my $ccat (@checkedcats) {
+ unless ( grep { /^$ccat$/ } @$branchcats ) {
+ push( @addcats, $ccat );
+ }
+ }
+ foreach my $cat (@addcats) {
+ my $sth =
+ $dbh->prepare(
+"insert into branchrelations (branchcode, categorycode) values(?, ?)"
+ );
+ $sth->execute( $branchcode, $cat );
+ $sth->finish;
+ }
+ foreach my $cat (@removecats) {
+ my $sth =
+ $dbh->prepare(
+ "delete from branchrelations where branchcode=? and categorycode=?"
+ );
+ $sth->execute( $branchcode, $cat );
+ $sth->finish;
+ }
+}
+
+=head2 GetBranchCategory
+
+$results = GetBranchCategory($categorycode);
+
+C<$results> is an ref to an array.
+
+=cut
+
+sub GetBranchCategory {
+
+ # returns a reference to an array of hashes containing branches,
+ my ($catcode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth;
+
+ # print DEBUG "GetBranchCategory: entry: catcode=".cvs($catcode)."\n";
+ if ($catcode) {
+ $sth =
+ $dbh->prepare(
+ "select * from branchcategories where categorycode = ?");
+ $sth->execute($catcode);
+ }
+ else {
+ $sth = $dbh->prepare("Select * from branchcategories");
+ $sth->execute();
+ }
+ my @results;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @results, $data );
+ }
+ $sth->finish;
+
+ # print DEBUG "GetBranchCategory: exit: returning ".cvs(\@results)."\n";
+ return \@results;
+}
+
+=head2 GetBranch
+
+$branch = GetBranch( $query, $branches );
+
+=cut
+
+sub GetBranch ($$) {
+ my ( $query, $branches ) = @_; # get branch for this query from branches
+ my $branch = $query->param('branch');
+ my %cookie = $query->cookie('userenv');
+ ($branch) || ($branch = $cookie{'branchname'});
+ ( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] );
+ return $branch;
+}
+
+=head2 GetBranchDetail
+
+ $branchname = &GetBranchDetail($branchcode);
+
+Given the branch code, the function returns the corresponding
+branch name for a comprehensive information display
+
+=cut
+
+sub GetBranchDetail {
+ my ($branchcode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
+ $sth->execute($branchcode);
+ my $branchname = $sth->fetchrow_hashref();
+ $sth->finish();
+ return $branchname;
+}
+
+
+=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 GetBranchInfo
+
+$results = GetBranchInfo($branchcode);
+
+C<$results> is a ref to an array.
+
+=cut
+
+sub GetBranchInfo {
+
+ # returns a reference to an array of hashes containing branches,
+
+ my ($branchcode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth;
+ if ($branchcode) {
+ $sth =
+ $dbh->prepare(
+ "Select * from branches where branchcode = ? order by branchcode");
+ $sth->execute($branchcode);
+ }
+ else {
+ $sth = $dbh->prepare("Select * from branches order by branchcode");
+ $sth->execute();
+ }
+ my @results;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ my $nsth =
+ $dbh->prepare(
+ "select categorycode from branchrelations where branchcode = ?");
+ $nsth->execute( $data->{'branchcode'} );
+ my @cats = ();
+ while ( my ($cat) = $nsth->fetchrow_array ) {
+ push( @cats, $cat );
+ }
+ $nsth->finish;
+ $data->{'categories'} = \@cats;
+ push( @results, $data );
+ }
+ $sth->finish;
+ return \@results;
+}
+
+=head2 DelBranch
+
+&DelBranch($branchcode);
+
+=cut
+
+sub DelBranch {
+ my ($branchcode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("delete from branches where branchcode = ?");
+ $sth->execute($branchcode);
+ $sth->finish;
+}
+
+=head2 ModBranchCategoryInfo
+
+&ModBranchCategoryInfo($data);
+sets the data from the editbranch form, and writes to the database...
+
+=cut
+
+sub ModBranchCategoryInfo {
+
+ my ($data) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("replace branchcategories (categorycode,categoryname,codedescription) values (?,?,?)");
+ $sth->execute(uc( $data->{'categorycode'} ),$data->{'categoryname'}, $data->{'codedescription'} );
+ $sth->finish;
+}
+
+=head2 DeleteBranchCategory
+
+DeleteBranchCategory($categorycode);
+
+=cut
+
+sub DeleteBranchCategory {
+ my ($categorycode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("delete from branchcategories where categorycode = ?");
+ $sth->execute($categorycode);
+ $sth->finish;
+}
+
+=head2 CheckBranchCategorycode
+
+$number_rows_affected = CheckBranchCategorycode($categorycode);
+
+=cut
+
+sub CheckBranchCategorycode {
+
+ # check to see if the branchcode is being used in the database somewhere....
+ my ($categorycode) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth =
+ $dbh->prepare(
+ "select count(*) from branchrelations where categorycode=?");
+ $sth->execute($categorycode);
+ my ($total) = $sth->fetchrow_array;
+ return $total;
+}
+
+
+
+=head1 AUTHOR
+
+Koha Developement team <info at koha.org>
+
+=cut
More information about the Koha-cvs
mailing list