Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 30723c32

Von Thomas Heck vor etwa 11 Jahren hinzugefügt

  • ID 30723c32d3a1d71b665f69777edd93c672f03c04
  • Vorgänger c0cd58d9
  • Nachfolger 1168e9c9

Kundennotizen auflisten und ändern

fixt #2388

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
147 147
      employee_id => SL::DB::Manager::Employee->current->id,
148 148
      addition => 'SAVED',
149 149
    )->save();
150

  
151
    if ( $::form->{delete_notes} ) {
152
      foreach my $note_id (@{ $::form->{delete_notes} }) {
153
        my $note = SL::DB::Note->new(id => $note_id)->load();
154
        if ( $note->follow_up ) {
155
          if ( $note->follow_up->follow_up_link ) {
156
            $note->follow_up->follow_up_link->delete(cascade => 'delete');
157
          }
158
          $note->follow_up->delete(cascade => 'delete');
159
        }
160
        $note->delete(cascade => 'delete');
161
      }
162
    }
150 163
  }) || die($db->error);
151 164

  
152 165
}
......
622 635

  
623 636
  if ( $::form->{note}->{id} ) {
624 637
    $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;
638
    $self->{note_followup} = $self->{note}->follow_up;
639
    $self->{note_followup_link} = $self->{note_followup}->follow_up_link;
636 640
  } else {
637 641
    $self->{note} = SL::DB::Note->new();
638 642
    $self->{note_followup} = SL::DB::FollowUp->new();
......
687 691

  
688 692
  if ( $::form->{note_id} ) {
689 693
    $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;
694
    $self->{note_followup} = $self->{note}->follow_up;
695
    $self->{note_followup_link} = $self->{note_followup}->follow_up_link;
701 696
  } else {
702 697
    $self->{note} = SL::DB::Note->new();
703 698
    $self->{note_followup} = SL::DB::FollowUp->new();
......
832 827
  $self->{shiptos} = $self->{cv}->shipto;
833 828
  $self->{shiptos} ||= [];
834 829

  
830
  $self->{notes} = SL::DB::Manager::Note->get_all(
831
    query => [
832
      trans_id => $self->{cv}->id,
833
      trans_module => 'ct',
834
    ],
835
    with_objects => ['follow_up'],
836
  );
837

  
835 838
  $self->{template_args} ||= {};
836 839

  
837 840
  $::request->{layout}->add_javascripts('autocomplete_customer.js');
templates/webpages/customer_vendor/tabs/vcnotes.html
3 3
[%- USE L %]
4 4

  
5 5
<div id="vcnotes">
6
   [% IF ( NOTES && NOTES.size ) %]
6
  [% IF ( SELF.notes && SELF.notes.size ) %]
7 7
     <p>
8 8
       <table>
9 9
        <tr>
......
19 19
        [%- FOREACH row = SELF.notes %]
20 20
          <tr class="listrow[% loop.count % 2 %]">
21 21
            <td>
22
              [% L.hidden_tag('notes[+].id', row.id) %]
23
              [% IF ( !NOTE_id || (NOTE_id != row.id) ) %]
24
                [% L.checkbox_tag('notes[].delete', 0) %]
22
              [% IF ( !SELF.note || SELF.note.id != row.id ) %]
23
                [% L.checkbox_tag('delete_notes[]', value = row.id) %]
25 24
              [% END %]
26 25
            </td>
27 26

  
28 27
            <td>
29
              <a href="ct.pl?action=edit&db=[% HTML.url(db) %]&id=[% HTML.url(id) %]&edit_note_id=[% HTML.url(row.id) %]">[% HTML.escape(row.subject) %]</a>
28
              <a href="controller.pl?action=CustomerVendor/edit&db=[% SELF.is_vendor() ? 'vendor' : 'customer' %]&id=[% HTML.url(SELF.cv.id) %]&note_id=[% HTML.url(row.id) %]">[% HTML.escape(row.subject) %]</a>
30 29
            </td>
31 30

  
32 31
            <td>
33
              [% HTML.escape(row.created_on) %]
32
              [% row.itime.to_kivitendo | html %]
34 33
            </td>
35 34

  
36 35
            <td>
37
              [% IF ( row.created_by_name ) %]
38
                [% HTML.escape(row.created_by_name) %]
39
              [% ELSE %]
40
                [% HTML.escape(row.created_by_login) %]
41
              [% END %]
36
              [% row.employee.safe_name | html %]
42 37
            </td>
43 38

  
44 39
            <td>
45
              [% HTML.escape(row.follow_up_date) %]
40
              [% row.follow_up.follow_up_date.to_kivitendo | html %]
46 41
            </td>
47 42

  
48 43
            <td>
49
              [% IF ( row.created_for_name ) %]
50
                [% HTML.escape(row.created_for_name) %]
51
              [% ELSE %]
52
                [% HTML.escape(row.created_for_login) %]
53
              [% END %]
44
              [% row.follow_up.created_for.safe_name | html %]
54 45
            </td>
55 46

  
56 47
            <td>
57
              [% IF ( row.follow_up_date ) %]
58
                [% IF ( row.follow_up_done ) %]
48
              [% IF ( row.follow_up.follow_up_date ) %]
49
                [% IF ( row.follow_up.done ) %]
59 50
                  [% 'Yes' | $T8 %]
60 51
                [% ELSE %]
61 52
                  [% 'No' | $T8 %]
......
68 59
    </p>
69 60
  [% END %]
70 61

  
62

  
71 63
  <div class="listtop">
72
    [% IF ( NOTE_id ) %]
64
    [% IF ( SELF.note.id ) %]
73 65
      [% 'Edit note' | $T8 %]
74 66
    [% ELSE %]
75 67
      [% 'Add note' | $T8 %]

Auch abrufbar als: Unified diff