Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 80a6d456

Von Thomas Heck vor etwa 11 Jahren hinzugefügt

  • ID 80a6d456aa9f6222316394a79e3f2f31b6078110
  • Vorgänger 21243e6b
  • Nachfolger 96ca0b88

Nicht mehr benötigten Code aus bin/ct.pl entfernt

Unterschiede anzeigen:

bin/mozilla/ct.pl
$::lxdebug->leave_sub;
}
sub edit {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
# show history button
$form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
#/show hhistory button
CT->get_tuple(\%myconfig, \%$form);
CT->populate_drop_down_boxes(\%myconfig, \%$form);
$form->{title} = "Edit";
# format discount
$form->{discount} *= 100;
# format uri
$form->{homepage} = 'http://' . $form->{homepage} unless ((!$form->{homepage}) || $form->{homepage} =~ m|^https?://|);
&form_header;
&form_footer;
$main::lxdebug->leave_sub();
}
sub _shipto_label {
my $s = shift(@_);
join('; ', grep { $_ } map { $s->{"shipto$_"} } qw(name department_1 street city)) || ' '
}
sub _contacts_label {
join ", ", grep { $_ } $_[0]->{cp_name}, $_[0]->{cp_givenname};
}
sub form_header {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
$form->get_lists(taxzones => "ALL_TAXZONES",
currencies => "ALL_CURRENCIES");
$form->get_pricegroup(\%myconfig, { all => 1 });
$form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::instance_conf->get_vertreter;
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{FU_created_for_user}, deleted => 0 ] ]);
$form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
$form->{USER} = SL::DB::Manager::Employee->current;
$form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$form->{is_customer} = $form->{db} eq 'customer';
$form->{shipto_label} = \&_shipto_label;
$form->{contacts_label} = \&_contacts_label;
$form->{taxzone_id} = 0 if !$form->{id};
$form->{SHIPTO_ALL} = [ +{ shipto_id => '0', shiptoname => $::locale->text('All') }, @{ $form->{SHIPTO} } ];
$form->{title} = $form->{title_save}
|| $locale->text("$form->{title} " . ucfirst $form->{db}) . ($form->{title} eq "Edit" ? " $form->{name}" : '');
CT->query_titles_and_greetings(\%myconfig, \%$form);
map { $form->{"MB_$_"} = [ map +{ id => $_, description => $_ }, @{ $form->{$_} } ] } qw(COMPANY_GREETINGS);
$form->{NOTES} ||= [ ];
if (!$form->{'language_id'}) {
my $l_id = SL::DB::Default->get->{'language_id'};
if ($l_id) {
$form->{'default_language_id'} = $l_id;
}
}
if (!$form->{'id'}) {
$form->{'currency'} = $form->get_default_currency(\%myconfig);
} else {
$form->{currency} = $form->{curr};
}
$::form->{CUSTOM_VARIABLES} = { };
my %specs = ( CT => { field => 'id', name_prefix => '', },
Contacts => { field => 'cp_id', name_prefix => 'cp', },
);
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');
$main::lxdebug->leave_sub();
}
sub form_footer {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
print $form->parse_html_template('ct/form_footer', { is_orphaned => $form->{status} eq 'orphaned',
is_customer => $form->{db} eq 'customer' });
$main::lxdebug->leave_sub();
}
sub _do_save {
$main::auth->assert('customer_vendor_edit');
$::form->isblank("name", $::locale->text("Name missing!"));
if ($::form->{new_salesman_id} && $::instance_conf->get_vertreter) {
$::form->{salesman_id} = $::form->{new_salesman_id};
delete $::form->{new_salesman_id};
}
my $res = $::form->{db} eq 'customer' ? CT->save_customer(\%::myconfig, $::form) : CT->save_vendor(\%::myconfig, $::form);
if (3 == $res) {
if ($::form->{"db"} eq "customer") {
$::form->error($::locale->text('This customer number is already in use.'));
} else {
$::form->error($::locale->text('This vendor number is already in use.'));
}
}
}
sub add_transaction {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit & ' .
'(general_ledger | invoice_edit | vendor_invoice_edit | ' .
' request_quotation_edit | sales_quotation_edit | sales_order_edit | purchase_order_edit)');
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
# # saving the history
# if(!exists $form->{addition}) {
# $form->{addition} = "ADD TRANSACTION";
# $form->save_history;
# }
# # /saving the history
_do_save();
$form->{callback} = $form->escape($form->{callback}, 1);
my $name = $form->escape("$form->{name}", 1);
$form->{callback} =
"$form->{script}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
$form->redirect;
$main::lxdebug->leave_sub();
}
sub save_and_ap_transaction {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit & general_ledger');
my $form = $main::form;
my %myconfig = %main::myconfig;
$form->{script} = "ap.pl";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_ar_transaction {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit & general_ledger');
my $form = $main::form;
my %myconfig = %main::myconfig;
$form->{script} = "ar.pl";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_invoice {
$main::lxdebug->enter_sub();
my $form = $main::form;
my %myconfig = %main::myconfig;
if ($form->{db} eq 'customer') {
$main::auth->assert('customer_vendor_edit & invoice_edit');
} else {
$main::auth->assert('customer_vendor_edit & vendor_invoice_edit');
}
$form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
$form->{type} = "invoice";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_rfq {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit & request_quotation_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
$form->{script} = "oe.pl";
$form->{type} = "request_quotation";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_quotation {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit & sales_quotation_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
$form->{script} = "oe.pl";
$form->{type} = "sales_quotation";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_order {
$main::lxdebug->enter_sub();
my $form = $main::form;
my %myconfig = %main::myconfig;
if ($form->{db} eq 'customer') {
$main::auth->assert('customer_vendor_edit & sales_order_edit');
} else {
$main::auth->assert('customer_vendor_edit & purchase_order_edit');
}
$form->{script} = "oe.pl";
$form->{type} =
($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&add_transaction;
$main::lxdebug->leave_sub();
}
sub save_and_close {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $msg = ucfirst $form->{db};
$msg .= " saved!";
_do_save();
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
$form->redirect($locale->text($msg));
$main::lxdebug->leave_sub();
}
sub save {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
my $msg = ucfirst $form->{db};
$msg .= " saved!";
_do_save();
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
$form->{addition} = "SAVED";
$form->save_history;
}
# /saving the history
&edit;
$main::lxdebug->leave_sub();
::end_of_request();
}
sub delete {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
CT->delete(\%myconfig, \%$form);
my $msg = ucfirst $form->{db};
$msg .= " deleted!";
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
$form->{addition} = "DELETED";
$form->save_history;
}
# /saving the history
$form->redirect($locale->text($msg));
$main::lxdebug->leave_sub();
}
sub display {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
&form_header();
&form_footer();
$main::lxdebug->leave_sub();
}
sub update {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
my $form = $main::form;
&display();
$main::lxdebug->leave_sub();
}
sub get_contact {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
CT->populate_drop_down_boxes(\%::myconfig, $::form);
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');
$main::lxdebug->leave_sub();
}
sub get_shipto {
$main::lxdebug->enter_sub();
$main::auth->assert('customer_vendor_edit');
CT->populate_drop_down_boxes(\%::myconfig, $::form);
CT->get_shipto(\%::myconfig, $::form) if $::form->{shipto_id};
$::form->{shipto_label} = \&_shipto_label;
print $::form->ajax_response_header(), $::form->parse_html_template('ct/_shipto');
$main::lxdebug->leave_sub();
}
sub get_delivery {
$::lxdebug->enter_sub;
$::auth->assert('customer_vendor_edit');
$::auth->assert('sales_all_edit');
CT->get_delivery(\%::myconfig, $::form );
print $::form->ajax_response_header,
$::form->parse_html_template('ct/get_delivery', {
is_customer => $::form->{db} eq 'customer',
});
$::lxdebug->leave_sub;
}
sub delete_shipto {
$::lxdebug->enter_sub;
$::auth->assert('customer_vendor_edit');
if (!$::form->{shipto_id}) {
flash('error', $::locale->text('No shipto selected to delete'));
} else {
CT->get_shipto(\%::myconfig, $::form);
my $shipto = SL::DB::Manager::Shipto->find_by(shipto_id => $::form->{shipto_id});
if ($shipto->used) {
$shipto->detach->save;
flash('info', $::locale->text('Shipto is in use and was flagged invalid.'));
} else {
$shipto->delete;
flash('info', $::locale->text('Shipto deleted.'));
}
delete $::form->{$_} for grep /^shipto/, keys %$::form;
}
edit();
$::lxdebug->leave_sub;
}
sub delete_contact {
$::lxdebug->enter_sub;
$::auth->assert('customer_vendor_edit');
if (!$::form->{cp_id}) {
flash('error', $::locale->text('No contact selected to delete'));
} else {
CT->get_contact(\%::myconfig, $::form);
my $contact = SL::DB::Manager::Contact->find_by(cp_id => $::form->{cp_id});
if ($contact->used) {
$contact->detach->save;
flash('info', $::locale->text('Contact is in use and was flagged invalid.'));
} else {
$contact->delete;
flash('info', $::locale->text('Contact deleted.'));
}
delete $::form->{$_} for grep /^cp_/, keys %$::form;
}
edit();
$::lxdebug->leave_sub;
}
sub ajax_autocomplete {
$main::lxdebug->enter_sub();
my $form = $main::form;
my %myconfig = %main::myconfig;
$form->{column} = 'name' unless $form->{column} =~ /^name$/;
$form->{vc} = 'customer' unless $form->{vc} =~ /^customer|vendor$/;
$form->{db} = $form->{vc}; # CT expects this
$form->{$form->{column}} = $form->{q} || '';
$form->{limit} = ($form->{limit} * 1) || 10;
$form->{searchitems} ||= '';
CT->search(\%myconfig, $form);
print $form->ajax_response_header(),
$form->parse_html_template('ct/ajax_autocomplete');
$main::lxdebug->leave_sub();
}
sub continue { call_sub($main::form->{nextsub}); }
templates/webpages/ct/_contact.html
[% USE L %][% USE HTML %][% USE T8 %][% USE LxERP %]
<table>
<input type="hidden" name="cp_id" value="[% HTML.escape(cp_id) %]">
<tr>
<th align="left">[% 'Contacts' | $T8 %]</th>
<td>
[%- L.select_tag('cp_id', CONTACTS, default = cp_id, with_empty = 1, empty_title = LxERP.t8('New contact'), value_key = 'cp_id', title_sub = \contacts_label,
onchange = "\$('#contacts').load('ct.pl?action=get_contact&id=' + \$('#cvid').val() + '&db=' + \$('#db').val() + '&cp_id=' + \$('#cp_id').val())") %]
</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Gender' | $T8 %]</th>
<td>
<select id="cp_gender" name="cp_gender">
<option value="m"[% IF cp_gender == 'm' %] selected[% END %]>[% 'male' | $T8 %]</option>
<option value="f"[% IF cp_gender == 'f' %] selected[% END %]>[% 'female' | $T8 %]</option>
</select>
</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Title' | $T8 %]</th>
<td>
<input id="cp_title" name="cp_title" size="40" maxlength="75" value="[% HTML.escape(cp_title) %]">&nbsp;
[% L.select_tag('selected_cp_title', TITLES, with_empty = 1) %]
</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Department' | $T8 %]</th>
<td>
<input id="cp_abteilung" name="cp_abteilung" size="40" value="[% HTML.escape(cp_abteilung) %]">&nbsp;
[% L.select_tag('selected_cp_abteilung', DEPARTMENT, with_empty = 1) %]
</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Function/position' | $T8 %]</th>
<td>[% L.input_tag('cp_position', cp_position, size=40, maxlength=75) %]</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Given Name' | $T8 %]</th>
<td><input id="cp_givenname" name="cp_givenname" size="40" maxlength="75" value="[% HTML.escape(cp_givenname) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Name' | $T8 %]</th>
<td><input id="cp_name" name="cp_name" size="40" maxlength="75" value="[% HTML.escape(cp_name) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'E-mail' | $T8 %]</th>
<td><input id="cp_email" name="cp_email" size="40" value="[% HTML.escape(cp_email) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Phone1' | $T8 %]</th>
<td><input id="cp_phone1" name="cp_phone1" size="40" maxlength="75" value="[% HTML.escape(cp_phone1) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Phone2' | $T8 %]</th>
<td><input id="cp_phone2" name="cp_phone2" size="40" maxlength="75" value="[% HTML.escape(cp_phone2) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Fax' | $T8 %]</th>
<td><input id="cp_fax" name="cp_fax" size="40" value="[% HTML.escape(cp_fax) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Mobile1' | $T8 %]</th>
<td><input id="cp_mobile1" name="cp_mobile1" size="40" value="[% HTML.escape(cp_mobile1) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Mobile2' | $T8 %]</th>
<td><input id="cp_mobile2" name="cp_mobile2" size="40" value="[% HTML.escape(cp_mobile2) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Sat. Phone' | $T8 %]</th>
<td><input id="cp_satphone" name="cp_satphone" size="40" value="[% HTML.escape(cp_satphone) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Sat. Fax' | $T8 %]</th>
<td><input id="cp_satfax" name="cp_satfax" size="40" value="[% HTML.escape(cp_satfax) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Project' | $T8 %]</th>
<td><input id="cp_project" name="cp_project" size="40" value="[% HTML.escape(cp_project) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Street' | $T8 %]</th>
<td><input id="cp_street" name="cp_street" size="40" maxlength="75" value="[% HTML.escape(cp_street) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Zip, City' | $T8 %]</th>
<td>
<input id="cp_zipcode" name="cp_zipcode" size="5" maxlength="10" value="[% HTML.escape(cp_zipcode) %]">
<input id="cp_city" name="cp_city" size="25" maxlength="75" value="[% HTML.escape(cp_city) %]">
</td>
</tr>
<tr>
<th align="left" nowrap>[% 'Private Phone' | $T8 %]</th>
<td><input id="cp_privatphone" name="cp_privatphone" size="40" value="[% HTML.escape(cp_privatphone) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Private E-mail' | $T8 %]</th>
<td><input id="cp_privatemail" name="cp_privatemail" size="40" value="[% HTML.escape(cp_privatemail) %]"></td>
</tr>
<tr>
<th align="left" nowrap>[% 'Birthday' | $T8 %]</th>
<td>
[% L.date_tag('cp_birthday', cp_birthday) %]
</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 %]
<input type="button" id="delete_contact" onclick="submitInputButton(this);" name="action" value="[% 'Delete Contact' | $T8 %]">
[% END %]
templates/webpages/ct/_shipto.html
[% USE L %][% USE HTML %][% USE T8 %][% USE LxERP %]
<table width="100%" id="shipto_table">
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td>
[% L.select_tag('shipto_id', SHIPTO, default = shipto_id, value_key = 'shipto_id', title_sub = \shipto_label, with_empty = 1, empty_title = LxERP.t8('New shipto'),
onchange = "\$('#shipto').load('ct.pl?action=get_shipto&id=' + \$('#cvid').val() + '&db=' + \$('#db').val() + '&shipto_id=' + this.value)") %]
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Name' | $T8 %]</th>
<td><input id="shiptoname" name="shiptoname" size="35" maxlength="75" value="[% HTML.escape(shiptoname) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Abteilung' | $T8 %]</th>
<td>
<input id="shiptodepartment_1" name="shiptodepartment_1" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_1) %]">
<input id="shiptodepartment_2" name="shiptodepartment_2" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_2) %]">
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Street' | $T8 %]</th>
<td><input id="shiptostreet" name="shiptostreet" size="35" maxlength="75" value="[% HTML.escape(shiptostreet) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
<td>
<input id="shiptozipcode" name="shiptozipcode" size="5" maxlength="75" value="[% HTML.escape(shiptozipcode) %]">
<input id="shiptocity" name="shiptocity" size="30" maxlength="75" value="[% HTML.escape(shiptocity) %]">
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Country' | $T8 %]</th>
<td><input id="shiptocountry" name="shiptocountry" size="35" maxlength="75" value="[% HTML.escape(shiptocountry) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Contact' | $T8 %]</th>
<td><input id="shiptocontact" name="shiptocontact" size="30" maxlength="75" value="[% HTML.escape(shiptocontact) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Phone' | $T8 %]</th>
<td><input id="shiptophone" name="shiptophone" size="30" maxlength="30" value="[% HTML.escape(shiptophone) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Fax' | $T8 %]</th>
<td><input id="shiptofax" name="shiptofax" size="30" maxlength="30" value="[% HTML.escape(shiptofax) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
<td><input id="shiptoemail" name="shiptoemail" size="45" value="[% HTML.escape(shiptoemail) %]"></td>
</tr>
</table>
[%- IF shipto_id %]
<input type="submit" id="delete_shipto" name="action" value="[% 'Delete Shipto' | $T8 %]">
[%- END %]
templates/webpages/ct/ajax_autocomplete.html
[%- USE HTML %]
[%- FOREACH vc = CT %]
[%- IF loop.count < limit %]
[% vc.$column %]
[%- END %]
[%- END %]
templates/webpages/ct/form_footer.html
[%- USE T8 %]
[% USE HTML %]
[% USE LxERP %]
[% USE L %]
<input name="id" type="hidden" id="cvid" value="[% HTML.escape(id) %]">
<input name="business_save" type="hidden" value="[% HTML.escape(selectbusiness) %]">
<input name="title_save" type="hidden" value="[% HTML.escape(title) %]">
<input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
<input type="hidden" name="db" id="db" value="[% HTML.escape(db) %]">
<br>
<input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save' | $T8 %]" onclick="return check_taxzone_and_ustid()">
<input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save and Close' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- IF is_customer %]
<input class="submit" type="submit" name="action" value="[% 'Save and AR Transaction' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- ELSE %]
<input class="submit" type="submit" name="action" value="[% 'Save and AP Transaction' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- END %]
<input class="submit" type="submit" name="action" value="[% 'Save and Invoice' | $T8 %]" onclick="return check_taxzone_and_ustid()">
<input class="submit" type="submit" name="action" value="[% 'Save and Order' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- IF is_customer %]
<input class="submit" type="submit" name="action" value="[% 'Save and Quotation' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- ELSE %]
<input class="submit" type="submit" name="action" value="[% 'Save and RFQ' | $T8 %]" onclick="return check_taxzone_and_ustid()">
[%- END %]
[%- IF id AND is_orphaned %]
[% L.submit_tag('action', LxERP.t8('Delete'), id => 'action_delete', confirm => LxERP.t8('Do you really want to delete this object?')) %]
[%- END %]
[%- IF id %]
<input type="button" class="submit" onclick="set_history_window([% HTML.escape(id) %]);" name="history" id="history" value="[% 'history' | $T8 %]">
[%- END %]
</form>
<script type="text/javascript">
<!--
function enable_delete_shipto(used) { var s=document.getElementById('delete_shipto'); if (s) s.disabled = (used > 0 ? true : false); }
function enable_delete_contact(used){ var s=document.getElementById('delete_contact'); if (s) s.disabled = (used > 0 ? true : false); }
function submitInputButton(button)
{
var hidden = document.createElement("input");
hidden.setAttribute("type", "hidden");
if( button.hasAttribute("name") )
hidden.setAttribute("name", button.getAttribute("name"));
if( button.hasAttribute("value") )
hidden.setAttribute("value", button.getAttribute("value"));
button.form.appendChild(hidden);
button.disabled = true;
button.form.submit();
}
function check_taxzone_and_ustid() {
if (($('#taxzone_id').val() == '1') && ($('#ustid').val() == '')) {
alert('[% LxERP.t8('Please enter the sales tax identification number.') %]');
return false;
}
return true;
}
-->
</script>
templates/webpages/ct/form_header.html
[%- USE T8 %]
[% USE HTML %][% USE LxERP %]
[% USE L %]
<h1>[% title %]</h1>
[% PROCESS 'common/flash.html' %]
<form method="post" name="ct" action="ct.pl" >
<div class="tabwidget">
<ul>
<li><a href="#billing">[% 'Billing Address' | $T8 %]</a></li>
<li><a href="#shipto">[% 'Shipping Address' | $T8 %]</a></li>
<li><a href="#contacts">[% 'Contacts' | $T8 %]</a></li>
[%- IF id %]
<li><a href="#deliveries">[% 'Supplies' | $T8 %]</a></li>
[%- END %]
<li><a href="#vcnotes">[% 'Notes' | $T8 %]</a></li>
[%- IF CUSTOM_VARIABLES.CT.size %]
<li><a href="#custom_variables">[% 'Custom Variables' | $T8 %]</a></li>
[%- END %]
</ul>
<div id="billing">
<table width="100%">
<tr height="5"></tr>
[% IF INSTANCE_CONF.get_vertreter %]
<tr>
<th align="right">[% IF is_customer %][% 'Type of Customer' | $T8 %][%- ELSE %][% 'Type of Vendor' | $T8 %][%- END %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'business',
DATA = all_business,
show_empty = 1,
id_key = 'id',
label_key = 'description',
-%]
</td>
</tr>
[%- IF id %]
<tr>
<th align="right">[% 'Representative' | $T8 %]</th>
<td>
<input type="hidden" name="salesman_id" value="[%- HTML.escape(salesman_id) %]"%>
[%- HTML.escape(salesman) %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">
[%- IF !id %]
[% 'Representative' | $T8 %]
[%- ELSE %]
[% 'Change representative to' | $T8 %]
[%- END %]
</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'new_salesman_id',
DATA = ALL_SALESMAN_CUSTOMERS,
id_key = 'id',
label_key = 'name',
show_empty = id,
-%]
</td>
</tr>
[%- END %]
<tr>
[%- IF is_customer %]
<th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
<td><input name="customernumber" size="35" value="[% HTML.escape(customernumber) %]"></td>
[%- ELSE %]
<th align="right" nowrap>[% 'Vendor Number' | $T8 %]</th>
<td><input name="vendornumber" size="35" value="[% HTML.escape(vendornumber) %]"></td>
[%- END %]
</tr>
<tr>
<th align="right" nowrap>[% 'Greeting' | $T8 %]</th>
<td>
<input id="greeting" name="greeting" size="30" value="[% HTML.escape(greeting) %]" class="initial_focus">&nbsp;
[%- INCLUDE generic/multibox.html
name = 'selected_company_greeting',
DATA = MB_COMPANY_GREETINGS,
show_empty = 1,
id_key = 'id',
label_key = 'description',
-%]
</td>
</tr>
<tr>
<th align="right" nowrap>[% IF is_customer %][% 'Customer Name' | $T8 %][%- ELSE %][% 'Vendor Name' | $T8 %][%- END %]</th>
<td><input name="name" size="35" maxlength="75" value="[% HTML.escape(name) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td>
<input name="department_1" size="16" maxlength="75" value="[% HTML.escape(department_1) %]">
<input name="department_2" size="16" maxlength="75" value="[% HTML.escape(department_2) %]">
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Street' | $T8 %]</th>
<td>
<input name="street" size="35" maxlength="75" value="[% HTML.escape(street) %]">
<a
href="#"
onclick="window.open('https://maps.google.com/maps?q='+ encodeURIComponent($('#billing input[name=street]').val() +', '+ $('#billing input[name=zipcode]').val() +' '+ $('#billing input[name=city]').val() +', '+ $('#billing input[name=country]').val()), '_blank'); window.focus();"
title="[% 'Map' | $T8 %]"
>
<img src="image/map.png" alt="[% 'Map' | $T8 %]" />
</a>
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
<td>
<input name="zipcode" size="5" maxlength="10" value="[% HTML.escape(zipcode) %]">
<input name="city" size="30" maxlength="75" value="[% HTML.escape(city) %]">
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Country' | $T8 %]</th>
<td><input name="country" size="35" maxlength="75" value="[% HTML.escape(country) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Contact' | $T8 %]</th>
<td><input name="contact" size="28" maxlength="75" value="[% HTML.escape(contact) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Phone' | $T8 %]</th>
<td><input name="phone" size="30" value="[% HTML.escape(phone) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Fax' | $T8 %]</th>
<td><input name="fax" size="30" maxlength="30" value="[% HTML.escape(fax) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
<td><input name="email" size="45" value="[% HTML.escape(email) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Cc E-mail' | $T8 %]</th>
<td><input name="cc" size="45" value="[% HTML.escape(cc) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Bcc E-mail' | $T8 %]</th>
<td><input name="bcc" size="45" value="[% HTML.escape(bcc) %]"></td>
</tr>
<tr>
<th align="right" nowrap>
[% IF homepage %]<a href="[% HTML.escape(homepage) %]" title="[% 'Open this Website' | $T8 %]" target="_blank">[% 'Homepage' | $T8 %]</a>
[% ELSE %][% 'Homepage' | $T8 %]
[% END %]
</th>
<td><input name="homepage" size="45" title="[% 'Example: http://kivitendo.de' | $T8 %]" value="[% HTML.escape(homepage) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Username' | $T8 %]</th>
<td><input name="username" size="45" value="[% HTML.escape(username) %]"></td>
</tr>
<tr>
<th align="right" nowrap>[% 'Password' | $T8 %]</th>
<td><input name="user_password" size="45" value="[% HTML.escape(user_password) %]"></td>
</tr>
</table>
<table>
<tr>
<th align="right">[% 'Credit Limit' | $T8 %]</th>
<td><input name="creditlimit" size="9" value="[% LxERP.format_amount(creditlimit, 0) %]"></td>
<input type="hidden" name="terms" value="[% HTML.escape(terms) %]">
<th align="right">[% 'Payment Terms' | $T8 %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'payment_id',
DATA = payment_terms,
show_empty = 1,
id_key = 'id',
label_key = 'description',
-%]
</td>
<th align="right">[% 'Discount' | $T8 %]</th>
<td><input name="discount" size="4" value="[% LxERP.format_amount(discount) %]"> %</td>
</tr>
<tr>
<th align="right">[% 'Tax Number / SSN' | $T8 %]</th>
<td><input name="taxnumber" size="20" value="[% HTML.escape(taxnumber) %]"></td>
<!-- Anm.: R&B 15.11.2008 VAT Reg No ist Ust-ID in GB, aber generell sollte es laut Richardson die sales tax id sein -->
<th align="right">[% 'sales tax identification number' | $T8 %]</th>
<td>[% L.input_tag('ustid', ustid, maxlength=14, size=30) %]</td>
[%- IF is_customer %]
<th align="right">[% 'our vendor number at customer' | $T8 %]</th>
<td>[% L.input_tag('c_vendor_id', c_vendor_id, size=30) %]</td>
[%- ELSE %]
<th align="right">[% 'Customer Number' | $T8 %]</th>
<td>[% L.input_tag('v_customer_id', v_customer_id, size=30) %]</td>
[%- END %]
</tr>
<tr>
<th align="right">[% 'Account Number' | $T8 %]</th>
<td>[% L.input_tag('account_number', account_number, size=30) %]</td>
<th align="right">[% 'Bank Code Number' | $T8 %]</th>
<td>[% L.input_tag('bank_code', bank_code, size=30) %]</td>
<th align="right">[% 'Bank' | $T8 %]</th>
<td>[% L.input_tag('bank', bank, size=30) %]</td>
</tr>
<tr>
<th align="right">[% 'IBAN' | $T8 %]</th>
<td>[% L.input_tag('iban', iban, maxlength=100, size=30) %]</td>
<th align="right">[% 'BIC' | $T8 %]</th>
<td>[% L.input_tag('bic', bic, maxlength=100, size=30) %]</td>
[%- IF ALL_CURRENCIES.size %]
<th align="right">[% 'Currency' | $T8 %]</th>
<td>[% L.select_tag('currency', ALL_CURRENCIES, default = currency) %]</td>
[%- END %]
</tr>
<tr>
[% UNLESS INSTANCE_CONF.get_vertreter %]
<th align="right">[% IF is_customer %][% 'Type of Customer' | $T8 %][% ELSE %][% 'Type of Vendor' | $T8 %][%- END %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'business',
DATA = all_business,
show_empty = 1,
id_key = 'id',
label_key = 'description',
-%]
</td>
[%- END %]
<th align="right">[% 'Language' | $T8 %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'language_id',
default = default_language_id,
DATA = languages,
show_empty = 1,
id_key = 'id',
label_key = 'description',
-%]
</td>
<th align="right">[% 'Delivery Terms' | $T8 %]</th>
<td>[% L.select_tag('delivery_term_id', ALL_DELIVERY_TERMS, default = delivery_term_id, with_empty = 1, title_key = 'description') %]</td>
</tr>
<tr>
<td align="right"><label for="obsolete">[% 'Obsolete' | $T8 %]</label></td>
<td><input name="obsolete" id="obsolete" class="checkbox" type="checkbox" value="1" [% IF obsolete %]checked[% END %]></td>
<td align="right"><label for="direct_debit">[% 'direct debit' | $T8 %]</label></td>
<td><input name="direct_debit" id="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
[%- IF is_customer %]
<th align="right">[% 'Preisklasse' | $T8 %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'klass',
DATA = all_pricegroup,
show_empty = 1,
id_key = 'id',
label_key = 'pricegroup',
-%]
</td>
[%- END %]
</tr>
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
<td>
[%- INCLUDE generic/multibox.html
name = 'taxzone_id',
id = 'taxzone_id',
DATA = ALL_TAXZONES,
show_empty = 0,
id_key = 'id',
label_key = 'description',
-%]
</td>
[%- IF is_customer && !INSTANCE_CONF.get_vertreter %]
<th align="right">[% 'Salesman' | $T8 %]</th>
<td>[% L.select_tag('salesman_id', ALL_SALESMEN, default = salesman_id, with_empty = 1, title_key = 'safe_name') %]</td>
[%- END %]
<td>[% 'taxincluded checked' | $T8 %]</td>
<td>[% L.select_tag('taxincluded_checked', [[undef, LxERP.t8('use user config')], ['1', LxERP.t8('Yes')], ['0', LxERP.t8('No')]], default = taxincluded_checked) %]</td>
</tr>
</table>
<table>
<tr>
<th align="left" nowrap>[% 'Internal Notes' | $T8 %]</th>
</tr>
<tr>
<td><textarea name="notes" rows="3" cols="60" wrap="soft">[% HTML.escape(notes) %]</textarea></td>
</tr>
</table>
</div>
<div id="shipto">
[% INCLUDE 'ct/_shipto.html' %]
</div>
<div id="contacts">
[% INCLUDE 'ct/_contact.html' %]
</div>
<div id="deliveries">
<table>
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td colspan="3">
[% L.select_tag('delivery_id', SHIPTO_ALL, value_key = 'shipto_id', title_sub = \shipto_label, with_empty = 1,
onchange = "\$('#delivery').load('ct.pl?action=get_delivery&id=' + \$('#cvid').val() + '&db=' + \$('#db').val() + '&shipto_id=' + this.value)") %]
</td>
</tr>
<tr>
<th align="right" nowrap>[% 'From' | $T8 %]</th>
<td>
[% L.date_tag('from',
from,
onchange => "\$('#delivery').load('ct.pl?action=get_delivery&shipto_id='+ \$('#delivery_id').val() +'&from='+ \$('#from').val() +'&to='+ \$('#to').val() +'&id='+ \$('#cvid').val() +'&db='+ \$('#db').val())")
%]
</td>
<th align="right" nowrap>[% 'To (time)' | $T8 %]</th>
<td>
[% L.date_tag('to',
to,
onchange => "\$('#delivery').load('ct.pl?action=get_delivery&shipto_id='+ \$('#delivery_id').val() +'&from='+ \$('#from').val() +'&to='+ \$('#to').val() +'&id='+ \$('#cvid').val() +'&db='+ \$('#db').val())")
%]
</td>
</tr>
<tr>
<td colspan="4">
<div id="delivery">
</div>
</td>
</tr>
</table>
</div>
<div id="vcnotes">
[%- IF NOTES && NOTES.size %]
<p>
<table>
<tr>
<th class="listheading">[% 'Delete' | $T8 %]</th>
<th class="listheading">[% 'Subject' | $T8 %]</th>
<th class="listheading">[% 'Created on' | $T8 %]</th>
<th class="listheading">[% 'Created by' | $T8 %]</th>
<th class="listheading">[% 'Follow-Up Date' | $T8 %]</th>
<th class="listheading">[% 'Follow-Up for' | $T8 %]</th>
<th class="listheading">[% 'Follow-Up done' | $T8 %]</th>
</tr>
[%- FOREACH row = NOTES %]
<tr class="listrow[% loop.count % 2 %]">
<input type="hidden" name="NOTE_id_[% loop.count %]" value="[% HTML.escape(row.id) %]">
<td>[% UNLESS NOTE_id && (NOTE_id == row.id) %]<input type="checkbox" name="NOTE_delete_[% loop.count %]" value="1">[% END %]</td>
<td><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></td>
<td>[% HTML.escape(row.created_on) %]</td>
<td>[% IF row.created_by_name %][% HTML.escape(row.created_by_name) %][% ELSE %][% HTML.escape(row.created_by_login) %][% END %]</td>
<td>[% HTML.escape(row.follow_up_date) %]</td>
<td>[% IF row.created_for_name %][% HTML.escape(row.created_for_name) %][% ELSE %][% HTML.escape(row.created_for_login) %][% END %]</td>
<td>[% IF row.follow_up_date %][% IF row.follow_up_done %][% 'Yes' | $T8 %][% ELSE %][% 'No' | $T8 %][% END %][% END %]</td>
</tr>
[%- END %]
<input type="hidden" name="NOTES_rowcount" value="[% NOTES.size %]">
</table>
</p>
[%- END %]
<div class="listtop">[% IF NOTE_id %][% 'Edit note' | $T8 %][% ELSE %][% 'Add note' | $T8 %][% END %]</div>
<input type="hidden" name="NOTE_id" value="[% HTML.escape(NOTE_id) %]">
<input type="hidden" name="FU_id" value="[% HTML.escape(FU_id) %]">
<p>
<table>
<tr>
<td valign="right">[% 'Subject' | $T8 %]</td>
<td><input name="NOTE_subject" value="[% HTML.escape(NOTE_subject) %]" size="50"></td>
</tr>
<tr>
<td valign="right" align="top">[% 'Body' | $T8 %]</td>
<td align="top"><textarea cols="50" rows="10" name="NOTE_body">[% HTML.escape(NOTE_body) %]</textarea></td>
</tr>
<tr>
<td valign="right">[% 'Follow-Up On' | $T8 %]</td>
<td>
[% L.date_tag('FU_date', FU_date) %]
[% 'for' | $T8 %]
[% L.select_tag('FU_created_for_user', ALL_EMPLOYEES, default = (FU_created_for_user ? FU_created_for_user : USER.id), title_key='safe_name') %]
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="checkbox" name="FU_done" id="FU_done" value="1"[% IF FU_done %] checked[% END %]>
<label for="FU_done">[% 'Follow-Up done' | $T8 %]</label>
</td>
</tr>
</table>
</p>
</div>
[%- IF CUSTOM_VARIABLES.CT.size %]
<div id="custom_variables">
<p>
<table>
[%- FOREACH var = CUSTOM_VARIABLES.CT %]
<tr>
<td align="right" valign="top">[% HTML.escape(var.description) %]</td>
<td valign="top">[% var.HTML_CODE %]</td>
</tr>
[%- END %]
</table>
</p>
</div>
[%- END %]
</div>
<script type="text/javascript">
<!--
function set_gender(gender) {
var s = document.getElementById('cp_gender');
if (s) {
s.selectedIndex = (gender == 'f') ? 1 : 0;
}
}
-->
</script>
templates/webpages/ct/get_delivery.html
[%- USE T8 %]
[% USE HTML %][% USE LxERP %]
<div id="delivery">
<table width="100%">
<tr>
<td>
<table width="100%">
<tr class="listheading">
<th class="listheading">[% 'Shipping Address' | $T8 %]</th>
<th class="listheading">[% 'Invoice' | $T8 %]</th>
<th class="listheading">[% 'Order' | $T8 %]</th>
<th class="listheading">[% 'Invdate' | $T8 %]</th>
<th class="listheading">[% 'Description' | $T8 %]</th>
<th class="listheading">[% 'Qty' | $T8 %]</th>
<th class="listheading">[% 'Unit' | $T8 %]</th>
[%- IF is_customer %]
<th class="listheading">[% 'Sell Price' | $T8 %]</th>
[%- ELSE %]
<th class="listheading">[% 'Last Cost' | $T8 %]</th>
[%- END %]
</tr>
[%- FOREACH row = DELIVERY %]
[%-
row.script = is_customer ? ( row.invoice ? 'is' : 'ar' )
: ( row.invoice ? 'ir' : 'ap' )
-%]
<tr class="listrow[% loop.count % 2 %]">
<td>[% HTML.escape(row.shiptoname) UNLESS loop.prev.shiptoname == row.shiptoname %]&nbsp;</td>
<td>[% IF row.id %]<a href='[% row.script %].pl?action=edit&id=[% HTML.escape(row.id) %]'>[% END %][% HTML.escape(row.invnumber) || '&nbsp;' %][% IF row.id %]</a>[% END %]</td>
<td>[% IF row.oe_id %]<a href='oe.pl?action=edit&type=[% IF is_customer %]sales_order[% ELSE %]purchase_order[% END %]&vc=customer&id=[% HTML.escape(row.oe_id) %]'>[% END %][% HTML.escape(row.ordnumber) || '&nbsp;' %][% IF row.oe_id %]</a>[% END %]</td>
<td>[% HTML.escape(row.transdate) || '&nbsp;' %]</td>
<td>[% HTML.escape(row.description) || '&nbsp;' %]</td>
<td>[% HTML.escape(row.qty) || '&nbsp;' %]</td>
<td>[% HTML.escape(row.unit) || '&nbsp;' %]</td>
<td>[% LxERP.format_amount(row.sellprice, 2) || '&nbsp;' %]</td>
</tr>
[%- END %]
</table>
[%- IF DELIVERY.size == 15 %]
<p>[% 'This list is capped at 15 items to keep it fast. If you need a full list, please use reports.' | $T8 %]</p>
[%- END %]
</div>
templates/webpages/ct/testpage.html
[% USE L %]
[% USE T8 %]
[% USE LxERP %]
[% L.javascript_tag('jquery-ui') %]
<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.12.custom.css" type="text/css" />
<p>Pick a customer</p>
id: [% L.input_tag('customer_id', '') %]
nr: [% L.input_tag('customer_customernumber', '') %]
desc: [% L.input_tag('customer_name', '') %]
<script type='text/javascript'>
function autocomplete_customer (selector, column) {
$(function(){ $(selector).autocomplete({
source: function(req, rsp) {
$.ajax({
url: 'controller.pl?action=Customer/ajax_autocomplete',
dataType: "json",
data: {
column: column,
term: req.term,
current: function() { $('#customer_id').val() },
obsolete: 0,
},
success: function (data){ rsp(data) }
});
},
limit: 20,
delay: 50,
select: function(event, ui) {
$('#customer_id').val(ui.item.id);
$('#customer_customernumber').val(ui.item.customernumber);
$('#customer_name').val(ui.item.name);
},
})});
}
//autocomplete_customer('#customer_customernumber', 'customernumber');
autocomplete_customer('#customer_name', '');
</script>

Auch abrufbar als: Unified diff