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) {

Auch abrufbar als: Unified diff