From df005c490a2d6a9b7e50ea44fc7557e39ce7d6ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 22 May 2009 14:22:01 +0000 Subject: [PATCH] =?utf8?q?Templatebasierte=20OE=20Suche=20=C3=BCbernommen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 3 +- bin/mozilla/oe.pl | 306 +++-------------------- locale/de/all | 1 + locale/de/login | 3 +- locale/de/oe | 3 +- locale/de/todo | 3 +- templates/webpages/oe/search_de.html | 243 ++++++++++++++++++ templates/webpages/oe/search_master.html | 243 ++++++++++++++++++ 8 files changed, 533 insertions(+), 272 deletions(-) create mode 100644 templates/webpages/oe/search_de.html create mode 100644 templates/webpages/oe/search_master.html diff --git a/SL/OE.pm b/SL/OE.pm index d3b1313cc..9adbee2eb 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -83,7 +83,8 @@ sub transactions { qq|WHERE (o.quotation = ?) |; push(@values, $quotation); - my ($null, $department_id) = split /--/, $form->{department}; + my ($null, $split_department_id) = split /--/, $form->{department}; + my $department_id = $form->{department_id} || $split_department_id; if ($department_id) { $query .= qq| AND o.department_id = ?|; push(@values, $department_id); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 656abcb5f..f8c47918a 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -507,8 +507,8 @@ sub update { my $rows = scalar @{ $form->{item_list} }; # hier ist das problem fuer bug 817 $form->{discount} wird nicht durchgeschliffen - # ferner fallunterscheidung fuer verkauf oder einkauf s.a. bug 736 jb 04.05.2009 - # select discount as vendor_discount from vendor || + # ferner fallunterscheidung fuer verkauf oder einkauf s.a. bug 736 jb 04.05.2009 + # select discount as vendor_discount from vendor || # select discount as customer_discount from customer $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"$form->{vc}_discount"} * 100); @@ -588,274 +588,50 @@ sub search { check_oe_access(); if ($form->{type} eq 'purchase_order') { - $form->{title} = $locale->text('Purchase Orders'); - $form->{vc} = 'vendor'; - $ordlabel = $locale->text('Order Number'); - $ordnumber = 'ordnumber'; - $employee = $locale->text('Employee'); - } + $form->{vc} = 'vendor'; + $form->{ordnrname} = 'ordnumber'; + $form->{title} = $locale->text('Purchase Orders'); + $form->{ordlabel} = $locale->text('Order Number'); + + } elsif ($form->{type} eq 'request_quotation') { + $form->{vc} = 'vendor'; + $form->{ordnrname} = 'quonumber'; + $form->{title} = $locale->text('Request for Quotations'); + $form->{ordlabel} = $locale->text('RFQ Number'); + + } elsif ($form->{type} eq 'sales_order') { + $form->{vc} = 'customer'; + $form->{ordnrname} = 'ordnumber'; + $form->{title} = $locale->text('Sales Orders'); + $form->{ordlabel} = $locale->text('Order Number'); + + } elsif ($form->{type} eq 'sales_quotation') { + $form->{vc} = 'customer'; + $form->{ordnrname} = 'quonumber'; + $form->{title} = $locale->text('Quotations'); + $form->{ordlabel} = $locale->text('Quotation Number'); - if ($form->{type} eq 'request_quotation') { - $form->{title} = $locale->text('Request for Quotations'); - $form->{vc} = 'vendor'; - $ordlabel = $locale->text('RFQ Number'); - $ordnumber = 'quonumber'; - $employee = $locale->text('Employee'); - } - - if ($form->{type} eq 'sales_order') { - $form->{title} = $locale->text('Sales Orders'); - $form->{vc} = 'customer'; - $ordlabel = $locale->text('Order Number'); - $ordnumber = 'ordnumber'; - $employee = $locale->text('Employee'); - } - - if ($form->{type} eq 'sales_quotation') { - $form->{title} = $locale->text('Quotations'); - $form->{vc} = 'customer'; - $ordlabel = $locale->text('Quotation Number'); - $ordnumber = 'quonumber'; - $employee = $locale->text('Employee'); - } - - # setup vendor / customer selection - $form->all_vc(\%myconfig, $form->{vc}, - ($form->{vc} eq 'customer') ? "AR" : "AP"); - - # departments - if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "\n" - } (@{ $form->{all_departments} }); - } - - $department = qq| - - | . $locale->text('Department') . qq| - - -| if $form->{selectdepartment}; - - my $delivered; - if (($form->{"type"} eq "sales_order") || - ($form->{"type"} eq "purchase_order")) { - $delivered = qq| - - - - - - -|; - } - - # use JavaScript Calendar or not - $form->{jsscript} = 1; - $jsscript = ""; - - $button1 = qq| - - text('button') . qq|> - |; - $button2 = qq| - - text('button') . qq|> - |; - $button3 = qq| - - text('button') . qq|> - |; - $button4 = qq| - - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "4", "transdatefrom", "BR", "trigger3", - "transdateto", "BL", "trigger4", - "reqdatefrom", "BR", "trigger5", "reqdateto", "BL", "trigger6"); - - my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; - - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 1 }, - "employees" => "ALL_EMPLOYEES", - "salesmen" => "ALL_SALESMEN", - $vc => "ALL_" . uc($vc) - ); - - my %labels = (); - my @values = (""); - foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"projectnumber"}; - } - my $projectnumber = - NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values, - '-labels' => \%labels)); - - #employees - %labels = (); - @values = (""); - foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; - } - - #salesmen - my %labels_salesmen = (); - my @values_salesmen = (''); - foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { - push(@values_salesmen, $item->{"id"}); - $labels_salesmen{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; - } - - my $employee_block = qq| - - | . $locale->text('Employee') . qq| - | . NTI($cgi->popup_menu('-name' => 'employee_id', '-values' => \@values, '-labels' => \%labels)) . qq| - - - | . $locale->text('Salesman') . qq| - | . - NTI($cgi->popup_menu('-name' => 'salesman_id', - '-values' => \@values_salesmen, - '-labels' => \%labels_salesmen)) . qq| - - |; - - %labels = (); - @values = (""); - - foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) { - push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; + } else { + $form->show_generic_error($locale->text('oe.pl::search called with unknown type'), back_button => 1); } - my $vc_label = $form->{vc} eq "customer" ? $locale->text('Customer') : $locale->text('Vendor'); - $vc = - $myconfig{vclimit} <= scalar(@values) - ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">| - : NTI($cgi->popup_menu('-name' => "$form->{vc}", - '-default' => $form->{"old$form->{vc}"}, - '-onChange' => 'document.getElementById(\'update_button\').click();', - '-values' => \@values, - '-labels' => \%labels)); - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - -
$form->{title}
- - - - - -$department - - - - -$employee_block - - - - - - - - - - $button1 - $button2 - - - - $button3 - $button4 - - - - - - -
$vc_label$vc
$ordlabel
| . $locale->text('Transaction description') . qq|
| . $locale->text("Project Number") . qq|$projectnumber
| . $locale->text('Order Date') . " " . $locale->text('From') . qq|| . $locale->text('Bis') . qq|
| . $locale->text('Delivery Date') . " " . $locale->text('From') . qq|| . $locale->text('Bis') . qq|
| . $locale->text('Include in Report') . qq| - - - - - - $delivered - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| . $locale->text('ID') . qq| $ordlabel
| . $locale->text('Date') . qq| | . $locale->text('Required by') . qq|
$vc_label $employee | . $locale->text('Ship via') . qq|
| . $locale->text('Amount') . qq| | . $locale->text('Tax') . qq| | . $locale->text('Total') . qq|
| . $locale->text('Ertrag') . qq| | . $locale->text('Ertrag prozentual') . qq|
| . $locale->text('Project Number') . qq| | . $locale->text('Transaction description') . qq|
| . $locale->text('Subtotal') . qq| | . $locale->text('Salesman') . qq|
-
-

- -$jsscript - -
- -{vc}> -{type}> + # setup vendor / customer data + $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", + "departments" => "ALL_DEPARTMENTS", + "$form->{vc}s" => "ALL_VC"); + + # constants and subs for template + $form->{jsscript} = 1; + $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} }; + $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; + $form->{salesman_labels} = $form->{employee_labels}; - -
+ $form->header(); - - -|; + print $form->parse_html_template('oe/search'); $lxdebug->leave_sub(); } diff --git a/locale/de/all b/locale/de/all index 8450cb793..f0ff96b73 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1835,6 +1835,7 @@ $self->{texts} = { 'not transferred in yet' => 'noch nicht eingelagert', 'not transferred out yet' => 'noch nicht ausgelagert', 'number' => 'Nummer', + 'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen', 'order' => 'Reihenfolge', 'our vendor number at customer' => 'unsere Lieferanten-Nr. beim Kunden', 'packing_list' => 'Versandliste', diff --git a/locale/de/login b/locale/de/login index b3857df7a..f04ac78c1 100644 --- a/locale/de/login +++ b/locale/de/login @@ -168,7 +168,6 @@ $self->{texts} = { 'History' => 'Historie', 'ID' => 'Buchungsnummer', 'In-line' => 'im Text', - 'Include in Report' => 'In Bericht aufnehmen', 'Incorrect Password!' => 'Ungültiges Passwort!', 'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!', 'Invalid follow-up ID.' => 'Ungültige Wiedervorlage-ID.', @@ -369,7 +368,6 @@ $self->{texts} = { 'Zipcode' => 'PLZ', '[email]' => '[email]', 'bin_list' => 'Lagerliste', - 'button' => '?', 'chargenumber #1' => 'Chargennummer #1', 'config/authentication.pl: Key "DB_config" is missing.' => 'config/authentication.pl: Das Schlüsselwort "DB_config" fehlt.', 'config/authentication.pl: Key "LDAP_config" is missing.' => 'config/authentication.pl: Der Schlüssel "LDAP_config" fehlt.', @@ -382,6 +380,7 @@ $self->{texts} = { 'no' => 'nein', 'no chargenumber' => 'keine Chargennummer', 'none (pricegroup)' => 'keine', + 'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen', 'packing_list' => 'Versandliste', 'pick_list' => 'Entnahmeliste', 'proforma' => 'Proforma', diff --git a/locale/de/oe b/locale/de/oe index 86a14a548..00d93f6c8 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -153,7 +153,6 @@ $self->{texts} = { 'History' => 'Historie', 'ID' => 'Buchungsnummer', 'In-line' => 'im Text', - 'Include in Report' => 'In Bericht aufnehmen', 'Invoice' => 'Rechnung', 'Invoice Date missing!' => 'Rechnungsdatum fehlt!', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', @@ -338,7 +337,6 @@ $self->{texts} = { 'Zipcode' => 'PLZ', '[email]' => '[email]', 'bin_list' => 'Lagerliste', - 'button' => '?', 'chargenumber #1' => 'Chargennummer #1', 'config/authentication.pl: Key "DB_config" is missing.' => 'config/authentication.pl: Das Schlüsselwort "DB_config" fehlt.', 'config/authentication.pl: Key "LDAP_config" is missing.' => 'config/authentication.pl: Der Schlüssel "LDAP_config" fehlt.', @@ -350,6 +348,7 @@ $self->{texts} = { 'no' => 'nein', 'no chargenumber' => 'keine Chargennummer', 'none (pricegroup)' => 'keine', + 'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen', 'packing_list' => 'Versandliste', 'pick_list' => 'Entnahmeliste', 'proforma' => 'Proforma', diff --git a/locale/de/todo b/locale/de/todo index fdce5d978..df26d0500 100644 --- a/locale/de/todo +++ b/locale/de/todo @@ -167,7 +167,6 @@ $self->{texts} = { 'History' => 'Historie', 'ID' => 'Buchungsnummer', 'In-line' => 'im Text', - 'Include in Report' => 'In Bericht aufnehmen', 'Invalid follow-up ID.' => 'Ungültige Wiedervorlage-ID.', 'Invoice' => 'Rechnung', 'Invoice Date missing!' => 'Rechnungsdatum fehlt!', @@ -362,7 +361,6 @@ $self->{texts} = { 'Zipcode' => 'PLZ', '[email]' => '[email]', 'bin_list' => 'Lagerliste', - 'button' => '?', 'chargenumber #1' => 'Chargennummer #1', 'config/authentication.pl: Key "DB_config" is missing.' => 'config/authentication.pl: Das Schlüsselwort "DB_config" fehlt.', 'config/authentication.pl: Key "LDAP_config" is missing.' => 'config/authentication.pl: Der Schlüssel "LDAP_config" fehlt.', @@ -375,6 +373,7 @@ $self->{texts} = { 'no' => 'nein', 'no chargenumber' => 'keine Chargennummer', 'none (pricegroup)' => 'keine', + 'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen', 'packing_list' => 'Versandliste', 'pick_list' => 'Entnahmeliste', 'proforma' => 'Proforma', diff --git a/templates/webpages/oe/search_de.html b/templates/webpages/oe/search_de.html new file mode 100644 index 000000000..e0efc080d --- /dev/null +++ b/templates/webpages/oe/search_de.html @@ -0,0 +1,243 @@ +[%- USE HTML %] +[%- SET vclabel = vc == 'customer' ? 'Kunde' : 'Lieferant' %] + + +
+ +

[% HTML.escape(title) %]

+ + + + + +
+ + + + + +[%- IF ALL_DEPARTMENTS.size %] + + + + +[%- END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% HTML.escape(vclabel) %] + [%- INCLUDE 'generic/multibox.html' + name = vc, + default = vc == 'customer' ? oldcustomer : oldvendor, + style = 'width: 250px', + DATA = ALL_VC, + id_sub = 'vc_keys', + label_key = 'name', + select = vc_select, + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
Abteilung + [%- INCLUDE 'generic/multibox.html' + name = 'department_id', + style = 'width: 250px', + DATA = ALL_DEPARTMENTS, + id_key = 'id', + label_key = 'description', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
[% HTML.escape(ordlabel) %]
Bearbeiter + [%- INCLUDE 'generic/multibox.html' + name = 'employee_id', + style = 'width: 250px', + DATA = ALL_EMPLOYEES, + id_key = 'id', + label_sub = 'employee_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + default = ' ', + -%] +
Verkäufer/in + [%- INCLUDE 'generic/multibox.html' + name = 'salesman_id', + style = 'width: 250px', + DATA = ALL_SALESMEN, + id_key = 'id', + label_sub = 'salesman_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
Vorgangsbezeichnung
Projektnummer + [%- INCLUDE 'generic/multibox.html' + name = 'project_id', + style = "width: 250px", + DATA = ALL_PROJECTS, + id_key = 'id', + label_key = 'projectnumber', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
Von + + + bis + + +
In Bericht aufnehmen + + + + + +[%- IF type == 'sales_order' OR type == 'purchase_order' %] + + + + +[%- END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[%- IF type == 'sales_order' %] + +[%- END %] +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

+
+
+ + + +
+ + + + +
+ + + diff --git a/templates/webpages/oe/search_master.html b/templates/webpages/oe/search_master.html new file mode 100644 index 000000000..393632833 --- /dev/null +++ b/templates/webpages/oe/search_master.html @@ -0,0 +1,243 @@ +[%- USE HTML %] +[%- SET vclabel = vc == 'customer' ? 'Customer' : 'Vendor' %] + + +
+ +

[% HTML.escape(title) %]

+ + + + + +
+ + + + + +[%- IF ALL_DEPARTMENTS.size %] + + + + +[%- END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% HTML.escape(vclabel) %] + [%- INCLUDE 'generic/multibox.html' + name = vc, + default = vc == 'customer' ? oldcustomer : oldvendor, + style = 'width: 250px', + DATA = ALL_VC, + id_sub = 'vc_keys', + label_key = 'name', + select = vc_select, + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
Department + [%- INCLUDE 'generic/multibox.html' + name = 'department_id', + style = 'width: 250px', + DATA = ALL_DEPARTMENTS, + id_key = 'id', + label_key = 'description', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
[% HTML.escape(ordlabel) %]
Employee + [%- INCLUDE 'generic/multibox.html' + name = 'employee_id', + style = 'width: 250px', + DATA = ALL_EMPLOYEES, + id_key = 'id', + label_sub = 'employee_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + default = ' ', + -%] +
Salesman + [%- INCLUDE 'generic/multibox.html' + name = 'salesman_id', + style = 'width: 250px', + DATA = ALL_SALESMEN, + id_key = 'id', + label_sub = 'salesman_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
Transaction description
Project Number + [%- INCLUDE 'generic/multibox.html' + name = 'project_id', + style = "width: 250px", + DATA = ALL_PROJECTS, + id_key = 'id', + label_key = 'projectnumber', + limit = vclimit, + show_empty = 1, + allow_textbox = 1, + -%] +
From + + + Bis + + +
Include in Report + + + + + +[%- IF type == 'sales_order' OR type == 'purchase_order' %] + + + + +[%- END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[%- IF type == 'sales_order' %] + +[%- END %] +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

+
+
+ + + +
+ + + + +
+ + + -- 2.20.1