template-ize agent type edit and add comment to package listing
authorivan <ivan>
Fri, 18 Nov 2005 14:59:53 +0000 (14:59 +0000)
committerivan <ivan>
Fri, 18 Nov 2005 14:59:53 +0000 (14:59 +0000)
httemplate/edit/agent_type.cgi

index 637c710..6842163 100755 (executable)
@@ -1,4 +1,3 @@
-<!-- mason kludge -->
 <%
 
 my($agent_type);
@@ -14,50 +13,51 @@ if ( $cgi->param('error') ) {
   $agent_type = new FS::agent_type {};
 }
 my $action = $agent_type->typenum ? 'Edit' : 'Add';
-my $hashref = $agent_type->hashref;
 
-print header("$action Agent Type", menubar(
+%>
+
+<%= header("$action Agent Type", menubar(
   'Main Menu' => "$p",
   'View all agent types' => "${p}browse/agent_type.cgi",
-));
+))
+%>
 
-print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
-      "</FONT>"
-  if $cgi->param('error');
+<% if ( $cgi->param('error') ) { %>
+  <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
+<% } %>
 
-print '<FORM ACTION="', popurl(1), 'process/agent_type.cgi" METHOD=POST>',
-      qq!<INPUT TYPE="hidden" NAME="typenum" VALUE="$hashref->{typenum}">!,
-      "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)";
+<FORM ACTION="<%= popurl(1) %>process/agent_type.cgi" METHOD=POST>
+<INPUT TYPE="hidden" NAME="typenum" VALUE="<%= $agent_type->typenum %>">
+Agent Type #<%= $agent_type->typenum || "(NEW)" %>
+<BR><BR>
 
-print <<END;
-<BR><BR>Agent Type <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="$hashref->{atype}">
-<BR><BR>Select which packages agents of this type may sell to customers<BR>
-END
+Agent Type
+<INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<%= $agent_type->atype %>">
+<BR><BR>
 
-foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) {
-  print qq!<BR><INPUT TYPE="checkbox" NAME="pkgpart!,
-        $part_pkg->getfield('pkgpart'), qq!" !,
-       # ( 'CHECKED 'x scalar(
+Select which packages agents of this type may sell to customers<BR>
+
+<% foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { %>
+
+  <BR>
+  <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>" <%=
         qsearchs('type_pkgs',{
-          'typenum' => $agent_type->getfield('typenum'),
-          'pkgpart'  => $part_pkg->getfield('pkgpart'),
+          'typenum' => $agent_type->typenum,
+          'pkgpart' => $part_pkg->pkgpart,
         })
           ? 'CHECKED '
-          : '',
-        qq!VALUE="ON"> !,
-    qq!<A HREF="${p}edit/part_pkg.cgi?!, $part_pkg->pkgpart, 
-    '">', $part_pkg->pkgpart. ": ". $part_pkg->getfield('pkg'), '</A>',
-  ;
-}
+          : ''
+  %> VALUE="ON">
 
-print qq!<BR><BR><INPUT TYPE="submit" VALUE="!,
-      $hashref->{typenum} ? "Apply changes" : "Add agent type",
-      qq!">!;
+  <A HREF="<%= $p %>edit/part_pkg.cgi?<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkgpart %>: 
+  <%= $part_pkg->pkg %> (<%= $part_pkg->comment %>)</A>
+
+<% } %>
+
+<BR><BR>
+
+<INPUT TYPE="submit" VALUE="<%= $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
 
-print <<END;
     </FORM>
   </BODY>
 </HTML>
-END
-
-%>