From a2546588a9aaf775e7724e9a7b90928933150d9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 10 Dec 2015 13:21:24 +0100 Subject: [PATCH] invoice_io.pl entfernt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit sql_ledger hat versucht ein zentrales display_form zu halten. Das hat aber in lx nur Probleme gemacht und weil Aufträge mehr und mehr brauchten ist die invoice_io.pl als alternative reingekommen. Mittlerweile bestand die aber nur noch aus Weichen für verschiedene Belege, und war ausserdem by design unsafe (no strict refs). Gleichzeitig fliegt auch das unsägliche if ($form->{display_form}) { call_sub($form->{display_form}) } feature raus, was niemals jemand benutzt hat. Danke für Deine Dienste invoice_io.pl. --- bin/mozilla/do.pl | 22 ++++- bin/mozilla/ic.pl | 22 ++++- bin/mozilla/invoice_io.pl | 188 -------------------------------------- bin/mozilla/ir.pl | 22 ++++- bin/mozilla/is.pl | 22 ++++- 5 files changed, 84 insertions(+), 192 deletions(-) delete mode 100644 bin/mozilla/invoice_io.pl diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 3a39e759b..e0a40f350 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -46,7 +46,6 @@ use SL::WH; use Sort::Naturally (); require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; -require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/io.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -1538,6 +1537,27 @@ sub mark_closed { $main::lxdebug->leave_sub(); } +sub display_form { + $::lxdebug->enter_sub; + + $::auth->assert('purchase_delivery_order_edit | sales_delivery_order_edit'); + + relink_accounts(); + retrieve_partunits(); + + my $new_rowcount = $::form->{"rowcount"} * 1 + 1; + $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"}; + + $::form->language_payment(\%::myconfig); + + Common::webdav_folder($::form); + + form_header(); + display_row(++$::form->{rowcount}); + form_footer(); + + $::lxdebug->leave_sub; +} sub yes { call_sub($main::form->{yes_nextsub}); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 332873544..563ea5fb7 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -51,7 +51,6 @@ use strict; our ($form, $locale, %myconfig, $lxdebug, $auth); require "bin/mozilla/io.pl"; -require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -2118,6 +2117,27 @@ sub ajax_autocomplete { $main::lxdebug->leave_sub(); } +sub display_form { + $::lxdebug->enter_sub; + + $auth->assert('part_service_assembly_edit'); + + relink_accounts(); + + $::form->language_payment(\%::myconfig); + + Common::webdav_folder($::form); + + form_header(); + price_row($::form->{price_rows}); + makemodel_row(++$::form->{makemodel_rows}) if $::form->{item} =~ /^(part|service)$/; + assembly_row(++$::form->{assembly_rows}) if $::form->{item} eq 'assembly'; + + form_footer(); + + $::lxdebug->leave_sub; +} + sub back_to_record { _check_io_auth(); diff --git a/bin/mozilla/invoice_io.pl b/bin/mozilla/invoice_io.pl deleted file mode 100644 index a4e50ff0c..000000000 --- a/bin/mozilla/invoice_io.pl +++ /dev/null @@ -1,188 +0,0 @@ -#===================================================================== -# LX-Office ERP -# Copyright (C) 2004 -# Based on SQL-Ledger Version 2.1.9 -# Web http://www.lx-office.org -############################################################################# -# Veraendert 2005-01-05 - Marco Welter - Neue Optik # -############################################################################# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -####################################################################### -# -# common routines used in is, ir but not in oe -# -####################################################################### - -use CGI; -use List::Util qw(max); - -use SL::Common; -use SL::CT; -use SL::IC; - -require "bin/mozilla/common.pl"; - -use strict; - -# any custom scripts for this one -if (-f "bin/mozilla/custom_invoice_io.pl") { - eval { require "bin/mozilla/custom_invoice_io.pl"; }; -} -if (-f "bin/mozilla/$::myconfig{login}_invoice_io.pl") { - eval { require "bin/mozilla/$::myconfig{login}_invoice_io.pl"; }; -} - -1; - -# end of main - -# this is for our long dates -# $locale->text('January') -# $locale->text('February') -# $locale->text('March') -# $locale->text('April') -# $locale->text('May ') -# $locale->text('June') -# $locale->text('July') -# $locale->text('August') -# $locale->text('September') -# $locale->text('October') -# $locale->text('November') -# $locale->text('December') - -# this is for our short month -# $locale->text('Jan') -# $locale->text('Feb') -# $locale->text('Mar') -# $locale->text('Apr') -# $locale->text('May') -# $locale->text('Jun') -# $locale->text('Jul') -# $locale->text('Aug') -# $locale->text('Sep') -# $locale->text('Oct') -# $locale->text('Nov') -# $locale->text('Dec') -use SL::IS; -use SL::PE; -use SL::AM; -use Data::Dumper; - -sub display_form { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' . - 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | '. - 'purchase_delivery_order_edit | sales_delivery_order_edit | part_service_assembly_details'); - - relink_accounts(); - retrieve_partunits() if ($form->{type} =~ /_delivery_order$/); - - my $new_rowcount = $form->{"rowcount"} * 1 + 1; - $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"}; - - $form->language_payment(\%myconfig); - - # if we have a display_form - if ($form->{display_form}) { - call_sub($form->{"display_form"}); - ::end_of_request(); - } - - Common::webdav_folder($form); - - # if ( $form->{print_and_post} - # && $form->{second_run} - # && ($form->{action} eq "display_form")) { - # for (keys %$form) { $old_form->{$_} = $form->{$_} } - # $old_form->{rowcount}++; - # - # #$form->{rowcount}--; - # #$form->{rowcount}--; - # - # $form->{print_and_post} = 0; - # - # &print_form($old_form); - # ::end_of_request(); - # } - # - # $form->{action} = ""; - # $form->{resubmit} = 0; - # - # if ($form->{print_and_post} && !$form->{second_run}) { - # $form->{second_run} = 1; - # $form->{action} = "display_form"; - # $form->{rowcount}--; - # my $rowcount = $form->{rowcount}; - # - # $form->{resubmit} = 1; - # - # } - &form_header; - - { - no strict 'refs'; - - my $numrows = ++$form->{rowcount}; - my $subroutine = "display_row"; - - if ($form->{item} =~ /(part|service)/) { - #set preisgruppenanzahl - $numrows = $form->{price_rows}; - $subroutine = "price_row"; - - &{$subroutine}($numrows); - - $numrows = ++$form->{makemodel_rows}; - $subroutine = "makemodel_row"; - } - if ($form->{item} eq 'assembly') { - $numrows = $form->{price_rows}; - $subroutine = "price_row"; - - &{$subroutine}($numrows); - - $numrows = ++$form->{makemodel_rows}; - $subroutine = "makemodel_row"; - - # assemblies are built from components, they aren't purchased from a vendor - # also the lastcost_$i from makemodel conflicted with the component lastcost_$i - # so we don't need the makemodel rows for assemblies - # create makemodel rows - # &{$subroutine}($numrows); - - $numrows = ++$form->{assembly_rows}; - $subroutine = "assembly_row"; - } - - # create rows - &{$subroutine}($numrows) if $numrows; - } - - &form_footer; - - $main::lxdebug->leave_sub(); -} diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 25a0f3e6b..ccf22345b 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -41,7 +41,6 @@ use List::Util qw(max sum); use List::UtilsBy qw(sort_by); require "bin/mozilla/io.pl"; -require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; @@ -850,6 +849,27 @@ sub delete { $main::lxdebug->leave_sub(); } +sub display_form { + $::lxdebug->enter_sub; + + $::auth->assert('vendor_invoice_edit'); + + relink_accounts(); + + my $new_rowcount = $::form->{"rowcount"} * 1 + 1; + $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"}; + + $::form->language_payment(\%::myconfig); + + Common::webdav_folder($::form); + + form_header(); + display_row(++$::form->{rowcount}); + form_footer(); + + $::lxdebug->leave_sub; +} + sub yes { $main::lxdebug->enter_sub(); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 2a6d9aba7..46387e8e0 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -47,7 +47,6 @@ use SL::DB::Customer; use SL::DB::PaymentTerm; require "bin/mozilla/io.pl"; -require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/arap.pl"; require "bin/mozilla/drafts.pl"; @@ -1093,6 +1092,27 @@ sub credit_note { $main::lxdebug->leave_sub(); } +sub display_form { + $::lxdebug->enter_sub; + + $::auth->assert('invoice_edit'); + + relink_accounts(); + + my $new_rowcount = $::form->{"rowcount"} * 1 + 1; + $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"}; + + $::form->language_payment(\%::myconfig); + + Common::webdav_folder($::form); + + form_header(); + display_row(++$::form->{rowcount}); + form_footer(); + + $::lxdebug->leave_sub; +} + sub yes { $main::lxdebug->enter_sub(); -- 2.20.1