Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 561744fd

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID 561744fd3b3dcd8cf0280e3b6dc2a81889610b29
  • Vorgänger 3e2892b1
  • Nachfolger 6988b41a

Funktion nicht doppelt invertieren

(das klingt als commit meldung noch
bescheuerter als es im code aussieht)

Unterschiede anzeigen:

SL/CVar.pm
364 364

  
365 365
  foreach my $var (@{ $params{variables} }) {
366 366
    $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var, %options });
367
    $var->{VALID_BOX} = "<input type=checkbox name='$options{name_prefix}cvar_$var->{name}$options{name_postfix}_valid'@{[!$var->{valid} ? ' checked' : '']}>";
367
    $var->{VALID_BOX} = "<input type=checkbox name='$options{name_prefix}cvar_$var->{name}$options{name_postfix}_valid'@{[$var->{valid} ? ' checked' : '']}>";
368 368
  }
369 369

  
370 370
  $main::lxdebug->leave_sub();
......
603 603
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.
604 604

  
605 605
Validity is assumed. If you modify validity, you actually save B<invalidity>.
606
validity is saved as a function of config_id, and the trans_id
606
iNvalidity is saved as a function of config_id, and the trans_id
607 607

  
608 608
In the naive way, disable an attribute for a specific id (simple)
609 609

  
......
665 665

  
666 666
  my $query    = qq|SELECT COUNT(*) FROM custom_variables_validity WHERE config_id = ? AND trans_id = ?|;
667 667

  
668
  my ($validity) = selectfirst_array_query($form, $dbh, $query, conv_i($params{config_id}), conv_i($params{trans_id}));
668
  my ($invalid) = selectfirst_array_query($form, $dbh, $query, conv_i($params{config_id}), conv_i($params{trans_id}));
669 669

  
670 670
  $main::lxdebug->leave_sub();
671 671

  
672
  return $validity;
672
  return !$invalid;
673 673
}
674 674

  
675 675
1;

Auch abrufbar als: Unified diff