make hours/input/output/total display on invoices conditional on there being any...
[freeside.git] / httemplate / config / config-process.cgi
index 99957eb..2597132 100644 (file)
@@ -10,7 +10,7 @@
     foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
       if ( $type eq '' ) {
       } elsif ( $type eq 'textarea' ) {
-        if ( $cgi->param($i->key. $n) ) {
+        if ( $cgi->param($i->key. $n) ne '' ) {
           my $value = $cgi->param($i->key. $n);
           $value =~ s/\r\n/\n/g; #browsers?
           $conf->set($i->key, $value);
           #$conf->delete($i->key);
           push @delete, $i->key;
         }
-      } elsif ( $type eq 'text' )  {
-        if ( $cgi->param($i->key. $n) ) {
+      } elsif ( $type eq 'text' || $type eq 'select' )  {
+        if ( $cgi->param($i->key. $n) ne '' ) {
           $conf->set($i->key, $cgi->param($i->key. $n));
         } else {
           $conf->delete($i->key);
         }
+      } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' )  {
+        if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) {
+          $conf->set($i->key, join("\n", @{[ $cgi->param($i->key. $n) ]} ));
+        } else {
+          $conf->delete($i->key);
+        }
       } else {
       }
       $n++;
@@ -43,4 +49,3 @@
 
 %>
 <%= $cgi->redirect("config-view.cgi") %>
-