Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c7d1ccda

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID c7d1ccda0f59bc8662e8836cab1f3ab453acd3cb
  • Vorgänger bd297209
  • Nachfolger 1320854c

DB/OrderItem: relationship zu order, sort_spec und paginating

Unterschiede anzeigen:

SL/DB/OrderItem.pm
27 27
    class        => 'SL::DB::Unit',
28 28
    column_map   => { unit => 'name' },
29 29
  },
30
  order => {
31
    type         => 'one to one',
32
    class        => 'SL::DB::Order',
33
    column_map   => { trans_id => 'id' },
34
  },
30 35
);
31 36

  
32 37
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
......
39 44
  return $self->origprice > $self->part->sellprice;
40 45
}
41 46

  
47
package SL::DB::Manager::OrderItem;
48

  
49
use SL::DB::Helper::Paginated;
50
use SL::DB::Helper::Sorted;
51

  
52
sub _sort_spec {
53
  return ( columns => { delivery_date => [ 'deliverydate',        ],
54
                        description   => [ 'lower(orderitems.description)',  ],
55
                        partnumber    => [ 'part.partnumber',     ],
56
                        qty           => [ 'qty'                  ],
57
                        ordnumber     => [ 'order.ordnumber'      ],
58
                        customer      => [ 'lower(customer.name)', ],
59
                        position      => [ 'trans_id', 'runningnumber' ],
60
                        transdate     => [ 'transdate', 'lower(order.reqdate::text)' ],
61
                      },
62
           default => [ 'position', 1 ],
63
           nulls   => { }
64
         );
65
}
66

  
67
sub default_objects_per_page { 40 }
68

  
42 69
1;

Auch abrufbar als: Unified diff