Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 62966f4b

Von Werner Hahn vor etwa 7 Jahren hinzugefügt

  • ID 62966f4b47fe4edf6b70caff9cdfc8e2cb985737
  • Vorgänger e3b06f85
  • Nachfolger f92238b9

Shopmodul: Shoporders Tbl geändert fkeys und unnötige spalten gelöscht
syntax im Shopoder Controller

Unterschiede anzeigen:

SL/Controller/ShopOrder.pm
45 45
  my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'order_date';
46 46
  $sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC';
47 47
  my $shop_orders = SL::DB::Manager::ShopOrder->get_all( %filter, sort_by => $sort_by,
48
                                                      with_objects => ['shop_order_items'],
49
                                                      with_objects => ['customer'],
48
                                                      with_objects => ['shop_order_items', 'kivi_customer'],
50 49
                                                    );
51 50

  
52 51
  foreach my $shop_order(@{ $shop_orders }){
......
69 68
sub action_show {
70 69
  my ( $self ) = @_;
71 70
  my $id = $::form->{id} || {};
72
  my $shop_order = SL::DB::Manager::ShopOrder->get_all(query => [ id => $id ],
73
                                                        with_objects => ['customer'], )->[0];
71
  my $shop_order = SL::DB::Manager::ShopOrder->find_by( id => $id , with_objects => ['kivi_customer'] );
74 72
  die "can't find shoporder with id $id" unless $shop_order;
75 73

  
76
  # the different importaddresscheck if there complete in the customer table to prevent duplicats inserts
77
  my %customer_address = ( 'name'    => $shop_order->customer_lastname,
78
                           'company' => $shop_order->customer_company,
79
                           'street'  => $shop_order->customer_street,
80
                           'zipcode' => $shop_order->customer_zipcode,
81
                           'city'    => $shop_order->customer_city,
82
                         );
83
  my %billing_address = ( 'name'     => $shop_order->billing_lastname,
84
                          'company'  => $shop_order->billing_company,
85
                          'street'   => $shop_order->billing_street,
86
                          'zipcode'  => $shop_order->billing_zipcode,
87
                          'city'     => $shop_order->billing_city,
88
                        );
89
  my %delivery_address = ( 'name'    => $shop_order->delivery_lastname,
90
                           'company' => $shop_order->delivery_company,
91
                           'street'  => $shop_order->delivery_street,
92
                           'zipcode' => $shop_order->delivery_zipcode,
93
                           'city'    => $shop_order->delivery_city,
94
                         );
95
  my $c_address = $self->check_address(%customer_address);
96
  my $b_address = $self->check_address(%billing_address);
97
  my $d_address = $self->check_address(%delivery_address);
98
  ####
99

  
100 74
  # Only Customers which are not found will be applied
101 75
  my $name = $shop_order->billing_lastname ne '' ? "%" . $shop_order->billing_firstname . "%" . $shop_order->billing_lastname . "%" : '';
102 76
  my $lastname = $shop_order->billing_lastname ne '' ? "%" . $shop_order->billing_lastname . "%" : '';
SL/DB/MetaSetup/ShopOrder.pm
76 76
  shop_customer_comment  => { type => 'text' },
77 77
  shop_customer_id       => { type => 'integer' },
78 78
  shop_customer_number   => { type => 'text' },
79
  shop_data              => { type => 'text' },
80 79
  shop_id                => { type => 'integer' },
81 80
  shop_ordernumber       => { type => 'text' },
82 81
  shop_trans_id          => { type => 'integer', not_null => 1 },
......
89 88

  
90 89
__PACKAGE__->meta->allow_inline_column_values(1);
91 90

  
91
__PACKAGE__->meta->foreign_keys(
92
  kivi_customer => {
93
    class       => 'SL::DB::Customer',
94
    key_columns => { kivi_customer_id => 'id' },
95
  },
96

  
97
  shop => {
98
    class       => 'SL::DB::Shop',
99
    key_columns => { shop_id => 'id' },
100
  },
101
);
102

  
92 103
1;
93 104
;
SL/DB/MetaSetup/ShopOrderItem.pm
16 16
  position            => { type => 'integer' },
17 17
  price               => { type => 'numeric', precision => 15, scale => 5 },
18 18
  quantity            => { type => 'numeric', precision => 25, scale => 5 },
19
  shop_id             => { type => 'integer' },
20 19
  shop_order_id       => { type => 'integer' },
21 20
  shop_trans_id       => { type => 'integer', not_null => 1 },
22 21
  tax_rate            => { type => 'numeric', precision => 15, scale => 2 },

Auch abrufbar als: Unified diff