Revision d157b20f
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/Customer.pm | ||
---|---|---|
1 |
package SL::Controller::Customer; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
use SL::DB::Customer; |
|
7 |
use SL::JSON; |
|
8 |
|
|
9 |
# safety |
|
10 |
__PACKAGE__->run_before(sub { $::auth->assert('customer_vendor_edit') }); |
|
11 |
|
|
12 |
sub action_get_hourly_rate { |
|
13 |
my ($self, %params) = @_; |
|
14 |
|
|
15 |
my $customer; |
|
16 |
$customer = SL::DB::Customer->new(id => $::form->{id})->load if $::form->{id}; |
|
17 |
my $data = {}; |
|
18 |
|
|
19 |
if ($customer) { |
|
20 |
$data = { |
|
21 |
hourly_rate => $customer->hourly_rate * 1, |
|
22 |
hourly_rate_formatted => $::form->format_amount(\%::myconfig, $customer->hourly_rate, 2), |
|
23 |
}; |
|
24 |
} |
|
25 |
|
|
26 |
$self->render(\to_json($data), { type => 'json' }); |
|
27 |
} |
|
28 |
|
|
29 |
1; |
Auch abrufbar als: Unified diff
Customer-Controller: 'get_hourly_rate'-AJAX-Funktion