Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ed71ba59

Von Kivitendo Admin vor fast 9 Jahren hinzugefügt

  • ID ed71ba59d8acc23b8284eafc8f7d1c13070adbdd
  • Vorgänger fea07b8e
  • Nachfolger bdd97244

Refactoring von orphaned in AM get_account

Unterschiede anzeigen:

SL/AM.pm
55 55

  
56 56
  my ($self, $myconfig, $form) = @_;
57 57

  
58

  
59
  my $chart_obj = SL::DB::Manager::Chart->find_by(id => $form->{id}) || die "Can't open chart";
60

  
58 61
  # connect to database
59 62
  my $dbh = $form->dbconnect($myconfig);
60 63
  my $query = qq{
......
173 176
    $sth->finish;
174 177

  
175 178
  }
176
  # check if we have any transactions
177
  $query = qq|SELECT a.trans_id FROM acc_trans a
178
              WHERE a.chart_id = ?|;
179
  $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query");
180
  $sth = $dbh->prepare($query);
181
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
182 179

  
183
  ($form->{orphaned}) = $sth->fetchrow_array;
184
  $form->{orphaned} = !$form->{orphaned};
185
  $sth->finish;
180
  # check if there any transactions for this chart
181
  $form->{orphaned} = $chart_obj->has_transaction ? 0 : 1;
186 182

  
187 183
  # check if new account is active
188 184
  $form->{new_chart_valid} = 0;

Auch abrufbar als: Unified diff