From 0b48a8edf60a2219c8726bf7e43e43bd22cd28b6 Mon Sep 17 00:00:00 2001 From: acli Date: Sun, 9 Feb 2003 06:56:43 +0000 Subject: [PATCH] Trying to fix bug 130 here; corresponding changes will need to be made to the templates --- admin/branches.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/admin/branches.pl b/admin/branches.pl index 17fdd56d8f..ef8414783b 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -167,22 +167,38 @@ sub editbranchform { $template->param(branchfax => $data->{'branchfax'}); $template->param(branchemail => $data->{'branchemail'}); } -# make the checkboxs..... -# FIXME: this way of doing it is wrong (bug 130) + + # make the checkboxs..... + # + # We export a "categoryloop" array to the template, each element of which + # contains separate 'categoryname', 'categorycode', 'codedescription', and + # 'checked' fields. The $checked field is either '' or 'checked' + # (see bug 130) + # my $catinfo = getcategoryinfo(); my $catcheckbox; # print DEBUG "catinfo=".cvs($catinfo)."\n"; + my @categoryloop = (); foreach my $cat (@$catinfo) { my $checked = ""; - my $tmp = $cat->{'categorycode'}; + my $tmp = quotemeta($cat->{'categorycode'}); if (grep {/^$tmp$/} @{$data->{'categories'}}) { $checked = "CHECKED"; } - $template->param(categoryname => $cat->{'categoryname'}); - $template->param(categorycode => $cat->{'categorycode'}); - $template->param(codedescription => $checked>$cat->{'codedescription'}); + push @categoryloop, { + categoryname => $cat->{'categoryname'}, + categorycode => $cat->{'categorycode'}, + codedescription => $cat->{'codedescription'}, + checked => $checked, + }; + } + $template->param(categoryloop => \@categoryloop); + + # {{{ Leave this here until bug 130 is completely resolved in the templates + for my $obsolete ('categoryname', 'categorycode', 'codedescription') { + $template->param($obsolete => 'Your template is out of date (bug 130)'); } - + # }}} } sub deleteconfirm { -- 2.39.5