Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e212d30

Von Tamino Steinert vor 12 Monaten hinzugefügt

  • ID 5e212d30fb63d0f9b223fdeee01a362fc1b9bddf
  • Vorgänger dd14fc35
  • Nachfolger 53c42274

Workflow: E-Mail → Kreditorenbuchung hinzugefügt

Unterschiede anzeigen:

SL/AP.pm
44 44
use SL::DB::Draft;
45 45
use SL::DB::Order;
46 46
use SL::DB::PurchaseInvoice;
47
use SL::DB::EmailJournal;
47 48
use SL::DB::ValidityToken;
48 49
use SL::Util qw(trim);
49 50
use SL::DB;
......
1106 1107

  
1107 1108
  map { IO->set_datepaid(table => 'ap', id => $_, dbh => $dbh) } ($id, $new_id);
1108 1109

  
1110
  if ($form->{workflow_email_journal_id}) {
1111
    my $ap_transaction_storno = SL::DB::PurchaseInvoice->new(id => $new_id)->load;
1112
    my $email_journal = SL::DB::EmailJournal->new(
1113
      id => delete $form->{workflow_email_journal_id}
1114
    )->load;
1115
    $email_journal->link_to_record_with_attachment(
1116
      $ap_transaction_storno,
1117
      delete $::form->{email_attachment_id}
1118
    );
1119
  }
1120

  
1109 1121
  return 1;
1110 1122
}
1111 1123

  
bin/mozilla/ap.pl
53 53
use SL::DB::PurchaseInvoice;
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::Presenter::ItemsList;
58 59
use SL::Webdav;
......
296 297

  
297 298
  AP->get_transdate(\%myconfig, $form);
298 299
  $form->{initial_transdate} = $form->{transdate};
300
  $form->{initial_vendor_id} = $form->{vendor_id};
299 301
  create_links(dont_save => 1);
300 302
  $form->{transdate} = $form->{initial_transdate};
303
  $form->{vendor_id} = $form->{initial_vendor_id} if $form->{initial_vendor_id};
301 304

  
302 305
  if ($form->{vendor_id}) {
303 306
    my $vendor = SL::DB::Vendor->load_cached($form->{vendor_id});
......
1001 1004
      }
1002 1005
    }
1003 1006

  
1007
    if ($form->{email_journal_id}) {
1008
      my $ap_transaction = SL::DB::PurchaseInvoice->new(id => $form->{id})->load;
1009
      my $email_journal = SL::DB::EmailJournal->new(
1010
        id => delete $form->{email_journal_id}
1011
      )->load;
1012
      $email_journal->link_to_record_with_attachment($ap_transaction, delete $::form->{email_attachment_id});
1013
    }
1014

  
1004 1015
    if (!$inline) {
1005 1016
      my $msg = $locale->text("AP transaction '#1' posted (ID: #2)", $form->{invnumber}, $form->{id});
1006 1017
      if ($form->{callback} =~ /BankTransaction/) {
......
1048 1059

  
1049 1060
  $main::auth->assert('ap_transactions');
1050 1061

  
1062
  $form->{email_journal_id}    = delete $form->{workflow_email_journal_id};
1063
  $form->{email_attachment_id} = delete $form->{workflow_email_attachment_id};
1064

  
1051 1065
  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 convert_from_oe_id);
1052 1066
  $form->{paidaccounts} = 1;
1053 1067
  $form->{rowcount}--;
......
1438 1452
  );
1439 1453
}
1440 1454

  
1455
sub add_from_email_journal {
1456
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
1457
  &add;
1458
}
1459

  
1460
sub edit_with_email_journal_workflow {
1461
  my ($self) = @_;
1462
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
1463
  $::form->{workflow_email_journal_id}    = delete $::form->{email_journal_id};
1464
  $::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id};
1465

  
1466
  &edit;
1467
}
1468

  
1441 1469
sub setup_ap_search_action_bar {
1442 1470
  my %params = @_;
1443 1471

  
templates/design40_webpages/ap/form_header.html
4 4
[% USE T8 %]
5 5
[% USE LxERP %]
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

  
......
39 42
[% IF !id %]
40 43
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
41 44
[% END %]
45
[% L.hidden_tag('email_journal_id',             email_journal_id) %]
46
[% L.hidden_tag('email_attachment_id',          email_attachment_id) %]
47
[% L.hidden_tag('workflow_email_journal_id',    workflow_email_journal_id) %]
48
[% L.hidden_tag('workflow_email_attachment_id', workflow_email_attachment_id) %]
42 49

  
43 50
[% FOREACH i IN [1..paidaccounts] %]
44 51
  [% temp = "acc_trans_id_"_ i %]
......
56 63

  
57 64
<ul>
58 65
  <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
66
  [% IF email_attachment_id || workflow_email_attachment_id %]
67
    <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>
68
  [% END %]
59 69
  [% IF INSTANCE_CONF.get_webdav %]
60 70
    <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
61 71
  [% END %]
......
77 87

  
78 88
<div id="ui-tabs-basic-data">
79 89

  
90
[% IF email_attachment_id || workflow_email_attachment_id%]
91
  <div class="wrapper" id="email_attachment_wrapper">
92
    [%
93
      BLOCK panel_1;
94
        P.email_journal.attachment_preview(
95
             email_attachment_id || workflow_email_attachment_id,
96
             style="height:600px"
97
             );
98
      END;
99
      INCLUDE 'common/toggle_panel.html'
100
        block_name='panel_1'
101
        button_closed  = LxERP.t8('Show Attachment')
102
        button_open    = LxERP.t8('Hide Attachment')
103
        ;
104
    %]
105
  </div>
106
[% END %]
107

  
80 108
<div class="wrapper">
81 109

  
82 110
<table class="tbl-horizontal">
templates/webpages/ap/form_header.html
4 4
[%- USE T8 %]
5 5
[%- USE LxERP %][%- 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

  
......
48 51
[% IF !id %]
49 52
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
50 53
[% END %]
54
[% L.hidden_tag('email_journal_id',             email_journal_id) %]
55
[% L.hidden_tag('email_attachment_id',          email_attachment_id) %]
56
[% L.hidden_tag('workflow_email_journal_id',    workflow_email_journal_id) %]
57
[% L.hidden_tag('workflow_email_attachment_id', workflow_email_attachment_id) %]
51 58

  
52 59
[% FOREACH i IN [1..paidaccounts] %]
53 60
  [% temp = "acc_trans_id_"_ i %]
......
64 71
<div id="ap_tabs" class="tabwidget">
65 72
 <ul>
66 73
  <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
74
[% IF email_attachment_id || workflow_email_attachment_id %]
75
  <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>
76
[% END %]
67 77
[%- IF INSTANCE_CONF.get_webdav %]
68 78
  <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
69 79
[%- END %]

Auch abrufbar als: Unified diff