Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e0c45f8

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 5e0c45f829a3b3e8c2b1d6f6b2a77dee8e0294af
  • Vorgänger 1ae384cf
  • Nachfolger 5b44ba35

Belegvorlagen + Dialogbuchung: Workflow von EmailJournal aus umgesetzt

Unterschiede anzeigen:

SL/Controller/EmailJournal.pm
52 52
    class      => 'Reclamation',
53 53
    types => SL::DB::Reclamation::TypeData->valid_types(),
54 54
  },
55
  GlTransaction => {
56
    controller => 'gl.pl',
57
    class      => 'GLTransaction',
58
    types => [
59
      'gl_transaction',
60
    ],
61
  },
55 62
  ArTransaction => {
56 63
    controller => 'ar.pl',
57 64
    class      => 'Invoice',
......
87 94
      'purchase_credit_note',
88 95
    ],
89 96
  },
90
  RecordTemplate => {
91
    controller => '',
97
  GlRecordTemplate => {
98
    controller => 'gl.pl',
92 99
    class      => 'RecordTemplate',
93 100
    types => [
94 101
      'gl_transaction_template',
102
    ],
103
  },
104
  ArRecordTemplate => {
105
    controller => 'ar.pl',
106
    class      => 'RecordTemplate',
107
    types => [
95 108
      'ar_transaction_template',
109
    ],
110
  },
111
  ApRecordTemplate => {
112
    controller => 'ap.pl',
113
    class      => 'RecordTemplate',
114
    types => [
96 115
      'ap_transaction_template',
97 116
    ],
98
  }
117
  },
99 118
);
100 119
my %RECORD_TYPE_TO_CONTROLLER =
101 120
  map {
......
121 140
      $_ => 'invnumber';
122 141
    } elsif (any {$model eq $_} qw(SL::DB::RecordTemplate)) {
123 142
      $_ => 'template_name';
143
    } elsif (any {$model eq $_} qw(SL::DB::GLTransaction)) {
144
      $_ => 'reference';
124 145
    } else {
125 146
      my $type_data = SL::DB::Helper::TypeDataProxy->new($model, $_);
126 147
      $_ => $type_data->properties('nr_key');
......
161 182
    { record_type => 'purchase_invoice',      customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('Purchase Invoice')},
162 183
    { record_type => 'purchase_credit_note',  customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('Purchase Credit Note')},
163 184
    # transactions
164
    # TODO: create gl_transaction with email
165
    # { record_type => 'gl_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 0, text => t8('GL Transaction')},
166
    # { record_type => 'gl_transaction', customervendor => 'vendor',   workflow_needed => 0, can_workflow => 0, text => t8('GL Transaction')},
185
    # gl_transaction can be for vendor and customer
186
    { record_type => 'gl_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 1, text => t8('GL Transaction')},
187
    { record_type => 'gl_transaction', customervendor => 'vendor',   workflow_needed => 0, can_workflow => 1, text => t8('GL Transaction')},
167 188
    { record_type => 'ar_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 1, text => t8('AR Transaction')},
168 189
    { record_type => 'ap_transaction', customervendor => 'vendor',   workflow_needed => 0, can_workflow => 1, text => t8('AP Transaction')},
169 190
    # templates
......
179 200
  my ($self, $customer_vendor_type, $action) = @_;
180 201
  return [
181 202
    map { $_->{record_type} }
203
    grep {
204
      # No gl_transaction in standard workflows
205
      # They can't be filtered by customer/vendor or open/closed and polute the list
206
      ($_->{record_type} ne 'gl_transaction')
207
    }
182 208
    grep {
183 209
      ($_->{customervendor} eq $customer_vendor_type)
184 210
      && ($action eq 'workflow_record' ? $_->{can_workflow} : 1)
......
270 296
      $additional_where{$nr_key} = { ilike => "%$record_number%" };
271 297
    }
272 298
    unless ($with_closed) {
273
      if (any {$_ eq 'closed' } $model->meta->columns) {
299
      if (any {$_ eq 'closed'} $model->meta->columns) {
274 300
        $additional_where{closed} = 0;
275
      } elsif (any {$_ eq 'paid' } $model->meta->columns) {
301
      } elsif (any {$_ eq 'paid'} $model->meta->columns) {
276 302
        $additional_where{amount} = { gt => \'paid' };
277 303
      }
278 304
    }
......
367 393
  my $action             = $::form->{action_selection};
368 394
  my $record_id          = $::form->{"record_id"};
369 395
  my $record_type        = $::form->{"record_type"};
370
     $record_type      ||= $::form->{"${customer_vendor}_record_type_selection"};
396
     $record_type      ||= $::form->{"${customer_vendor}_${action}_type_selection"};
371 397

  
372
  die t8("No record is selected.")               unless $record_id || $action eq 'create_new';
398
  die t8("No record is selected.")               unless $record_id || $action eq 'new_record';
373 399
  die t8("No record type is selected.")          unless $record_type;
374 400
  die "no 'email_journal_id' was given"          unless $email_journal_id;
375 401
  die "no 'customer_vendor_selection' was given" unless $customer_vendor;
......
385 411
  }
386 412

  
387 413
  my %additional_params = ();
388
  if ($action eq 'create_new') {
414
  if ($action eq 'new_record') {
389 415
    $additional_params{action} = 'add_from_email_journal';
390 416
    $additional_params{"${customer_vendor}_id"} = $customer_vendor_id;
391
  } else {
417
  } elsif ($action eq 'template_record') {
418
    $additional_params{action} = 'load_record_template_from_email_journal';
419
    $additional_params{id} = $record_id;
420
    $additional_params{form_defaults} = {
421
      email_journal_id => $email_journal_id,
422
      email_attachment_id => $attachment_id,
423
    };
424
  } else { # workflow_record
392 425
    $additional_params{action} = 'edit_with_email_journal_workflow';
393 426
    $additional_params{id} = $record_id;
394 427
  }

Auch abrufbar als: Unified diff