Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1dd6d84a

Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt

  • ID 1dd6d84aa18d0a0ec9e36f02eae743625cd569e9
  • Vorgänger b8c7ffdf
  • Nachfolger 371ab59d

Titel von Ansprechpersonen: Freitext-Feld und/oder Auswahlliste

Der Titel wird entweder nur mit einer Auswahlliste angezeigt oder mit
Freitext-Feld und Auswahlliste. Das ist annähernd das alte Verhalten - im
Freitext-Feld eingegebener Text wird auch in contact_titles gespeichert.

In der Mandantenkonfiguration ist das Freitext-Feld (altes Verhalten)
abschaltbar.

Todo: Fremdschlüsselbeziehung zwischen contacts und contact_titles

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
17 17
use SL::DB::Customer;
18 18
use SL::DB::Vendor;
19 19
use SL::DB::Business;
20
use SL::DB::ContactTitle;
20 21
use SL::DB::Employee;
21 22
use SL::DB::Greeting;
22 23
use SL::DB::Language;
......
164 165
  }
165 166

  
166 167
  $self->{cv}->greeting(trim $self->{cv}->greeting);
167
  my $save_greeting  = $self->{cv}->greeting
168
                    && $::instance_conf->get_vc_greetings_use_textfield
169
                    && SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0;
168
  my $save_greeting      = $self->{cv}->greeting
169
    && $::instance_conf->get_vc_greetings_use_textfield
170
    && SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0;
171

  
172
  $self->{contact}->cp_title(trim($self->{contact}->cp_title));
173
  my $save_contact_title = $self->{contact}->cp_title
174
    && $::instance_conf->get_contact_titles_use_textfield
175
    && SL::DB::Manager::ContactTitle->get_all_count(where => [description => $self->{contact}->cp_title]) == 0;
170 176

  
171 177
  my $db = $self->{cv}->db;
172 178

  
......
197 203

  
198 204
    $self->{contact}->cp_cv_id($self->{cv}->id);
199 205
    if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) {
206
      SL::DB::ContactTitle->new(description => $self->{contact}->cp_title)->save if $save_contact_title;
207

  
200 208
      $self->{contact}->save(cascade => 1);
201 209
    }
202 210

  
......
936 944
    unshift @{$self->{all_greetings}}, (SL::DB::Greeting->new(description => $self->{cv}->greeting));
937 945
  }
938 946

  
939

  
940
  $query =
941
    'SELECT DISTINCT(cp_title) AS title
942
     FROM contacts
943
     WHERE cp_title IS NOT NULL AND cp_title != \'\'
944
     ORDER BY cp_title';
945
  $self->{all_titles} = [
946
    map(
947
      { $_->{title}; }
948
      selectall_hashref_query($::form, $dbh, $query)
949
    )
950
  ];
947
  $self->{all_contact_titles} = SL::DB::Manager::ContactTitle->get_all_sorted();
948
  foreach my $contact (@{ $self->{cv}->contacts }) {
949
    if ($contact->cp_title && !grep {$contact->cp_title eq $_->description} @{$self->{all_contact_titles}}) {
950
      unshift @{$self->{all_contact_titles}}, (SL::DB::ContactTitle->new(description => $contact->cp_title));
951
    }
952
  }
951 953

  
952 954
  $self->{all_currencies} = SL::DB::Manager::Currency->get_all();
953 955

  
SL/DB/ContactTitle.pm
5 5

  
6 6
use strict;
7 7

  
8
use SL::Util qw(trim);
9

  
8 10
use SL::DB::MetaSetup::ContactTitle;
9 11
use SL::DB::Manager::ContactTitle;
10 12

  
11 13
__PACKAGE__->meta->initialize;
12 14

  
15
__PACKAGE__->before_save('_before_save_trim_content');
16

  
17
sub _before_save_trim_content {
18
  $_[0]->description(trim($_[0]->description));
19
  return 1;
20
}
21

  
13 22
1;
SL/DB/MetaSetup/Default.pm
40 40
  co_ustid                                  => { type => 'text' },
41 41
  coa                                       => { type => 'text' },
42 42
  company                                   => { type => 'text' },
43
  contact_titles_use_textfield              => { type => 'boolean' },
43 44
  create_part_if_not_found                  => { type => 'boolean', default => 'false' },
44 45
  create_zugferd_invoices                   => { type => 'integer' },
45 46
  currency_id                               => { type => 'integer', not_null => 1 },
js/kivi.CustomerVendor.js
67 67

  
68 68
      kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars, 'contact_cvars_');
69 69

  
70
      if ( contactId )
70
      if ( contactId ) {
71 71
        $('#action_delete_contact').show();
72
      else
72
        $('#contact_cp_title_select').val(contact['cp_title']);
73
      } else {
73 74
        $('#action_delete_contact').hide();
75
        $('#contact_cp_title_select, #contact_cp_abteilung_select').val('');
76
      }
74 77
      if (data.contact.disable_cp_main === 1)
75 78
        $("#contact_cp_main").prop("disabled", true);
76 79
      else
......
79 82
        params.onFormSet();
80 83
    });
81 84

  
82
    $('#contact_cp_title_select, #contact_cp_abteilung_select').val('');
83 85
  };
84 86

  
85 87
  var mapSearchStmts = [
locale/de/all
3822 3822
  'Use UStVA'                   => 'UStVA verwenden',
3823 3823
  'Use WebDAV Repository'       => 'Verwende WebDAV',
3824 3824
  'Use WebDAV Storage backend'  => 'Verwende WebDAV-Backend',
3825
  'Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.' => 'Textfeld zusätzlich zur Eingabe (neuer) Titel von Ansprechpersonen verwenden. Sonst wird nur eine Auswahlliste angezeigt.',
3825 3826
  'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => 'Textfeld zusätzlich zur Eingabe (neuer) Anreden verwenden. Sonst wird nur eine Auswahlliste angezeigt.',
3826 3827
  'Use as new'                  => 'Als neu verwenden',
3827 3828
  'Use default booking group because setting is \'all\'' => 'Standardbuchungsgruppe wird verwendet',
......
3834 3835
  'Use master default bin for Default Transfer, if no default bin for the part is configured' => 'Standardlagerplatz für Ein- / Auslagern über Standard-Lagerplatz, falls für die Ware kein expliziter Lagerplatz konfiguriert ist',
3835 3836
  'Use settings from client configuration' => 'Einstellungen aus Mandantenkonfiguration folgen',
3836 3837
  'Use text field for greetings' => 'Textfeld für Anreden verwenden',
3838
  'Use text field for title of contacts' => 'Textfeld für Titel von Ansprechpersonen verwenden',
3837 3839
  'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien',
3838 3840
  'Use this storage backend for all uploaded attachments' => 'Verwende dieses Backend für hochgeladene Dateien',
3839 3841
  'Use this storage backend for uploaded images' => 'Verwende dieses Backend für hochgeladene Bilder',
locale/en/all
3821 3821
  'Use UStVA'                   => '',
3822 3822
  'Use WebDAV Repository'       => '',
3823 3823
  'Use WebDAV Storage backend'  => '',
3824
  'Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.' => '',
3824 3825
  'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => '',
3825 3826
  'Use as new'                  => '',
3826 3827
  'Use default booking group because setting is \'all\'' => '',
......
3833 3834
  'Use master default bin for Default Transfer, if no default bin for the part is configured' => '',
3834 3835
  'Use settings from client configuration' => '',
3835 3836
  'Use text field for greetings' => '',
3837
  'Use text field for title of contacts' => '',
3836 3838
  'Use this storage backend for all generated PDF-Files' => '',
3837 3839
  'Use this storage backend for all uploaded attachments' => '',
3838 3840
  'Use this storage backend for uploaded images' => '',
sql/Pg-upgrade2/defaults_contact_titles_use_textfield.sql
1
-- @tag: defaults_contact_titles_use_textfield
2
-- @description: Auswahl, ob Freitext-Feld für Titel von Ansprechpersonen im Kunden-/Lieferantenstamm angeboten wird
3
-- @depends: release_3_5_5
4

  
5
ALTER TABLE defaults ADD COLUMN contact_titles_use_textfield BOOLEAN;
6
UPDATE defaults SET contact_titles_use_textfield = TRUE;
templates/webpages/client_config/_features.html
139 139
   <td>   [% L.yes_no_tag('defaults.vc_greetings_use_textfield', SELF.defaults.vc_greetings_use_textfield) %]</td>
140 140
   <td>[% LxERP.t8('Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.') %]</td>
141 141
  </tr>
142
  <tr>
143
   <td align="right">[% LxERP.t8('Use text field for title of contacts') %]</td>
144
   <td>   [% L.yes_no_tag('defaults.contact_titles_use_textfield', SELF.defaults.contact_titles_use_textfield) %]</td>
145
   <td>[% LxERP.t8('Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.') %]</td>
146
  </tr>
142 147

  
143 148
  <tr>
144 149
   <td align="right">[% LxERP.t8('Hourly Rate') %]</td>
templates/webpages/customer_vendor/tabs/contacts.html
45 45
      <th align="right" nowrap>[% 'Title' | $T8 %]</th>
46 46

  
47 47
      <td>
48
        [% L.input_tag('contact.cp_title', SELF.contact.cp_title, size = 40) %]
49
        [% L.select_tag('contact_cp_title_select', SELF.all_titles, with_empty = 1, onchange = '$("#contact_cp_title").val(this.value);') %]
48
        [%- IF INSTANCE_CONF.get_contact_titles_use_textfield -%]
49
          [% L.input_tag('contact.cp_title', SELF.contact.cp_title, size = 40) %]
50
          [% L.select_tag('contact_cp_title_select', SELF.all_contact_titles, default = SELF.contact.cp_title, value_key = 'description', title_key = 'description', with_empty = 1, onchange = '$("#contact_cp_title").val(this.value);') %]
51
        [%- ELSE -%]
52
          [% L.select_tag('contact.cp_title', SELF.all_contact_titles, default = SELF.contact.cp_title, value_key = 'description', title_key = 'description', with_empty = 1) %]
53
        [%- END -%]
50 54
      </td>
51 55
    </tr>
52 56

  

Auch abrufbar als: Unified diff