format_percent auf 2 stellen defaulten
[kivitendo-erp.git] / SL / CVar.pm
index f9e2d8a..cdc05b5 100644 (file)
@@ -353,7 +353,7 @@ sub save_custom_variables {
 }
 
 sub render_inputs {
-  $main::lxdebug->enter_sub();
+  $main::lxdebug->enter_sub(2);
 
   my $self     = shift;
   my %params   = @_;
@@ -374,7 +374,7 @@ sub render_inputs {
     $var->{VALID_BOX} = $form->parse_html_template('amcvar/render_checkboxes', { var => $var, %options });
   }
 
-  $main::lxdebug->leave_sub();
+  $main::lxdebug->leave_sub(2);
 }
 
 sub render_search_options {
@@ -490,8 +490,7 @@ sub build_filter_query {
     }
 
     if (@sub_where) {
-      push @sub_where,  qq|cvar.sub_module = ?|;
-      push @sub_values, "$params{sub_module}";
+      add_token(\@sub_where, \@sub_values, col => 'cvar.sub_module', val => $params{sub_module} || '');
 
       push @where,
         qq|$not EXISTS(
@@ -606,18 +605,6 @@ sub get_field_format_list {
   return ($date_fields, $number_fields);
 }
 
-=head2 VALIDITY
-
-Suppose the following scenario:
-
-You have a lot of parts in your database, and a set of properties cofigured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display.
-
-Validity is assumed. If you modify validity, you actually save B<invalidity>.
-iNvalidity is saved as a function of config_id, and the trans_id
-
-In the naive way, disable an attribute for a specific id (simple)
-
-=cut
 sub save_custom_variables_validity {
   $main::lxdebug->enter_sub();
 
@@ -661,7 +648,7 @@ sub save_custom_variables_validity {
 }
 
 sub get_custom_variables_validity {
-  $main::lxdebug->enter_sub();
+  $main::lxdebug->enter_sub(2);
 
   my $self     = shift;
   my %params   = @_;
@@ -677,9 +664,42 @@ sub get_custom_variables_validity {
 
   my ($invalid) = selectfirst_array_query($form, $dbh, $query, conv_i($params{config_id}), conv_i($params{trans_id}));
 
-  $main::lxdebug->leave_sub();
+  $main::lxdebug->leave_sub(2);
 
   return !$invalid;
 }
 
 1;
+
+__END__
+
+=head1 NAME
+
+SL::CVar.pm - Custom Variables module
+
+=head1 SYNOPSIS
+
+  # dealing with configs
+
+  my $all_configs = CVar->get_configs()
+  my $config      = CVar->get_config(id => '1234')
+
+  CVar->save_config($config);
+  CVar->delete->config($config)
+
+  # dealing with custom vars
+
+  CVar->get_custom_variables(module => 'ic')
+
+=head2 VALIDITY
+
+Suppose the following scenario:
+
+You have a lot of parts in your database, and a set of properties cofigured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display.
+
+Validity is assumed. If you modify validity, you actually save B<invalidity>.
+Invalidity is saved as a function of config_id, and the trans_id
+
+In the naive way, disable an attribute for a specific id (simple)
+
+=cut