Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision db7d17f2

Von Tamino Steinert vor 1 Tag hinzugefügt

  • ID db7d17f2e3cceb19e83502a46b7336f69a1c7b2f
  • Vorgänger eaf77a00
  • Nachfolger 15a630c6

POS: Neukunden anlegen

Unterschiede anzeigen:

SL/Controller/POS.pm
9 9
use SL::DB::ValidityToken;
10 10
use SL::DB::Order::TypeData qw(:types);
11 11
use SL::DB::DeliveryOrder::TypeData qw(:types);
12
use SL::DB::TaxZone;
13
use SL::DB::Currency;
12 14

  
13 15
use SL::Locale::String qw(t8);
14 16

  
......
68 70
  my ($self) = @_;
69 71

  
70 72
  my $cash_customer_id = $::instance_conf->get_pos_cash_customer_id or
71
    die "No cash customer set in client config\n";
73
    die "No cash customer set in client config.";
72 74
  my $cash_customer = SL::DB::Manager::Customer->find_by( id => $cash_customer_id );
73 75

  
76
  $self->change_customer($cash_customer);
77
}
78

  
79
sub action_create_new_customer {
80
  my ($self) = @_;
81
  die "id can't be given" if defined $::form->{new_customer}->{id};
82
  my $name = delete $::form->{new_customer}->{name}
83
    or die "name is needed.";
84

  
85
  my $taxzone_id = SL::DB::Manager::TaxZone->get_all_sorted(
86
    query => [ obsolete => 0 ]
87
  )->[0]->id;
88
  my $currency_id = SL::DB::Default->get->currency_id;
89

  
90
  my $new_customer = SL::DB::Customer->new(
91
    name => $name,
92
    taxzone_id  => $taxzone_id,
93
    currency_id => $currency_id,
94
    %{$::form->{new_customer}}
95
  );
96
  $new_customer->save();
97

  
98
  $self->change_customer($new_customer);
99
}
100

  
101
sub change_customer {
102
  my ($self, $customer) = @_;
103

  
104
  die "Need customer object." unless ref $customer eq 'SL::DB::Customer';
105

  
74 106
  return $self->js
75
    ->val('#order_customer_id', $cash_customer->id)
76
    ->val(        '#order_customer_id_name', $cash_customer->displayable_name)
107
    ->val(        '#order_customer_id',      $customer->id)
108
    ->val(        '#order_customer_id_name', $customer->displayable_name)
77 109
    ->removeClass('#order_customer_id_name', 'customer-vendor-picker-undefined')
78 110
    ->addClass(   '#order_customer_id_name', 'customer-vendor-picker-picked')
79 111
    ->run('kivi.Order.reload_cv_dependent_selections')
80 112
    ->render();
81 113
}
82 114

  
115
sub action_open_new_customer_dialog {
116
  my ($self) = @_;
117

  
118
  $self->render(
119
    'pos/_new_customer_dialog', { layout => 0 },
120
    popup_dialog            => 1,
121
    popup_js_close_function => '$("#new_customer_dialog").dialog("close")',
122
  );
123
}
124

  
83 125
sub action_add_discount_item_dialog {
84 126
  my ($self) = @_;
85 127

  
......
98 140
    popup_dialog            => 1,
99 141
    popup_js_close_function => '$("#add_discount_item_dialog").dialog("close")',
100 142
    TYPE_NAME               => $type_name,
101

  
102 143
  );
103 144
}
104 145

  

Auch abrufbar als: Unified diff