]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/TimeRecording.pm
Merge branch 'master' of http://wagnertech.de/git/mfinanz
[mfinanz.git] / SL / Controller / TimeRecording.pm
index 38771d1fc1f0d54ceb7423225a59a4d6165a510e..32974e13fcf9ececb60ce78ca9a9a5ecf4fbefc4 100644 (file)
@@ -90,8 +90,10 @@ sub action_mark_as_booked {
   my ($self) = @_;
 
   if (scalar @{ $::form->{ids} }) {
-    my $trs = SL::DB::Manager::TimeRecording->get_all(query => [id => $::form->{ids}]);
-    $_->update_attributes(booked => 1) for @$trs;
+    SL::DB::Manager::TimeRecording->update_all(
+      set   => { booked => 1              },
+      where => [ id     => $::form->{ids} ]
+    );
   }
 
   $self->redirect_to(safe_callback());
@@ -100,7 +102,7 @@ sub action_mark_as_booked {
 sub action_edit {
   my ($self) = @_;
 
-  $::request->{layout}->use_javascript("${_}.js") for qw(kivi.TimeRecording ckeditor/ckeditor ckeditor/adapters/jquery kivi.Validator);
+  $::request->{layout}->use_javascript("${_}.js") for qw(kivi.TimeRecording kivi.Validator);
 
   if ($self->use_duration) {
     flash('warning', t8('This entry is using start and end time. This information will be overwritten on saving.')) if !$self->time_recording->is_duration_used;
@@ -271,9 +273,9 @@ sub init_all_time_recording_articles {
 }
 
 sub init_all_orders {
-  my $orders = SL::DB::Manager::Order->get_all(query => [or             => [ closed    => 0, closed    => undef ],
-                                                         or             => [ quotation => 0, quotation => undef ],
-                                                         '!customer_id' => undef]);
+  my $orders = SL::DB::Manager::Order->get_all(query => [or             => [ closed    => 0, closed    => undef, id => $_[0]->time_recording->order_id ],
+                                                         record_type    => 'sales_order',
+                                                        ]);
   return [ map { [$_->id, sprintf("%s %s", $_->number, $_->customervendor->name) ] } sort { $a->number <=> $b->number } @{$orders||[]} ];
 }
 
@@ -320,7 +322,7 @@ sub prepare_report {
     order        => { text => t8('Sales Order'),  sub => sub { $_[0]->order && $_[0]->order->number } },
     customer     => { text => t8('Customer'),     sub => sub { $_[0]->customer->displayable_name } },
     part         => { text => t8('Article'),      sub => sub { $_[0]->part && $_[0]->part->displayable_name } },
-    project      => { text => t8('Project'),      sub => sub { $_[0]->project && $_[0]->project->full_description(sytle => 'both') } },
+    project      => { text => t8('Project'),      sub => sub { $_[0]->project && $_[0]->project->full_description(style => 'both') } },
     description  => { text => t8('Description'),  sub => sub { $_[0]->description_as_stripped_html },
                       raw_data => sub { $_[0]->description_as_restricted_html }, # raw_data only used for html(?)
                       obj_link => sub { $self->url_for(action => 'edit', 'id' => $_[0]->id, callback => $self->models->get_callback) }  },
@@ -371,7 +373,7 @@ sub make_filter_summary {
   my @filter_strings;
 
   my $staff_member = $filter->{staff_member_id} ? SL::DB::Employee->new(id => $filter->{staff_member_id})->load->safe_name                         : '';
-  my $project      = $filter->{project_id}      ? SL::DB::Project->new (id => $filter->{project_id})     ->load->full_description(sytle => 'both') : '';
+  my $project      = $filter->{project_id}      ? SL::DB::Project->new (id => $filter->{project_id})     ->load->full_description(style => 'both') : '';
 
   my @filters = (
     [ $filter->{"date:date::ge"},                              t8('From Date')       ],