Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0d758a9d

Von Tamino Steinert vor 11 Monaten hinzugefügt

  • ID 0d758a9d51eb1c48fc45f3a5b0573ac6ae32698a
  • Vorgänger 993874c3
  • Nachfolger 6c922eec

Workflow: E-Mail → Debitorenbuchung hinzugefügt

Unterschiede anzeigen:

SL/AR.pm
42 42
use SL::IO;
43 43
use SL::MoreCommon;
44 44
use SL::DB::Default;
45
use SL::DB::Invoice;
46
use SL::DB::EmailJournal;
45 47
use SL::DB::ValidityToken;
46 48
use SL::TransNumber;
47 49
use SL::Util qw(trim);
......
980 982

  
981 983
  map { IO->set_datepaid(table => 'ar', id => $_, dbh => $dbh) } ($id, $new_id);
982 984

  
985
  if ($form->{workflow_email_journal_id}) {
986
    my $ar_transaction_storno = SL::DB::Invoice->new(id => $new_id)->load;
987
    my $email_journal = SL::DB::EmailJournal->new(
988
      id => delete $form->{workflow_email_journal_id}
989
    )->load;
990
    $email_journal->link_to_record_with_attachment(
991
      $ar_transaction_storno,
992
      delete $::form->{email_attachment_id}
993
    );
994
  }
995

  
983 996
  return 1;
984 997
}
985 998

  
bin/mozilla/ar.pl
53 53
use SL::DB::InvoiceItem;
54 54
use SL::DB::RecordTemplate;
55 55
use SL::DB::Tax;
56
use SL::DB::EmailJournal;
56 57
use SL::DB::ValidityToken;
57 58
use SL::Helper::Flash qw(flash flash_later);
58 59
use SL::Locale::String qw(t8);
......
263 264

  
264 265
  AR->get_transdate(\%myconfig, $form);
265 266
  $form->{initial_transdate} = $form->{transdate};
267
  $form->{initial_customer_id} = $form->{customer_id};
266 268
  create_links(dont_save => 1);
267 269
  $form->{transdate} = $form->{initial_transdate};
270
  $form->{customer_id} = $form->{initial_customer_id} if $form->{initial_customer_id};
268 271

  
269 272
  if ($form->{customer_id}) {
270 273
    my $last_used_ar_chart = SL::DB::Customer->load_cached($form->{customer_id})->last_used_ar_chart;
......
279 282
  $main::lxdebug->leave_sub();
280 283
}
281 284

  
285
sub add_from_email_journal {
286
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
287
  &add;
288
}
289

  
290
sub edit_with_email_journal_workflow {
291
  my ($self) = @_;
292
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
293
  $::form->{workflow_email_journal_id}    = delete $::form->{email_journal_id};
294
  $::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id};
295

  
296
  &edit;
297
}
298

  
282 299
sub edit {
283 300
  $main::lxdebug->enter_sub();
284 301

  
......
862 879
  }
863 880
  # /saving the history
864 881

  
882
  if ($form->{email_journal_id} && $form->{id} ne "") {
883
    my $ar_transaction = SL::DB::Invoice->new(id => $form->{id})->load;
884
    my $email_journal = SL::DB::EmailJournal->new(
885
      id => delete $form->{email_journal_id}
886
    )->load;
887
    $email_journal->link_to_record_with_attachment($ar_transaction, delete $::form->{email_attachment_id});
888
  }
889

  
865 890
  if (!$inline) {
866 891
    my $msg = $locale->text("AR transaction '#1' posted (ID: #2)", $form->{invnumber}, $form->{id});
867 892
    if ($::instance_conf->get_ar_add_doc && $::instance_conf->get_doc_storage) {
......
886 911
  my $form     = $main::form;
887 912
  my %myconfig = %main::myconfig;
888 913

  
914
  $form->{email_journal_id}    = delete $form->{workflow_email_journal_id};
915
  $form->{email_attachment_id} = delete $form->{workflow_email_attachment_id};
916

  
889 917
  map { delete $form->{$_} } qw(printed emailed queued invnumber deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
890 918
  $form->{paidaccounts} = 1;
891 919
  $form->{rowcount}--;
templates/design40_webpages/ar/form_header.html
4 4
[% USE LxERP %]
5 5
[% USE P %]
6 6

  
7
<h1>[% title | html %]</h1>
7
<h1>
8
  [% IF workflow_email_journal_id; LxERP.t8("Email Journal Workflow") _ " - "; END; %]
9
  [% title %]
10
</h1>
8 11

  
9 12
[% INCLUDE 'common/flash.html' %]
10 13

  
......
24 27
[% IF !id %]
25 28
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
26 29
[% END %]
30
[% L.hidden_tag('email_journal_id',             email_journal_id) %]
31
[% L.hidden_tag('email_attachment_id',          email_attachment_id) %]
32
[% L.hidden_tag('workflow_email_journal_id',    workflow_email_journal_id) %]
33
[% L.hidden_tag('workflow_email_attachment_id', workflow_email_attachment_id) %]
27 34

  
28 35
[% IF saved_message %]<p class="message message_info">[% saved_message | html  %]</p>[% END %]
29 36

  
......
31 38

  
32 39
<ul>
33 40
  <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
41
  [% IF email_attachment_id || workflow_email_attachment_id %]
42
    <li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(email_attachment_id || workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
43
  [% END %]
34 44
  [% IF id %]
35 45
    [% IF INSTANCE_CONF.get_doc_storage %]
36 46
      <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
......
45 55

  
46 56
<div id="ui-tabs-basic-data">
47 57

  
58
[% IF email_attachment_id || workflow_email_attachment_id%]
59
  <div class="wrapper" id="email_attachment_wrapper">
60
    [%
61
      BLOCK panel_1;
62
        P.email_journal.attachment_preview(
63
             email_attachment_id || workflow_email_attachment_id,
64
             style="height:600px"
65
             );
66
      END;
67
      INCLUDE 'common/toggle_panel.html'
68
        block_name='panel_1'
69
        button_closed  = LxERP.t8('Show Attachment')
70
        button_open    = LxERP.t8('Hide Attachment')
71
        ;
72
    %]
73
  </div>
74
[% END %]
75

  
48 76
<div class="wrapper">
49 77

  
50 78
  <table class="tbl-horizontal">
templates/webpages/ar/form_header.html
3 3
[%- USE T8 %]
4 4
[%- USE LxERP %][%- USE P -%]
5 5

  
6
<h1>[% title | html %]</h1>
6
<h1>
7
  [% IF workflow_email_journal_id; LxERP.t8("Email Journal Workflow") _ " - "; END; %]
8
  [% title | html %]
9
</h1>
7 10

  
8 11
[%- INCLUDE 'common/flash.html' %]
9 12

  
......
23 26
[% IF !id %]
24 27
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
25 28
[% END %]
29
[% L.hidden_tag('email_journal_id',             email_journal_id) %]
30
[% L.hidden_tag('email_attachment_id',          email_attachment_id) %]
31
[% L.hidden_tag('workflow_email_journal_id',    workflow_email_journal_id) %]
32
[% L.hidden_tag('workflow_email_attachment_id', workflow_email_attachment_id) %]
26 33

  
27 34
[%- IF saved_message %]<p>[% saved_message | html  %]</p>[% END %]
28 35

  
29 36
<div class="tabwidget">
30 37
 <ul>
31 38
  <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
39
  [% IF email_attachment_id || workflow_email_attachment_id %]
40
    <li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(email_attachment_id || workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
41
  [% END %]
32 42
[%- IF id %]
33 43
  [%- IF INSTANCE_CONF.get_doc_storage %]
34 44
  <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>

Auch abrufbar als: Unified diff