'trans_id' => $form->{id},
'variables' => $form,
'always_valid' => 1);
+ CVar->save_custom_variables('dbh' => $dbh,
+ 'module' => 'Contacts',
+ 'trans_id' => $form->{cp_id},
+ 'variables' => $form,
+ 'name_prefix' => 'cp',
+ 'always_valid' => 1);
my $rc = $dbh->commit();
'trans_id' => $form->{id},
'variables' => $form,
'always_valid' => 1);
+ CVar->save_custom_variables('dbh' => $dbh,
+ 'module' => 'Contacts',
+ 'trans_id' => $form->{cp_id},
+ 'variables' => $form,
+ 'name_prefix' => 'cp',
+ 'always_valid' => 1);
my $rc = $dbh->commit();
our @types = qw(text textfield number date bool select customer); # timestamp
our @modules = ({ module => 'CT', description => $locale->text('Customers and vendors') },
+ { module => 'Contacts', description => $locale->text('Contact persons') },
{ module => 'IC', description => $locale->text('Parts, services and assemblies') },
{ module => 'Projects', description => $locale->text('Projects') },
);
$form->{currency} = $form->{curr};
}
- $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'CT', 'trans_id' => $form->{id});
+ $::form->{CUSTOM_VARIABLES} = { };
+ my %specs = ( CT => { field => 'id', name_prefix => '', },
+ Contacts => { field => 'cp_id', name_prefix => 'cp', },
+ );
- CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
+ for my $module (keys %specs) {
+ my $spec = $specs{$module};
+
+ $::form->{CUSTOM_VARIABLES}->{$module} = CVar->get_custom_variables(module => $module, trans_id => $::form->{ $spec->{field} });
+ CVar->render_inputs(variables => $::form->{CUSTOM_VARIABLES}->{$module}, name_prefix => $spec->{name_prefix})
+ if scalar @{ $::form->{CUSTOM_VARIABLES}->{$module} };
+ }
$form->header;
print $form->parse_html_template('ct/form_header');
CT->query_titles_and_greetings(\%::myconfig, $::form);
CT->get_contact(\%::myconfig, $::form) if $::form->{cp_id};
+ $::form->{CUSTOM_VARIABLES}{Contacts} = CVar->get_custom_variables(module => 'Contacts', trans_id => $::form->{cp_id});
+ CVar->render_inputs(variables => $::form->{CUSTOM_VARIABLES}{Contacts}, name_prefix => 'cp')
+ if scalar @{ $::form->{CUSTOM_VARIABLES}->{Contacts} };
+
$::form->{contacts_label} = \&_contacts_label;
print $::form->ajax_response_header(), $::form->parse_html_template('ct/_contact');
'Contact deleted.' => 'Ansprechpartner gelöscht.',
'Contact is in use and was flagged invalid.' => 'Ansprechpartner ist noch in Verwendung, und wurde als ungültig markiert.',
'Contact person (surname)' => 'Ansprechpartner (Nachname)',
+ 'Contact persons' => 'Ansprechpartner',
'Contacts' => 'Ansprechpartner',
'Continue' => 'Weiter',
'Contra' => 'gegen',
<th align="left" nowrap>[% 'Bcc' | $T8 %]</th>
<td><input name="bcc" size="40" value="[% HTML.escape(bcc) %]"></td>
</tr>
+ [% IF CUSTOM_VARIABLES.Contacts.size %]
+ <tr>
+ <td colspan="2"><hr></td>
+ </tr>
+
+ [%- FOREACH var = CUSTOM_VARIABLES.Contacts %]
+ <tr>
+ <th align="left" valign="top" nowrap>[% HTML.escape(var.description) %]</th>
+ <td valign="top">[% var.HTML_CODE %]</td>
+ </tr>
+ [%- END %]
+ [%- END %]
+
</table>
[% IF cp_id %]
<li><a href="#" rel="deliveries">[% 'Supplies' | $T8 %]</a></li>
[%- END %]
<li><a href="#" rel="vcnotes">[% 'Notes' | $T8 %]</a></li>
- [%- IF CUSTOM_VARIABLES.size %]
+ [%- IF CUSTOM_VARIABLES.CT.size %]
<li><a href="#" rel="custom_variables">[% 'Custom Variables' | $T8 %]</a></li>
[%- END %]
</ul>
<br style="clear: left" />
</div>
- [%- IF CUSTOM_VARIABLES.size %]
+ [%- IF CUSTOM_VARIABLES.CT.size %]
<div id="custom_variables" class="tabcontent">
<p>
<table>
- [%- FOREACH var = CUSTOM_VARIABLES %]
+ [%- FOREACH var = CUSTOM_VARIABLES.CT %]
<tr>
<td align="right" valign="top">[% HTML.escape(var.description) %]</td>
<td valign="top">[% var.HTML_CODE %]</td>