if ($error) {
# copy input parameters back to form
# FIXME - doing this doesn't preserve any branch group selections, but good enough for now
- $template->param(%$params); # FIXME: Allows user to set ANY TMPL_VAR to ANY value!!
- $template->param(branch_name => $params->{branchname});
+ editbranchform($branchcode,$template);
$template->param( 'heading-branches-add-branch-p' => 1, 'add' => 1, "ERROR$error" => 1 );
} else {
$template->param( else => 1);
# 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;
- if ($total) {
+ my $sthitems = $dbh->prepare("select count(*) from items where holdingbranch=? or homebranch=?");
+ my $sthborrowers = $dbh->prepare("select count(*) from borrowers where branchcode=?");
+ $sthitems->execute( $branchcode, $branchcode );
+ $sthborrowers->execute( $branchcode );
+ my ($totalitems) = $sthitems->fetchrow_array;
+ my ($totalborrowers) = $sthitems->fetchrow_array;
+ if ($totalitems or $totalborrowers) {
$template->param( else => 1 );
default("MESSAGE7", $template);
}
branchaddress1 => $data->{'branchaddress1'},
branchaddress2 => $data->{'branchaddress2'},
branchaddress3 => $data->{'branchaddress3'},
+ branchzip => $data->{'branchzip'},
+ branchcity => $data->{'branchcity'},
+ branchcountry => $data->{'branchcountry'},
branchphone => $data->{'branchphone'},
branchfax => $data->{'branchfax'},
branchemail => $data->{'branchemail'},
- branchip => $data->{'branchip'}
+ branchurl => $data->{'branchurl'},
+ branchip => $data->{'branchip'},
+ branchnotes => $data->{'branchnotes'},
);
}
# - branchaddress1 \
# - branchaddress2 |
# - branchaddress3 | comprising the old "address" field
+ # - branchzip |
+ # - branchcity |
+ # - branchcountry |
# - branchphone |
# - branchfax |
# - branchemail /
+ # - branchurl /
# - address-empty-p (1 if no address information, 0 otherwise)
# - categories (containing a static error message)
# - category_list (loop containing "categoryname")
my $address_empty_p = 1;
for my $field (
'branchaddress1', 'branchaddress2',
- 'branchaddress3', 'branchphone',
- 'branchfax', 'branchemail',
- 'branchip', 'branchprinter'
+ 'branchaddress3', 'branchzip',
+ 'branchcity', 'branchcountry',
+ 'branchphone', 'branchfax',
+ 'branchemail', 'branchurl',
+ 'branchip', 'branchprinter', 'branchnotes'
)
{
$row{$field} = $branch->{$field};