Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9a2253e9

Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt

  • ID 9a2253e94ffe4d5de1c25f2301ee0cd153765a59
  • Vorgänger f8f23e03
  • Nachfolger 691a1293

Refactoring und Einrückungen in BankTransaction.pm

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
218 218
  # create an HTML blob to be used by the js function add_invoices in templates/webpages/bank_transactions/list.html
219 219
  # and return encoded as JSON
220 220

  
221
  my $bt = SL::DB::Manager::BankTransaction->find_by( id => $::form->{bt_id} );
222
  my $invoice = SL::DB::Manager::Invoice->find_by( id => $::form->{prop_id} );
223
  $invoice = SL::DB::Manager::PurchaseInvoice->find_by( id => $::form->{prop_id} ) unless $invoice;
221
  my $bt      = SL::DB::Manager::BankTransaction->find_by( id => $::form->{bt_id} );
222
  my $invoice = SL::DB::Manager::Invoice->find_by( id => $::form->{prop_id} ) || SL::DB::Manager::PurchaseInvoice->find_by( id => $::form->{prop_id} );
224 223

  
225 224
  die unless $bt and $invoice;
226 225

  
......
345 344

  
346 345
  my @selected_invoices;
347 346
  foreach my $invoice_id (@{ $::form->{invoice_id} || [] }) {
348
    my $invoice_object = SL::DB::Manager::Invoice->find_by(id => $invoice_id);
349
    $invoice_object ||= SL::DB::Manager::PurchaseInvoice->find_by(id => $invoice_id);
350

  
347
    my $invoice_object = SL::DB::Manager::Invoice->find_by(id => $invoice_id) || SL::DB::Manager::PurchaseInvoice->find_by(id => $invoice_id);
351 348
    push @selected_invoices, $invoice_object;
352 349
  }
353 350

  
......
375 372
      push @invoices, (SL::DB::Manager::Invoice->find_by(id => $invoice_id) || SL::DB::Manager::PurchaseInvoice->find_by(id => $invoice_id));
376 373
    }
377 374
    @invoices = sort { return 1 if ($a->is_sales and $a->amount > 0);
378
                          return 1 if (!$a->is_sales and $a->amount < 0);
379
                          return -1; } @invoices                if $bank_transaction->amount > 0;
375
                       return 1 if (!$a->is_sales and $a->amount < 0);
376
                       return -1;
377
                     } @invoices if $bank_transaction->amount > 0;
380 378
    @invoices = sort { return -1 if ($a->is_sales and $a->amount > 0);
381 379
                       return -1 if (!$a->is_sales and $a->amount < 0);
382
                       return 1; } @invoices                    if $bank_transaction->amount < 0;
380
                       return 1;
381
                     } @invoices if $bank_transaction->amount < 0;
383 382

  
384 383
    my $max_invoices = scalar(@invoices);
385 384
    my $n_invoices   = 0;

Auch abrufbar als: Unified diff