Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a90eee6a

Von Werner Hahn vor etwa 7 Jahren hinzugefügt

  • ID a90eee6ac6eb3a281466688ed0b355d060656706
  • Vorgänger b6e62764
  • Nachfolger 8b2313ef

Shopmodul: ShopOrder: Massenübernahme von Shopaufträgen

Webshop:: ShopOrderMassTransfer

Webshop: ShopOrder

Webshop: ShopOrder BGJ Anzahl Orders und welche in Backgroundjob Data/Info

Webshop: ShopOrder - Bestellung löschen bzw. auf ungültig setzten

Conflicts:
SL/Controller/ShopOrder.pm
templates/webpages/shop_order/list.html

Webshop: ShopOrder - Anzahl der Positionen wird mit in die Stammdaten der Bestellung übernommen.

Conflicts:
SL/DB/ShopOrder.pm

Conflicts:
SL/ShopConnector/Shopware.pm

Webshop: Shoporder BGJ in bearbeitung

Conflicts:
SL/BackgroundJob/ShopOrderMassTransfer.pm
templates/webpages/shop_order/_transfer_status.html

Conflicts:
SL/BackgroundJob/ShopOrderMassTransfer.pm

WebShop: ShopOrder BGJ - Kundenvorschläge groß und kleinschreibung bei abfrage ignorieren
Cvars beim übernehmen der Shopimporte
Bestellbemerkung bzw. Kundenbemerkungen mit in den Auftrag in intnotes
andere fehlende Felder wie active_price_source übernehmen oder einfügen

Conflicts:
SL/ShopConnector/Shopware.pm

Webshop: ShopOrder

Webshop: ShopOrder: css, Kundendaten mit Shoprechnungsdaten überschreiben, löschen Rückgängig, löschen aus der ShopOrder heraus, In den Vorschlägen Link zum Kunden, Kunden mit Auftragssperre in den Vorschlägen kenntlich gemacht für diese können auch von dort keinen Aufträge generiert werden

Conflicts:
css/webshop.css

Conflicts:
css/webshop.css

Webshop: ShopOrder - shop_ordernumber als Kundenbestellnummer in Aufträgen usw. nutzen

Webshop: ShopOrder - TODO comment

Webshop: ShopOrder Abrufen zeigt nur nicht übernommene, Sortierung der Tabelle übernimmt die Datumsfilter.

Conflicts:
templates/webpages/shop_order/list.html

Webshop: ShopOrder - Massenkonvertierung geht wieder

WebShop: ShopOrder Liste Shoporders checkall eingebunden

WebShop: ShopOrder - Historie beim Kundenanlegen, Auftrag übernehmen und Massenauftragsübernahme

Conflicts:
SL/ShopConnector/Shopware.pm

Webshop: ShopOrder

Webshop: ShopOrder - Anlegen/Überschreiben der Kunden-, Rechnungs-, Lieferadresse als/mit Kundenadresse geht wieder

Conflicts:
SL/Controller/ShopOrder.pm

Webshop: ShopOrder - Kundenadresse ausblenden

Webshop: ShopOrder - Shopimport Kundensuche ilike; Anzahl OP's in Webshopliste; Lieferant Name 2 wird mit übertragen

Webshop: ShopOrder - payment_id wird anhand Kunden payment_id an Auftrag übergeben

Webshop: ShopOrder

Webshop: ShopOrder - Liste OPs oder Auftragssperre rot markiert
Filter Obsolete eingebaut
Proposals beim Import verbessert unschäfere Suche

Conflicts:
templates/webpages/shop_order/_transfer_status.html

Webshop: ShopOrder - Vorschläge unschäfere Suche

Webshop: ShopOrder

Conflicts:
SL/ShopConnector/Shopware.pm

Webshop: ShopOrder - BGJ ShopOrderMassTransfer angepasst wg cherry-pick

Conflicts:
SL/BackgroundJob/ShopOrderMassTransfer.pm
SL/Controller/ShopOrder.pm
SL/ShopConnector/Shopware.pm
js/kivi.ShopOrder.js
templates/webpages/shop_order/list.html

Conflicts:
SL/Controller/ShopOrder.pm
SL/DB/ShopOrder.pm
templates/webpages/shop_order/list.html

Unterschiede anzeigen:

SL/BackgroundJob/ShopOrderMassTransfer.pm
13 13
use SL::DB::ShopOrder;
14 14
use SL::DB::ShopOrderItem;
15 15
use SL::DB::Order;
16
use SL::DB::History;
16 17
use SL::DB::DeliveryOrder;
17 18
use SL::DB::Inventory;
18 19
use Sort::Naturally ();
19 20

  
20 21
use constant WAITING_FOR_EXECUTION        => 0;
21
use constant CONVERTING_TO_ORDER          => 1;
22
use constant CONVERTING_TO_DELIVERY_ORDER => 2;
23
use constant DONE                         => 3;
22
#use constant CONVERTING_TO_ORDER          => 1;
23
use constant CONVERTING_TO_DELIVERY_ORDER => 1;
24
use constant DONE                         => 2;
24 25

  
25 26
# Data format:
26 27
# my $data                  = {
......
35 36
  my ( $self ) = @_;
36 37
  my $job_obj = $self->{job_obj};
37 38
  my $db      = $job_obj->db;
38

  
39
  my %error_report;
39 40
  $job_obj->set_data(CONVERTING_TO_DELIVERY_ORDER())->save;
40 41

  
41 42
  foreach my $shop_order_id (@{ $job_obj->data_as_hash->{shop_order_record_ids} }) {
43
    my $data = $job_obj->data_as_hash;
42 44
    my $shop_order = SL::DB::ShopOrder->new(id => $shop_order_id)->load;
43
    die "can't find shoporder with id $shop_order_id" unless $shop_order;
44
    $::lxdebug->dump(0, 'WH: CREATE:I ', \$shop_order);
45
    # die "can't find shoporder with id $shop_order_id" unless $shop_order;
45 46
    #TODO Kundenabfrage so ändern, dass es nicht abricht
46 47
    unless($shop_order){
47 48
      push @{ $error_report{$shop_order_id}} }, 'Shoporder not found';
......
51 52
    my $employee = SL::DB::Manager::Employee->current;
52 53
    my $items = SL::DB::Manager::ShopOrderItem->get_all( where => [shop_order_id => $shop_order_id],
53 54
                                                          sort_by => 'partnumber::int' );
54
    $::lxdebug->dump(0, 'WH: CREATE:I ', \$shop_order);
55
    $::lxdebug->dump(0, 'WH: CREATE:II ', \$items);
56

  
57
    # check inventory onhand > 0
58
    my $onhand = 0;
55
    # check inventory onhand > 0 and active = 1
56
    my $transferable = 0;
59 57
    foreach my $item (@$items) {
60
      my $qty = SL::DB::Manager::Part->find_by(partnumber => $item->{partnumber})->onhand; # > 0 ? $onhand = 1 : 0;
61
      $qty >= $item->{quantity} ? $onhand = 1 : 0;
62
      $main::lxdebug->message(0, "WH: STOCK: $qty -- $onhand");
63
      last if $onhand == 0;
58
      my $part = SL::DB::Manager::Part->find_by(partnumber => $item->{partnumber});
59
      # TODO: qty direkt aus dem Lager holen und nicht von onhand
60
      $transferable = $part->{onhand} >= $item->{quantity} ? 1 : 0;
61
      $transferable = $part->{active} = 1 ? 1 : 0;
62

  
63
      last if $transferable == 0;
64 64
    }
65
    $main::lxdebug->message(0, "WH:ONHAND: $onhand ");
66
    if ($onhand == 1) {
65
    if ($transferable == 1 && $customer->{order_lock} == 0) {
67 66
      $shop_order->{shop_order_items} = $items;
68
      $main::lxdebug->dump(0, 'WH: TRANSFER SHOPORDER', \$shop_order);
69 67

  
70 68
      my $order = $shop_order->convert_to_sales_order(customer => $customer, employee => $employee);
71 69
      $order->save;
70
      my $snumbers = "ordernumber_" . $order->ordnumber;
71
      SL::DB::History->new(
72
                        trans_id    => $order->id,
73
                        snumbers    => $snumbers,
74
                        employee_id => SL::DB::Manager::Employee->current->id,
75
                        addition    => 'SAVED',
76
                        what_done   => 'Shopimport->Order(MassTransfer)',
77
                      )->save();
72 78
      $shop_order->transferred(1);
73 79
      $shop_order->transfer_date(DateTime->now_local);
74 80
      $shop_order->oe_transid($order->id);
75 81
      $shop_order->save;
76 82
      $shop_order->link_to_record($order);
83
      $data->{num_created}++;
84
      push @{ $data->{orders_ids} }, $order->id;
85
      push @{ $data->{shop_orders_ids} }, $shop_order->id;
77 86

  
78 87
      my $delivery_order = $order->convert_to_delivery_order(customer => $customer, employee => $employee);
79 88
      $delivery_order->save;
89
      my $snumbers = "deliveryordernumber_" . $delivery_order->donumber;
90
      SL::DB::History->new(
91
                        trans_id    => $delivery_order->id,
92
                        snumbers    => $snumbers,
93
                        employee_id => SL::DB::Manager::Employee->current->id,
94
                        addition    => 'SAVED',
95
                        what_done   => 'Shopimport->Order->Deliveryorder(MassTransfer)',
96
                      )->save();
80 97
      $order->link_to_record($delivery_order);
81 98
      my $delivery_order_items = $delivery_order->{orderitems};
82 99
      # Lagerentnahme
83 100
      # entsprechende defaults holen, falls standardlagerplatz verwendet werden soll
84
      $main::lxdebug->dump(0, 'WH: LAGER: ', \$delivery_order_items);
85 101
      my $test = $::instance_conf->get_transfer_default_use_master_default_bin;
86
      $main::lxdebug->message(0, "WH: TEST $test ");
87
      $main::lxdebug->dump(0, 'WH: KONF ',$::instance_conf);
88
      $main::lxdebug->message(0, "WH:NACH ");
89 102
      require SL::DB::Inventory;
90 103
      my $rose_db = SL::DB::Inventory->new->db;
91 104
      my $dbh = $db->dbh;
......
138 151
        }
139 152
        push @errors, @{ $err };
140 153
      }
141
      $main::lxdebug->dump(0, 'WH: LAGER II ', \@transfers);
142
      $main::lxdebug->dump(0, 'WH: LAGER III ', \@errors);
143 154
      if (!@errors) {
144 155
          $delivery_order->delivered(1);
145 156
          $delivery_order->save;
......
148 159
  }
149 160
}
150 161

  
151
sub create_delivery_order {
152
  my ( $self ) = @_;
153
}
154

  
155 162
sub run {
156 163
  my ($self, $job_obj) = @_;
157
  $::lxdebug->dump(0, 'WH: RUN: ', \$self);
158 164

  
159 165
  $self->{job_obj}         = $job_obj;
160 166
  $self->create_order;
SL/Controller/ShopOrder.pm
6 6

  
7 7
use parent qw(SL::Controller::Base);
8 8

  
9
use SL::BackgroundJob::ShopOrderMassTransfer;
10
use SL::System::TaskServer;
9 11
use SL::DB::ShopOrder;
10 12
use SL::DB::ShopOrderItem;
11 13
use SL::DB::Shop;
14
use SL::DB::History;
12 15
use SL::Shop;
13 16
use SL::Presenter;
17
use SL::Helper::Flash;
14 18
use SL::Locale::String;
15 19
use SL::Controller::Helper::ParseFilter;
16 20
use Rose::Object::MakeMethods::Generic
17 21
(
18
  'scalar --get_set_init' => [ qw(shop_order transferred) ],
22
  'scalar --get_set_init' => [ qw(shop_order transferred js) ],
19 23
);
24

  
25
__PACKAGE__->run_before('setup');
26

  
20 27
use Data::Dumper;
21 28

  
22 29
sub action_get_orders {
......
34 41

  
35 42
sub action_list {
36 43
  my ( $self ) = @_;
37
  $::lxdebug->dump(0, "WH: LIST ", \$::form);
38
  my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0 ]);
44
  my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0, obsolete => 0 ]);
39 45
  my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : '';
40 46
  #$::lxdebug->dump(0, "WH: FILTER ",  $::form->{filter}->{_eq_ignore_empty}." - ".$transferred);
41 47
  #$::lxdebug->dump(0, "WH: FILTER2 ",  \%filter);
......
43 49
  $sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC';
44 50
  my $shop_orders = SL::DB::Manager::ShopOrder->get_all( %filter, sort_by => $sort_by,
45 51
                                                      with_objects => ['shop_order_items'],
52
                                                      with_objects => ['customer'],
46 53
                                                    );
47
  $::lxdebug->dump(0, "WH: IMPORTS ",  \$shop_orders);
54

  
55
  foreach my $shop_order(@{ $shop_orders }){
56

  
57
    my $open_invoices = SL::DB::Manager::Invoice->get_all_count(
58
      query => [customer_id => $shop_order->{kivi_customer_id},
59
              paid => {lt_sql => 'amount'},
60
      ],
61
    );
62
    $shop_order->{open_invoices} = $open_invoices;
63
  }
64
  $main::lxdebug->dump(0, 'WH:SHOPORDER ',\$shop_orders);
65

  
66

  
48 67
  $self->render('shop_order/list',
49 68
                title       => t8('ShopOrders'),
50 69
                SHOPORDERS  => $shop_orders,
......
55 74
sub action_show {
56 75
  my ( $self ) = @_;
57 76
  my $id = $::form->{id} || {};
58
  my $shop_order = SL::DB::Manager::ShopOrder->find_by( id => $id );
77
  my $shop_order = SL::DB::Manager::ShopOrder->get_all(query => [ id => $id ],
78
                                                        with_objects => ['customer'], )->[0];
59 79
  die "can't find shoporder with id $id" unless $shop_order;
60 80

  
61 81
  # the different importaddresscheck if there complete in the customer table to prevent duplicats inserts
......
83 103
  ####
84 104

  
85 105
  my $lastname = $shop_order->customer_lastname;
106

  
86 107
  my $proposals = SL::DB::Manager::Customer->get_all(
87 108
       where => [
88 109
                   or => [
89 110
                            and => [ # when matching names also match zipcode
90
                                     or => [ 'name' => { like => "%$lastname%"},
91
                                             'name' => { like => $shop_order->customer_company },
111
                                     or => [ 'name' => { ilike => "%$lastname%"},
112
                                             'name' => { ilike => $shop_order->customer_company },
92 113
                                           ],
93
                                     'zipcode' => { like => $shop_order->customer_zipcode },
114
                                     'zipcode' => { ilike => $shop_order->customer_zipcode },
94 115
                                   ],
95
                            or  => [ 'email' => { like => $shop_order->customer_email } ],
116
                            and => [ # check for street and zipcode
117
                                     and => [ 'street'  => { ilike => "%".$shop_order->customer_street."%" },
118
                                              'zipcode' => { ilike => $shop_order->customer_zipcode },
119
                            or  => [ 'email' => { ilike => $shop_order->customer_email } ],
96 120
                         ],
97 121
                ],
98 122
  );
123
  $main::lxdebug->dump(0, 'WH:PROP ',\$proposals);
124

  
99 125

  
100 126
  $self->render('shop_order/show',
101 127
                title       => t8('Shoporder'),
......
108 134

  
109 135
}
110 136

  
137
sub action_delete_order {
138
  my ( $self ) = @_;
139

  
140
  $self->shop_order->obsolete(1);
141
  $self->shop_order->save;
142
  $self->redirect_to(controller => "ShopOrder", action => 'list', filter => { 'transferred:eq_ignore_empty' => 0 });
143
}
144

  
145
sub action_valid_order {
146
  my ( $self ) = @_;
147

  
148
  $self->shop_order->obsolete(0);
149
  $self->shop_order->save;
150
  $self->redirect_to(controller => "ShopOrder", action => 'show', id => $self->shop_order->id);
151
}
152

  
111 153
sub action_transfer {
112 154
  my ( $self ) = @_;
113 155
  my $customer = SL::DB::Manager::Customer->find_by(id => $::form->{customer});
114 156
  die "Can't find customer" unless $customer;
115 157
  my $employee = SL::DB::Manager::Employee->current;
116 158

  
117
  # $self->shop_order inits via $::form->{import_id}
118 159
  die "Can't load shop_order form form->import_id" unless $self->shop_order;
119 160

  
120 161
  my $order = $self->shop_order->convert_to_sales_order(customer => $customer, employee => $employee);
121 162
  $order->save;
163

  
164
  my $snumbers = "ordernumber_" . $order->ordnumber;
165
  SL::DB::History->new(
166
                    trans_id    => $order->id,
167
                    snumbers    => $snumbers,
168
                    employee_id => SL::DB::Manager::Employee->current->id,
169
                    addition    => 'SAVED',
170
                    what_done   => 'Shopimport -> Order',
171
                  )->save();
172
  foreach my $item(@{ $order->orderitems }){
173
    $item->parse_custom_variable_values->save;
174
    $item->{custom_variables} = \@{ $item->cvars_by_config };
175
    $item->save;
176
  }
177

  
122 178
  $self->shop_order->transferred(1);
123 179
  $self->shop_order->transfer_date(DateTime->now_local);
124 180
  $self->shop_order->oe_transid($order->id);
......
127 183
  $self->redirect_to(controller => "oe.pl", action => 'edit', type => 'sales_order', vc => 'customer', id => $order->id);
128 184
}
129 185

  
186
sub action_mass_transfer {
187
  my ($self) = @_;
188
  my @shop_orders =  @{ $::form->{id} || [] };
189

  
190
  my $job                   = SL::DB::BackgroundJob->new(
191
    type                    => 'once',
192
    active                  => 1,
193
    package_name            => 'ShopOrderMassTransfer',
194
  )->set_data(
195
     shop_order_record_ids       => [ @shop_orders ],
196
     num_order_created           => 0,
197
     num_delivery_order_created  => 0,
198
     status                      => SL::BackgroundJob::ShopOrderMassTransfer->WAITING_FOR_EXECUTION(),
199
     conversation_errors         => [ ],
200
   )->update_next_run_at;
201

  
202
   SL::System::TaskServer->new->wake_up;
203

  
204
   my $html = $self->render('shop_order/_transfer_status', { output => 0 }, job => $job);
205

  
206
   $self->js
207
      ->html('#status_mass_transfer', $html)
208
      ->run('kivi.ShopOrder.massTransferStarted')
209
      ->render;
210
}
211

  
212
sub action_transfer_status {
213
  my ($self)  = @_;
214
  my $job     = SL::DB::BackgroundJob->new(id => $::form->{job_id})->load;
215
  my $html    = $self->render('shop_order/_transfer_status', { output => 0 }, job => $job);
216

  
217
  $self->js->html('#status_mass_transfer', $html);
218
  $self->js->run('kivi.ShopOrder.massTransferFinished') if $job->data_as_hash->{status} == SL::BackgroundJob::ShopOrderMassTransfer->DONE();
219
  $self->js->render;
220

  
221
}
222

  
130 223
sub action_apply_customer {
131
  my ( $self ) = @_;
132
  $::lxdebug->dump(0, "WH: CUSTOMER ", \$::form);
133
  my $what = $::form->{create_customer}; # billing, customer or delivery
134
  $::lxdebug->dump(0, "WH: WHAT ",$what);
135
  my %address = ( 'name'       => $::form->{$what.'_name'},
136
                  'street'     => $::form->{$what.'_street'},
137
                  'zipcode'    => $::form->{$what.'_zipcode'},
138
                  'city'       => $::form->{$what.'_city'},
139
                  'email'      => $::form->{$what.'_email'},
140
                  'country'    => $::form->{$what.'_country'},
141
                  'greeting'   => $::form->{$what.'_greeting'},
142
                  'taxzone_id' => 4,  # hardcoded, use default taxzone instead
143
                  'currency'   => 1,  # hardcoded
224
  my ( $self, %params ) = @_;
225
  my $shop = SL::DB::Manager::Shop->find_by( id => $self->shop_order->shop_id );
226
  my $what = $::form->{create_customer}; # new from billing, customer or delivery address
227
  my %address = ( 'name'                  => $::form->{$what.'_name'},
228
                  'department_1'          => $::form->{$what.'_company'},
229
                  'department_2'          => $::form->{$what.'_department'},
230
                  'street'                => $::form->{$what.'_street'},
231
                  'zipcode'               => $::form->{$what.'_zipcode'},
232
                  'city'                  => $::form->{$what.'_city'},
233
                  'email'                 => $::form->{$what.'_email'},
234
                  'country'               => $::form->{$what.'_country'},
235
                  'phone'                 => $::form->{$what.'_phone'},
236
                  'email'                 => $::form->{$what.'_email'},
237
                  'greeting'              => $::form->{$what.'_greeting'},
238
                  # TODO in shopconfig
239
                        'taxincluded_checked'   => $shop->pricetype eq "brutto" ? 1 : 0,
240
                        'taxincluded'           => $shop->pricetype eq "brutto" ? 1 : 0,
241
                        'klass'                 => (split '\/',$shop->price_source)[1],
242
                        'taxzone_id'            => $shop->taxzone_id,
243
                        'currency'              => 1,   # TODO hardcoded
244
                        'payment_id'            => 7345,# TODO hardcoded
144 245
                );
145
  $address{contact} = ($address{name} ne $::form->{$what.'_firstname'} . " " . $::form->{$what.'_lastname'} ? $::form->{$what.'_firstname'} . " " . $::form->{$what.'_lastname'} : '');
146
  $::lxdebug->dump(0, "WH: ADDRESS ",\%address);
147
  my $customer = SL::DB::Customer->new(%address);
148
  $customer->save;
246
  my $customer;
247
  if($::form->{cv_id}){
248
    $customer = SL::DB::Customer->new(id => $::form->{cv_id})->load;
249
    $customer->assign_attributes(%address);
250
    $customer->save;
251
  }else{
252
    $customer = SL::DB::Customer->new(%address);
253
    $customer->save;
254
  }
255
  my $snumbers = "customernumber_" . $customer->customernumber;
256
  SL::DB::History->new(
257
                    trans_id    => $customer->id,
258
                    snumbers    => $snumbers,
259
                    employee_id => SL::DB::Manager::Employee->current->id,
260
                    addition    => 'SAVED',
261
                    what_done   => 'Shopimport',
262
                  )->save();
263

  
149 264
  if($::form->{$what.'_country'} ne "Deutschland") {   # hardcoded
150 265
    $self->redirect_to(controller => "controller.pl", action => 'CustomerVendor/edit', id => $customer->id);
151 266
  }else{
152 267
    $self->redirect_to(action => 'show', id => $::form->{import_id});
153 268
  }
154 269
}
270

  
271
sub setup {
272
  my ($self) = @_;
273
  $::auth->assert('invoice_edit');
274

  
275
  $::request->layout->use_javascript("${_}.js")  for qw(kivi.ShopOrder);
276
}
277

  
155 278
#
156 279
# Helper
157 280
#
......
159 282
  my ($self,%address) = @_;
160 283
  my $addressdata = SL::DB::Manager::Customer->get_all(
161 284
                                query => [
162
                                            or => [ 'name'   => { like => "%$address{'name'}%" }, 'name' => { like => $address{'company'} }, ],
163
                                           'street' => { like => $address{'street'} },
164
                                           'zipcode'=> { like => $address{'zipcode'} },
165
                                           'city'   => { like => $address{'city'} },
285
                                            or => [ 'name'   => { ilike => "%$address{'name'}%" }, 'name' => { ilike => $address{'company'} }, ],
286
                                           'street' => { ilike => $address{'street'} },
287
                                           'zipcode'=> { ilike => $address{'zipcode'} },
288
                                           'city'   => { ilike => $address{'city'} },
166 289
                                         ]);
167 290
  $::lxdebug->dump(0, "WH: CUSTOMER ", \$addressdata);
168 291
  return @{$addressdata}[0];
SL/DB/MetaSetup/ShopOrder.pm
57 57
  kivi_customer_id       => { type => 'integer' },
58 58
  mtime                  => { type => 'timestamp' },
59 59
  netamount              => { type => 'numeric', precision => 15, scale => 5 },
60
  obsolete               => { type => 'boolean', default => 'false', not_null => 1 },
60 61
  oe_transid             => { type => 'integer' },
61 62
  order_date             => { type => 'timestamp' },
62 63
  payment_description    => { type => 'text' },
63 64
  payment_id             => { type => 'integer' },
65
  positions              => { type => 'integer' },
64 66
  remote_ip              => { type => 'text' },
65 67
  sepa_account_holder    => { type => 'text' },
66 68
  sepa_bic               => { type => 'text' },
SL/DB/ShopOrder.pm
16 16
    column_map => { id => 'shop_order_id' },
17 17
    type       => 'one to many',
18 18
  },
19
  customer => {
20
    class     => 'SL::DB::Customer',
21
    column_map  => { kivi_customer_id => 'id' },
22
    type        => 'one to many',
23
  },
24
  shop => {
25
    class     => 'SL::DB::Shop',
26
    column_map  => { shop_id => 'id' },
27
    type        => 'one to many',
28
  },
19 29
);
20 30

  
21 31
__PACKAGE__->meta->initialize;
......
33 43
  require SL::DB::Part;
34 44
  require SL::DB::Shipto;
35 45

  
36
  my @order_items;
37
  foreach my $items (@{$self->shop_order_items}) {
38
    my $item = SL::DB::OrderItem->new;
39
    my $part = SL::DB::Manager::Part->find_by( partnumber => $items->{partnumber} );
40

  
41
    $item->assign_attributes(
42
        parts_id        => $part->id,
43
        description     => $items->description,
44
        qty             => $items->quantity,
45
        sellprice       => $items->price,
46
        unit            => $part->unit,
47
        );
48
    push(@order_items,$item);
49
  }
46
  my @items = map{
47
    my $part = SL::DB::Part->new( partnumber => $_->partnumber )->load;
48
    my @cvars = map { ($_->config->name => { value => $_->value_as_text, is_valid => $_->is_valid }) } @{ $part->cvars_by_config } ;
49
    my $current_order_item =
50
      SL::DB::OrderItem->new(parts_id               => $part->id,
51
                             description            => $part->description,
52
                             qty                    => $_->quantity,
53
                             sellprice              => $_->price,
54
                             unit                   => $part->unit,
55
                             position               => $_->position,
56
                             active_price_source    => ( $_->price == 0 ? "" : "pricegroup/908"), #TODO Hardcoded
57
                           );
58
  }@{ $self->shop_order_items };
50 59

  
51 60
  my $shipto_id;
52 61
  if ($self->{billing_firstname} ne $self->{delivery_firstname} || $self->{billing_lastname} ne $self->{delivery_lastname} || $self->{billing_city} ne $self->{delivery_city} || $self->{billing_street} ne $self->{delivery_street}) {
53
    if(my $address = SL::DB::Manager::Shipto->find_by( shiptoname          => $self->{delivery_firstname} . " " . $self->{delivery_lastname}, 
62
    if(my $address = SL::DB::Manager::Shipto->find_by( shiptoname          => $self->{delivery_firstname} . " " . $self->{delivery_lastname},
54 63
                                                        shiptostreet        => $self->{delivery_street},
55 64
                                                        shiptocity          => $self->{delivery_city},
56 65
                                                      )) {
......
59 68
      my $gender = $self->{delivery_greeting} eq "Frau" ? 'f' : 'm';
60 69
      my $deliveryaddress = SL::DB::Shipto->new;
61 70
      $deliveryaddress->assign_attributes(
62
        shiptoname      => $self->{delivery_firstname} . " " . $self->{delivery_lastname},
63
        shiptocp_gender => $gender,
64
        shiptostreet    => $self->{delivery_street},
65
        shiptozipcode   => $self->{delivery_zipcode},
66
        shiptocity      => $self->{delivery_city},
67
        shiptocountry   => $self->{delivery_country},
68
        trans_id        => $customer->id,   # ????
69
        module          => "CT",
71
        shiptoname          => $self->{delivery_firstname} . " " . $self->{delivery_lastname},
72
        shiptodepartment_1  => $self->{delivery_company},
73
        shiptodepartment_2  => $self->{delivery_department},
74
        shiptocp_gender     => $gender,
75
        shiptostreet        => $self->{delivery_street},
76
        shiptozipcode       => $self->{delivery_zipcode},
77
        shiptocity          => $self->{delivery_city},
78
        shiptocountry       => $self->{delivery_country},
79
        trans_id            => $customer->id,
80
        module              => "CT",
70 81
      );
71 82
      $deliveryaddress->save;
72 83
      $shipto_id = $deliveryaddress->{shipto_id};
......
75 86

  
76 87
  my $order = SL::DB::Order->new(
77 88
                  amount                  => $self->amount,
78
                  cusordnumber            => $self->shop_id,
89
                  cusordnumber            => $self->shop_ordernumber,
79 90
                  customer_id             => $customer->id,
80 91
                  shipto_id               => $shipto_id,
81
                  orderitems              => [ @order_items ],
92
                  orderitems              => [ @items ],
82 93
                  employee_id             => $employee->id,
83
                  intnotes                => $self->{shop_customer_comment},
94
                  intnotes                => ($customer->notes ne "" ? "\n[Kundestammdaten]\n" . $customer->notes : ""),
84 95
                  salesman_id             => $employee->id,
85 96
                  taxincluded             => 1,   # TODO: make variable
97
                  payment_id              => $customer->payment_id,
86 98
                  taxzone_id              => $customer->taxzone_id,
87 99
                  currency_id             => $customer->currency_id,
88 100
                  transaction_description => 'Shop Import',
89 101
                  transdate               => DateTime->today_local
90 102
                );
91
  # $order->save;
92
  return $order;
103
   return $order;
93 104
};
94 105

  
95 106
1;
SL/ShopConnector/Shopware.pm
31 31
  my $ordnumber = $self->config->last_order_number + 1;
32 32
  my $otf = $self->config->orders_to_fetch;
33 33

  
34

  
34 35
  my $i;
35 36
  for ($i=1;$i<=$otf;$i++) {
36 37

  
......
106 107
        tax_included            => ($import->{data}->{net} == 0 ? 0 : 1)
107 108
      );
108 109
      my $shop_order = SL::DB::ShopOrder->new(%columns);
109

  
110 110
      $shop_order->save;
111 111
      my $id = $shop_order->id;
112 112

  
......
134 134
      my $proposals = SL::DB::Manager::Customer->get_all_count(
135 135
           where => [
136 136
                       or => [
137
                                and => [ # when matching names also match zipcode
138
                                         or => [ 'name' => { like => "$shop_order->billing_lastname"},
139
                                                 'name' => { like => $shop_order->billing_company },
140
                                               ],
141
                                         'zipcode' => { like => $shop_order->billing_zipcode },
142
                                       ],
143
                                or  => [ 'email' => { like => $shop_order->billing_email } ],
144
                                and  => [ 'street' => { like => $shop_order->billing_street },
145
                                         'zipcode' => { like => $shop_order->billing_zipcode } ],
137
                                and  => [ # when matching names also match zipcode
138
                                          or => [ 'name' => { ilike => "%$shop_order->billing_lastname%"},
139
                                                  'name' => { ilike => "%$shop_order->billing_company%" },
140
                                                ],
141
                                          'zipcode' => { ilike => $shop_order->billing_zipcode },
142
                                        ],
143
                                and  => [ # matching street and zipcode
144
                                         'street' => { ilike => "%$shop_order->billing_street%" },
145
                                         'zipcode' => { ilike => $shop_order->billing_zipcode }
146
                                        ],
147
                                or   => [ 'email' => { ilike => $shop_order->billing_email } ],
146 148
                             ],
147 149
                    ],
148 150
      );
......
162 164
                        'ustid'                 => $shop_order->billing_vat,
163 165
                        'taxincluded_checked'   => $self->config->pricetype eq "brutto" ? 1 : 0,
164 166
                        'taxincluded'           => $self->config->pricetype eq "brutto" ? 1 : 0,
165
                        'klass'                 => (split '\/',$self->config->price_source)[1],
167
                        'pricegroup_id'                 => (split '\/',$self->config->price_source)[1],
166 168
                        'taxzone_id'            => $self->config->taxzone_id,
167 169
                        'currency'              => 1,   # TODO hardcoded
168 170
                        'payment_id'            => 7345,# TODO hardcoded
169 171
                      );
170 172
        my $customer = SL::DB::Customer->new(%address);
171 173
        $customer->save;
174
        my $snumbers = "customernumber_" . $customer->customernumber;
175
        SL::DB::History->new(
176
                          trans_id    => $customer->id,
177
                          snumbers    => $snumbers,
178
                          employee_id => SL::DB::Manager::Employee->current->id,
179
                          addition    => 'SAVED',
180
                          what_done   => 'Shopimport',
181
                        )->save();
172 182

  
173 183
      }
174 184
      my %billing_address = ( 'name'     => $shop_order->billing_lastname,
......
275 285
    $data = $self->connector->get("http://$url/api/articles/$partnumber?useNumberAsId=true");
276 286
    $data_json = $data->content;
277 287
    $import = SL::JSON::decode_json($data_json);
278
  }
288
    $main::lxdebug->dump(0, 'WH:IMPORT ',\$import);
289

  
290
#  }
279 291

  
280 292
  # get the right price
281 293
  my ( $price_src_str, $price_src_id ) = split(/\//,$shop_part->active_price_source);
......
400 412
  my ($self,$partnumber) = @_;
401 413

  
402 414
  my $url = $self->url;
415
  $partnumber = $::form->escape($partnumber);#shopware don't accept / in articlenumber
403 416
  my $data = $self->connector->get("http://$url/api/articles/$partnumber?useNumberAsId=true");
404 417
  my $data_json = $data->content;
405 418
  return SL::JSON::decode_json($data_json);
406 419
}
407 420

  
421
sub set_orderstatus {
422
  my ($self,$ordernumber);
423
}
424

  
408 425
sub init_url {
409 426
  my ($self) = @_;
410 427
  # TODO: validate url and port Mabey in shopconfig test connection
css/webshop.css
1
div.table {
1
/* Shop */
2
div.shop_table {
2 3
  display: table;
3
  padding: 20px,20px,20px,20px;
4
  margin: 15px,15px,15px,15px;
4
  background-color: #ebebeb;
5
  /* padding: 15px;
6
  margin: 15px; */
7
}
8
div.shop_table_address {
9
  display: table;
10
  /* padding: 15px; */
11
  margin: 0px 0px 0px 15px;
5 12
}
6
div.table-row {
13
div.shop_table-row {
7 14
  display: table-row;
8 15
}
9
div.table-cell {
16
div.shop_table-cell {
10 17
  display: table-cell;
11 18
  padding: 20px,20px,20px,20px;
12 19
}
13
div.main{
20
div.shop_table-cell_colspan {
21
  flex: 2;
22
  align: center;
23
}
24
div.shop_main{
14 25
  width: 100%;
15 26
  padding: 15px,15px,15px,15px;
16 27
  margin: 15px,15px,15px,15px;
17 28
}
18
.fleft {
29
.shop_fleft {
19 30
  width: 30%;
20 31
  float: left;
21 32
  border: thin solid red;
22 33
}
34

  
35
div.shop_table_info {
36
  color: #b3b3b3;
37
  width: 100%;
38
  align: left;
39
}
js/kivi.ShopOrder.js
26 26

  
27 27
  ns.setup = function() {
28 28
    kivi.ShopOrder.massTransferInitialize();
29
    kivi.submit_ajax_form('controller.pl?action=ShopOrder/mass_transfer','[name=shop_orders]');
29
    kivi.submit_ajax_form('controller.pl?action=ShopOrder/mass_transfer','[name=shop_orders_list]');
30 30
  };
31 31

  
32 32
});
menus/user/10-shopimport.yaml
7 7
  name: Webshop Import
8 8
  params:
9 9
    action: ShopOrder/list
10
    filter.transferred:eq_ignore_empty: 0
11
    filter.obsolete: 0
10 12
    db: shop_orders
11 13
    sort_by: shop_ordernumber
12 14
- parent: webshop
sql/Pg-upgrade2/df_shoporder.sql
1
-- @tag: df_shoporder
2
-- @description: Feld Auftragssperre in der shoporder Tabelle
3
-- @depends: release_3_4_0
4

  
5
ALTER TABLE shop_orders ADD COLUMN df_kivi_customer_order_lock boolean DEFAULT FALSE NOT NULL;
sql/Pg-upgrade2/df_shoporder3.sql
1
-- @tag: df_shoporder3
2
-- @description: Feld df_kivi_customer_order_lock in der shoporder Tabelle wieder gelösch da order_lock direkt aus den Kundendaten genommen wird. Tabellen customer und shop_order sind Verknüpft. Spalte obsolete hinzgefügt
3
-- @depends: release_3_4_0
4

  
5
ALTER TABLE shop_orders DROP COLUMN df_kivi_customer_order_lock;
6
ALTER TABLE shop_orders ADD COLUMN obsolete boolean DEFAULT FALSE NOT NULL;
sql/Pg-upgrade2/df_shoporder_2.sql
1
-- @tag: df_shoporder_2
2
-- @description: Feld Positionen in der shoporder Tabelle
3
-- @depends: release_3_4_0
4

  
5
ALTER TABLE shop_orders ADD COLUMN positions integer;
6

  
templates/webpages/shop_order/_filter.html
2 2
[%- USE L %]
3 3
[%- USE LxERP %]
4 4
[%- USE HTML %]
5
<form action='controller.pl' method='post'>
5
 <form method="post" action="controller.pl" name="shop_orders" id="shoporders">
6 6
 [% L.submit_tag('action_get_orders',LxERP.t8('New shop orders')) %]
7 7
 <table id='filter_table'>
8 8

  
9 9
    <tr>
10 10
     <th align="right">[% 'Status' | $T8 %]</th>
11
     <td>[% L.select_tag('filter.transferred:eq_ignore_empty', SELF.transferred, value_key = 'value', title_key = 'title', default=TOOK) %]</td>
11
     <td>[% L.select_tag('filter.transferred:eq_ignore_empty', SELF.transferred, value_key = 'value', title_key = 'title', default=0) %]</td>
12 12
    </tr>
13 13

  
14 14

  
15 15
    <tr>
16 16
     <th align="right">[% 'from' | $T8 %]</th>
17
     <td>[% L.date_tag('filter.order_date:date::ge', filter.order_date_date__ge) %]</td>
17
     <td>[% L.date_tag('filter.order_date:date::ge', FORM.filter.order_date_date__ge) %]</td>
18 18
    </tr>
19 19

  
20 20
    <tr>
21 21
     <th align="right">[% 'to' | $T8 %]</th>
22
     <td>[% L.date_tag('filter.order_date:date::le', filter.order_date_date__le) %]</td>
22
     <td>[% L.date_tag('filter.order_date:date::le', FORM.filter.order_date_date__le) %]</td>
23
    </tr>
24

  
25
    <tr>
26
      <th align="right">[% 'Obsolete' | $T8 %]</th>
27
      <td>[% L.yes_no_tag('filter.obsolete', FORM.filter.obsolete, default='0', with_empty=1, empty_title='---') %]</td>
23 28
    </tr>
24 29

  
25 30
 </table>
......
31 36
 [% L.hidden_tag('action', 'ShopOrder/dispatch') %]
32 37
 [% L.submit_tag('action_list',LxERP.t8('renew')) %]
33 38

  
34
</form>
templates/webpages/shop_order/_transfer_status.html
1
[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
2
[%- USE Dumper -%]
3
[% SET data = job.data_as_hash %]
4

  
5
<!-- ShopOrder -->
6
<h2>[% LxERP.t8("Watch status") %]</h2>
7

  
8
[% L.hidden_tag('', job.id, id="smt_job_id") %]
9

  
10
JOBID: [% job.id %] <p>
11
 [% LxERP.t8("This status output will be refreshed every five seconds.") %]
12
</p>
13
<p>
14
[% # Dumper.dump_html(data) %]
15
</p>
16
<p>
17
 <table>
18
  <tr>
19
   <th valign="top" align="left">[% LxERP.t8("Current status:") %]</th>
20
   <td valign="top">
21
    [% IF !data.status %]
22
     [% LxERP.t8("waiting for job to be started") %]
23
    [% ELSIF data.status == 1 %]
24
     [% LxERP.t8("Converting to deliveryorder") %]
25
     [% ELSE %]
26
     [% LxERP.t8("Done.") %]
27
    [% END %]
28
   </td>
29
  </tr>
30
  <tr>
31
   <th valign="top" align="left">[% LxERP.t8("Number of invoices created:") %]</th>
32
   <td valign="top">[% IF data.status > 0 %][% HTML.escape(data.num_created) %] / [% HTML.escape(data.record_ids.size) %][% ELSE %]–[% END %]</td>
33
  </tr>
34

  
35
  <tr>
36
   <th valign="top" align="left">[% LxERP.t8("Number of invoices printed:") %]</th>
37
   <td valign="top">[% IF data.status > 1 %][% HTML.escape(data.num_printed) %] / [% HTML.escape(data.invoice_ids.size) %][% ELSE %]–[% END %]</td>
38
  </tr>
39

  
40
  <tr>
41
   <th valign="top" align="left">[% LxERP.t8("Errors during conversion:") %]</th>
42
   <td valign="top">
43
[% IF !data.status %]
44
45
[% ELSIF !data.conversion_errors.size %]
46
 [% LxERP.t8("No errors have occurred.") %]
47
[% ELSE %]
48
    <table>
49
     <tr class="listheader">
50
      <th>[% LxERP.t8("Delivery Order") %]</th>
51
      <th>[% LxERP.t8("Error") %]</th>
52
     </tr>
53

  
54
 [% FOREACH error = data.conversion_errors %]
55
     <tr>
56
      <td valign="top">[% IF error.id %][% L.link(SELF.url_for(controller='do.pl', action='edit', type='sales_delivery_order', id=error.id), HTML.escape(error.number), target="_blank") %][% ELSE %]–[% END %]</td>
57
      <td valign="top">[% HTML.escape(error.message) %]</td>
58
     </tr>
59
 [% END %]
60
    </table>
61
[% END %]
62
   </td>
63
  </tr>
64

  
65
  <tr>
66
   <th valign="top" align="left">[% LxERP.t8("Errors during printing:") %]</th>
67
   <td valign="top">
68
[% IF data.status < 2 %]
69
70
[% ELSIF !data.print_errors.size %]
71
 [% LxERP.t8("No errors have occurred.") %]
72
[% ELSE %]
73
    <table>
74
     <tr class="listheader">
75
      <th>[% LxERP.t8("Invoice") %]</th>
76
      <th>[% LxERP.t8("Error") %]</th>
77
     </tr>
78

  
79
 [% FOREACH error = data.print_errors %]
80
     <tr>
81
      <td valign="top">[% IF error.id %][% L.link(SELF.url_for(controller='is.pl', action='edit', type='sales_invoice',id=error.id), HTML.escape(error.number), target="_blank") %][% ELSE %]–[% END %]</td>
82
      <td valign="top">[% HTML.escape(error.message) %]</td>
83
     </tr>
84
 [% END %]
85
    </table>
86
[% END %]
87
   </td>
88
  </tr>
89

  
90
 </table>
91
</p>
templates/webpages/shop_order/list.html
4 4

  
5 5
<h1>[% title %]</h1>
6 6
[%- PROCESS 'shop_order/_filter.html' filter=SELF.models.filtered.laundered %]
7

  
7 8
<hr>
9
 <div class="table_info">[% 'Number data sets' | $T8 %]: [% SHOPORDERS.size %]</div>
8 10
 <table id="shoplist">
9 11
  <thead>
10 12
   <tr class="listheading">
11 13
    <th>[% 'Shop Host' | $T8 %]</th>
12 14
    <th>[% IF FORM.sort_by == 'order_date' %]
13
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=order_date&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
15
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=order_date&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
14 16
        [% 'Shop orderdate' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
15 17
    [% ELSE %]
16
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=order_date&sort_dir=0" class="sort_link">
18
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=order_date&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
17 19
        [% 'Shop orderdate' | $T8 %]</a>
18 20
    [% END %]
19 21
    </th>
20 22
    <th>[% IF FORM.sort_by == 'shop_ordernumber' %]
21
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_ordernumber&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
23
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_ordernumber&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
22 24
        [% 'Shop ordernumber' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
23 25
    [% ELSE %]
24
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_ordernumber&sort_dir=0" class="sort_link">
26
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_ordernumber&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
25 27
        [% 'Shop ordernumber' | $T8 %]</a>
26 28
    [% END %]
27 29
    </th>
28 30
    <th>[% IF FORM.sort_by == 'shop_customer_number' %]
29
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_number&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
31
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_number&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
30 32
        [% 'Shop customernumber' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
31 33
    [% ELSE %]
32
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_number&sort_dir=0" class="sort_link">
34
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_number&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
33 35
        [% 'Shop customernumber' | $T8 %]</a>
34 36
    [% END %]
35 37
    </th>
36 38
    <th>[% 'Shop Customer Address' | $T8 %]<br>
37 39
    [% IF FORM.sort_by == 'customer_lastname' %]
38
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_lastname&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
40
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_lastname&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
39 41
        [% 'Name' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
40 42
    [% ELSE %]
41
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_lastname&sort_dir=0" class="sort_link">
43
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_lastname&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
42 44
        [% 'Name' | $T8 %]</a>|
43 45
    [% END %]
44 46
    [% IF FORM.sort_by == 'customer_zipcode' %]
45
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_zipcode&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
47
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_zipcode&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
46 48
        [% 'Zip' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
47 49
    [% ELSE %]
48
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_zipcode&sort_dir=0" class="sort_link">
50
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_zipcode&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
49 51
        [% 'Zip' | $T8 %]</a>|
50 52
    [% END %]
51 53
    [% IF FORM.sort_by == 'customer_country' %]
52
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_country&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
54
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_country&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
53 55
        [% 'Country' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
54 56
    [% ELSE %]
55
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_country&sort_dir=0" class="sort_link">
57
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=customer_country&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
56 58
        [% 'Country' | $T8 %]</a>
57 59
    [% END %]
58 60
      </th>
59 61
    <th>[% 'Shop Billing Address' | $T8 %]</br>
60 62
    [% IF FORM.sort_by == 'billing_lastname' %]
61
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_lastname&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
63
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_lastname&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
62 64
        [% 'Name' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
63 65
    [% ELSE %]
64
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_lastname&sort_dir=0" class="sort_link">
66
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_lastname&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
65 67
        [% 'Name' | $T8 %]</a>|
66 68
    [% END %]
67 69
    [% IF FORM.sort_by == 'billing_zipcode' %]
68
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_zipcode&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
70
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_zipcode&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
69 71
        [% 'Zip' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
70 72
    [% ELSE %]
71
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_zipcode&sort_dir=0" class="sort_link">
73
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_zipcode&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
72 74
        [% 'Zip' | $T8 %]</a>|
73 75
    [% END %]
74 76
    [% IF FORM.sort_by == 'billing_country' %]
75
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_country&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
77
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_country&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
76 78
        [% 'Country' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
77 79
    [% ELSE %]
78
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_country&sort_dir=0" class="sort_link">
80
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=billing_country&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
79 81
        [% 'Country' | $T8 %]</a>
80 82
    [% END %]
81 83
      </th>
82 84
    <th>[% 'Shop Delivery Address' | $T8 %]</br>
83 85
    [% IF FORM.sort_by == 'delivery_lastname' %]
84
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_lastname&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
86
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_lastname&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
85 87
        [% 'Name' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
86 88
    [% ELSE %]
87
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_lastname&sort_dir=0" class="sort_link">
89
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_lastname&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
88 90
        [% 'Name' | $T8 %]</a>|
89 91
    [% END %]
90 92
    [% IF FORM.sort_by == 'delivery_zipcode' %]
91
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_zipcode&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
93
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_zipcode&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
92 94
        [% 'Zip' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>|
93 95
    [% ELSE %]
94
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_zipcode&sort_dir=0" class="sort_link">
96
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_zipcode&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
95 97
        [% 'Zip' | $T8 %]</a>|
96 98
    [% END %]
97 99
    [% IF FORM.sort_by == 'delivery_country' %]
98
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_country&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
100
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_country&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
99 101
        [% 'Country' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
100 102
    [% ELSE %]
101
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_country&sort_dir=0" class="sort_link">
103
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=delivery_country&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
102 104
        [% 'Country' | $T8 %]</a>
103 105
    [% END %]
104 106
      </th>
105 107
    <th>[% IF FORM.sort_by == 'shop_customer_comment' %]
106
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_comment&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
108
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_comment&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
107 109
        [% 'Notes' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
108 110
    [% ELSE %]
109
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_comment&sort_dir=0" class="sort_link">
111
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shop_customer_comment&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
110 112
        [% 'Notes' | $T8 %]</a>
111 113
    [% END %]
112 114
    </th>
113 115
    <th>
114
      [% 'Positions' | $T8 %]<br>
116
      [% IF FORM.sort_by == 'positions' %]
117
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=positions&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
118
        [% 'Positions' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a><br>
119
      [% ELSE %]
120
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=positions&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link"> [% 'Positions' | $T8 %]</a><br>
121
      [% END %]
115 122
      [% IF FORM.sort_by == 'amount' %]
116
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=amount&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
117
        [% 'Amount' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
123
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=amount&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
124
        [% 'Amount' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a><br>
118 125
      [% ELSE %]
119
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=amount&sort_dir=0" class="sort_link"> [% 'Amount' | $T8 %]</a><br>
126
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=amount&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link"> [% 'Amount' | $T8 %]</a><br>
120 127
      [% END %]
121 128
      [% IF FORM.sort_by == 'shipping_costs' %]
122
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shipping_costs&sort_dir=[% 1 - FORM.sort_dir %]" class="sort_link">
129
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shipping_costs&sort_dir=[% 1 - FORM.sort_dir %]&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link">
123 130
        [% 'Shippingcosts' | $T8 %][% IF FORM.sort_dir == 0 %]<img border="0" src="image/down.png">[% ELSE %]<img border="0" src="image/up.png">[% END %]</a>
124 131
      [% ELSE %]
125
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shipping_costs&sort_dir=0" class="sort_link"> [% 'Shippingcosts' | $T8 %]</a><br>
132
      <a href ="controller.pl?action=ShopOrder/list&filter.transferred:eq_ignore_empty=[% FORM.filter.transferred_eq_ignore_empty %]&sort_by=shipping_costs&sort_dir=0&filter.order_date:date::ge=[% FORM.filter.order_date_date__ge %]&filter.order_date:date::le=[% FORM.filter.order_date_date__le %]&filter.obsolete=[% FORM.filter.obsolete %]" class="sort_link"> [% 'Shippingcosts' | $T8 %]</a>
126 133
      [% END %]
127 134
    </th>
128
    <th></th>
135
    <th>[% 'Action' | $T8 %]<br>[% L.checkbox_tag('check_all') %]</th>
129 136
   </tr>
130 137
  </thead>
138
 </form>
139
 <form method="post" action="controller.pl" name="shop_orders_list" id="shoporderslist">
131 140
  [% FOREACH shop_order = SHOPORDERS %]
141
    [% IF shop_order.customer.id && shop_order.customer.order_lock == 0 && shop_order.open_invoices == 0 %] [% SET transferable = 1 %] [% SET transferable_class = 'style="background:rgba(43, 208, 54, 0.5);"' %] [% ELSE %] [% SET transferable = 0 %] [% SET transferable_class = '' %][% END %]
132 142
  <tr class="listrow">
133 143
    <td>[% HTML.escape(shop_order.host) %]</td>
134 144
    <td>[% shop_order.order_date.dmy('.') _ ' ' _ shop_order.order_date.hms(':') %]</td>
......
143 153
      <b>[% HTML.escape(shop_order.billing_lastname) %],&nbsp;[% HTML.escape(shop_order.billing_firstname) %]</b>
144 154
      <br>[% HTML.escape(shop_order.billing_street) %]
145 155
      <br>[% HTML.escape(shop_order.billing_zipcode) %]&nbsp;[% HTML.escape(shop_order.billing_city) %]
146
      <br>[% HTML.escape(shop_order.billing_country) %] </td>
147
    [% IF (shop_order.delivery_lastname != shop_order.billing_lastname || shop_order.delivery_firstname != shop_order.billing_firstname || shop_order.delivery_street != shop_order.billing_street || shop_order.delivery_city != shop_order.billing_city) %] [% SET deliveryclass = 'style="background-color:red;"' %] [% ELSE %] [% SET deliveryclass = '' %] [% END %]
156
      <br>[% HTML.escape(shop_order.billing_country) %]
157
      <br>[% IF shop_order.open_invoices > 0 || shop_order.customer.order_lock == 1 %][% SET alertclass = 'style="background:rgba(255,0,0,1);"' %][% ELSE %][% SET alertclass = '' %][% END %]<span [% alertclass %]>&nbsp;&nbsp;[% HTML.escape(shop_order.customer.customernumber) %] -- [% shop_order.open_invoices %]&nbsp;&nbsp;</span></td>
158
    [% IF (shop_order.delivery_lastname != shop_order.billing_lastname || shop_order.delivery_firstname != shop_order.billing_firstname || shop_order.delivery_street != shop_order.billing_street || shop_order.delivery_city != shop_order.billing_city) %] [% SET deliveryclass = 'style="background:rgba(100, 100, 100, 0.5);"' %] [% ELSE %] [% SET deliveryclass = '' %] [% END %]
148 159
    <td [% deliveryclass %]>[% IF shop_order.customer_company %]<b>[% HTML.escape(shop_order.customer_company) %]</b><br>[% END %]
149 160
      <b>[% HTML.escape(shop_order.delivery_lastname) %],&nbsp;[% HTML.escape(shop_order.delivery_firstname) %]</b>
150 161
      <br>[% HTML.escape(shop_order.delivery_street) %]
151 162
      <br>[% HTML.escape(shop_order.delivery_zipcode) %]&nbsp;[% HTML.escape(shop_order.delivery_city) %]
152 163
      <br>[% HTML.escape(shop_order.delivery_country) %] </td>
153 164
    <td>[% HTML.escape(shop_order.shop_customer_comment) %]</td>
154
    <td>[% shop_order.shop_order_items.size %]<br>[% shop_order.amount_as_number %]<br>[% shop_order.shipping_costs_as_number %]</td>
155
    <td>[% IF shop_order.transferred == 1 %]<a href="controller.pl?id=[% shop_order.id %]&action=ShopOrder/show">[% 'Show order' | $T8 %]<br>[% shop_order.transferred_date_as_date %]</a>
156
        [% ELSE %]<a href="controller.pl?id=[% shop_order.id %]&action=ShopOrder/show">[% 'Create order' | $T8 %][% END %]</a></td>
165
    <td><span class="tooltipster-html" title="[% FOREACH item = shop_order.shop_order_items %] [% LxERP.format_amount(item.quantity,0) %] x [% item.partnumber %] [% item.description %] <br> [% END %]">[% shop_order.positions %]<br>[% shop_order.amount_as_number %]<br>[% shop_order.shipping_costs_as_number %]</td><span>
166
    <td valign="middle">[% IF shop_order.transferred == 1 %]<a href="controller.pl?id=[% shop_order.id %]&action=ShopOrder/show">[% 'Show order' | $T8 %]<br>[% shop_order.transferred_date_as_date %]</a>
167
        [% ELSE %]
168
          [% IF transferable == 1 && shop_order.obsolete == 0 %]
169
            [% L.checkbox_tag('id[]', checked = '1',  value=shop_order.id) %]<br>
170
          [% END %]
171
          [% IF shop_order.obsolete == 0 %]<a href="controller.pl?id=[% shop_order.id %]&action=ShopOrder/show">[% 'Create order' | $T8 %]</a></br></br>
172
          <a href="controller.pl?import_id=[% shop_order.id %]&action=ShopOrder/delete_order">[% 'Delete shoporder' | $T8 %]</a>
173
          [% ELSE %]
174
          [% 'Obsolete' | $T8 %]<br><br>
175
            <a href="controller.pl?id=[% shop_order.id %]&action=ShopOrder/show">[% 'Show order' | $T8 %]
176
          [% END %]
177
    </td>
178
        [% END %]
157 179
  </tr>
158 180
  [% END %]
159 181
 </table>
182
 <hr>
183
  <p>
184
   [% L.hidden_tag("action", "ShopOrder/mass_transfer") %]
185
   [% L.submit_tag("", LxERP.t8("Transfer all marked")) %]
186
  </p>
187
 </form>
188
<script type="text/javascript">
189
<!--
190

  
191
$(function() {
192
  $('#check_all').checkall('INPUT[name^="id"]');
193
});
194
-->
195
</script>
templates/webpages/shop_order/show.html
4 4

  
5 5
<h1>[% title %]</h1>
6 6

  
7
<form method="post" action="controller.pl">
8
  <div class="table main">
9
    <div class="table-row listheading">
10
      <div class="table-cell">
11
        <div class="table" style="margin:150px,15px,15px,15px;">
12
          <div class="table-row listheading">
13
            <div class="table-cell">[% 'Shop Customer Address' | $T8 %]</div>
7
  <div class="shop_table shop_main">
8
    <div class="shop_table-row">
9
      <div class="shop_table-cell" style="display:none">
10
      <form method="post" action="controller.pl" id="customer">[% L.hidden_tag('create_customer','customer') %][% L.hidden_tag('import_id', IMPORT.id) %]
11
        <div class="shop_table shop_table_address">
12
          <div class="shop_table-row listheading">
13
            <div class="shop_table-cell">[% 'Shop Customer Address' | $T8 %]</div>
14
            <div class="shop_table-cell"></div>
14 15
          </div>
15
          <div class="table-row"><div class="table-cell">[% 'Greeting' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_greeting', IMPORT.customer_greeting) %]</div></div>
16
          <div class="table-row"><div class="table-cell">[% 'Firstname' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_firstname', IMPORT.customer_firstname) %]</div></div>
17
          <div class="table-row"><div class="table-cell">[% 'Lastname' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_lastname', IMPORT.customer_lastname) %]</div></div>
18
          <div class="table-row"><div class="table-cell">[% 'Company' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_company', IMPORT.customer_company) %]</div></div>
19
          [% IF IMPORT.customer_company == '' %]
16
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.customer_greeting) %]</div></div>
17
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Firstname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.customer_firstname) %]</div></div>
18
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Lastname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.customer_lastname) %]</div></div>
19
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Company' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.customer_company) %]</div></div>
20
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Department' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.customer_department) %]</div></div>
20 21
            [% SET customer = IMPORT.customer_firstname _ ' ' _ IMPORT.customer_lastname %]
21
          [% ELSE %]
22
            [% SET customer = IMPORT.customer_company %]
23
          [% END %]
24 22
          <hr>
25
          <div class="table-row"><div class="table-cell">[% 'Customer' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_name', customer) %]</div></div>
26
          <div class="table-row"><div class="table-cell">[% 'Street' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_street', IMPORT.customer_street) %]</div></div>
27
          <div class="table-row"><div class="table-cell">[% 'Zipcode' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_zipcode', IMPORT.customer_zipcode) %]</div></div>
28
          <div class="table-row"><div class="table-cell">[% 'City' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_city', IMPORT.customer_city) %]</div></div>
29
          <div class="table-row"><div class="table-cell">[% 'Country' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_country', IMPORT.customer_country) %]</div></div>
30
          <div class="table-row"><div class="table-cell">[% 'Email' | $T8 %]</div><div class="table-cell">[% L.input_tag('customer_email', IMPORT.customer_email) %]</div></div>
23
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_greeting', IMPORT.customer_greeting) %]</div></div>
24
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customer' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_name', customer) %]</div></div>
25
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 2' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_company', IMPORT.customer_company) %]</div></div>
26
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 3' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_department', IMPORT.customer_department) %]</div></div>
27
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Street' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_street', IMPORT.customer_street) %]</div></div>
28
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Zipcode' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_zipcode', IMPORT.customer_zipcode) %]</div></div>
29
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'City' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_city', IMPORT.customer_city) %]</div></div>
30
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Country' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_country', IMPORT.customer_country) %]</div></div>
31
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Phone' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_phone', IMPORT.customer_phone) %]</div></div>
32
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Email' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('customer_email', IMPORT.customer_email) %]</div></div>
31 33
          [% IF C_ADDRESS %]
32
          <div>[% C_ADDRESS.customernumber %]</div>
34
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customernumber' | $T8 %]</div><div class="shop_table-cell">[% C_ADDRESS.customernumber %]</div></div>
33 35
          [% ELSE %]
34
          <div>[% L.radio_button_tag('create_customer', value='customer') %]</div>
36
          <div>[% L.ajax_submit_tag("controller.pl?action=ShopOrder/apply_customer",  "#customer", LxERP.t8("Apply customer")) %]</div>
35 37
          [% END %]
36 38
        </div>
39
      </form>
37 40
      </div>
38
      <div class="table-cell">
39
        <div class="table">
40
          <div class="table-row listheading">
41
            <div class="table-cell">[% 'Shop Billing  Address' | $T8 %]</div>
41
      <div class="shop_table-cell">
42
      <form method="post" action="controller.pl" id="billing">[% L.hidden_tag('create_customer','billing') %][% L.hidden_tag('import_id', IMPORT.id) %]
43
        <div class="shop_table shop_table_address">
44
          <div class="shop_table-row listheading">
45
            <div class="shop_table-cell">[% 'Shop Billing Address' | $T8 %]</div>
46
            <div class="shop_table-cell"></div>
42 47
          </div>
43
          <div class="table-row"><div class="table-cell">[% 'Greeting' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_greeting', IMPORT.billing_greeting) %]</div></div>
44
          <div class="table-row"><div class="table-cell">[% 'Firstname' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_firstname', IMPORT.billing_firstname) %]</div></div>
45
          <div class="table-row"><div class="table-cell">[% 'Lastname' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_lastname', IMPORT.billing_lastname) %]</div></div>
46
          <div class="table-row"><div class="table-cell">[% 'Company' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_company', IMPORT.billing_company) %]</div></div>
47
          [% IF IMPORT.billing_company == '' %]
48
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.billing_greeting) %]</div></div>
49
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Firstname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.billing_firstname) %]</div></div>
50
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Lastname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.billing_lastname) %]</div></div>
51
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Company' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.billing_company) %]</div></div>
52
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Department' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.billing_department) %]</div></div>
48 53
            [% SET billing = IMPORT.billing_firstname _ ' ' _ IMPORT.billing_lastname %]
49
          [% ELSE %]
50
            [% SET billing = IMPORT.billing_company %]
51
          [% END %]
52 54
          <hr>
53
          <div class="table-row"><div class="table-cell">[% 'Customer' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_name', billing) %]</div></div>
54
          <div class="table-row"><div class="table-cell">[% 'Street' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_street', IMPORT.billing_street) %]</div></div>
55
          <div class="table-row"><div class="table-cell">[% 'Zipcode' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_zipcode', IMPORT.billing_zipcode) %]</div></div>
56
          <div class="table-row"><div class="table-cell">[% 'City' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_city', IMPORT.billing_city) %]</div></div>
57
          <div class="table-row"><div class="table-cell">[% 'Country' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_country', IMPORT.billing_country) %]</div></div>
58
          <div class="table-row"><div class="table-cell">[% 'Email' | $T8 %]</div><div class="table-cell">[% L.input_tag('billing_email', IMPORT.billing_email) %]</div></div>
55
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_greeting', IMPORT.billing_greeting) %]</div></div>
56
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customer' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_name', billing) %]</div></div>
57
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 2' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_company', IMPORT.billing_company) %]</div></div>
58
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 3' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_department', IMPORT.billing_department) %]</div></div>
59
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Street' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_street', IMPORT.billing_street) %]</div></div>
60
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Zipcode' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_zipcode', IMPORT.billing_zipcode) %]</div></div>
61
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'City' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_city', IMPORT.billing_city) %]</div></div>
62
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Country' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_country', IMPORT.billing_country) %]</div></div>
63
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Phone' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_phone', IMPORT.billing_phone) %]</div></div>
64
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Email' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('billing_email', IMPORT.billing_email) %]</div></div>
59 65
          [% IF B_ADDRESS %]
60
          <div>[% B_ADDRESS.customernumber %]</div>
66
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customernumber' | $T8 %]</div><div class="shop_table-cell">[% B_ADDRESS.customernumber %]</div></div>
61 67
          [% ELSE %]
62
          <div>[% L.radio_button_tag('create_customer', value='billing') %]</div>
68
          <div>[% L.ajax_submit_tag("controller.pl?action=ShopOrder/apply_customer",  "#billing", LxERP.t8("Apply customer")) %]</div>
63 69
          [% END %]
64 70
        </div>
71
      </form>
65 72
      </div>
66
      <div class="table-cell">
67
        <div style="display:table;">
68
          <div class="table-row listheading">
69
            <div class="table-cell">[% 'Shop Delivery Address' | $T8 %]</div>
73
      <div class="shop_table-cell">
74
      <form method="post" action="controller.pl" id="delivery">[% L.hidden_tag('create_customer','delivery') %][% L.hidden_tag('import_id', IMPORT.id) %]
75
        <div class="shop_table shop_table_address">
76
          <div class="shop_table-row listheading">
77
            <div class="shop_table-cell">[% 'Shop Delivery Address' | $T8 %]</div>
78
            <div class="shop_table-cell"></div>
70 79
          </div>
71
          <div class="table-row"><div class="table-cell">[% 'Greeting' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_greeting', IMPORT.billing_greeting) %]</div></div>
72
          <div class="table-row"><div class="table-cell">[% 'Firstname' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_firstname', IMPORT.delivery_firstname) %]</div></div>
73
          <div class="table-row"><div class="table-cell">[% 'Lastname' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_lastname', IMPORT.delivery_lastname) %]</div></div>
74
          <div class="table-row"><div class="table-cell">[% 'Company' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_company', IMPORT.delivery_company) %]</div></div>
75
          [% IF IMPORT.delivery_company == '' %]
80
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.delivery_greeting) %]</div></div>
81
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Firstname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.delivery_firstname) %]</div></div>
82
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Lastname' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.delivery_lastname) %]</div></div>
83
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Company' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.delivery_company) %]</div></div>
84
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Department' | $T8 %]</div><div class="shop_table-cell">[% HTML.escape(IMPORT.delivery_department) %]</div></div>
76 85
            [% SET delivery = IMPORT.delivery_firstname _ ' ' _ IMPORT.delivery_lastname %]
77
          [% ELSE %]
78
            [% SET delivery = IMPORT.delivery_company %]
79
          [% END %]
80 86
          <hr>
81
          <div class="table-row"><div class="table-cell">[% 'Customer' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_name', delivery) %]</div></div>
82
          <div class="table-row"><div class="table-cell">[% 'Street' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_street', IMPORT.delivery_street) %]</div></div>
83
          <div class="table-row"><div class="table-cell">[% 'Zipcode' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_zipcode', IMPORT.delivery_zipcode) %]</div></div>
84
          <div class="table-row"><div class="table-cell">[% 'City' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_city', IMPORT.delivery_city) %]</div></div>
85
          <div class="table-row"><div class="table-cell">[% 'Country' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_country', IMPORT.delivery_country) %]</div></div>
86
          <div class="table-row"><div class="table-cell">[% 'Email' | $T8 %]</div><div class="table-cell">[% L.input_tag('delivery_email', IMPORT.delivery_email) %]</div></div>
87
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Greeting' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_greeting', IMPORT.delivery_greeting) %]</div></div>
88
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customer' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_name', delivery) %]</div></div>
89
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 2' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_company', IMPORT.delivery_company) %]</div></div>
90
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Name 3' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_department', IMPORT.delivery_department) %]</div></div>
91
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Street' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_street', IMPORT.delivery_street) %]</div></div>
92
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Zipcode' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_zipcode', IMPORT.delivery_zipcode) %]</div></div>
93
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'City' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_city', IMPORT.delivery_city) %]</div></div>
94
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Country' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_country', IMPORT.delivery_country) %]</div></div>
95
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Phone' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_phone', IMPORT.delivery_phone) %]</div></div>
96
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Email' | $T8 %]</div><div class="shop_table-cell">[% L.input_tag('delivery_email', IMPORT.delivery_email) %]</div></div>
87 97
          [% IF D_ADDRESS %]
88
          <div>[% D_ADDRESS.customernumber %]</div>
98
          <div class="shop_table-row"><div class="shop_table-cell listheading">[% 'Customernumber' | $T8 %]</div><div class="shop_table-cell">[% D_ADDRESS.customernumber %]</div></div>
89 99
          [% ELSE %]
90
          <div>[% L.radio_button_tag('create_customer', value='delivery') %]</div>
91
          <div>[% L.submit_tag('action_apply_customer', LxERP.t8('Create customer')) %]</div>
100
          <div>[% L.ajax_submit_tag("controller.pl?action=ShopOrder/apply_customer",  "#delivery", LxERP.t8("Apply customer")) %]</div>
92 101
          [% END %]
93 102
        </div>
103
      </form>
94 104
      </div>
95 105
    </div>
96 106
  </div>
......
112 122
        </table>
113 123
      </td>
114 124
      <td style="padding-left: 20px; vertical-align: top;">
125
        [% IF IMPORT.obsolete %]
126
        <b>[% 'Shoporder deleted -- ' | $T8 %]</b><a href="controller.pl?action=ShopOrder/valid_order&import_id=[% IMPORT.id %]">[% 'revert deleted' | $T8 %]</a>
127
        [% ELSE %]
115 128
        [% UNLESS IMPORT.transferred %]
116 129
        [% IF PROPOSALS %]
117
        <div style="height: 120px; overflow:auto;">
118
          <table>
119
            <tr class="listheading">
120
              <th colspan="7">Customer Proposals</td>
121
            </tr>
130
          <form method="post" action="controller.pl" id="create_order">
131
            [% L.hidden_tag('import_id', IMPORT.id) %]
132
            <div style="height: 125px; overflow:auto;">
133
              <table>
134
                <tr class="listheading">
135
                  <th colspan="7">Customer Proposals</td>
136
                </tr>
137
                [% FOREACH prop = PROPOSALS %][% IF prop.order_lock %][% SET orderlock_class = 'style="background:rgba(232, 32, 23, 0.2);"' %][% END %]
138
                <tr class="listrow" [% orderlock_class %]>
139
                  <td>[% IF !prop.order_lock %][% L.radio_button_tag('customer', value=prop.id) %][% END %]</td>
140
                  <td><a href="controller.pl?action=CustomerVendor/edit&id=[% prop.id %]&db=customer&callback=[% HTML.url('controller.pl?action=ShopOrder/show&id=' _ IMPORT.id) %]">[% HTML.escape(prop.customernumber) %]</a></td>
141
                  <td>[% IF !prop.notes == '' %]<span class="tooltipster-html" title="[% HTML.escape(prop.notes) %]"><span style="color:red;font-weight: bold;">[% HTML.escape(prop.name) %]</span>[% ELSE %][% HTML.escape(prop.name) %][% END %]</td>
142
                  <td>[% HTML.escape(prop.street) %]</td>
143
                  <td>[% HTML.escape(prop.zipcode) %]</td>
144
                  <td>[% HTML.escape(prop.city) %]</td>
145
                  <td>[% HTML.escape(prop.email) %]</td>
146
                </tr>
147
                [% END %]
148
              </table>
149
            </div>
150
            <div id="transfer" style="float:left; display:none;">
151
              [% # 'Customernumber: ' _ %]
152
              [% L.ajax_submit_tag('controller.pl?action=ShopOrder/transfer', "#create_order", LxERP.t8('Create order')) %]
153
            </div>
122 154
            [% FOREACH prop = PROPOSALS %]
123
            <tr>
124
              <td>[% L.radio_button_tag('customer', value=prop.id) %]</td>
125
              <td>[% HTML.escape(prop.customernumber) %]</td>
126
              <td>[% HTML.escape(prop.name) %]</td>
127
              <td>[% HTML.escape(prop.street) %]</td>
128
              <td>[% HTML.escape(prop.zipcode) %]</td>
129
              <td>[% HTML.escape(prop.city) %]</td>
130
              <td>[% HTML.escape(prop.email) %]</td>
131
            </tr>
155
            <div id="shop_update_customer_[% prop.id %]" class="div_hidden" style="display:none;">
156
              [% L.ajax_submit_tag("controller.pl?action=ShopOrder/apply_customer&cv_id=" _ prop.id,  "#billing", LxERP.t8("Update customer using billing address")) %]
157
            </div>
132 158
            [% END %]
133
          </table>
134
       [% END # PROPOSALS %]
135
        </div>
136
        [% L.hidden_tag('action', 'ShopOrder/dispatch') %]
137
        [% L.hidden_tag('import_id', IMPORT.id) %]
138
        [%- L.submit_tag('action_transfer', LxERP.t8('Create order')) %]
139
       [% ELSE %]
159
          </form>
160
        <a href="controller.pl?action=ShopOrder/delete_order&import_id=[% IMPORT.id %]">[% 'delete order' | $T8 %]</a>
161
        [% END # PROPOSALS %]
162
        [% ELSE %]
140 163
        <div>
141
          Wurde schon übernommen
164
          [% 'Transferred' | $T8 %]
142 165
          <div id="recordlinks"></div>
143 166
          <script type="text/javascript">
144 167
            var url = 'controller.pl?action=RecordLinks/ajax_list&object_model=ShopOrder&object_id=[% IMPORT.id %]';
......
146 169
          </script>
147 170
        </div>
148 171
        [% END %]
172
        [% END %]
149 173
      </td>
150 174
    </tr>
151 175
  </table>
......
176 200
    </table>
177 201
  </div>
178 202
  <hr>
179
</form>
180 203
<script type="text/javascript">
181
  function apply_customer(address) {
182
    alert('Hallo ' + address);
183
    $.post("controller.pl", { action: 'ShopOrder/list'});
184
  }
204
$("input[type=radio]").change(function(){
205
      $('.div_hidden').css("display", 'none');
206
      var cv_id = $("input[type=radio][id="+ this.id + "]").val();
207
      $('#shop_update_customer_'+ cv_id).css("display", 'block');
208
      $('#transfer').css("display", 'block');
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff