Revision 133cdef3
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/Controller/TimeRecording.pm | ||
---|---|---|
22 | 22 |
use SL::Helper::Number qw(_round_number _parse_number _round_total); |
23 | 23 |
use SL::Helper::UserPreferences::TimeRecording; |
24 | 24 |
use SL::Locale::String qw(t8); |
25 |
use SL::Presenter::Tag qw(checkbox_tag); |
|
25 | 26 |
use SL::ReportGenerator; |
26 | 27 |
|
27 | 28 |
use Rose::Object::MakeMethods::Generic |
... | ... | |
33 | 34 |
|
34 | 35 |
# safety |
35 | 36 |
__PACKAGE__->run_before('check_auth'); |
36 |
__PACKAGE__->run_before('check_auth_edit', only => [ qw(edit save delete) ]); |
|
37 |
__PACKAGE__->run_before('check_auth_edit', only => [ qw(edit save delete) ]); |
|
38 |
__PACKAGE__->run_before('check_auth_edit_all', only => [ qw(mark_as_booked) ]); |
|
39 |
|
|
37 | 40 |
|
38 | 41 |
my %sort_columns = ( |
39 | 42 |
date => t8('Date'), |
... | ... | |
83 | 86 |
$self->report_generator_list_objects(report => $self->{report}, objects => $objects); |
84 | 87 |
} |
85 | 88 |
|
89 |
sub action_mark_as_booked { |
|
90 |
my ($self) = @_; |
|
91 |
|
|
92 |
if (scalar @{ $::form->{ids} }) { |
|
93 |
my $trs = SL::DB::Manager::TimeRecording->get_all(query => [id => $::form->{ids}]); |
|
94 |
$_->update_attributes(booked => 1) for @$trs; |
|
95 |
} |
|
96 |
|
|
97 |
$self->redirect_to(safe_callback()); |
|
98 |
} |
|
99 |
|
|
86 | 100 |
sub action_edit { |
87 | 101 |
my ($self) = @_; |
88 | 102 |
|
... | ... | |
279 | 293 |
} |
280 | 294 |
} |
281 | 295 |
|
296 |
sub check_auth_edit_all { |
|
297 |
my ($self) = @_; |
|
298 |
|
|
299 |
$::auth->assert('time_recording_edit_all'); |
|
300 |
} |
|
301 |
|
|
282 | 302 |
sub prepare_report { |
283 | 303 |
my ($self) = @_; |
284 | 304 |
|
285 | 305 |
my $report = SL::ReportGenerator->new(\%::myconfig, $::form); |
286 | 306 |
$self->{report} = $report; |
287 | 307 |
|
288 |
my @columns = qw(date start_time end_time order customer project part description staff_member duration booked); |
|
308 |
my @columns = qw(ids date start_time end_time order customer project part description staff_member duration booked);
|
|
289 | 309 |
|
290 | 310 |
my %column_defs = ( |
311 |
ids => { raw_header_data => checkbox_tag("", id => "check_all", checkall => "[data-checkall=1]"), |
|
312 |
align => 'center', |
|
313 |
raw_data => sub { $_[0]->booked ? '' : checkbox_tag("ids[]", value => $_[0]->id, "data-checkall" => 1) } }, |
|
291 | 314 |
date => { text => t8('Date'), sub => sub { $_[0]->date_as_date }, |
292 | 315 |
obj_link => sub { $self->url_for(action => 'edit', 'id' => $_[0]->id, callback => $self->models->get_callback) } }, |
293 | 316 |
start_time => { text => t8('Start'), sub => sub { $_[0]->start_time_as_timestamp }, |
... | ... | |
307 | 330 |
booked => { text => t8('Booked'), sub => sub { $_[0]->booked ? t8('Yes') : t8('No') } }, |
308 | 331 |
); |
309 | 332 |
|
333 |
if (!$self->can_edit_all) { |
|
334 |
@columns = grep {'ids' ne $_} @columns; |
|
335 |
delete $column_defs{ids}; |
|
336 |
} |
|
337 |
|
|
310 | 338 |
my $title = t8('Time Recordings'); |
311 | 339 |
$report->{title} = $title; # for browser titlebar (title-tag) |
312 | 340 |
|
... | ... | |
373 | 401 |
submit => [ '#filter_form', { action => 'TimeRecording/list' } ], |
374 | 402 |
accesskey => 'enter', |
375 | 403 |
], |
404 |
combobox => [ |
|
405 |
action => [ |
|
406 |
t8('Actions'), |
|
407 |
only_if => $self->can_edit_all, |
|
408 |
], |
|
409 |
action => [ |
|
410 |
t8('Mark as booked'), |
|
411 |
submit => [ '#form', { action => 'TimeRecording/mark_as_booked', callback => $self->models->get_callback } ], |
|
412 |
checks => [ [ 'kivi.check_if_entries_selected', '[name="ids[]"]' ] ], |
|
413 |
confirm => $::locale->text('Do you really want to mark the selected entries as booked?'), |
|
414 |
only_if => $self->can_edit_all, |
|
415 |
], |
|
416 |
], |
|
376 | 417 |
action => [ |
377 | 418 |
t8('Add'), |
378 | 419 |
link => $self->url_for(action => 'edit', callback => $self->models->get_callback), |
locale/de/all | ||
---|---|---|
1106 | 1106 |
'Do you really want to delete this draft?' => 'Möchten Sie diesen Entwurf wirklich löschen?', |
1107 | 1107 |
'Do you really want to delete this object?' => 'Möchten Sie dieses Objekt wirklich löschen?', |
1108 | 1108 |
'Do you really want to delete this record template?' => 'Möchten Sie diese Belegvorlage wirklich löschen?', |
1109 |
'Do you really want to mark the selected entries as booked?' => 'Möchten Sie die ausgewählten Einträge wirklich als gebucht markieren?', |
|
1109 | 1110 |
'Do you really want to print?' => 'Wollen Sie wirklich drucken?', |
1110 | 1111 |
'Do you really want to revert to this version?' => 'Möchten Sie wirklich auf diese Version zurücksetzen?', |
1111 | 1112 |
'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => 'Möchten Sie wirklich die ausgewählten SEPA-Exports rückgängig machen? Der Export muss anschließend neu erzeugt werden.', |
... | ... | |
1990 | 1991 |
'Margepercent' => 'Ertrag prozentual', |
1991 | 1992 |
'Margetotal' => 'Ertrag', |
1992 | 1993 |
'Margins' => 'Seitenränder', |
1994 |
'Mark as booked' => 'Als gebucht markieren', |
|
1993 | 1995 |
'Mark as closed' => 'Als geschlossen markieren', |
1994 | 1996 |
'Mark as paid' => 'Als bezahlt markieren', |
1995 | 1997 |
'Mark as shop article if column missing' => 'Als Shopartikel setzen, falls Spalte nicht vorhanden', |
locale/en/all | ||
---|---|---|
1106 | 1106 |
'Do you really want to delete this draft?' => '', |
1107 | 1107 |
'Do you really want to delete this object?' => '', |
1108 | 1108 |
'Do you really want to delete this record template?' => '', |
1109 |
'Do you really want to mark the selected entries as booked?' => '', |
|
1109 | 1110 |
'Do you really want to print?' => '', |
1110 | 1111 |
'Do you really want to revert to this version?' => '', |
1111 | 1112 |
'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => '', |
... | ... | |
1990 | 1991 |
'Margepercent' => '', |
1991 | 1992 |
'Margetotal' => '', |
1992 | 1993 |
'Margins' => '', |
1994 |
'Mark as booked' => '', |
|
1993 | 1995 |
'Mark as closed' => '', |
1994 | 1996 |
'Mark as paid' => '', |
1995 | 1997 |
'Mark as shop article if column missing' => '', |
templates/webpages/time_recording/report_bottom.html | ||
---|---|---|
1 |
[% USE HTML%] |
|
2 |
[%- USE T8 %] |
|
3 |
[%- USE L %][%- USE LxERP -%] |
|
1 |
[%- USE L %] |
|
4 | 2 |
[% L.paginate_controls(models=SELF.models) %] |
5 |
<input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]"> |
|
6 |
[%- FOREACH item = HIDDEN %] |
|
7 |
<input type="hidden" name="[% HTML.escape(item.key) %]" value="[% HTML.escape(item.value) %]"> |
|
8 |
[%- END %] |
|
9 | 3 |
</form> |
templates/webpages/time_recording/report_top.html | ||
---|---|---|
1 | 1 |
[%- PROCESS 'time_recording/_filter.html' filter=SELF.models.filtered.laundered %] |
2 | 2 |
<hr> |
3 |
<form method="post" action="controller.pl" id="form"> |
Auch abrufbar als: Unified diff
Zeiterfassung: Im Bericht Einträge als gebucht markieren können, …
… wenn man das Recht hat, alle zu ändern.