From 96e89fa4dc2d732bcb55865cf314d7970cf281f2 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 8 Jan 2008 18:03:25 -0600 Subject: [PATCH] Removing replace statement from C4::Branch as per bug 1546 Signed-off-by: Joshua Ferraro --- C4/Branch.pm | 16 ++++++++++++---- .../prog/en/modules/admin/branches.tmpl | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/C4/Branch.pm b/C4/Branch.pm index 47cfd6c59e..475516875c 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -480,12 +480,20 @@ 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,categorytype) values (?,?,?,?)"); - $sth->execute(uc( $data->{'categorycode'} ),$data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'} ); - $sth->finish; + if ($data->{'add'}){ + # we are doing an insert + my $sth = $dbh->prepare("INSERT INTO branchcategories (categorycode,categoryname,codedescription,categorytype) VALUES (?,?,?,?)"); + $sth->execute(uc( $data->{'categorycode'} ),$data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'} ); + $sth->finish(); + } + else { + # modifying + my $sth = $dbh->prepare("UPDATE branchcategories SET categoryname=?,codedescription=?,categorytype=? WHERE categorycode=?"); + $sth->execute($data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},uc( $data->{'categorycode'} ) ); + $sth->finish(); + } } =head2 DeleteBranchCategory diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl index af1776f67a..70fc20b2fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl @@ -223,6 +223,11 @@

Edit Group Add Group

" name="Aform" method="post"> + + + + +
  1. -- 2.39.5