$auth->assert('customer_vendor_edit');
- $form->{title} = "Add";
-
- $form->{callback} =
- "$form->{script}?action=add&db=$form->{db}"
- unless $form->{callback};
+ $form->{title} = "Add";
+ $form->{callback} = "$form->{script}?action=add&db=$form->{db}" unless $form->{callback};
CT->populate_drop_down_boxes(\%myconfig, \%$form);
$form->{IS_CUSTOMER} = $form->{db} eq 'customer';
+ report_generator_set_default_sort('name', 1);
+
CT->search(\%myconfig, \%$form);
my $cvar_configs = CVar->get_configs('module' => 'CT');
my @hidden_variables = (qw(db status obsolete), map { "l_$_" } @columns);
my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
my $callback = build_std_url('action=list_names', grep { $form->{$_} } @hidden_variables);
- $form->{callback} = "$callback&sort=" . E($form->{sort});
+ $form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir});
- map { $column_defs{$_}->{link} = "${callback}&sort=${_}" } @columns;
+ foreach (@columns) {
+ my $sortdir = $form->{sort} eq $_ ? 1 - $form->{sortdir} : $form->{sortdir};
+ $column_defs{$_}->{link} = "${callback}&sort=${_}&sortdir=${sortdir}";
+ }
my ($ordertype, $quotationtype, $attachment_basename);
if ($form->{IS_CUSTOMER}) {
$report->set_export_options('list_names', @hidden_variables);
- $report->set_sort_indicator($form->{sort}, 1);
+ $report->set_sort_indicator($form->{sort}, $form->{sortdir});
CVar->add_custom_variables_to_report('module' => 'CT',
'trans_id_field' => 'id',
CT->get_contact(\%myconfig, \%$form);
print $cgi->header(), join '__pjx__', map $form->{"cp_$_"},
- qw(name greeting title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday);
+ qw(name greeting title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used);
$lxdebug->leave_sub();
}
CT->get_shipto(\%myconfig, \%$form);
print $cgi->header(), join '__pjx__', map $form->{"shipto$_"},
- qw(name department_1 department_2 street zipcode city country contact phone fax email);
+ qw(name department_1 department_2 street zipcode city country contact phone fax email used);
$lxdebug->leave_sub();
}
$lxdebug->leave_sub();
}
+sub delete_shipto {
+ $main::lxdebug->enter_sub();
+
+ $auth->assert('customer_vendor_edit');
+
+ CT->get_shipto(\%myconfig, \%$form);
+
+ unless ($form->{shiptoused}) {
+ CT->delete_shipto($form->{shipto_id});
+ @$form{ grep /^shipto/, keys %$form } = undef;
+ }
+
+ edit();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub delete_contact {
+ $main::lxdebug->enter_sub();
+
+ $auth->assert('customer_vendor_edit');
+
+ CT->get_contact(\%myconfig, \%$form);
+
+ unless ($form->{cp_used}) {
+ CT->delete_shipto($form->{cp_id});
+ @$form{ grep /^cp_/, keys %$form } = undef;
+ }
+
+ edit();
+
+ $main::lxdebug->leave_sub();
+}
+
sub continue { call_sub($form->{nextsub}); }