Revision cc1f1d85
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/Controller/TimeRecording.pm | ||
---|---|---|
103 | 103 |
$self->{end_time} = $self->time_recording->end_time->to_kivitendo_time; |
104 | 104 |
} |
105 | 105 |
|
106 |
my $inputs_to_disable = $self->get_inputs_to_disable; |
|
107 |
|
|
106 | 108 |
$self->setup_edit_action_bar; |
107 | 109 |
|
108 | 110 |
$self->render('time_recording/form', |
109 |
title => t8('Time Recording'), |
|
111 |
title => t8('Time Recording'), |
|
112 |
inputs_to_disable => $inputs_to_disable, |
|
110 | 113 |
); |
111 | 114 |
} |
112 | 115 |
|
... | ... | |
405 | 408 |
$::form->{callback} || (action => 'list') |
406 | 409 |
} |
407 | 410 |
|
411 |
sub get_inputs_to_disable { |
|
412 |
my ($self) = @_; |
|
413 |
|
|
414 |
return [qw(customer project)] if $self->time_recording->order_id; |
|
415 |
return [qw(customer)] if $self->time_recording->project_id && $self->time_recording->project->customer_id; |
|
416 |
} |
|
417 |
|
|
418 |
|
|
408 | 419 |
1; |
js/kivi.TimeRecording.js | ||
---|---|---|
1 | 1 |
namespace('kivi.TimeRecording', function(ns) { |
2 | 2 |
'use strict'; |
3 | 3 |
|
4 |
ns.inputs_to_disable = []; |
|
5 |
|
|
4 | 6 |
ns.set_end_date = function() { |
5 | 7 |
if ($('#start_date').val() !== '' && $('#end_date').val() === '') { |
6 | 8 |
var kivi_start_date = kivi.format_date(kivi.parse_date($('#start_date').val())); |
... | ... | |
56 | 58 |
}); |
57 | 59 |
}; |
58 | 60 |
|
61 |
ns.set_input_constraints = function() { |
|
62 |
$(ns.inputs_to_disable).each(function(idx, elt) { |
|
63 |
if ("customer" === elt) { |
|
64 |
$('#time_recording_customer_id_name').prop('disabled', true); |
|
65 |
} |
|
66 |
if ("project" === elt) { |
|
67 |
$('#time_recording_project_id_name').prop('disabled', true); |
|
68 |
} |
|
69 |
}); |
|
70 |
}; |
|
71 |
|
|
59 | 72 |
}); |
60 | 73 |
|
61 | 74 |
$(function() { |
75 |
kivi.TimeRecording.set_input_constraints(); |
|
62 | 76 |
$('#time_recording_project_id').on('set_item:ProjectPicker', function(){ kivi.TimeRecording.project_changed() }); |
63 | 77 |
}); |
templates/webpages/time_recording/form.html | ||
---|---|---|
93 | 93 |
[%- END %] |
94 | 94 |
|
95 | 95 |
</form> |
96 |
|
|
97 |
<script type="text/javascript"> |
|
98 |
<!-- |
|
99 |
[% FOREACH i = inputs_to_disable %] |
|
100 |
kivi.TimeRecording.inputs_to_disable.push("[% i %]"); |
|
101 |
[% END %] |
|
102 |
--> |
|
103 |
</script> |
Auch abrufbar als: Unified diff
Zeiterfassung: Auch beim Laden entsprechende Eingabe-Felder sperren:
- wenn Auftrag ausgewählt. so ist Kunde und Projekt gesperrt
- wenn Projekt ausgewählt, und Projekt einen Kunden hat, so ist
Kunde gesperrt