my $pg_select = $form->{l_pricegroup} ? qq|, pg.pricegroup as pricegroup | : '';
my $pg_join = $form->{l_pricegroup} ? qq|LEFT JOIN pricegroup pg ON (ct.pricegroup_id = pg.id) | : '';
+
+ my $main_cp_select = '';
+ if ($form->{l_main_contact_person}) {
+ $main_cp_select = qq/, (SELECT concat(cp.cp_givenname, ' ', cp.cp_name, ' | ', cp.cp_email, ' | ', cp.cp_phone1)
+ FROM contacts cp WHERE ct.id=cp.cp_cv_id AND cp.cp_main LIMIT 1)
+ AS main_contact_person /;
+ }
my $query =
qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
qq| pt.description as payment | .
$pg_select .
+ $main_cp_select .
(qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) .
qq|FROM $cv ct | .
qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
}
qw(
id gender abteilung title position givenname name email phone1 phone2 fax mobile1 mobile2
- satphone satfax project street zipcode city privatphone privatemail birthday
+ satphone satfax project street zipcode city privatphone privatemail birthday main
)
)
};
$data->{contact_cvars} = $self->_prepare_cvar_configs_for_ajaj($self->{contact}->cvars_by_config);
+ # avoid two or more main_cp
+ my $has_main_cp = grep { $_->cp_main == 1 } @{ $self->{cv}->contacts };
+ $data->{contact}->{disable_cp_main} = 1 if ($has_main_cp && !$data->{contact}->{cp_main});
+
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 });
}
cp_gender => { type => 'character', length => 1 },
cp_givenname => { type => 'text' },
cp_id => { type => 'integer', not_null => 1, sequence => 'id' },
+ cp_main => { type => 'boolean' },
cp_mobile1 => { type => 'text' },
cp_mobile2 => { type => 'text' },
cp_name => { type => 'text' },
};
my @columns = (
- 'id', 'name', "$form->{db}number", 'contact', 'phone', 'discount',
+ 'id', 'name', "$form->{db}number", 'contact', 'main_contact_person',
+ 'phone', 'discount',
'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city',
'business', 'payment', 'invnumber', 'ordnumber', 'quonumber', 'salesman',
'country', 'gln', 'insertdate', 'pricegroup', 'contact_origin', 'invoice_mail',
"$form->{db}number" => { 'text' => $locale->text('Number'), },
'name' => { 'text' => $form->{IS_CUSTOMER} ? $::locale->text('Customer Name') : $::locale->text('Vendor Name'), },
'contact' => { 'text' => $locale->text('Contact'), },
+ 'main_contact_person' => { 'text' => $locale->text('Main Contact Person'), },
'phone' => { 'text' => $locale->text('Phone'), },
'fax' => { 'text' => $locale->text('Fax'), },
'email' => { 'text' => $locale->text('E-mail'), },
- Kundenstammdaten um Feld Amtsgericht erweitert
Falls das Feld Steuernummer mit dem Wert der Hr-Nr gefüllt wurde, wird auch das zuständige
Registierungs-Gericht benötigt.
-
+- Ansprechpartner um Feld 'Hauptansprechpartner' erweitert und exportierbar im Kundenbericht gemacht
2019-01-03 - Release 3.5.3
$('#action_delete_contact').show();
else
$('#action_delete_contact').hide();
-
+ if (data.contact.disable_cp_main === 1)
+ $("#contact_cp_main").prop("disabled", true);
+ else
+ $("#contact_cp_main").prop("disabled", false);
if ( params.onFormSet )
params.onFormSet();
});
'MIME type' => 'MIME-Typ',
'MT940 import' => 'MT940 Import',
'Mails' => 'E-Mails',
+ 'Main Contact Person' => 'Hauptansprechpartner',
'Main Preferences' => 'Grundeinstellungen',
'Main sorting' => 'Hauptsortierung',
'Make' => 'Lieferant',
--- /dev/null
+# @tag: contacts_add_main_contact
+# @description: Feld 'Hauptansprechpartner' für Kontakte
+# @depends: release_3_5_3
+package SL::DBUpgrade2::contacts_add_main_contact;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+sub run {
+ my ($self) = @_;
+
+ $self->db_query('ALTER TABLE contacts ADD COLUMN cp_main boolean DEFAULT false', may_fail => 1);
+ $self->db_query("UPDATE contacts set cp_main='false'");
+
+ return 1;
+}
+
+1;
<input name="l_commercial_court" id="l_commercial_court" type="checkbox" class="checkbox" value="Y">
<label for="l_commercial_court">[% 'Commercial court' | $T8 %]</label>
</td>
+ <td>
+ <input name="l_main_contact_person" id="l_main_contact_person" type="checkbox" class="checkbox" value="Y">
+ <label for="l_main_contact_person">[% 'Main Contact Person' | $T8 %]</label>
+ </td>
<td>
</tr>
%]
</td>
</tr>
-
+ <tr>
+ <th align="right" nowrap>[% 'Main Contact Person' | $T8 %]</th>
+ <td>[% L.yes_no_tag('contact.cp_main', SELF.contact.cp_main) %]</td>
+ </tr>
<tr>
<th align="right" nowrap>[% 'Gender' | $T8 %]</th>