Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ef2b5e94

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID ef2b5e949ac07d4f3258821f781da90761bead1a
  • Vorgänger e4fb6339
  • Nachfolger 4a366d76

Refactoring: Code für OrderItem-Manager von DB-Datei in eigene Manager-Datei ausgelagert

Unterschiede anzeigen:

SL/DB/OrderItem.pm
6 6
use SL::AM;
7 7

  
8 8
use SL::DB::MetaSetup::OrderItem;
9
use SL::DB::Manager::OrderItem;
9 10
use SL::DB::Helper::CustomVariables (
10 11
  sub_module  => 'orderitems',
11 12
  cvars_alias => 1,
......
37 38
  },
38 39
);
39 40

  
40
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
41
__PACKAGE__->meta->make_manager_class;
42

  
43 41
__PACKAGE__->meta->initialize;
44 42

  
45 43
sub is_price_update_available {
......
56 54
  return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi);
57 55
}
58 56

  
59
package SL::DB::Manager::OrderItem;
60

  
61
use SL::DB::Helper::Paginated;
62
use SL::DB::Helper::Sorted;
63

  
64
sub _sort_spec {
65
  return ( columns => { delivery_date => [ 'deliverydate',        ],
66
                        description   => [ 'lower(orderitems.description)',  ],
67
                        partnumber    => [ 'part.partnumber',     ],
68
                        qty           => [ 'qty'                  ],
69
                        ordnumber     => [ 'order.ordnumber'      ],
70
                        customer      => [ 'lower(customer.name)', ],
71
                        position      => [ 'trans_id', 'runningnumber' ],
72
                        reqdate       => [ 'COALESCE(orderitems.reqdate, order.reqdate)' ],
73
                        orddate       => [ 'order.orddate' ],
74
                        sellprice     => [ 'sellprice' ],
75
                        discount      => [ 'discount' ],
76
                        transdate     => [ 'transdate::date', 'order.reqdate' ],
77
                      },
78
           default => [ 'position', 1 ],
79
           nulls   => { }
80
         );
81
}
82

  
83
sub default_objects_per_page { 40 }
84

  
85 57
1;

Auch abrufbar als: Unified diff