[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha admin/branches.pl C4/Branch.pm koha-tmpl/i... [rel_3_0]
From: |
paul poulain |
Subject: |
[Koha-cvs] koha admin/branches.pl C4/Branch.pm koha-tmpl/i... [rel_3_0] |
Date: |
Thu, 25 Jan 2007 10:13:00 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: paul poulain <tipaul> 07/01/25 10:13:00
Modified files:
admin : branches.pl
C4 : Branch.pm
koha-tmpl/intranet-tmpl/prog/en/admin: branches.tmpl
Log message:
bugfixing branches :
REPLACE is not standard SQL, and there are intergity constraint risen
when the branch is used : using INSERT or UPDATE instead.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/admin/branches.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.34.2.4&r2=1.34.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Branch.pm?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/koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.4&r2=1.3.2.5
Patches:
Index: admin/branches.pl
===================================================================
RCS file: /sources/koha/koha/admin/branches.pl,v
retrieving revision 1.34.2.4
retrieving revision 1.34.2.5
diff -u -b -r1.34.2.4 -r1.34.2.5
--- admin/branches.pl 22 Dec 2006 17:13:48 -0000 1.34.2.4
+++ admin/branches.pl 25 Jan 2007 10:12:59 -0000 1.34.2.5
@@ -90,7 +90,6 @@
if ( $op eq 'add' ) {
# If the user has pressed the "add new branch" button.
- heading("Branches: Add Branch",$template);
$template->param( 'heading-branches-add-branch-p' => 1 );
editbranchform($branchcode,$template);
@@ -98,9 +97,8 @@
elsif ( $op eq 'edit' ) {
# if the user has pressed the "edit branch settings" button.
- heading("Branches: Edit Branch",$template);
- $template->param( 'heading-branches-edit-branch-p' => 1 );
- $template->param( add => 1 );
+ $template->param( 'heading-branches-add-branch-p' => 0,
+ 'add' => 1, );
editbranchform($branchcode,$template);
}
elsif ( $op eq 'add_validate' ) {
@@ -203,19 +201,12 @@
sub default {
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,$innertemplate) = @_;
- $innertemplate->param( head => $head );
-}
-
sub editbranchform {
my ($branchcode,$innertemplate) = @_;
# initiate the scrolling-list to select the printers
Index: C4/Branch.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Branch.pm,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- C4/Branch.pm 12 Jan 2007 18:10:19 -0000 1.1.2.4
+++ C4/Branch.pm 25 Jan 2007 10:13:00 -0000 1.1.2.5
@@ -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: Branch.pm,v 1.1.2.4 2007/01/12 18:10:19 toins Exp $
+# $Id: Branch.pm,v 1.1.2.5 2007/01/25 10:13:00 tipaul Exp $
use strict;
require Exporter;
@@ -25,7 +25,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.1.2.4 $' =~ /\d+/g; shift(@v).".".join(
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.1.2.5 $' =~ /\d+/g; shift(@v).".".join(
"_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -155,8 +155,9 @@
my ($data) = @_;
my $dbh = C4::Context->dbh;
+ if ($data->{add}) {
my $query = "
- REPLACE branches
+ INSERT INTO branches
(branchcode,branchname,branchaddress1,
branchaddress2,branchaddress3,branchphone,
branchfax,branchemail,branchip,branchprinter)
@@ -170,7 +171,24 @@
$data->{'branchfax'}, $data->{'branchemail'},
$data->{'branchip'}, $data->{'branchprinter'},
);
-
+ } else {
+ my $query = "
+ UPDATE branches
+ SET branchname=?,branchaddress1=?,
+ branchaddress2=?,branchaddress3=?,branchphone=?,
+ branchfax=?,branchemail=?,branchip=?,branchprinter=?
+ WHERE branchcode=?
+ ";
+ my $sth = $dbh->prepare($query);
+ $sth->execute(
+ $data->{'branchname'},
+ $data->{'branchaddress1'}, $data->{'branchaddress2'},
+ $data->{'branchaddress3'}, $data->{'branchphone'},
+ $data->{'branchfax'}, $data->{'branchemail'},
+ $data->{'branchip'}, $data->{'branchprinter'},
+ $data->{'branchcode'},
+ );
+ }
# sort out the categories....
my @checkedcats;
my $cats = GetBranchCategory();
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.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl 14 Dec 2006 15:41:54
-0000 1.3.2.4
+++ koha-tmpl/intranet-tmpl/prog/en/admin/branches.tmpl 25 Jan 2007 10:13:00
-0000 1.3.2.5
@@ -8,9 +8,18 @@
<!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
<!-- TMPL_IF name="add" -->
-<h1><!-- TMPL_VAR name="head" --></h1>
-<form action="<!-- TMPL_VAR name="action" -->" name="Aform" method="post">
+ <!-- TMPL_IF name="heading-branches-add-branch-p" -->
+ <h1>Add branch</h1>
+ <!-- TMPL_ELSE -->
+ <h1>Modify branch</h1>
+ <!-- /TMPL_IF -->
+ <form action="<!-- TMPL_VAR name="action" -->" name="Aform" method="post">
<input type="hidden" name="op" value="add_validate" />
+ <!-- TMPL_IF name="heading-branches-add-branch-p" -->
+ <input type="hidden" name="add" value="1" />
+ <!-- TMPL_ELSE -->
+ <input type="hidden" name="add" value="0" />
+ <!-- /TMPL_IF -->
<p>
<label><b>Branch code</b></label>
<!-- TMPL_IF name="branchcode" -->
@@ -45,7 +54,7 @@
<!-- /TMPL_LOOP -->
</select>
<p><input type="submit" value="Submit" /></p>
-</form>
+ </form>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="delete_confirm" -->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha admin/branches.pl C4/Branch.pm koha-tmpl/i... [rel_3_0],
paul poulain <=