Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ac86ce08

Von Thomas Heck vor mehr als 11 Jahren hinzugefügt

  • ID ac86ce0822fb544d3080509343bdbcbb3eb6009a
  • Vorgänger b623ece7
  • Nachfolger f60e424c

CustomerVendor: Ändern von Wiedervorlagen erlauben

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
133 133
      $self->{note_followup_link}->save();
134 134

  
135 135
      SL::Helper::Flash::flash_later('info', $::locale->text('Follow-Up saved.'));
136

  
137
      $self->{note} = SL::DB::Note->new();
138
      $self->{note_followup} = SL::DB::FollowUp->new();
139
      $self->{note_followup_link} = SL::DB::FollowUpLink->new();
140 136
    }
141 137

  
142 138
    $self->{shipto}->trans_id($self->{cv}->id);
......
174 170
    push(@redirect_params, shipto_id => $self->{shipto}->shipto_id);
175 171
  }
176 172

  
173
  if ( $self->{note}->id ) {
174
    push(@redirect_params, note_id => $self->{note}->id);
175
  }
176

  
177 177
  $self->redirect_to(@redirect_params);
178 178
}
179 179

  
......
622 622

  
623 623
  if ( $::form->{note}->{id} ) {
624 624
    $self->{note} = SL::DB::Note->new(id => $::form->{note}->{id})->load();
625

  
626
    $self->{note_followup_link} = SL::DB::Manager::FollowUpLink->get_all(
627
      query => [
628
        'follow_up.note_id' => $self->{note}->id,
629
        trans_id => $self->{cv}->id,
630
        trans_type => ($self->is_vendor() ? 'vendor' : 'customer'),
631
      ],
632
      with_objects => ['follow_up'],
633
    )->[0];
634

  
635
    $self->{note_followup} = $self->{note_followup_link}->follow_up;
625 636
  } else {
626 637
    $self->{note} = SL::DB::Note->new();
638
    $self->{note_followup} = SL::DB::FollowUp->new();
639
    $self->{note_followup_link} = SL::DB::FollowUpLink->new();
627 640
  }
641

  
628 642
  $self->{note}->assign_attributes(%{$::form->{note}});
629 643
  $self->{note}->created_by($curr_employee->id);
630 644
  $self->{note}->trans_module('ct');
631 645

  
632
  $self->{note_followup} = SL::DB::FollowUp->new();
633 646
  $self->{note_followup}->assign_attributes(%{$::form->{note_followup}});
634 647
  $self->{note_followup}->note($self->{note});
635 648
  $self->{note_followup}->created_by($curr_employee->id);
636 649

  
637
  $self->{note_followup_link} = SL::DB::FollowUpLink->new(
638
    trans_type => ($self->is_vendor() ? 'vendor' : 'customer'),
639
    trans_info => $self->{cv}->name
640
  );
650
  $self->{note_followup_link}->trans_type($self->is_vendor() ? 'vendor' : 'customer');
651
  $self->{note_followup_link}->trans_info($self->{cv}->name);
641 652

  
642 653
  if ( $::form->{shipto}->{shipto_id} ) {
643 654
    $self->{shipto} = SL::DB::Shipto->new(shipto_id => $::form->{shipto}->{shipto_id})->load();
......
674 685
    $self->{cv} = SL::DB::Customer->new(id => $::form->{id})->load();
675 686
  }
676 687

  
677
  $self->{note} = SL::DB::Note->new();
678
  $self->{note_followup} = SL::DB::FollowUp->new();
679
  $self->{note_followup_link} = SL::DB::FollowUpLink->new();
688
  if ( $::form->{note_id} ) {
689
    $self->{note} = SL::DB::Note->new(id => $::form->{note_id})->load();
690

  
691
    $self->{note_followup_link} = SL::DB::Manager::FollowUpLink->get_all(
692
      query => [
693
        'follow_up.note_id' => $self->{note}->id,
694
        trans_id => $self->{cv}->id,
695
        trans_type => ($self->is_vendor() ? 'vendor' : 'customer'),
696
      ],
697
      with_objects => ['follow_up'],
698
    )->[0];
699

  
700
    $self->{note_followup} = $self->{note_followup_link}->follow_up;
701
  } else {
702
    $self->{note} = SL::DB::Note->new();
703
    $self->{note_followup} = SL::DB::FollowUp->new();
704
    $self->{note_followup_link} = SL::DB::FollowUpLink->new();
705
  }
680 706

  
681 707
  if ( $::form->{shipto_id} ) {
682 708
    $self->{shipto} = SL::DB::Shipto->new(shipto_id => $::form->{shipto_id})->load();

Auch abrufbar als: Unified diff