- # make the checkboxes.....
- #
- # 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="checked"'
-
- my $catinfo = GetBranchCategory();
- my @categoryloop = ();
- foreach my $cat (@$catinfo) {
- my $checked = "";
- my $tmp = quotemeta( $cat->{'categorycode'} );
- if ( grep { /^$tmp$/ } @{ $data->{'categories'} } ) {
- $checked = "checked=\"checked\"";
- }
- push @categoryloop, {
- categoryname => $cat->{'categoryname'},
- categorycode => $cat->{'categorycode'},
- categorytype => $cat->{'categorytype'},
- codedescription => $cat->{'codedescription'},
- checked => $checked,
- };
- }
- $innertemplate->param( categoryloop => \@categoryloop );