add an element for selecting part_pkg frequencies
authorivan <ivan>
Sun, 13 Apr 2008 02:55:44 +0000 (02:55 +0000)
committerivan <ivan>
Sun, 13 Apr 2008 02:55:44 +0000 (02:55 +0000)
httemplate/elements/tr-part_pkg_freq.html [new file with mode: 0644]

diff --git a/httemplate/elements/tr-part_pkg_freq.html b/httemplate/elements/tr-part_pkg_freq.html
new file mode 100644 (file)
index 0000000..98b7da5
--- /dev/null
@@ -0,0 +1,29 @@
+<% include('tr-td-label.html', @_ ) %>
+
+  <TD>
+    <SELECT NAME="freq">
+%     foreach my $freq ( @freq ) {
+        <OPTION VALUE="<% $freq %>" <% $freq eq $curr_value ? 'SELECTED' : '' %>><% $freq{$freq} %>
+%     }
+    </SELECT>
+  </TD>
+
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+my $curr_value = $opt{'curr_value'} || $opt{'freq'};
+
+tie my %freq, 'Tie::IxHash', %{FS::part_pkg->freqs_href()};
+if ( dbdef->table('part_pkg')->column('freq')->type =~ /(int)/i ) {
+  delete $freq{$_} foreach grep { ! /^\d+$/ } keys %freq;
+}
+
+my @freq = keys %freq;
+@freq = grep { /^\d+$/ } @freq
+  if $opt{'month_increments_only'};
+#   if exists($plans{$layer}->{'freq'}) && $plans{$layer}->{'freq'} eq 'm';
+
+</%init>