Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 078bb016

Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt

  • ID 078bb016bca38979f722bf94b8a4d006f5b57077
  • Vorgänger 3c22e5f4
  • Nachfolger fdb3de69

Zeiterfassung: Auftrag auswählen können, Kunden und ggf. Projekt daraus setzen

Auftrag hat Vorrang und setzt Kunde und Projekt. Diese Felder sind dann
gesperrt.
Wenn kein Auftrag gewählt ist (oder einer wieder abgtewählt wird,
dann ist Kunde und Projekt wieder frei.

Unterschiede anzeigen:

SL/Controller/TimeRecording.pm
use SL::Controller::Helper::ReportGenerator;
use SL::DB::Customer;
use SL::DB::Employee;
use SL::DB::Order;
use SL::DB::Part;
use SL::DB::TimeRecording;
use SL::DB::TimeRecordingArticle;
......
use Rose::Object::MakeMethods::Generic
(
# scalar => [ qw() ],
'scalar --get_set_init' => [ qw(time_recording models all_employees all_time_recording_articles can_view_all can_edit_all use_duration) ],
'scalar --get_set_init' => [ qw(time_recording models all_employees all_time_recording_articles all_orders can_view_all can_edit_all use_duration) ],
);
......
$self->redirect_to(safe_callback());
}
sub action_ajaj_get_order_info {
my $order = SL::DB::Order->new(id => $::form->{id})->load;
my $data = { customer => { id => $order->customer_id,
value => $order->customer->displayable_name,
type => 'customer'
},
project => { id => $order->globalproject_id,
value => ($order->globalproject_id ? $order->globalproject->displayable_name : undef),
},
};
$_[0]->render(\SL::JSON::to_json($data), { type => 'json', process => 0 });
}
sub init_time_recording {
my ($self) = @_;
......
return $res;
}
sub init_all_orders {
SL::DB::Manager::Order->get_all_sorted(query => [or => [ closed => 0, closed => undef ],
'!customer_id' => undef]);
}
sub init_use_duration {
return SL::Helper::UserPreferences::TimeRecording->new()->get_use_duration();
}
js/kivi.TimeRecording.js
$time.val(kivi.format_time(date));
};
ns.order_changed = function(value) {
if (!value) {
$('#time_recording_customer_id').data('customer_vendor_picker').set_item({});
$('#time_recording_customer_id_name').prop('disabled', false);
$('#time_recording_project_id').data('project_picker').set_item({});
$('#time_recording_project_id_name').prop('disabled', false);
return;
}
var url = 'controller.pl?action=TimeRecording/ajaj_get_order_info&id='+ value;
$.getJSON(url, function(data) {
$('#time_recording_customer_id').data('customer_vendor_picker').set_item(data.customer);
$('#time_recording_customer_id_name').prop('disabled', true);
$('#time_recording_project_id').data('project_picker').set_item(data.project);
$('#time_recording_project_id_name').prop('disabled', true);
});
};
});
templates/webpages/time_recording/form.html
<th>[% 'Start' | $T8 %]</th>
<th>[% 'End' | $T8 %]</th>
[%- END %]
<th>[% 'Sales Order' | $T8 %]</th>
<th>[% 'Customer' | $T8 %]</th>
<th>[% 'Article' | $T8 %]</th>
<th>[% 'Project' | $T8 %]</th>
......
[% P.button_tag('kivi.TimeRecording.set_current_date_time("end")', LxERP.t8('now')) %]
</td>
[%- END %]
<td>[% P.select_tag('time_recording.order_id', SELF.all_orders, default=SELF.time_recording.order_id, title_key='digest', with_empty=1, onchange='kivi.TimeRecording.order_changed(this.value)') %]</td>
<td>[% P.customer_vendor.picker('time_recording.customer_id', SELF.time_recording.customer_id, type='customer', style='width: 300px', "data-validate"="required", "data-title"=LxERP.t8('Customer')) %]</td>
<td>[% P.select_tag('time_recording.part_id', SELF.all_time_recording_articles, default=SELF.time_recording.part_id, with_empty=1, value_key='id', title_key='description') %]</td>
<td>[% P.project.picker('time_recording.project_id', SELF.time_recording.project_id, style='width: 300px') %]</td>

Auch abrufbar als: Unified diff