From 86259e5f3a3aef92920653cfe6f7719fc63d1eef Mon Sep 17 00:00:00 2001 From: lavide Date: Tue, 15 Oct 2002 20:37:26 +0000 Subject: [PATCH] Yet the last version of branche.pl after a good story with cvs using by a beginner to use HTML::Template --- admin/branches.pl | 100 +++------------------------------------------- 1 file changed, 6 insertions(+), 94 deletions(-) diff --git a/admin/branches.pl b/admin/branches.pl index b0a8ea47ba..3f0290b247 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -56,6 +56,7 @@ if ($op eq 'add') { # If the user has pressed the "add new branch" button. heading("Branches: Add Branch"); editbranchform(); + } elsif ($op eq 'edit') { # if the user has pressed the "edit branch settings" button. heading("Branches: Edit Branch"); @@ -141,56 +142,17 @@ sub editbranchform { my $tmp = $cat->{'categorycode'}; if (grep {/^$tmp$/} @{$data->{'categories'}}) { $checked = "CHECKED"; -<<<<<<< branches.pl } $template->param(categoryname => $cat->{'categoryname'}); $template->param(categorycode => $cat->{'categorycode'}); $template->param(codedescription => $checked>$cat->{'codedescription'}); } -======= - } - $catcheckbox .= <$cat->{'categoryname'} -$cat->{'codedescription'} -EOF - } - my $form = < - - - - -$catcheckbox - - - - - - - -
Branch code
Name 
Address
 
 
Phone
Fax
E-mail
 
- -EOF - return $form; ->>>>>>> 1.5 } sub deleteconfirm { -# message to print if the +# message to print if the my ($branchcode) = @_; -<<<<<<< branches.pl -======= - my $output = < - - -
-
-EOF - return $output; ->>>>>>> 1.5 } @@ -204,22 +166,6 @@ sub branchinfotable { } else { $branchinfo = getbranchinfo(); } -<<<<<<< branches.pl -======= - my $table = < - -Branches - -Name -Code -Address -Categories -  - -EOF - ->>>>>>> 1.5 my $color; foreach my $branch (@$branchinfo) { ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); @@ -237,33 +183,12 @@ EOF $categories .= $catinfo->{'categoryname'}."
"; } $categories = '(no categories set)' unless ($categories); -<<<<<<< branches.pl $template->param(color => $color); $template->param(branch_name => $branch->{'branchname'}); $template->param(adress => $address); $template->param(categories => $categories); $template->param(branch_code => $branch->{'branchcode'}); $template->param(value => $branch->{'branchcode'}); -======= - $table .= < - $branch->{'branchname'} - $branch->{'branchcode'} - $address - $categories - -
- - - -
-
- - -
- -EOF ->>>>>>> 1.5 } } @@ -272,19 +197,6 @@ sub branchcategoriestable { #Needs to be implemented... my $categoryinfo = getcategoryinfo(); -<<<<<<< branches.pl -======= - my $table = < - -Branches Categories - -Name -Code -Description - -EOF ->>>>>>> 1.5 my $color; foreach my $cat (@$categoryinfo) { ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1); @@ -313,7 +225,7 @@ sub getbranchinfo { my $sth = $dbh->prepare($query); $sth->execute; my @results; - while (my $data = $sth->fetchrow_hashref) { + while (my $data = $sth->fetchrow_hashref) { my $tmp = $data->{'branchcode'}; my $brc = $dbh->quote($tmp); $query = "select categorycode from branchrelations where branchcode = $brc"; my $nsth = $dbh->prepare($query); @@ -344,7 +256,7 @@ sub getcategoryinfo { my $sth = $dbh->prepare($query); $sth->execute; my @results; - while (my $data = $sth->fetchrow_hashref) { + while (my $data = $sth->fetchrow_hashref) { push(@results, $data); } $sth->finish; @@ -392,7 +304,7 @@ sub setbranchinfo { unless (grep {/^$ccat$/} @$branchcats) { push(@addcats, $ccat); } - } + } # FIXME - There's already a $dbh in this scope. my $dbh = C4::Context->dbh; foreach my $cat (@addcats) { @@ -430,7 +342,7 @@ sub checkdatabasefor { my $message; if ($total) { $message = "Branch cannot be deleted because there are $total items using that branch."; - } + } return $message; } -- 2.39.5