Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a2546588

Von Sven Schöling vor fast 9 Jahren hinzugefügt

  • ID a2546588a9aaf775e7724e9a7b90928933150d9e
  • Vorgänger 7b2d881b
  • Nachfolger 7801c6c2

invoice_io.pl entfernt

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.

Unterschiede anzeigen:

bin/mozilla/do.pl
46 46
use Sort::Naturally ();
47 47
require "bin/mozilla/arap.pl";
48 48
require "bin/mozilla/common.pl";
49
require "bin/mozilla/invoice_io.pl";
50 49
require "bin/mozilla/io.pl";
51 50
require "bin/mozilla/reportgenerator.pl";
52 51

  
......
1538 1537
  $main::lxdebug->leave_sub();
1539 1538
}
1540 1539

  
1540
sub display_form {
1541
  $::lxdebug->enter_sub;
1542

  
1543
  $::auth->assert('purchase_delivery_order_edit | sales_delivery_order_edit');
1544

  
1545
  relink_accounts();
1546
  retrieve_partunits();
1547

  
1548
  my $new_rowcount = $::form->{"rowcount"} * 1 + 1;
1549
  $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"};
1550

  
1551
  $::form->language_payment(\%::myconfig);
1552

  
1553
  Common::webdav_folder($::form);
1554

  
1555
  form_header();
1556
  display_row(++$::form->{rowcount});
1557
  form_footer();
1558

  
1559
  $::lxdebug->leave_sub;
1560
}
1541 1561

  
1542 1562
sub yes {
1543 1563
  call_sub($main::form->{yes_nextsub});
bin/mozilla/ic.pl
51 51
our ($form, $locale, %myconfig, $lxdebug, $auth);
52 52

  
53 53
require "bin/mozilla/io.pl";
54
require "bin/mozilla/invoice_io.pl";
55 54
require "bin/mozilla/common.pl";
56 55
require "bin/mozilla/reportgenerator.pl";
57 56

  
......
2118 2117
  $main::lxdebug->leave_sub();
2119 2118
}
2120 2119

  
2120
sub display_form {
2121
  $::lxdebug->enter_sub;
2122

  
2123
  $auth->assert('part_service_assembly_edit');
2124

  
2125
  relink_accounts();
2126

  
2127
  $::form->language_payment(\%::myconfig);
2128

  
2129
  Common::webdav_folder($::form);
2130

  
2131
  form_header();
2132
  price_row($::form->{price_rows});
2133
  makemodel_row(++$::form->{makemodel_rows}) if $::form->{item} =~ /^(part|service)$/;
2134
  assembly_row(++$::form->{assembly_rows})   if $::form->{item} eq 'assembly';
2135

  
2136
  form_footer();
2137

  
2138
  $::lxdebug->leave_sub;
2139
}
2140

  
2121 2141
sub back_to_record {
2122 2142
  _check_io_auth();
2123 2143

  
bin/mozilla/invoice_io.pl
1
#=====================================================================
2
# LX-Office ERP
3
# Copyright (C) 2004
4
# Based on SQL-Ledger Version 2.1.9
5
# Web http://www.lx-office.org
6
#############################################################################
7
# Veraendert 2005-01-05 - Marco Welter <mawe@linux-studio.de> - Neue Optik  #
8
#############################################################################
9
# SQL-Ledger, Accounting
10
# Copyright (c) 1998-2002
11
#
12
#  Author: Dieter Simader
13
#   Email: dsimader@sql-ledger.org
14
#     Web: http://www.sql-ledger.org
15
#
16
#
17
# This program is free software; you can redistribute it and/or modify
18
# it under the terms of the GNU General Public License as published by
19
# the Free Software Foundation; either version 2 of the License, or
20
# (at your option) any later version.
21
#
22
# This program is distributed in the hope that it will be useful,
23
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
# GNU General Public License for more details.
26
# You should have received a copy of the GNU General Public License
27
# along with this program; if not, write to the Free Software
28
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
#
30
#######################################################################
31
#
32
# common routines used in is, ir but not in oe
33
#
34
#######################################################################
35

  
36
use CGI;
37
use List::Util qw(max);
38

  
39
use SL::Common;
40
use SL::CT;
41
use SL::IC;
42

  
43
require "bin/mozilla/common.pl";
44

  
45
use strict;
46

  
47
# any custom scripts for this one
48
if (-f "bin/mozilla/custom_invoice_io.pl") {
49
  eval { require "bin/mozilla/custom_invoice_io.pl"; };
50
}
51
if (-f "bin/mozilla/$::myconfig{login}_invoice_io.pl") {
52
  eval { require "bin/mozilla/$::myconfig{login}_invoice_io.pl"; };
53
}
54

  
55
1;
56

  
57
# end of main
58

  
59
# this is for our long dates
60
# $locale->text('January')
61
# $locale->text('February')
62
# $locale->text('March')
63
# $locale->text('April')
64
# $locale->text('May ')
65
# $locale->text('June')
66
# $locale->text('July')
67
# $locale->text('August')
68
# $locale->text('September')
69
# $locale->text('October')
70
# $locale->text('November')
71
# $locale->text('December')
72

  
73
# this is for our short month
74
# $locale->text('Jan')
75
# $locale->text('Feb')
76
# $locale->text('Mar')
77
# $locale->text('Apr')
78
# $locale->text('May')
79
# $locale->text('Jun')
80
# $locale->text('Jul')
81
# $locale->text('Aug')
82
# $locale->text('Sep')
83
# $locale->text('Oct')
84
# $locale->text('Nov')
85
# $locale->text('Dec')
86
use SL::IS;
87
use SL::PE;
88
use SL::AM;
89
use Data::Dumper;
90

  
91
sub display_form {
92
  $main::lxdebug->enter_sub();
93

  
94
  my $form     = $main::form;
95
  my %myconfig = %main::myconfig;
96

  
97
  $main::auth->assert('part_service_assembly_edit   | vendor_invoice_edit       | sales_order_edit    | invoice_edit |' .
98
                'request_quotation_edit       | sales_quotation_edit      | purchase_order_edit | '.
99
                'purchase_delivery_order_edit | sales_delivery_order_edit | part_service_assembly_details');
100

  
101
  relink_accounts();
102
  retrieve_partunits() if ($form->{type} =~ /_delivery_order$/);
103

  
104
  my $new_rowcount = $form->{"rowcount"} * 1 + 1;
105
  $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"};
106

  
107
  $form->language_payment(\%myconfig);
108

  
109
  # if we have a display_form
110
  if ($form->{display_form}) {
111
    call_sub($form->{"display_form"});
112
    ::end_of_request();
113
  }
114

  
115
  Common::webdav_folder($form);
116

  
117
  #   if (   $form->{print_and_post}
118
  #       && $form->{second_run}
119
  #       && ($form->{action} eq "display_form")) {
120
  #     for (keys %$form) { $old_form->{$_} = $form->{$_} }
121
  #     $old_form->{rowcount}++;
122
  #
123
  #     #$form->{rowcount}--;
124
  #     #$form->{rowcount}--;
125
  #
126
  #     $form->{print_and_post} = 0;
127
  #
128
  #     &print_form($old_form);
129
  #     ::end_of_request();
130
  #   }
131
  #
132
  #   $form->{action}   = "";
133
  #   $form->{resubmit} = 0;
134
  #
135
  #   if ($form->{print_and_post} && !$form->{second_run}) {
136
  #     $form->{second_run} = 1;
137
  #     $form->{action}     = "display_form";
138
  #     $form->{rowcount}--;
139
  #     my $rowcount = $form->{rowcount};
140
  #
141
  #     $form->{resubmit} = 1;
142
  #
143
  #   }
144
  &form_header;
145

  
146
  {
147
    no strict 'refs';
148

  
149
    my $numrows    = ++$form->{rowcount};
150
    my $subroutine = "display_row";
151

  
152
    if ($form->{item} =~ /(part|service)/) {
153
      #set preisgruppenanzahl
154
      $numrows    = $form->{price_rows};
155
      $subroutine = "price_row";
156

  
157
      &{$subroutine}($numrows);
158

  
159
      $numrows    = ++$form->{makemodel_rows};
160
      $subroutine = "makemodel_row";
161
    }
162
    if ($form->{item} eq 'assembly') {
163
      $numrows    = $form->{price_rows};
164
      $subroutine = "price_row";
165

  
166
      &{$subroutine}($numrows);
167

  
168
      $numrows    = ++$form->{makemodel_rows};
169
      $subroutine = "makemodel_row";
170

  
171
      # assemblies are built from components, they aren't purchased from a vendor
172
      # also the lastcost_$i from makemodel conflicted with the component lastcost_$i
173
      # so we don't need the makemodel rows for assemblies
174
      # create makemodel rows
175
      # &{$subroutine}($numrows);
176

  
177
      $numrows    = ++$form->{assembly_rows};
178
      $subroutine = "assembly_row";
179
    }
180

  
181
    # create rows
182
    &{$subroutine}($numrows) if $numrows;
183
  }
184

  
185
  &form_footer;
186

  
187
  $main::lxdebug->leave_sub();
188
}
bin/mozilla/ir.pl
41 41
use List::UtilsBy qw(sort_by);
42 42

  
43 43
require "bin/mozilla/io.pl";
44
require "bin/mozilla/invoice_io.pl";
45 44
require "bin/mozilla/arap.pl";
46 45
require "bin/mozilla/common.pl";
47 46
require "bin/mozilla/drafts.pl";
......
850 849
  $main::lxdebug->leave_sub();
851 850
}
852 851

  
852
sub display_form {
853
  $::lxdebug->enter_sub;
854

  
855
  $::auth->assert('vendor_invoice_edit');
856

  
857
  relink_accounts();
858

  
859
  my $new_rowcount = $::form->{"rowcount"} * 1 + 1;
860
  $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"};
861

  
862
  $::form->language_payment(\%::myconfig);
863

  
864
  Common::webdav_folder($::form);
865

  
866
  form_header();
867
  display_row(++$::form->{rowcount});
868
  form_footer();
869

  
870
  $::lxdebug->leave_sub;
871
}
872

  
853 873
sub yes {
854 874
  $main::lxdebug->enter_sub();
855 875

  
bin/mozilla/is.pl
47 47
use SL::DB::PaymentTerm;
48 48

  
49 49
require "bin/mozilla/io.pl";
50
require "bin/mozilla/invoice_io.pl";
51 50
require "bin/mozilla/arap.pl";
52 51
require "bin/mozilla/drafts.pl";
53 52

  
......
1093 1092
  $main::lxdebug->leave_sub();
1094 1093
}
1095 1094

  
1095
sub display_form {
1096
  $::lxdebug->enter_sub;
1097

  
1098
  $::auth->assert('invoice_edit');
1099

  
1100
  relink_accounts();
1101

  
1102
  my $new_rowcount = $::form->{"rowcount"} * 1 + 1;
1103
  $::form->{"project_id_${new_rowcount}"} = $::form->{"globalproject_id"};
1104

  
1105
  $::form->language_payment(\%::myconfig);
1106

  
1107
  Common::webdav_folder($::form);
1108

  
1109
  form_header();
1110
  display_row(++$::form->{rowcount});
1111
  form_footer();
1112

  
1113
  $::lxdebug->leave_sub;
1114
}
1115

  
1096 1116
sub yes {
1097 1117
  $main::lxdebug->enter_sub();
1098 1118

  

Auch abrufbar als: Unified diff