From e7214232350249fdab6da3445442ff85891a0d7c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 28 Nov 2006 09:35:30 +0000 Subject: [PATCH] ADR entfernt (kam aus Kundenprojekt und ist nicht fuer die allgemeine Lx-Office-Variante gedacht). --- SL/AM.pm | 98 -------- SL/CT.pm | 34 +-- SL/Form.pm | 12 - SL/IC.pm | 15 -- SL/IS.pm | 3 +- bin/mozilla/am.pl | 201 ---------------- bin/mozilla/ct.pl | 221 ------------------ bin/mozilla/ic.pl | 22 -- bin/mozilla/io.pl | 6 +- .../Pg-upgrade-2.2.0.23-2.2.0.24.sql | 2 + 10 files changed, 7 insertions(+), 607 deletions(-) create mode 100644 sql/Pg-upgrade/Pg-upgrade-2.2.0.23-2.2.0.24.sql diff --git a/SL/AM.pm b/SL/AM.pm index a2e201f61..d738dc29d 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1191,104 +1191,6 @@ sub delete_printer { $main::lxdebug->leave_sub(); } -sub adr { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT id, adr_description, adr_code - FROM adr - ORDER BY adr_code|; - - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $form->{ALL} }, $ref; - } - - $sth->finish; - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub get_adr { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = - qq|SELECT a.adr_description, a.adr_code - FROM adr a - WHERE a.id = $form->{id}|; - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - my $ref = $sth->fetchrow_hashref(NAME_lc); - - map { $form->{$_} = $ref->{$_} } keys %$ref; - - $sth->finish; - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub save_adr { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - $form->{adr_description} =~ s/\'/\'\'/g; - $form->{adr_code} =~ s/\'/\'\'/g; - - - # id is the old record - if ($form->{id}) { - $query = qq|UPDATE adr SET - adr_description = '$form->{adr_description}', - adr_code = '$form->{adr_code}' - WHERE id = $form->{id}|; - } else { - $query = qq|INSERT INTO adr - (adr_description, adr_code) - VALUES ('$form->{adr_description}', '$form->{adr_code}')|; - } - $dbh->do($query) || $form->dberror($query); - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub delete_adr { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - $query = qq|DELETE FROM adr - WHERE id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - sub payment { $main::lxdebug->enter_sub(); diff --git a/SL/CT.pm b/SL/CT.pm index cfd1c238e..f5729927e 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -875,9 +875,9 @@ sub get_delivery { if ($form->{to}) { $where .= "AND $tabelle.transdate <= '$form->{to}' "; } - my $query = qq|select shiptoname, adr_code, $tabelle.transdate, $tabelle.invnumber, $tabelle.ordnumber, invoice.description, qty, invoice.unit FROM $tabelle LEFT JOIN shipto ON |; + my $query = qq|select shiptoname, $tabelle.transdate, $tabelle.invnumber, $tabelle.ordnumber, invoice.description, qty, invoice.unit FROM $tabelle LEFT JOIN shipto ON |; $query .= ($tabelle eq "ar") ? qq|($tabelle.shipto_id=shipto.shipto_id) |:qq|($tabelle.id=shipto.trans_id) |; - $query .=qq|LEFT join invoice on ($tabelle.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) LEFT join adr ON (parts.adr_id=adr.id) $where ORDER BY $tabelle.transdate DESC LIMIT 15|; + $query .=qq|LEFT join invoice on ($tabelle.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) $where ORDER BY $tabelle.transdate DESC LIMIT 15|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -891,35 +891,5 @@ sub get_delivery { $main::lxdebug->leave_sub(); } -sub adr { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - my $dbh = $form->dbconnect($myconfig); - $where = " WHERE 1=1 "; - if ($form->{from}) { - $where .= "AND ar.transdate >= '$form->{from}' "; - } - if ($form->{to}) { - $where .= "AND ar.transdate <= '$form->{to}' "; - } - if ($form->{year}) { - $where = " WHERE ar.transdate >= '$form->{year}-01-01' AND ar.transdate <= '$form->{year}-12-31' "; - } - - my $query = qq|select adr_code, adr_description, sum(base_qty), parts.unit from ar LEFT join invoice on (ar.id=invoice.trans_id) LEFT join parts ON (invoice.parts_id=parts.id) LEFT join adr ON (adr.id=parts.adr_id) $where GROUP BY adr_code,adr_description,parts.unit|; - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $form->{ADR} }, $ref; - } - $sth->finish; - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - 1; diff --git a/SL/Form.pm b/SL/Form.pm index 96d0adca0..3354a2f1b 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1563,18 +1563,6 @@ sub language_payment { } $sth->finish; - # get adr - $query = qq|SELECT id, adr_description, adr_code - FROM adr|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - - $self->{ADR} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $self->{ADR} }, $ref; - } - $sth->finish; $dbh->disconnect; $main::lxdebug->leave_sub(); } diff --git a/SL/IC.pm b/SL/IC.pm index d486228e6..576340e75 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -372,7 +372,6 @@ sub save { $form->{ge} *= 1; $form->{alu} *= 1; $form->{buchungsgruppen_id} *= 1; - $form->{adr_id} *= 1; $form->{not_discountable} *= 1; $form->{payment_id} *= 1; @@ -491,7 +490,6 @@ sub save { rop = $form->{rop}, bin = '$form->{bin}', buchungsgruppen_id = '$form->{buchungsgruppen_id}', - adr_id = '$form->{adr_id}', payment_id = '$form->{payment_id}', inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = '$form->{inventory_accno}'), @@ -1511,19 +1509,6 @@ sub create_links { } $sth->finish; - # get adr - $query = qq|SELECT id, adr_description, adr_code - FROM adr|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - - $form->{ADR} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $form->{ADR} }, $ref; - } - $sth->finish; - # get payment terms $query = qq|SELECT id, description FROM payment_terms diff --git a/SL/IS.pm b/SL/IS.pm index 7c9d21853..8e8b4781f 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1902,13 +1902,12 @@ sub retrieve_item { c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid, c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid, p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable, - pg.partsgroup, p.formel, p.alu, p.payment_id AS part_payment_id, adr.adr_description + pg.partsgroup, p.formel, p.alu, p.payment_id AS part_payment_id FROM parts p LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id) LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id) LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id) LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id) - LEFT JOIN adr adr ON (adr.id = p.adr_id) WHERE $where|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d7373d78b..7426ca03b 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -2267,207 +2267,6 @@ sub delete_printer { } -sub add_adr { - $lxdebug->enter_sub(); - - $form->{title} = "Add"; - - $form->{callback} = - "$form->{script}?action=add_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; - - &adr_header; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub edit_adr { - $lxdebug->enter_sub(); - - $form->{title} = "Edit"; - - AM->get_adr(\%myconfig, \%$form); - - &adr_header; - - $form->{orphaned} = 1; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub list_adr { - $lxdebug->enter_sub(); - - AM->adr(\%myconfig, \%$form); - - $form->{callback} = - "$form->{script}?action=list_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('ADR'); - - @column_index = qw(adr_code adr_description); - - $column_header{adr_description} = - qq|| - . $locale->text('ADR Description') - . qq||; - $column_header{adr_code} = - qq|| - . $locale->text('ADR Code') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{adr_code} = - qq||; - $column_data{adr_description} = qq||; - - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_adr&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{adr_code}$ref->{adr_description}
-

- -
-
{script}> - - - - - -{path}> -{login}> -{password}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| - -
- - - -|; - - $lxdebug->leave_sub(); -} - -sub adr_header { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text("$form->{title} ADR"); - - # $locale->text('Add ADR') - # $locale->text('Edit ADR') - - $form->{adr_description} =~ s/\"/"/g; - $form->{adr_code} =~ s/\"/"/g; - - - $form->header; - - print qq| - - -
{script}> - -{id}> - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('ADR Code') . qq|
| . $locale->text('ADR Description') . qq|

-|; - - $lxdebug->leave_sub(); -} - -sub save_adr { - $lxdebug->enter_sub(); - - $form->isblank("adr_description", $locale->text('ADR Description missing!')); - $form->isblank("adr_code", $locale->text('ADR Code missing!')); - AM->save_adr(\%myconfig, \%$form); - $form->redirect($locale->text('ADR saved!')); - - $lxdebug->leave_sub(); -} - - -sub delete_adr { - $lxdebug->enter_sub(); - - AM->delete_adr(\%myconfig, \%$form); - $form->redirect($locale->text('ADR deleted!')); - - $lxdebug->leave_sub(); -} - - sub add_payment { $lxdebug->enter_sub(); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index cb1d591a0..923a18a1a 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -307,224 +307,6 @@ sub search_delivery { $lxdebug->leave_sub(); } -sub search_adr { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text('ADR Report'); - - # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; - $jsscript = ""; - - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - {from}> - text('button') . qq|> - |; - $button2 = qq| - {to}> - text('button') . qq|> - |; - - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", - "from", "BL", - "trigger1", "to", - "BL", "trigger2"); - } else { - - # without JavaScript Calendar - $button1 = - qq|{from}>|; - $button2 = - qq|{to}>|; - } - - $form->header; - - print qq| - - -{script}> - - - - - - - - - - - - - -
$form->{title}
- - - - - - - $button1 - - - - $button2 - - - - - -
| . $locale->text('Year') . qq|{year}>
| . $locale->text('From') . qq|
| . $locale->text('Bis') . qq|
 | - . $locale->text('HTML') . qq| -  | - . $locale->text('CSV') . qq|
-

-$jsscript - - -{path}> -{login}> -{password}> - -
- -
- - - -|; - $lxdebug->leave_sub(); -} -sub adr_report { - $lxdebug->enter_sub(); - - CT->adr(\%myconfig, \%$form); - - $form->{title} = $locale->text('ADR Report'); - if ($form->{from} || $form->{to}) { - $option = "Für den Zeitraum $form->{from} bis $form->{to}"; - } elsif ($form->{year}) { - $option = "Für das Jahr $form->{year}"; - } - - if ($form->{format} eq "html") { - $form->header(); - print qq| - - - - - - - - - - -
$form->{title}
$option
|; - - - @column_index = - $form->sort_columns(adr_code, - adr_description, - sum, - unit); - - - - $column_header{adr_code} = - qq|| . $locale->text('ADR Code') . qq||; - $column_header{adr_description} = - qq||. $locale->text('ADR Description'). qq||; - $column_header{sum} = - qq||. $locale->text('Quantity'). qq||; - $column_header{unit} = - qq|| . $locale->text('Unit') . qq||; - - print qq| - - - - |; $column_header{description} = qq||; - $column_header{adr_code} = - qq||; $column_header{qty} = qq||; $column_header{unit} = diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index db5a84c08..80e0bbc55 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -2256,27 +2256,6 @@ sub form_header { |; - $form->{selectadr} = ""; - if (@{ $form->{ADR} }) { - foreach $item (@{ $form->{ADR} }) { - if ($item->{id} == $form->{adr_id}) { - $form->{selectadr} .= - " - - - |; - - # set option foreach $item (qw(IC IC_income IC_expense)) { if ($form->{$item}) { @@ -2628,7 +2607,6 @@ sub form_header {
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - - foreach $ref (@{ $form->{ADR} }) { - - map { $column_data{$_} = "" } @column_index; - - - $i++; - $i %= 2; - print " - -"; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - - - } - - print qq| -
$ref->{$_} 
- - -|; - } else { - my $filename = "adr-report-$form->{from}-$form->{to}.csv"; - if ($form->{year}) { - $filename = "adr-report-$form->{year}.csv"; - } - @column_index = - $form->sort_columns(adr_code, - adr_description, - sum, - unit); - - $tmpfile = qq|ADR Code;ADR Beschreibung;Menge;Einheit\n|; - foreach $ref (@{ $form->{ADR} }) { - - map { $column_data{$_} = qq|"$ref->{$_}"| } @column_index; - - $line = ""; - map { $line .= "$column_data{$_};" } @column_index; - chomp($line); - $tmpfile .= qq|$line\n|;; - } - - my $size = length($tmpfile); - # launch application - print qq|Content-Type: application/csv -Content-Disposition: attachment; filename="$filename" -Content-Length: $size - -$tmpfile -|; - } - - $lxdebug->leave_sub(); -} - sub list_names { $lxdebug->enter_sub(); @@ -1851,7 +1633,6 @@ sub get_delivery { ordnumber, transdate, description, - adr_code, qty, unit); @@ -1867,8 +1648,6 @@ sub get_delivery { qq|
| . $locale->text('Invdate') . qq|| . $locale->text('Description') . qq|| . $locale->text('ADR') . qq|| . $locale->text('Qty') . qq|
| . $locale->text('ADR') . qq|
$buchungsgruppe $linkaccounts - $adr
diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index c7d7b694a..e8084f1ae 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -424,7 +424,6 @@ sub display_row { - |; @@ -640,7 +639,6 @@ sub select_item { - {id}> @@ -703,7 +701,7 @@ sub item_selected { $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } - qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup formel alu longdescription not_discountable adr_description); + qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup formel alu longdescription not_discountable); if ($form->{"part_payment_id_$i"} ne "") { $form->{payment_id} = $form->{"part_payment_id_$i"}; } @@ -940,7 +938,7 @@ sub check_form { my @a = (); my $count = 0; my @flds = ( - qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id adr_id language_values) + qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values) ); diff --git a/sql/Pg-upgrade/Pg-upgrade-2.2.0.23-2.2.0.24.sql b/sql/Pg-upgrade/Pg-upgrade-2.2.0.23-2.2.0.24.sql new file mode 100644 index 000000000..18358895c --- /dev/null +++ b/sql/Pg-upgrade/Pg-upgrade-2.2.0.23-2.2.0.24.sql @@ -0,0 +1,2 @@ +ALTER TABLE parts DROP COLUMN adr_id; +DROP TABLE adr; -- 2.20.1