Helper-Klasse für Konsistenz-Checks
[kivitendo-erp.git] / SL / CT.pm
index 66b3e25..cae50f0 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -42,6 +42,7 @@ use Data::Dumper;
 use SL::Common;
 use SL::CVar;
 use SL::DBUtils;
+use SL::DB::Default;
 use SL::FU;
 use SL::Notes;
 use SL::TransNumber;
@@ -633,6 +634,7 @@ sub search {
       "zipcode"            => "ct.zipcode",
       "city"               => "ct.city",
       "country"            => "ct.country",
+      "discount"           => "ct.discount",
       "salesman"           => "e.name"
     );
 
@@ -648,7 +650,7 @@ sub search {
   }
   my $sortdir   = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
 
-  if ($sortorder !~ /(business|id)/ && !$join_records) {
+  if ($sortorder !~ /(business|id|discount)/ && !$join_records) {
     $sortorder  = "lower($sortorder) ${sortdir}";
   } else {
     $sortorder .= " ${sortdir}";
@@ -1080,6 +1082,10 @@ sub parse_excel_file {
   my ($self, $myconfig, $form) = @_;
   my $locale = $main::locale;
 
+  my $defaults = SL::DB::Default->get;
+  $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+  $form->{templates} = $defaults->templates;
+
   $form->{formname}   = 'sales_quotation';
   $form->{type}   = 'sales_quotation';
   $form->{format} = 'excel';
@@ -1122,8 +1128,6 @@ sub parse_excel_file {
 
   $form->{notes} =~ s/^\s+//g;
 
-  $form->{templates} = $myconfig->{templates};
-
   delete $form->{printer_command};
 
   $form->get_employee_info($myconfig);