Removing replace statement from C4::Branch as per bug 1546

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Chris Cormack 2008-01-08 18:03:25 -06:00 committed by Joshua Ferraro
parent b5a1060788
commit 96e89fa4dc
2 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -223,6 +223,11 @@
<h3><!-- TMPL_IF NAME="categorycode" -->Edit Group <!-- TMPL_VAR NAME="categorycode" --><!-- TMPL_ELSE -->Add Group<!-- /TMPL_IF --></h3>
<form action="<!-- TMPL_VAR name="action" -->" name="Aform" method="post">
<input type="hidden" name="op" value="addcategory_validate" />
<!-- TMPL_IF NAME="categorycode" -->
<input type="hidden" name="add" value="0">
<!-- TMPL_ELSE -->
<input type="hidden" name="add" value="1">
<!-- /TMPL_IF -->
<fieldset class="rows">
<ol><li>