From 19fb04d1cfad224a0f0c4c3b88494b4605fc6d4e Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Wed, 7 Dec 2016 10:07:01 +0100 Subject: [PATCH] SL/PE.pm und bin/mozilla/pe.pl entfernt --- SL/PE.pm | 274 ------------------------------------------- bin/mozilla/ap.pl | 1 - bin/mozilla/ar.pl | 1 - bin/mozilla/dn.pl | 1 - bin/mozilla/gl.pl | 1 - bin/mozilla/io.pl | 1 - bin/mozilla/ir.pl | 1 - bin/mozilla/is.pl | 1 - bin/mozilla/oe.pl | 1 - bin/mozilla/pe.pl | 161 ------------------------- bin/mozilla/rp.pl | 1 - bin/mozilla/ustva.pl | 1 - 12 files changed, 445 deletions(-) delete mode 100644 SL/PE.pm delete mode 100644 bin/mozilla/pe.pl diff --git a/SL/PE.pm b/SL/PE.pm deleted file mode 100644 index 5391d7f14..000000000 --- a/SL/PE.pm +++ /dev/null @@ -1,274 +0,0 @@ -#===================================================================== -# LX-Office ERP -# Copyright (C) 2004 -# Based on SQL-Ledger Version 2.1.9 -# Web http://www.lx-office.org -# -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 1998-2002 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# Contributors: -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1335, USA. -#====================================================================== -# -# Partsgroups and pricegroups -# -#====================================================================== - -package PE; - -use Data::Dumper; - -use SL::DBUtils; -use SL::DB; - -use strict; - -sub partsgroups { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = SL::DB->client->dbh; - - my ($where, @values); - - if ($form->{partsgroup}) { - $where .= qq| AND partsgroup ILIKE ?|; - push(@values, like($form->{partsgroup})); - } - - if ($form->{status} eq 'orphaned') { - $where .= - qq| AND id NOT IN | . - qq| (SELECT DISTINCT partsgroup_id FROM parts | . - qq| WHERE NOT partsgroup_id ISNULL | . - qq| UNION | . - qq| SELECT DISTINCT partsgroup_id FROM custom_variable_config_partsgroups | . - qq| WHERE NOT partsgroup_id ISNULL) |; - } - - substr($where, 0, 4) = "WHERE " if ($where); - - my $sortorder = $form->{sort} ? $form->{sort} : "partsgroup"; - $sortorder =~ s/[^a-z_]//g; - - my $query = - qq|SELECT id, partsgroup FROM partsgroup | . - $where . - qq|ORDER BY $sortorder|; - - $form->{item_list} = selectall_hashref_query($form, $dbh, $query, @values); - - $main::lxdebug->leave_sub(); - - return scalar(@{ $form->{item_list} }); -} - -sub save_partsgroup { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = SL::DB->client->dbh; - - $form->{discount} /= 100; - - my @values = ($form->{partsgroup}); - my $query; - - if ($form->{id}) { - $query = qq|UPDATE partsgroup SET partsgroup = ? WHERE id = ?|; - push(@values, $form->{id}); - } else { - $query = qq|INSERT INTO partsgroup (partsgroup) VALUES (?)|; - } - do_query($form, $dbh, $query, @values); - - $main::lxdebug->leave_sub(); -} - -sub get_partsgroup { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = SL::DB->client->dbh; - - my $query = - qq|SELECT pg.*, | . - qq|(SELECT COUNT(*) FROM parts WHERE partsgroup_id = ?) = 0 AS orphaned | . - qq|FROM partsgroup pg | . - qq|WHERE pg.id = ?|; - my $sth = prepare_execute_query($form, $dbh, $query, $form->{id}, - $form->{id}); - my $ref = $sth->fetchrow_hashref("NAME_lc"); - - map({ $form->{$_} = $ref->{$_} } keys(%{$ref})); - $sth->finish; - - # also not orphaned if partsgroup is selected for a cvar filter - if ($form->{orphaned}) { - my $cvar_count = scalar( @{ SL::DB::PartsGroup->new(id => $form->{id})->custom_variable_configs } ); - $form->{orphaned} = !$cvar_count; - } - - $main::lxdebug->leave_sub(); -} - -sub delete_tuple { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - SL::DB->client->with_transaction(sub { - my $dbh = SL::DB->client->dbh; - - my $table = $form->{type} eq "pricegroup" ? "pricegroup" : "partsgroup"; - - my $query = qq|DELETE FROM $table WHERE id = ?|; - do_query($form, $dbh, $query, $form->{id}); - 1; - }) or do { die SL::DB->client->error }; - - $main::lxdebug->leave_sub(); -} - -########################## -# get pricegroups from database -# -sub pricegroups { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = SL::DB->client->dbh; - - my ($where, @values); - - if ($form->{pricegroup}) { - $where .= qq| AND pricegroup ILIKE ?|; - push(@values, like($form->{pricegroup})); - } - - if ($form->{status} eq 'orphaned') { - my $first = 1; - - $where .= qq| AND id NOT IN (|; - foreach my $table (qw(invoice orderitems prices)) { - $where .= "UNION " unless ($first); - $first = 0; - $where .= - qq|SELECT DISTINCT pricegroup_id FROM $table | . - qq|WHERE NOT pricegroup_id ISNULL |; - } - $where .= qq|) |; - } - - substr($where, 0, 4) = "WHERE " if ($where); - - my $sortorder = $form->{sort} ? $form->{sort} : "pricegroup"; - $sortorder =~ s/[^a-z_]//g; - - my $query = - qq|SELECT id, pricegroup FROM pricegroup | . - $where . - qq|ORDER BY $sortorder|; - - $form->{item_list} = selectall_hashref_query($form, $dbh, $query, @values); - - $main::lxdebug->leave_sub(); - - return scalar(@{ $form->{item_list} }); -} - -######################## -# save pricegruop to database -# -sub save_pricegroup { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - SL::DB->client->with_transaction(sub { - my $dbh = SL::DB->client->dbh; - my $query; - - $form->{discount} /= 100; - - my @values = ($form->{pricegroup}); - - if ($form->{id}) { - $query = qq|UPDATE pricegroup SET pricegroup = ? WHERE id = ? |; - push(@values, $form->{id}); - } else { - $query = qq|INSERT INTO pricegroup (pricegroup) VALUES (?)|; - } - do_query($form, $dbh, $query, @values); - 1; - }) or do { die SL::DB->client->error }; - - $main::lxdebug->leave_sub(); -} - -############################ -# get one pricegroup from database -# -sub get_pricegroup { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = SL::DB->client->dbh; - - my $query = qq|SELECT id, pricegroup FROM pricegroup WHERE id = ?|; - my $sth = prepare_execute_query($form, $dbh, $query, $form->{id}); - my $ref = $sth->fetchrow_hashref("NAME_lc"); - - map({ $form->{$_} = $ref->{$_} } keys(%{$ref})); - - $sth->finish; - - my $first = 1; - - my @values = (); - $query = qq|SELECT |; - foreach my $table (qw(invoice orderitems prices)) { - $query .= " + " unless ($first); - $first = 0; - $query .= qq|(SELECT COUNT(*) FROM $table WHERE pricegroup_id = ?) |; - push(@values, $form->{id}); - } - - ($form->{orphaned}) = selectrow_query($form, $dbh, $query, @values); - $form->{orphaned} = !$form->{orphaned}; - - $main::lxdebug->leave_sub(); -} - -1; - diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 00ab61801..1ea3516cc 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -40,7 +40,6 @@ use SL::AP; use SL::FU; use SL::IR; use SL::IS; -use SL::PE; use SL::ReportGenerator; use SL::DB::Default; use SL::DB::PurchaseInvoice; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index e6265e020..1bfe969dc 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -39,7 +39,6 @@ use List::UtilsBy qw(sort_by); use SL::AR; use SL::FU; use SL::IS; -use SL::PE; use SL::DB::Default; use SL::DB::Invoice; use SL::ReportGenerator; diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index f1bc4c8cb..ca08da498 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -35,7 +35,6 @@ use POSIX qw(strftime); use SL::IS; -use SL::PE; use SL::DN; use SL::DB::Dunning; use SL::Helper::Flash qw(flash); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 9b54c9af6..63f4cad4a 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -41,7 +41,6 @@ use List::Util qw(sum); use SL::FU; use SL::GL; use SL::IS; -use SL::PE; use SL::ReportGenerator; use SL::DBUtils qw(selectrow_query selectall_hashref_query); diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 628a0c235..b150a3c8d 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -104,7 +104,6 @@ if (-f "bin/mozilla/$::myconfig{login}_io.pl") { # $locale->text('Nov') # $locale->text('Dec') use SL::IS; -use SL::PE; use SL::AM; use Data::Dumper; diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index e9a0f3d8a..d6e162ed8 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -35,7 +35,6 @@ use SL::FU; use SL::IR; use SL::IS; -use SL::PE; use SL::DB::Default; use SL::DB::PurchaseInvoice; use List::Util qw(max sum); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index c72f3e136..9c8b87085 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -34,7 +34,6 @@ use SL::FU; use SL::IS; -use SL::PE; use SL::OE; use SL::MoreCommon qw(restore_form save_form); use Data::Dumper; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f92eea79d..47d6f8f09 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -43,7 +43,6 @@ use SL::OE; use SL::IR; use SL::IS; use SL::MoreCommon qw(ary_diff restore_form save_form); -use SL::PE; use SL::ReportGenerator; use List::MoreUtils qw(uniq any none); use List::Util qw(min max reduce sum); diff --git a/bin/mozilla/pe.pl b/bin/mozilla/pe.pl deleted file mode 100644 index 5e5e0644c..000000000 --- a/bin/mozilla/pe.pl +++ /dev/null @@ -1,161 +0,0 @@ -#===================================================================== -# LX-Office ERP -# Copyright (C) 2004 -# Based on SQL-Ledger Version 2.1.9 -# Web http://www.lx-office.org -# -#===================================================================== -# SQL-Ledger Accounting -# Copyright (c) 1998-2002 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1335, USA. -#====================================================================== -# -# partsgroup administration -# -#====================================================================== - -use SL::PE; - -require "bin/mozilla/common.pl"; - -use strict; - -1; - -# end of main - -sub add { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - $::form->{title} = "Add"; - $::form->{callback} ||= "$::form->{script}?action=add&type=$::form->{type}"; - - call_sub("form_$::form->{type}"); - - $::lxdebug->leave_sub; -} - -sub edit { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - $::form->{title} = "Edit"; - - if ($::form->{type} eq 'partsgroup') { - PE->get_partsgroup(\%::myconfig, $::form); - } - call_sub("form_$::form->{type}"); - - $::lxdebug->leave_sub; -} - -sub search { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - $::form->header; - print $::form->parse_html_template('pe/search', { - is_pricegroup => $::form->{type} eq 'pricegroup', - }); - - $::lxdebug->leave_sub; -} - -sub save { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - if ($::form->{type} eq 'partsgroup') { - $::form->isblank("partsgroup", $::locale->text('Group missing!')); - PE->save_partsgroup(\%::myconfig, $::form); - $::form->redirect($::locale->text('Group saved!')); - } - - # saving the history - if(!exists $::form->{addition} && $::form->{id} ne "") { - $::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber}; - $::form->{addition} = "SAVED"; - $::form->save_history; - } - # /saving the history - - $::lxdebug->leave_sub; -} - -sub delete { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - PE->delete_tuple(\%::myconfig, $::form); - - if ($::form->{type} eq 'partsgroup') { - $::form->redirect($::locale->text('Group deleted!')); - } - $::lxdebug->leave_sub; -} - -sub continue { call_sub($::form->{nextsub}); } - -sub partsgroup_report { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - $::form->{$_} = $::form->unescape($::form->{$_}) for qw(partsgroup); - PE->partsgroups(\%::myconfig, $::form); - - my $callback = build_std_url("action=partsgroup_report", qw(type status)); - - my $option = ''; - $option .= $::locale->text('All') if $::form->{status} eq 'all'; - $option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned'; - - if ($::form->{partsgroup}) { - $callback .= "&partsgroup=$::form->{partsgroup}"; - $option .= ", " . $::locale->text('Group') . " : $::form->{partsgroup}"; - } - - # escape callback - $::form->{callback} = $callback; - - $::form->header; - print $::form->parse_html_template('pe/partsgroup_report', { - option => $option, - callback => $callback, - editlink => build_std_url('action=edit', qw(type status callback)), - }); - - $::lxdebug->leave_sub; -} - -sub form_partsgroup { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - # $locale->text('Add Group') - # $locale->text('Edit Group') - $::form->{title} = $::locale->text("$::form->{title} Group"); - - $::form->header; - print $::form->parse_html_template('pe/partsgroup_form'); - - $::lxdebug->leave_sub; -} diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 857995611..845b1be3d 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -41,7 +41,6 @@ use POSIX qw(strftime); use SL::DB::Default; use SL::DB::Project; use SL::DB::Customer; -use SL::PE; use SL::RP; use SL::Iconv; use SL::ReportGenerator; diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 9181232f6..4de6f71db 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -41,7 +41,6 @@ require "bin/mozilla/common.pl"; use List::Util qw(first); use SL::DB::Default; -use SL::PE; use SL::RP; use SL::USTVA; use SL::User; -- 2.20.1