Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b50be513

Von Tamino Steinert vor 11 Monaten hinzugefügt

  • ID b50be5132d2211c52f86eb4dc155f5e118b6e28b
  • Vorgänger 1e228b7c
  • Nachfolger 84ae013c

Workflow: E-Mail → Angebot/Auftrag überarbeitet

Unterschiede anzeigen:

SL/Controller/Order.pm
33 33
use SL::DB::Shipto;
34 34
use SL::DB::Translation;
35 35
use SL::DB::EmailJournal;
36
use SL::DB::EmailJournalAttachment;
37 36
use SL::DB::ValidityToken;
38 37
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
39 38
use SL::DB::Helper::TypeDataProxy;
......
160 159

  
161 160
sub action_add_from_email_journal {
162 161
  my ($self) = @_;
163
  my $email_journal_id    = $::form->{from_id};
164
  my $email_attachment_id = $::form->{email_attachment_id};
165

  
166
  $self->order->{RECORD_ID()}       = $email_journal_id;
167
  $self->order->{RECORD_TYPE_REF()} = 'SL::DB::EmailJournal';
168
  $self->{email_attachment_id} = $email_attachment_id;
162
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
169 163

  
170 164
  $self->action_add();
171 165
}
172 166

  
167
sub action_edit_with_email_journal_workflow {
168
  my ($self) = @_;
169
  die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
170
  $::form->{workflow_email_journal_id}    = delete $::form->{email_journal_id};
171
  $::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id};
172

  
173
  $self->action_edit();
174
}
175

  
173 176
# edit an existing order
174 177
sub action_edit {
175 178
  my ($self) = @_;
......
825 828
    type       => $to_type,
826 829
    from_id    => $self->order->id,
827 830
    from_type  => $self->order->type,
831
    email_journal_id    => $::form->{workflow_email_journal_id},
832
    email_attachment_id => $::form->{workflow_email_attachment_id},
828 833
    %additional_params,
829 834
  );
830 835
}
......
837 842
  $self->save_and_redirect_to(
838 843
    controller => 'oe.pl',
839 844
    action     => 'oe_invoice_from_order',
845
    email_journal_id    => $::form->{workflow_email_journal_id},
846
    email_attachment_id => $::form->{workflow_email_attachment_id},
840 847
  );
841 848
}
842 849

  
......
847 854
    controller       => 'oe.pl',
848 855
    action           => 'oe_invoice_from_order',
849 856
    new_invoice_type => 'invoice_for_advance_payment',
857
    email_journal_id    => $::form->{workflow_email_journal_id},
858
    email_attachment_id => $::form->{workflow_email_attachment_id},
850 859
  );
851 860
}
852 861

  
......
857 866
    controller       => 'oe.pl',
858 867
    action           => 'oe_invoice_from_order',
859 868
    new_invoice_type => 'final_invoice',
869
    email_journal_id    => $::form->{workflow_email_journal_id},
870
    email_attachment_id => $::form->{workflow_email_attachment_id},
860 871
  );
861 872
}
862 873

  
......
867 878
    type       => $_[0]->type,
868 879
    to_type    => $::form->{to_type},
869 880
    use_shipto => $::form->{use_shipto},
881
    email_journal_id    => $::form->{workflow_email_journal_id},
882
    email_attachment_id => $::form->{workflow_email_attachment_id},
870 883
  );
871 884
}
872 885

  
......
877 890
  $self->save_and_redirect_to(
878 891
    controller => 'ap.pl',
879 892
    action     => 'add_from_purchase_order',
893
    email_journal_id    => $::form->{workflow_email_journal_id},
894
    email_attachment_id => $::form->{workflow_email_attachment_id},
880 895
  );
881 896
}
882 897

  
......
2126 2141
                          set_project_in_linked_requirement_specs                => 1,
2127 2142
  );
2128 2143

  
2129
  if ($::form->{email_attachment_id}) {
2130
    my $attachment = SL::DB::EmailJournalAttachment->new(id => $::form->{email_attachment_id})->load;
2131
    $attachment->add_file_to_record($self->order);
2144
  if ($::form->{email_journal_id}) {
2145
    my $email_journal = SL::DB::EmailJournal->new(
2146
      id => delete $::form->{email_journal_id}
2147
    )->load;
2148
    $email_journal->link_to_record_with_attachment(
2149
      $self->order,
2150
      delete $::form->{email_attachment_id}
2151
    );
2132 2152
  }
2133 2153

  
2134 2154
  if ($is_new && $self->order->is_sales) {
templates/design40_webpages/order/form.html
2 2
[% USE LxERP %]
3 3
[% USE L %]
4 4
[% USE HTML %]
5

  
6
[% IF FORM.workflow_email_journal_id %]
7
  [% SET FORM.title = LxERP.t8("Email Journal Workflow") _ " - " _ FORM.title %]
8
[% END %]
5 9
<h1>[% FORM.title %] <span id='nr_in_title'>[% SELF.order.number %]</span></h1>
6 10

  
7 11
<div id="print_options" style="display:none">
......
22 26
  [% L.hidden_tag('type',                 FORM.type) %]
23 27
  [% L.hidden_tag('id',                   SELF.order.id) %]
24 28
  [% L.hidden_tag('converted_from_record_type_ref', SELF.order.converted_from_record_type_ref) %]
25
  [% L.hidden_tag('converted_from_record_id',  SELF.order.converted_from_record_id) %]
26
  [% L.hidden_tag('email_attachment_id'   , SELF.email_attachment_id) %]
29
  [% L.hidden_tag('converted_from_record_id',       SELF.order.converted_from_record_id) %]
30
  [% L.hidden_tag('email_journal_id',               FORM.email_journal_id) %]
31
  [% L.hidden_tag('email_attachment_id',            FORM.email_attachment_id) %]
32
  [% L.hidden_tag('workflow_email_journal_id',      FORM.workflow_email_journal_id) %]
33
  [% L.hidden_tag('workflow_email_attachment_id',   FORM.workflow_email_attachment_id) %]
27 34

  
28 35
  [% IF !SELF.order.id %]
29 36
  [%   L.hidden_tag('form_validity_token', FORM.form_validity_token) %]
......
35 42

  
36 43
<ul>
37 44
  <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
38
  [% IF SELF.email_attachment_id %]
39
    <li><a href="#ui-tabs-email-attachment-preview">[% 'Email Attachment Preview' | $T8 %]</a></li>
45
  [% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id %]
46
    <li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(FORM.email_attachment_id || FORM.workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
40 47
  [% END %]
41 48
  [% IF INSTANCE_CONF.get_webdav %]
42 49
    <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
......
70 77
    cvars=SELF.order.custom_shipto.cvars_by_config
71 78
    id_selector='#order_shipto_id' %]
72 79
</div>
73
[% IF SELF.email_attachment_id %]
74
<div id="ui-tabs-email-attachment-preview">
75
  <div class="wrapper" id="email_attachment_wrapper">
76
    [% P.email_journal.attachment_preview(
77
          SELF.email_attachment_id,
78
          style="height: 1800px"
79
          );
80
     %]
81
  </div><!-- /.wrapper -->
82
</div><!-- /#ui-tabs-attachment-preview -->
83
[% END %]
84

  
85 80

  
86 81
</div><!-- /.tabwidget -->
87 82
</form>
templates/design40_webpages/order/tabs/basic_data.html
9 9
<div id="ui-tabs-basic-data">
10 10
<!-- PENDENT: EXPERIMENTELL -->
11 11

  
12
[% IF SELF.email_attachment_id %]
12
[% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id%]
13 13
  <div class="wrapper" id="email_attachment_wrapper">
14 14
    [%
15 15
      BLOCK panel_1;
16 16
        P.email_journal.attachment_preview(
17
             SELF.email_attachment_id,
17
             FORM.email_attachment_id || FORM.workflow_email_attachment_id,
18 18
             style="height:600px"
19 19
             );
20 20
      END;
templates/webpages/order/form.html
2 2
[%- USE LxERP %]
3 3
[%- USE L %]
4 4
[%- USE HTML %]
5

  
6
[% IF FORM.workflow_email_journal_id %]
7
  [% SET FORM.title = LxERP.t8("Email Journal Workflow") _ " - " _ FORM.title %]
8
[% END %]
5 9
<h1>[% FORM.title %] <span id='nr_in_title'>[%- SELF.order.number -%]</span></h1>
6 10

  
7 11
<div id="print_options" style="display:none">
......
22 26
  [% L.hidden_tag('type',                 FORM.type) %]
23 27
  [% L.hidden_tag('id',                   SELF.order.id) %]
24 28
  [% L.hidden_tag('converted_from_record_type_ref', SELF.order.converted_from_record_type_ref) %]
25
  [% L.hidden_tag('converted_from_record_id',  SELF.order.converted_from_record_id) %]
26
  [% L.hidden_tag('email_attachment_id'   , SELF.email_attachment_id) %]
29
  [% L.hidden_tag('converted_from_record_id',       SELF.order.converted_from_record_id) %]
30
  [% L.hidden_tag('email_journal_id',               FORM.email_journal_id) %]
31
  [% L.hidden_tag('email_attachment_id',            FORM.email_attachment_id) %]
32
  [% L.hidden_tag('workflow_email_journal_id',      FORM.workflow_email_journal_id) %]
33
  [% L.hidden_tag('workflow_email_attachment_id',   FORM.workflow_email_attachment_id) %]
27 34

  
28 35
  [% IF !SELF.order.id %]
29 36
  [%   L.hidden_tag('form_validity_token', FORM.form_validity_token) %]
......
34 41
  <div class="tabwidget" id="order_tabs">
35 42
    <ul>
36 43
      <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
37
[% IF SELF.email_attachment_id %]
38
      <li><a href="#ui-tabs-email-attachment-preview">[% 'Email Attachment Preview' | $T8 %]</a></li>
44
[% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id %]
45
      <li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(FORM.email_attachment_id || FORM.workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
39 46
[% END %]
40 47
[%- IF INSTANCE_CONF.get_webdav %]
41 48
      <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
......
69 76
        cvars=SELF.order.custom_shipto.cvars_by_config
70 77
        id_selector='#order_shipto_id' %]
71 78
    </div>
72
[% IF SELF.email_attachment_id %]
73
    <div id="ui-tabs-email-attachment-preview">
74
      <div class="wrapper" id="email_attachment_wrapper">
75
        [% P.email_journal.attachment_preview(
76
              SELF.email_attachment_id,
77
              style="height: 1800px"
78
              );
79
         %]
80
      </div><!-- /.wrapper -->
81
    </div><!-- /#ui-tabs-attachment-preview -->
82
[% END %]
83 79

  
84 80
  </div>
85 81
</form>

Auch abrufbar als: Unified diff