Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 168836cf

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 168836cf2b4967a5fb2332867b329785cccc932a
  • Vorgänger ca9d536f
  • Nachfolger 9f07753b

Verknüpfte Belege: beliebige Verknüpfungen hinzufügen können

Unterschiede anzeigen:

SL/DB/Manager/Invoice.pm
2 2

  
3 3
use strict;
4 4

  
5
use base qw(SL::DB::Helper::Manager);
5
use parent qw(SL::DB::Helper::Manager);
6

  
7
use SL::DB::Helper::Paginated;
8
use SL::DB::Helper::Sorted;
6 9

  
7 10
sub object_class { 'SL::DB::Invoice' }
8 11

  
......
13 16
  my $type  = lc(shift || '');
14 17

  
15 18
  return (or  => [ invoice => 0, invoice => undef                                               ]) if $type eq 'ar_transaction';
16
  return (and => [ invoice => 1, amount  => { ge => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
19
  return (and => [ invoice => 1, amount  => { ge => 0 }, or => [ storno => 0, storno => undef ] ]) if $type =~ m/^(?:sales_)?invoice$/;
17 20
  return (and => [ invoice => 1, amount  => { lt => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'credit_note';
18 21
  return (and => [ invoice => 1, amount  => { lt => 0 },         storno => 1                    ]) if $type =~ m/(?:invoice_)?storno/;
19 22
  return (and => [ invoice => 1, amount  => { ge => 0 },         storno => 1                    ]) if $type eq 'credit_note_storno';
......
21 24
  die "Unknown type $type";
22 25
}
23 26

  
27
sub _sort_spec {
28
  return (
29
    default                   => [ 'transdate', 1 ],
30
    nulls                     => {
31
      transaction_description => 'FIRST',
32
      customer_name           => 'FIRST',
33
      default                 => 'LAST',
34
    },
35
    columns                   => {
36
      SIMPLE                  => 'ALL',
37
      customer                => 'customer.name',
38
      globalprojectnumber     => 'lower(globalproject.projectnumber)',
39

  
40
      # Bug in Rose::DB::Object: the next should be
41
      # "globalproject.project_type.description". This workaround will
42
      # only work if no other table with "project_type" is visible in
43
      # the current query
44
      globalproject_type      => 'lower(project_type.description)',
45

  
46
      map { ( $_ => "lower(ar.$_)" ) } qw(invnumber ordnumber quonumber cusordnumber shippingpoint shipvia notes intnotes transaction_description),
47
    });
48
}
49

  
50
sub default_objects_per_page { 40 }
51

  
24 52
1;

Auch abrufbar als: Unified diff