Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0395c036

Von Kivitendo Admin vor fast 10 Jahren hinzugefügt

  • ID 0395c0364adb8fde7442c6b11ab064e406fd7776
  • Vorgänger 9abe5538
  • Nachfolger 9d113c3f

ar/ap/gl - neues Relationship "transactions"

Objekt-Verknüpfung ar/ap/gl zu acc_trans-Objekten: one-to-many

Hat man ein ar/ap/gl Objekt kann man sich jetzt alle acc_trans-Einträge
dazu holen.

Die acc_trans-Objekte werden nach acc_trans_id sortiert zurückgegeben.

Die Methode transactions aus Invoice wurde entfernt.

Unterschiede anzeigen:

SL/DB/GLTransaction.pm
4 4

  
5 5
use SL::DB::MetaSetup::GLTransaction;
6 6

  
7
__PACKAGE__->meta->initialize;
8 7

  
9 8
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10 9
__PACKAGE__->meta->make_manager_class;
11 10

  
11
__PACKAGE__->meta->add_relationship(
12
  transactions   => {
13
    type         => 'one to many',
14
    class        => 'SL::DB::AccTransaction',
15
    column_map   => { id => 'trans_id' },
16
    manager_args => {
17
      with_objects => [ 'chart' ],
18
      sort_by      => 'acc_trans_id ASC',
19
    },
20
  },
21
);
22

  
23
__PACKAGE__->meta->initialize;
24

  
12 25
sub abbreviation {
13 26
  my $self = shift;
14 27

  
SL/DB/Invoice.pm
45 45
    column_map      => { id => 'trans_id' },
46 46
    query_args      => [ module => 'AR' ],
47 47
  },
48
  transactions   => {
49
    type         => 'one to many',
50
    class        => 'SL::DB::AccTransaction',
51
    column_map   => { id => 'trans_id' },
52
    manager_args => {
53
      with_objects => [ 'chart' ],
54
      sort_by      => 'acc_trans_id ASC',
55
    },
56
  },
48 57
);
49 58

  
50 59
__PACKAGE__->meta->initialize;
......
351 360
  goto &customer;
352 361
}
353 362

  
354
sub transactions {
355
  my ($self) = @_;
356

  
357
  return unless $self->id;
358

  
359
  require SL::DB::AccTransaction;
360
  SL::DB::Manager::AccTransaction->get_all(query => [ trans_id => $self->id ]);
361
}
362

  
363 363
1;
364 364

  
365 365
__END__
SL/DB/PurchaseInvoice.pm
31 31
    column_map      => { id => 'trans_id' },
32 32
    query_args      => [ module => 'AP' ],
33 33
  },
34
  transactions   => {
35
    type         => 'one to many',
36
    class        => 'SL::DB::AccTransaction',
37
    column_map   => { id => 'trans_id' },
38
    manager_args => { with_objects => [ 'chart' ],
39
                      sort_by      => 'acc_trans_id ASC' }
40
  },
34 41
);
35 42

  
36 43
__PACKAGE__->meta->initialize;

Auch abrufbar als: Unified diff