From c4409bf66a835166b3a50c0de9c5bdedbb5b5c69 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jan=20B=C3=BCren?=
Date: Sat, 30 Sep 2017 09:45:08 +0200
Subject: [PATCH] =?utf8?q?Filter=20nach=20Namen=20f=C3=BCr=20Buchungsvorla?=
=?utf8?q?gen=20implementiert?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
Hintergrund: Nachdem einige Vorlagen erstellt worden sind,
ist der Standard-Fall nicht mehr Anlegen oder Ãndern, sondern
Suchen und Buchen. Entsprechend den Focus auch auf das Suchfeld gesetzt.
---
SL/Controller/RecordTemplate.pm | 21 ++++++++++++++++---
locale/de/all | 1 +
.../webpages/record_template/dialog.html | 10 +++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/SL/Controller/RecordTemplate.pm b/SL/Controller/RecordTemplate.pm
index a349378f9..9ce8e152c 100644
--- a/SL/Controller/RecordTemplate.pm
+++ b/SL/Controller/RecordTemplate.pm
@@ -52,7 +52,7 @@ sub action_show_dialog {
title => t8('Record templates'),
},
})
- ->focus("#record_template_dialog_new_template_name")
+ ->focus("#template_filter")
->render;
}
@@ -84,6 +84,20 @@ sub action_delete {
->render;
}
+sub action_filter_templates {
+ my ($self) = @_;
+
+ $self->{template_filter} = $::form->{template_filter};
+
+ $self
+ ->js
+ ->html('#record_template_dialog', $self->dialog_html)
+ ->focus("#record_template_dialog_new_template_name")
+ ->reinit_widgets
+ ->focus("#template_filter")
+ ->render();
+}
+
#
# helpers
#
@@ -98,9 +112,10 @@ sub init_template { SL::DB::RecordTemplate->new(id => $::form->{id})->load
sub init_templates {
my ($self) = @_;
-
return scalar SL::DB::Manager::RecordTemplate->get_all_sorted(
- where => [ template_type => $self->template_type ],
+ where => [ template_type => $self->template_type,
+ (template_name => { ilike => '%' . $::form->{template_filter} . '%' })x!! ($::form->{template_filter})
+ ],
);
}
diff --git a/locale/de/all b/locale/de/all
index 181141fd2..4c2ff465f 100755
--- a/locale/de/all
+++ b/locale/de/all
@@ -1371,6 +1371,7 @@ $self->{texts} = {
'Filter for customer variables' => 'Filter für benutzerdefinierte Kundenvariablen',
'Filter for item variables' => 'Filter für benutzerdefinierte Artikelvariablen',
'Filter parts' => 'Artikel filtern',
+ 'Filter record template' => 'Filter für Buchungsvorlagen',
'Financial Controlling' => 'Finanzcontrolling',
'Financial Controlling Report' => 'Finanzcontrollingbericht',
'Financial Overview' => 'Finanzübersicht',
diff --git a/templates/webpages/record_template/dialog.html b/templates/webpages/record_template/dialog.html
index 4131b9bb5..d51a72b95 100644
--- a/templates/webpages/record_template/dialog.html
+++ b/templates/webpages/record_template/dialog.html
@@ -17,6 +17,16 @@
[% L.button_tag("kivi.RecordTemplate.create()", LxERP.t8("Save")) %]
+[% LxERP.t8("Filter record template") %]
+
+
+
+
[% SET templates = SELF.templates.as_list %]
[% IF templates.size %]
--
2.20.1