From 2ff471a7b78c1085bbc0adff525fbf589127d819 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 26 Mar 2007 08:27:24 +0000 Subject: [PATCH] =?utf8?q?Speichern=20und=20Anzeigen=20eines=20Verk=C3=A4u?= =?utf8?q?fers=20bei=20Verkaufsmasken.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 2 +- SL/IS.pm | 6 ++++-- SL/OE.pm | 3 ++- bin/mozilla/is.pl | 24 ++++++++++++++++++++++-- bin/mozilla/oe.pl | 29 ++++++++++++++++++++++++++++- locale/de/is | 1 + locale/de/oe | 1 + sql/Pg-upgrade2/oe_is_salesman.sql | 7 +++++++ 8 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 sql/Pg-upgrade2/oe_is_salesman.sql diff --git a/SL/Form.pm b/SL/Form.pm index e1ea94174..3f1e877d2 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1707,7 +1707,7 @@ sub all_vc { # build selection list if ($count < $myconfig->{vclimit}) { - $query = qq|SELECT id, name + $query = qq|SELECT id, name, salesman_id FROM $table WHERE not obsolete ORDER BY name|; $sth = $dbh->prepare($query); diff --git a/SL/IS.pm b/SL/IS.pm index 6c0f71b10..cd90a8578 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1050,6 +1050,7 @@ Message: $form->{message}\r| if $form->{message}; delivery_customer_id = $form->{delivery_customer_id}, delivery_vendor_id = $form->{delivery_vendor_id}, employee_id = $form->{employee_id}, + salesman_id = | . conv_i($form->{salesman_id}, 'NULL') . qq|, storno = '$form->{storno}', globalproject_id = | . conv_i($form->{"globalproject_id"}, 'NULL') . qq|, cp_id = | . conv_i($form->{"cp_id"}, 'NULL') . qq| @@ -1482,7 +1483,7 @@ sub retrieve_invoice { a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate, a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id, a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id, - a.employee_id, e.name AS employee, a.payment_id, a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type + a.employee_id, e.name AS employee, a.salesman_id, a.payment_id, a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type FROM ar a LEFT JOIN employee e ON (e.id = a.employee_id) WHERE a.id = $form->{id}|; @@ -1685,7 +1686,8 @@ sub get_customer { c.email, c.cc, c.bcc, c.language_id, c.payment_id AS customer_payment_id, c.street, c.zipcode, c.city, c.country, $duedate + COALESCE(pt.terms_netto, 0) AS duedate, c.notes AS intnotes, - b.discount AS tradediscount, b.description AS business, c.klass as customer_klass, c.taxzone_id + b.discount AS tradediscount, b.description AS business, c.klass as customer_klass, c.taxzone_id, + c.salesman_id FROM customer c LEFT JOIN business b ON (b.id = c.business_id) LEFT JOIN payment_terms pt ON c.payment_id = pt.id diff --git a/SL/OE.pm b/SL/OE.pm index 27f57f99a..f9bcd342f 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -447,6 +447,7 @@ Message: $form->{message}\r| if $form->{message}; delivery_customer_id = $form->{delivery_customer_id}, globalproject_id = | . conv_i($form->{"globalproject_id"}, 'NULL') . qq|, employee_id = $form->{employee_id}, + salesman_id = | . conv_i($form->{salesman_id}, 'NULL') . qq|, cp_id = | . conv_i($form->{cp_id}, 'NULL') . qq| WHERE id = $form->{id}|; $dbh->do($query) || $form->dberror($query); @@ -677,7 +678,7 @@ sub retrieve { # it will be killed out and then has to be fetched from the item scope query further down $query = qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate, o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, - o.curr AS currency, e.name AS employee, o.employee_id, + o.curr AS currency, e.name AS employee, o.employee_id, o.salesman_id, o.$form->{vc}_id, cv.name AS $form->{vc}, o.amount AS invtotal, o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber, d.description AS department, o.payment_id, o.language_id, o.taxzone_id, diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 85e03c150..bf64bb612 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -121,6 +121,7 @@ sub invoice_links { if ($form->{all_customer}) { unless ($form->{customer_id}) { $form->{customer_id} = $form->{all_customer}->[0]->{id}; + $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id}; } } @@ -367,7 +368,8 @@ sub form_header { "shipto" => "ALL_SHIPTO", "projects" => { "key" => "ALL_PROJECTS", "all" => 0, - "old_id" => \@old_project_ids }); + "old_id" => \@old_project_ids }, + "employees" => "ALL_SALESMEN"); my (%labels, @values); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { @@ -405,6 +407,22 @@ sub form_header { '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); + %labels = (); + @values = (""); + foreach my $item (@{ $form->{ALL_SALESMEN} }) { + push(@values, $item->{id}); + $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; + } + + $salesman = + qq| + | . $locale->text('Salesman') . qq| + | . + NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id}, + '-values' => \@values, '-labels' => \%labels)) + . qq| + |; + # set option selected foreach $item (qw(AR customer currency department employee)) { $form->{"select$item"} =~ s/ selected//; @@ -717,7 +735,9 @@ print qq| - |; + + $salesman +|; if ($form->{type} eq "credit_note") { print qq| | . $locale->text('Credit Note Number') . qq| diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index be1428672..7d42d8216 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -167,6 +167,8 @@ sub order_links { # set jscalendar $form->{jscalendar} = $jscalendar; + my $editing = $form->{id}; + OE->retrieve(\%myconfig, \%$form); if ($form->{payment_id}) { @@ -179,6 +181,8 @@ sub order_links { $taxzone_id = $form->{taxzone_id}; } + $salesman_id = $form->{salesman_id} if ($editing); + # if multiple rowcounts (== collective order) then check if the # there were more than one customer (in that case OE::retrieve removes @@ -282,6 +286,8 @@ sub order_links { # forex $form->{forex} = $form->{exchangerate}; + $form->{salesman_id} = $salesman_id if ($editing); + $lxdebug->leave_sub(); } @@ -418,7 +424,8 @@ sub form_header { "shipto" => "ALL_SHIPTO", "projects" => { "key" => "ALL_PROJECTS", "all" => 0, - "old_id" => \@old_project_ids }); + "old_id" => \@old_project_ids }, + "employees" => "ALL_SALESMEN"); my (%labels, @values); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { @@ -456,6 +463,25 @@ sub form_header { '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); + $salesman = ""; + if ($form->{type} =~ /^sales_/) { + %labels = (); + @values = (""); + foreach my $item (@{ $form->{ALL_SALESMEN} }) { + push(@values, $item->{id}); + $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; + } + + $salesman = + qq| + | . $locale->text('Salesman') . qq| + | . + NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id}, + '-values' => \@values, '-labels' => \%labels)) + . qq| + |; + } + $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -803,6 +829,7 @@ print qq| $openclosed $employee + $salesman $ordnumber diff --git a/locale/de/is b/locale/de/is index 7d1e0060f..e3f858e65 100644 --- a/locale/de/is +++ b/locale/de/is @@ -190,6 +190,7 @@ $self->{texts} = { 'SAVED FOR DUNNING' => 'Gespeichert', 'SCREENED' => 'Angezeigt', 'Sales Order' => 'Kundenauftrag', + 'Salesman' => 'Verkäufer/in', 'Save draft' => 'Entwurf speichern', 'Screen' => 'Bildschirm', 'Select a Customer' => 'Endkunde auswählen', diff --git a/locale/de/oe b/locale/de/oe index 115ad874c..e025858bd 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -193,6 +193,7 @@ $self->{texts} = { 'SCREENED' => 'Angezeigt', 'Sales Order' => 'Kundenauftrag', 'Sales Orders' => 'Aufträge', + 'Salesman' => 'Verkäufer/in', 'Save' => 'Speichern', 'Save and Close' => 'Speichern und schließen', 'Save as new' => 'als neu speichern', diff --git a/sql/Pg-upgrade2/oe_is_salesman.sql b/sql/Pg-upgrade2/oe_is_salesman.sql new file mode 100644 index 000000000..c994d730c --- /dev/null +++ b/sql/Pg-upgrade2/oe_is_salesman.sql @@ -0,0 +1,7 @@ +-- @tag: oe_is_salesman +-- @description: Speichern eines Verkäufers bei Angeboten und Ausgangsrechnungen +-- @depends: release_2_4_1 +ALTER TABLE oe ADD COLUMN salesman_id integer; +ALTER TABLE oe ADD FOREIGN KEY (salesman_id) REFERENCES employee (id); +ALTER TABLE ar ADD COLUMN salesman_id integer; +ALTER TABLE ar ADD FOREIGN KEY (salesman_id) REFERENCES employee (id); -- 2.20.1
| . $locale->text('Project Number') . qq|