From: Jan Büren Date: Mon, 11 May 2009 20:18:47 +0000 (+0000) Subject: Backport von Revision 7581 von XPlace. Hintergrund: Hersteller und Modell sind derzei... X-Git-Tag: release-2.6.0rc1~89 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4bbf708cfb8324cbad57b0a379d0489124aad132;p=kivitendo-erp.git Backport von Revision 7581 von XPlace. Hintergrund: Hersteller und Modell sind derzeit Freitextfelder, in der Regel möchte man Lieferanten und die entsprechenden Lieferanten-Art.-Nr. abbilden. Am liebsten noch mit Lieferanten-Art-Preis. Dazu vielleicht nach der 2.6 mehr --- diff --git a/SL/CT.pm b/SL/CT.pm index f2745fb02..79169b5d2 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -123,7 +123,14 @@ sub get_tuple { } # check if it is orphaned - my $arap = ( $form->{db} eq 'customer' ) ? "ar" : "ap"; + my $arap = ( $form->{db} eq 'customer' ) ? "ar" : "ap"; + my $num_args = 2; + my $makemodel = ''; + if ($form->{db} eq 'vendor') { + $makemodel = qq| UNION SELECT mm.make FROM makemodel mm WHERE mm.make = ?|; + $num_args++; + } + $query = qq|SELECT a.id | . qq|FROM $arap a | . @@ -133,8 +140,10 @@ sub get_tuple { qq|SELECT a.id | . qq|FROM oe a | . qq|JOIN $cv ct ON (a.${cv}_id = ct.id) | . - qq|WHERE ct.id = ?|; - my ($dummy) = selectrow_query($form, $dbh, $query, $form->{id}, $form->{id}); + qq|WHERE ct.id = ?| + . $makemodel; + my ($dummy) = selectrow_query($form, $dbh, $query, (conv_i($form->{id})) x $num_args); + $form->{status} = "orphaned" unless ($dummy); $dbh->disconnect; diff --git a/SL/IC.pm b/SL/IC.pm index f025663da..c84365fb6 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -491,11 +491,11 @@ sub save { unless ($form->{item} eq 'service') { for my $i (1 .. $form->{makemodel_rows}) { if (($form->{"make_$i"}) || ($form->{"model_$i"})) { - map { $form->{"${_}_$i"} =~ s/\'/\'\'/g } qw(make model); $query = qq|INSERT INTO makemodel (parts_id, make, model) | . qq|VALUES (?, ?, ?)|; - @values = (conv_i($form->{id}), $form->{"make_$i"}, $form->{"model_$i"}); + @values = (conv_i($form->{id}), conv_i($form->{"make_$i"}), $form->{"model_$i"}); + do_query($form, $dbh, $query, @values); } } @@ -1818,9 +1818,11 @@ sub prepare_parts_for_printing { } my $placeholders = join ', ', ('?') x scalar(@part_ids); - my $query = qq|SELECT parts_id, make, model - FROM makemodel - WHERE parts_id IN ($placeholders)|; + my $query = qq|SELECT mm.parts_id, mm.model, v.name AS make + FROM makemodel mm + LEFT JOIN vendor v ON (mm.make = v.id) + WHERE mm.parts_id IN ($placeholders)|; + my %makemodel = (); my $sth = prepare_execute_query($form, $dbh, $query, @part_ids); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 547acf7df..195a72cfb 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1464,7 +1464,9 @@ sub form_header { map { $form->{$_} =~ s/"/"/g; } qw(unit); $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS', - 'partsgroup' => 'all_partsgroup'); + 'partsgroup' => 'all_partsgroup', + 'vendors' => 'ALL_VENDORS',); + IC->retrieve_buchungsgruppen(\%myconfig, $form); @{ $form->{BUCHUNGSGRUPPEN} } = grep { $_->{id} eq $form->{buchungsgruppen_id} || ($form->{id} && $form->{orphaned}) || !$form->{id} } @{ $form->{BUCHUNGSGRUPPEN} }; @@ -1478,11 +1480,12 @@ sub form_header { $form->{fokus} = "ic.partnumber"; $form->header; - print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS}, - ALL_UNITS => $form->{ALL_UNITS}, - BUCHUNGSGRUPPEN => $form->{BUCHUNGSGRUPPEN}, - payment_terms => $form->{payment_terms}, - all_partsgroup => $form->{all_partsgroup}}); + #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS}, + # ALL_UNITS => $form->{ALL_UNITS}, + # BUCHUNGSGRUPPEN => $form->{BUCHUNGSGRUPPEN}, + # payment_terms => $form->{payment_terms}, + # all_partsgroup => $form->{all_partsgroup}}); + print $form->parse_html_template('ic/form_header'); $lxdebug->leave_sub(); } @@ -1501,6 +1504,7 @@ sub makemodel_row { my ($numrows) = @_; my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows; + delete @{$form}{grep { m/^make_\d+/ || m/^model_\d+/ } keys %{ $form }}; print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 }); $lxdebug->leave_sub(); diff --git a/locale/de/all b/locale/de/all index 87c08fd97..2aa589958 100644 --- a/locale/de/all +++ b/locale/de/all @@ -916,7 +916,7 @@ $self->{texts} = { 'MAILED' => 'Gesendet', 'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' => 'Ihr Browser kann leider keine eingebetteten Frames anzeigen. Bitte wählen Sie ein anderes Menü in der Benutzerkonfiguration im Administrationsmenü aus.', 'Main Preferences' => 'Grundeinstellungen', - 'Make' => 'Hersteller', + 'Make' => 'Lieferant', 'Manage license keys' => 'Lizenzschlüssel verwalten', 'Mandantennummer' => 'Mandantennummer', 'Mar' => 'März', @@ -948,7 +948,7 @@ $self->{texts} = { 'Mitarbeiter' => 'Mitarbeiter', 'Mobile1' => 'Mobile 1', 'Mobile2' => 'Mobile 2', - 'Model' => 'Modell', + 'Model' => 'Lieferanten-Art-Nr.', 'Module home page' => 'Modul-Webseite', 'Module name' => 'Modulname', 'Monat' => 'Monat', diff --git a/templates/webpages/ic/makemodel_de.html b/templates/webpages/ic/makemodel_de.html index f90fba5ce..dd4d03842 100644 --- a/templates/webpages/ic/makemodel_de.html +++ b/templates/webpages/ic/makemodel_de.html @@ -2,18 +2,27 @@ [%- USE LxERP %] - +
- - + + [%- FOREACH row = MM_DATA %] - - + + [%- END %]
HerstellerModellLieferantLieferanten-Art-Nr.
+ [%- INCLUDE generic/multibox.html + name = "make_$loop.count", + default = row.make, + DATA = ALL_VENDORS, + show_empty = 1, + label_key = 'name', + id_key = 'id', + -%] +
- + diff --git a/templates/webpages/ic/makemodel_master.html b/templates/webpages/ic/makemodel_master.html index 356143d8d..696080ebf 100644 --- a/templates/webpages/ic/makemodel_master.html +++ b/templates/webpages/ic/makemodel_master.html @@ -2,18 +2,27 @@ [%- USE LxERP %] - +
[%- FOREACH row = MM_DATA %] - - + + [%- END %]
Make Model
+ [%- INCLUDE generic/multibox.html + name = "make_$loop.count", + default = row.make, + DATA = ALL_VENDORS, + show_empty = 1, + label_key = 'name', + id_key = 'id', + -%] +
- +