Revision 217d32f3
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/Auth.pm | ||
---|---|---|
855 | 855 |
["customer_vendor_edit", $locale->text("Create and edit customers and vendors")], |
856 | 856 |
["part_service_assembly_edit", $locale->text("Create and edit parts, services, assemblies")], |
857 | 857 |
["project_edit", $locale->text("Create and edit projects")], |
858 |
["license_edit", $locale->text("Manage license keys")], |
|
859 | 858 |
["--ar", $locale->text("AR")], |
860 | 859 |
["sales_quotation_edit", $locale->text("Create and edit sales quotations")], |
861 | 860 |
["sales_order_edit", $locale->text("Create and edit sales orders")], |
SL/DB/Helper/ALL.pm | ||
---|---|---|
44 | 44 |
use SL::DB::Invoice; |
45 | 45 |
use SL::DB::InvoiceItem; |
46 | 46 |
use SL::DB::Language; |
47 |
use SL::DB::License; |
|
48 |
use SL::DB::LicenseInvoice; |
|
49 | 47 |
use SL::DB::MakeModel; |
50 | 48 |
use SL::DB::Note; |
51 | 49 |
use SL::DB::Order; |
SL/DB/Helper/Mappings.pm | ||
---|---|---|
67 | 67 |
inventory => 'inventory', |
68 | 68 |
invoice => 'invoice_item', |
69 | 69 |
language => 'language', |
70 |
license => 'license', |
|
71 |
licenseinvoice => 'license_invoice', |
|
72 | 70 |
makemodel => 'make_model', |
73 | 71 |
notes => 'note', |
74 | 72 |
orderitems => 'order_item', |
SL/DB/License.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 |
package SL::DB::License; |
|
5 |
|
|
6 |
use strict; |
|
7 |
|
|
8 |
use SL::DB::MetaSetup::License; |
|
9 |
|
|
10 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
11 |
__PACKAGE__->meta->make_manager_class; |
|
12 |
|
|
13 |
1; |
SL/DB/LicenseInvoice.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 |
package SL::DB::LicenseInvoice; |
|
5 |
|
|
6 |
use strict; |
|
7 |
|
|
8 |
use SL::DB::MetaSetup::LicenseInvoice; |
|
9 |
|
|
10 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
11 |
__PACKAGE__->meta->make_manager_class; |
|
12 |
|
|
13 |
1; |
SL/DB/MetaSetup/Licemse.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::Licemse; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'license', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
parts_id => { type => 'integer' }, |
|
15 |
customer_id => { type => 'integer' }, |
|
16 |
comment => { type => 'text' }, |
|
17 |
validuntil => { type => 'date' }, |
|
18 |
issuedate => { type => 'date', default => 'now' }, |
|
19 |
quantity => { type => 'integer' }, |
|
20 |
licensenumber => { type => 'text' }, |
|
21 |
], |
|
22 |
|
|
23 |
primary_key_columns => [ 'id' ], |
|
24 |
); |
|
25 |
|
|
26 |
1; |
|
27 |
; |
SL/DB/MetaSetup/License.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::License; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'license', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
parts_id => { type => 'integer' }, |
|
15 |
customer_id => { type => 'integer' }, |
|
16 |
comment => { type => 'text' }, |
|
17 |
validuntil => { type => 'date' }, |
|
18 |
issuedate => { type => 'date', default => 'now' }, |
|
19 |
quantity => { type => 'integer' }, |
|
20 |
licensenumber => { type => 'text' }, |
|
21 |
], |
|
22 |
|
|
23 |
primary_key_columns => [ 'id' ], |
|
24 |
); |
|
25 |
|
|
26 |
1; |
|
27 |
; |
SL/DB/MetaSetup/LicenseInvoice.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::LicenseInvoice; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'licenseinvoice', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
trans_id => { type => 'integer' }, |
|
14 |
license_id => { type => 'integer' }, |
|
15 |
id => { type => 'serial', not_null => 1 }, |
|
16 |
], |
|
17 |
|
|
18 |
primary_key_columns => [ 'id' ], |
|
19 |
); |
|
20 |
|
|
21 |
1; |
|
22 |
; |
SL/Form.pm | ||
---|---|---|
819 | 819 |
|
820 | 820 |
$additional_params->{"conf_dbcharset"} = $::lx_office_conf{system}->{dbcharset}; |
821 | 821 |
$additional_params->{"conf_webdav"} = $::lx_office_conf{features}->{webdav}; |
822 |
$additional_params->{"conf_lizenzen"} = $::lx_office_conf{features}->{lizenzen}; |
|
823 | 822 |
$additional_params->{"conf_latex_templates"} = $::lx_office_conf{print_templates}->{latex}; |
824 | 823 |
$additional_params->{"conf_opendocument_templates"} = $::lx_office_conf{print_templates}->{opendocument}; |
825 | 824 |
$additional_params->{"conf_vertreter"} = $::lx_office_conf{features}->{vertreter}; |
SL/IC.pm | ||
---|---|---|
671 | 671 |
|
672 | 672 |
my %columns = ( "assembly" => "id", "parts" => "id" ); |
673 | 673 |
|
674 |
for my $table (qw(prices partstax makemodel inventory assembly license translation parts)) {
|
|
674 |
for my $table (qw(prices partstax makemodel inventory assembly translation parts)) { |
|
675 | 675 |
my $column = defined($columns{$table}) ? $columns{$table} : "parts_id"; |
676 | 676 |
do_query($form, $dbh, qq|DELETE FROM $table WHERE $column = ?|, @values); |
677 | 677 |
} |
SL/IS.pm | ||
---|---|---|
148 | 148 |
|
149 | 149 |
my @arrays = |
150 | 150 |
qw(runningnumber number description longdescription qty ship unit bin |
151 |
deliverydate_oe ordnumber_oe transdate_oe licensenumber validuntil
|
|
151 |
deliverydate_oe ordnumber_oe transdate_oe validuntil |
|
152 | 152 |
partnotes serialnumber reqdate sellprice listprice netprice |
153 | 153 |
discount p_discount discount_sub nodiscount_sub |
154 | 154 |
linetotal nodiscount_linetotal tax_rate projectnumber projectdescription |
... | ... | |
214 | 214 |
push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description}; |
215 | 215 |
push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} }, $form->{"partsgroup_$i"}; |
216 | 216 |
push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} }, $form->{"reqdate_$i"}; |
217 |
|
|
218 |
if ($form->{lizenzen}) { |
|
219 |
if ($form->{"licensenumber_$i"}) { |
|
220 |
$query = qq|SELECT licensenumber, validuntil FROM license WHERE id = ?|; |
|
221 |
my ($licensenumber, $validuntil) = selectrow_query($form, $dbh, $query, conv_i($form->{"licensenumber_$i"})); |
|
222 |
push(@{ $form->{TEMPLATE_ARRAYS}->{licensenumber} }, $licensenumber); |
|
223 |
push(@{ $form->{TEMPLATE_ARRAYS}->{validuntil} }, $locale->date($myconfig, $validuntil, 0)); |
|
224 |
|
|
225 |
} else { |
|
226 |
push(@{ $form->{TEMPLATE_ARRAYS}->{licensenumber} }, ""); |
|
227 |
push(@{ $form->{TEMPLATE_ARRAYS}->{validuntil} }, ""); |
|
228 |
} |
|
229 |
} |
|
230 |
|
|
231 |
# listprice |
|
232 |
push(@{ $form->{TEMPLATE_ARRAYS}->{listprice} }, $form->{"listprice_$i"}); |
|
217 |
push(@{ $form->{TEMPLATE_ARRAYS}->{listprice} }, $form->{"listprice_$i"}); |
|
233 | 218 |
|
234 | 219 |
my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
235 | 220 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
... | ... | |
740 | 725 |
conv_i($form->{"marge_price_factor_$i"})); |
741 | 726 |
do_query($form, $dbh, $query, @values); |
742 | 727 |
|
743 |
if ($form->{lizenzen} && $form->{"licensenumber_$i"}) { |
|
744 |
$query = |
|
745 |
qq|INSERT INTO licenseinvoice (trans_id, license_id) |
|
746 |
VALUES ((SELECT id FROM invoice WHERE trans_id = ? ORDER BY oid DESC LIMIT 1), ?)|; |
|
747 |
@values = (conv_i($form->{"id"}), conv_i($form->{"licensenumber_$i"})); |
|
748 |
do_query($form, $dbh, $query, @values); |
|
749 |
} |
|
750 |
|
|
751 | 728 |
CVar->save_custom_variables(module => 'IC', |
752 | 729 |
sub_module => 'invoice', |
753 | 730 |
trans_id => $invoice_id, |
... | ... | |
1359 | 1336 |
my @values = (conv_i($form->{id})); |
1360 | 1337 |
do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE trans_id = ?|, @values); |
1361 | 1338 |
do_query($form, $dbh, qq|DELETE FROM invoice WHERE trans_id = ?|, @values); |
1362 |
|
|
1363 |
if ($form->{lizenzen}) { |
|
1364 |
$query = |
|
1365 |
qq|DELETE FROM licenseinvoice |
|
1366 |
WHERE trans_id in (SELECT id FROM invoice WHERE trans_id = ?)|; |
|
1367 |
do_query($form, $dbh, $query, @values); |
|
1368 |
} |
|
1369 |
|
|
1370 | 1339 |
do_query($form, $dbh, qq|DELETE FROM shipto WHERE (trans_id = ?) AND (module = 'AR')|, @values); |
1371 | 1340 |
|
1372 | 1341 |
$main::lxdebug->leave_sub(); |
... | ... | |
1583 | 1552 |
|
1584 | 1553 |
} |
1585 | 1554 |
|
1586 |
if ($form->{lizenzen}) { |
|
1587 |
$query = qq|SELECT l.licensenumber, l.id AS licenseid FROM license l, licenseinvoice li WHERE l.id = li.license_id AND li.trans_id = ?|; |
|
1588 |
my ($licensenumber, $licenseid) = selectrow_query($form, $dbh, $query, conv_i($ref->{invoice_pos})); |
|
1589 |
$ref->{lizenzen} = "<option value=\"$licenseid\">$licensenumber</option>"; |
|
1590 |
} |
|
1591 |
|
|
1592 | 1555 |
$ref->{qty} *= -1 if $form->{type} eq "credit_note"; |
1593 | 1556 |
|
1594 | 1557 |
chop $ref->{taxaccounts}; |
... | ... | |
1943 | 1906 |
$ref->{onhand} *= 1; |
1944 | 1907 |
|
1945 | 1908 |
push @{ $form->{item_list} }, $ref; |
1946 |
|
|
1947 |
if ($form->{lizenzen}) { |
|
1948 |
if ($ref->{inventory_accno} > 0) { |
|
1949 |
$query = |
|
1950 |
qq|SELECT l.* |
|
1951 |
FROM license l |
|
1952 |
WHERE l.parts_id = ? AND NOT l.id IN (SELECT li.license_id FROM licenseinvoice li)|; |
|
1953 |
my $stw = prepare_execute_query($form, $dbh, $query, conv_i($ref->{id})); |
|
1954 |
while (my $ptr = $stw->fetchrow_hashref('NAME_lc')) { |
|
1955 |
push @{ $form->{LIZENZEN}{ $ref->{id} } }, $ptr; |
|
1956 |
} |
|
1957 |
$stw->finish; |
|
1958 |
} |
|
1959 |
} |
|
1960 | 1909 |
} |
1961 | 1910 |
$sth->finish; |
1962 | 1911 |
$_->[1]->finish for @translation_queries; |
SL/LICENSES.pm | ||
---|---|---|
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 |
#===================================================================== |
|
8 |
# SQL-Ledger Accounting |
|
9 |
# Copyright (c) 2002 |
|
10 |
# |
|
11 |
# Author: Philip Reetz |
|
12 |
# Email: p.reetz@linet-services.de |
|
13 |
# Web: http://www.linet-services.de/ |
|
14 |
# |
|
15 |
# |
|
16 |
# This program is free software; you can redistribute it and/or modify |
|
17 |
# it under the terms of the GNU General Public License as published by |
|
18 |
# the Free Software Foundation; either version 2 of the License, or |
|
19 |
# (at your option) any later version. |
|
20 |
# |
|
21 |
# This program is distributed in the hope that it will be useful, |
|
22 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
# GNU General Public License for more details. |
|
25 |
# You should have received a copy of the GNU General Public License |
|
26 |
# along with this program; if not, write to the Free Software |
|
27 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
28 |
#====================================================================== |
|
29 |
# |
|
30 |
# Software license module |
|
31 |
# Backend routines |
|
32 |
#====================================================================== |
|
33 |
|
|
34 |
package LICENSES; |
|
35 |
|
|
36 |
use SL::Form; |
|
37 |
|
|
38 |
use strict; |
|
39 |
|
|
40 |
sub save_license { |
|
41 |
$main::lxdebug->enter_sub(); |
|
42 |
|
|
43 |
my ($self, $myconfig, $form) = @_; |
|
44 |
|
|
45 |
my $dbh = $form->dbconnect($myconfig); |
|
46 |
|
|
47 |
my $query = |
|
48 |
qq| INSERT INTO license (licensenumber) VALUES ('$form->{licensenumber}')|; |
|
49 |
my $sth = $dbh->prepare($query); |
|
50 |
$sth->execute || $form->dberror($query); |
|
51 |
$sth->finish(); |
|
52 |
|
|
53 |
$query = |
|
54 |
qq|SELECT l.id FROM license l WHERE l.licensenumber = '$form->{licensenumber}'|; |
|
55 |
$sth = $dbh->prepare($query); |
|
56 |
$sth->execute || $form->dberror($query); |
|
57 |
my ($license_id) = $sth->fetchrow_array; |
|
58 |
$sth->finish(); |
|
59 |
|
|
60 |
# save license |
|
61 |
$query = qq|UPDATE license SET |
|
62 |
validuntil = '$form->{validuntil}', |
|
63 |
licensenumber = '$form->{licensenumber}', |
|
64 |
parts_id = $form->{parts_id}, |
|
65 |
customer_id = $form->{customer_id}, |
|
66 |
comment = '$form->{comment}', |
|
67 |
quantity = $form->{quantity} |
|
68 |
WHERE id=$license_id|; |
|
69 |
$sth = $dbh->prepare($query); |
|
70 |
$sth->execute || $form->dberror($query); |
|
71 |
$sth->finish(); |
|
72 |
|
|
73 |
$dbh->disconnect(); |
|
74 |
|
|
75 |
$main::lxdebug->leave_sub(); |
|
76 |
|
|
77 |
return $license_id; |
|
78 |
} |
|
79 |
|
|
80 |
sub get_customers { |
|
81 |
$main::lxdebug->enter_sub(); |
|
82 |
|
|
83 |
my ($self, $myconfig, $form) = @_; |
|
84 |
|
|
85 |
my $ref; |
|
86 |
my $dbh = $form->dbconnect($myconfig); |
|
87 |
|
|
88 |
my $f = $dbh->quote('%' . $form->{"customer_name"} . '%'); |
|
89 |
my $query = qq|SELECT * FROM customer WHERE name ilike $f|; |
|
90 |
my $sth = $dbh->prepare($query); |
|
91 |
$sth->execute || $form->dberror($query); |
|
92 |
$form->{"all_customers"} = []; |
|
93 |
while ($ref = $sth->fetchrow_hashref("NAME_lc")) { |
|
94 |
push(@{ $form->{"all_customers"} }, $ref); |
|
95 |
} |
|
96 |
$sth->finish(); |
|
97 |
$dbh->disconnect(); |
|
98 |
$main::lxdebug->leave_sub(); |
|
99 |
} |
|
100 |
|
|
101 |
sub search { |
|
102 |
$main::lxdebug->enter_sub(); |
|
103 |
|
|
104 |
my ($self, $myconfig, $form) = @_; |
|
105 |
my ($ref, $sth, $f, $s, $query); |
|
106 |
my $dbh = $form->dbconnect($myconfig); |
|
107 |
|
|
108 |
if ($form->{"partnumber"} || $form->{"description"}) { |
|
109 |
$f = "(parts_id IN (SELECT id FROM parts WHERE "; |
|
110 |
if ($form->{"partnumber"}) { |
|
111 |
$f .= |
|
112 |
"(partnumber ILIKE " |
|
113 |
. $dbh->quote('%' . $form->{"partnumber"} . '%') . ")"; |
|
114 |
} |
|
115 |
if ($form->{"description"}) { |
|
116 |
$f .= " AND " if ($form->{"partnumber"}); |
|
117 |
$f .= |
|
118 |
"(description ILIKE " |
|
119 |
. $dbh->quote('%' . $form->{"description"} . '%') . ")"; |
|
120 |
} |
|
121 |
$f .= "))"; |
|
122 |
} |
|
123 |
|
|
124 |
if ($form->{"customer_name"}) { |
|
125 |
$f .= " AND " if ($f); |
|
126 |
$f .= |
|
127 |
"(l.customer_id IN (SELECT id FROM customer WHERE name ILIKE " |
|
128 |
. $dbh->quote('%' . $form->{"customer_name"} . '%') . "))"; |
|
129 |
} |
|
130 |
|
|
131 |
if (!$form->{"all"} && $form->{"expiring_in"}) { |
|
132 |
$f .= " AND " if ($f); |
|
133 |
$f .= |
|
134 |
"(validuntil < now() + " |
|
135 |
. $dbh->quote("" . $form->{"expiring_in"} . " months") . ")"; |
|
136 |
} |
|
137 |
|
|
138 |
if (!$form->{"show_expired"}) { |
|
139 |
$f .= " AND " if ($f); |
|
140 |
$f .= "(validuntil >= now())"; |
|
141 |
} |
|
142 |
|
|
143 |
if ($f) { |
|
144 |
$f = "WHERE (inventory_accno_id notnull) AND $f"; |
|
145 |
} else { |
|
146 |
$f = "WHERE (inventory_accno_id notnull)"; |
|
147 |
} |
|
148 |
|
|
149 |
if ($form->{"sortby"} eq "partnumber") { |
|
150 |
$s = "p.partnumber"; |
|
151 |
} elsif ($form->{"sortby"} eq "description") { |
|
152 |
$s = "p.description"; |
|
153 |
} elsif ($form->{"sortby"} eq "name") { |
|
154 |
$s = "c.name"; |
|
155 |
} elsif ($form->{"sortby"} eq "validuntil") { |
|
156 |
$s = "l.validuntil"; |
|
157 |
} else { |
|
158 |
$s = "l.validuntil"; |
|
159 |
} |
|
160 |
if ($form->{"sortasc"}) { |
|
161 |
$s .= " ASC"; |
|
162 |
} else { |
|
163 |
$s .= " DESC"; |
|
164 |
} |
|
165 |
|
|
166 |
$query = |
|
167 |
"SELECT l.*, p.partnumber, p.description, c.name, a.invnumber " |
|
168 |
. "FROM license l " |
|
169 |
. "LEFT JOIN parts p ON (p.id = l.parts_id) " |
|
170 |
. "LEFT JOIN customer c ON (c.id = l.customer_id) " |
|
171 |
. "LEFT JOIN ar a ON " |
|
172 |
. "(a.id = (SELECT i.trans_id FROM invoice i WHERE i.id = " |
|
173 |
. "(SELECT li.trans_id FROM licenseinvoice li WHERE li.license_id = l.id))) " |
|
174 |
. "$f ORDER BY $s"; |
|
175 |
|
|
176 |
$sth = $dbh->prepare($query); |
|
177 |
$sth->execute() || $form->dberror($query); |
|
178 |
$form->{"licenses"} = []; |
|
179 |
while ($ref = $sth->fetchrow_hashref("NAME_lc")) { |
|
180 |
push(@{ $form->{"licenses"} }, $ref); |
|
181 |
} |
|
182 |
|
|
183 |
$sth->finish(); |
|
184 |
$dbh->disconnect(); |
|
185 |
$main::lxdebug->leave_sub(); |
|
186 |
} |
|
187 |
|
|
188 |
sub get_license { |
|
189 |
$main::lxdebug->enter_sub(); |
|
190 |
|
|
191 |
my ($self, $myconfig, $form) = @_; |
|
192 |
my ($ref, $sth, $query); |
|
193 |
my $dbh = $form->dbconnect($myconfig); |
|
194 |
|
|
195 |
$query = |
|
196 |
"SELECT l.*, p.partnumber, p.description, c.name, c.street, " |
|
197 |
. "c.zipcode, c.city, c.country, c.contact, c.phone, c.fax, c.homepage, " |
|
198 |
. "c.email, c.notes, c.customernumber, c.language, a.invnumber " |
|
199 |
. "FROM license l " |
|
200 |
. "LEFT JOIN parts p ON (p.id = l.parts_id) " |
|
201 |
. "LEFT JOIN customer c ON (c.id = l.customer_id) " |
|
202 |
. "LEFT JOIN ar a ON " |
|
203 |
. "(a.id = (SELECT i.trans_id FROM invoice i WHERE i.id = " |
|
204 |
. "(SELECT li.trans_id FROM licenseinvoice li WHERE li.license_id = l.id))) " |
|
205 |
. "LEFT JOIN invoice i ON " |
|
206 |
. "(i.id = " |
|
207 |
. "(SELECT li.trans_id FROM licenseinvoice li WHERE li.license_id = l.id)) " |
|
208 |
. "WHERE l.id = " |
|
209 |
. $form->{"id"}; |
|
210 |
$sth = $dbh->prepare($query); |
|
211 |
$sth->execute() || $form->dberror($query); |
|
212 |
$form->{"license"} = $sth->fetchrow_hashref("NAME_lc"); |
|
213 |
$sth->finish(); |
|
214 |
$dbh->disconnect(); |
|
215 |
$main::lxdebug->leave_sub(); |
|
216 |
} |
|
217 |
|
|
218 |
1; |
bin/mozilla/io.pl | ||
---|---|---|
148 | 148 |
{ id => 'qty', width => 5, value => $locale->text('Qty'), display => 1, }, |
149 | 149 |
{ id => 'price_factor', width => 5, value => $locale->text('Price Factor'), display => !$is_delivery_order, }, |
150 | 150 |
{ id => 'unit', width => 5, value => $locale->text('Unit'), display => 1, }, |
151 |
{ id => 'license', width => 10, value => $locale->text('License'), display => 0, }, |
|
152 | 151 |
{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, }, |
153 | 152 |
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, }, |
154 | 153 |
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, }, |
... | ... | |
500 | 499 |
partsgroup formel longdescription not_discountable partnotes lastcost |
501 | 500 |
price_factor_id price_factor); |
502 | 501 |
|
503 |
push @new_fields, 'lizenzen' if $::lx_office_conf{features}->{lizenzen}; |
|
504 |
|
|
505 | 502 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
506 | 503 |
push @new_fields, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
507 | 504 |
|
... | ... | |
1795 | 1792 |
$main::lxdebug->leave_sub(); |
1796 | 1793 |
} |
1797 | 1794 |
|
1798 |
sub new_license { |
|
1799 |
$main::lxdebug->enter_sub(); |
|
1800 |
|
|
1801 |
my $form = $main::form; |
|
1802 |
|
|
1803 |
_check_io_auth(); |
|
1804 |
|
|
1805 |
my $row = shift; |
|
1806 |
|
|
1807 |
# change callback |
|
1808 |
$form->{old_callback} = $form->escape($form->{callback}, 1); |
|
1809 |
$form->{callback} = $form->escape("$form->{script}?action=display_form", 1); |
|
1810 |
$form->{old_callback} = $form->escape($form->{old_callback}, 1); |
|
1811 |
|
|
1812 |
# delete action |
|
1813 |
delete $form->{action}; |
|
1814 |
my $customer = $form->{customer}; |
|
1815 |
map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description); |
|
1816 |
|
|
1817 |
# save all other form variables in a previousform variable |
|
1818 |
$form->{row} = $row; |
|
1819 |
my $previousform; |
|
1820 |
foreach my $key (keys %$form) { |
|
1821 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
|
1822 |
|
|
1823 |
# escape ampersands |
|
1824 |
$form->{$key} =~ s/&/%26/g; |
|
1825 |
$previousform .= qq|$key=$form->{$key}&|; |
|
1826 |
} |
|
1827 |
chop $previousform; |
|
1828 |
$previousform = $form->escape($previousform, 1); |
|
1829 |
|
|
1830 |
$form->{script} = "licenses.pl"; |
|
1831 |
|
|
1832 |
map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description); |
|
1833 |
map { $form->{$_} = $form->escape($form->{$_}, 1) } |
|
1834 |
qw(partnumber description); |
|
1835 |
$form->{callback} = |
|
1836 |
qq|$form->{script}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$form->{name}&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|; |
|
1837 |
$form->redirect; |
|
1838 |
|
|
1839 |
$main::lxdebug->leave_sub(); |
|
1840 |
} |
|
1841 |
|
|
1842 | 1795 |
sub relink_accounts { |
1843 | 1796 |
$main::lxdebug->enter_sub(); |
1844 | 1797 |
|
bin/mozilla/is.pl | ||
---|---|---|
134 | 134 |
|
135 | 135 |
# create links |
136 | 136 |
$form->{webdav} = $::lx_office_conf{features}->{webdav}; |
137 |
$form->{lizenzen} = $::lx_office_conf{features}->{lizenzen}; |
|
138 | 137 |
|
139 | 138 |
$form->create_links("AR", \%myconfig, "customer"); |
140 | 139 |
|
... | ... | |
562 | 561 |
|
563 | 562 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); |
564 | 563 |
|
565 |
if ($::lx_office_conf{features}->{lizenzen}) { |
|
566 |
if ($form->{"inventory_accno_$i"} ne "") { |
|
567 |
$form->{"lizenzen_$i"} = qq|<option></option>|; |
|
568 |
foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) { |
|
569 |
$form->{"lizenzen_$i"} .= qq|<option value="$item->{"id"}">$item->{"licensenumber"}</option>|; |
|
570 |
} |
|
571 |
$form->{"lizenzen_$i"} .= qq|<option value=-1>Neue Lizenz</option>|; |
|
572 |
} |
|
573 |
} |
|
574 |
|
|
575 | 564 |
# get pricegroups for parts |
576 | 565 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
577 | 566 |
|
bin/mozilla/licenses.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 |
#===================================================================== |
|
8 |
# SQL-Ledger Accounting |
|
9 |
# Copyright (c) 2002 |
|
10 |
# |
|
11 |
# Author: Moritz Bunkus |
|
12 |
# Email: m.bunkus@linet-services.de |
|
13 |
# Web: http://www.linet-services.de/ |
|
14 |
# |
|
15 |
# |
|
16 |
# This program is free software; you can redistribute it and/or modify |
|
17 |
# it under the terms of the GNU General Public License as published by |
|
18 |
# the Free Software Foundation; either version 2 of the License, or |
|
19 |
# (at your option) any later version. |
|
20 |
# |
|
21 |
# This program is distributed in the hope that it will be useful, |
|
22 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
# GNU General Public License for more details. |
|
25 |
# You should have received a copy of the GNU General Public License |
|
26 |
# along with this program; if not, write to the Free Software |
|
27 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
28 |
#====================================================================== |
|
29 |
# |
|
30 |
# Software license module |
|
31 |
# |
|
32 |
#====================================================================== |
|
33 |
|
|
34 |
use SL::IC; |
|
35 |
use SL::IS; |
|
36 |
use SL::LICENSES; |
|
37 |
|
|
38 |
require "bin/mozilla/common.pl"; |
|
39 |
|
|
40 |
use strict; |
|
41 |
|
|
42 |
sub quot { |
|
43 |
$main::lxdebug->enter_sub(); |
|
44 |
$_[0] =~ s/\"/\"/g; |
|
45 |
$main::lxdebug->leave_sub(); |
|
46 |
return $_[0]; |
|
47 |
} |
|
48 |
|
|
49 |
sub form_header { |
|
50 |
$main::lxdebug->enter_sub(); |
|
51 |
|
|
52 |
$main::auth->assert('license_edit'); |
|
53 |
|
|
54 |
my $form = $main::form; |
|
55 |
|
|
56 |
$form->{jsscript} = 1; |
|
57 |
$form->header(); |
|
58 |
|
|
59 |
print( |
|
60 |
qq|<body> |
|
61 |
|
|
62 |
<form method=post action=$form->{script}>|); |
|
63 |
$main::lxdebug->leave_sub(); |
|
64 |
} |
|
65 |
|
|
66 |
sub form_footer { |
|
67 |
$main::lxdebug->enter_sub(); |
|
68 |
|
|
69 |
$main::auth->assert('license_edit'); |
|
70 |
|
|
71 |
my $form = $main::form; |
|
72 |
|
|
73 |
my @items = qw(old_callback previousform); |
|
74 |
push @items, @{ $form->{"hidden"} } if ref $form->{hidden} eq 'ARRAY'; |
|
75 |
map({ |
|
76 |
print("<input type=hidden name=$_ value=\"" . quot($form->{$_}) . "\">\n" |
|
77 |
); |
|
78 |
} @items); |
|
79 |
|
|
80 |
print( |
|
81 |
qq|<input type="hidden" name="cursor_field" value='$form->{cursor_field}'></form> |
|
82 |
</body> |
|
83 |
</html> |
|
84 |
|); |
|
85 |
$main::lxdebug->leave_sub(); |
|
86 |
} |
|
87 |
|
|
88 |
sub set_std_hidden { |
|
89 |
$main::lxdebug->enter_sub(); |
|
90 |
|
|
91 |
my $form = $main::form; |
|
92 |
|
|
93 |
$form->{"hidden"} = ["comment", "validuntil", "quantity", @_]; |
|
94 |
$main::lxdebug->leave_sub(); |
|
95 |
} |
|
96 |
|
|
97 |
sub print_part_selection { |
|
98 |
$main::lxdebug->enter_sub(); |
|
99 |
|
|
100 |
$main::auth->assert('license_edit'); |
|
101 |
|
|
102 |
my $form = $main::form; |
|
103 |
my $locale = $main::locale; |
|
104 |
|
|
105 |
form_header(); |
|
106 |
set_std_hidden("business"); |
|
107 |
|
|
108 |
print( |
|
109 |
qq| |
|
110 |
|
|
111 |
<table width=100%> |
|
112 |
<tr> |
|
113 |
<th class=listtop colspan=5>| |
|
114 |
. $locale->text('Select from one of the items below') . qq|</th> |
|
115 |
</tr> |
|
116 |
<tr height="5"></tr> |
|
117 |
<tr class=listheading> |
|
118 |
<th> </th> |
|
119 |
<th class=listheading>| . $locale->text('Part Number') . qq|</th> |
|
120 |
<th class=listheading>| . $locale->text('Description') . qq|</th> |
|
121 |
</tr> |
|
122 |
|); |
|
123 |
|
|
124 |
my $j = 1; |
|
125 |
for (my $i = 1; $i <= scalar(@{ $form->{"parts"} }); $i++) { |
|
126 |
my %p = %{ $form->{"parts"}->[$i - 1] }; |
|
127 |
my $checked; |
|
128 |
if ($i == 1) { |
|
129 |
$checked = "checked"; |
|
130 |
} else { |
|
131 |
$checked = ""; |
|
132 |
} |
|
133 |
|
|
134 |
print( |
|
135 |
qq|<tr class=listrow$j> |
|
136 |
<td><input name=ndx class=radio type=radio value=$i $checked></td> |
|
137 |
<td><input name=\"new_partnumber_$i\" type=hidden value=\"| |
|
138 |
. $p{"partnumber"} . qq|\">| . $p{"partnumber"} . qq|</td> |
|
139 |
<td><input name=\"new_description_$i\" type=hidden value=\"| |
|
140 |
. $p{"description"} . qq|\">| . $p{"description"} . qq|</td> |
|
141 |
<input name=\"new_parts_id_$i\" type=hidden value=\"| . $p{"id"} . qq|\"> |
|
142 |
</tr>|); |
|
143 |
|
|
144 |
$j = ($j + 1) % 2; |
|
145 |
} |
|
146 |
|
|
147 |
print( |
|
148 |
qq|<tr><td colspan=3><hr size=3 noshade></td></tr> |
|
149 |
</table> |
|
150 |
|
|
151 |
<input type=hidden name=nextsub value=\"do_add\"> |
|
152 |
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|); |
|
153 |
|
|
154 |
form_footer(); |
|
155 |
$main::lxdebug->leave_sub(); |
|
156 |
} |
|
157 |
|
|
158 |
sub print_customer_selection { |
|
159 |
$main::lxdebug->enter_sub(); |
|
160 |
|
|
161 |
$main::auth->assert('license_edit'); |
|
162 |
|
|
163 |
my $form = $main::form; |
|
164 |
my $locale = $main::locale; |
|
165 |
|
|
166 |
form_header(); |
|
167 |
set_std_hidden("parts_id", "partnumber", "description"); |
|
168 |
|
|
169 |
print( |
|
170 |
qq| |
|
171 |
<table width=100%> |
|
172 |
<tr> |
|
173 |
<th class=listtop colspan=5>| |
|
174 |
. $locale->text('Select from one of the names below') . qq|</th> |
|
175 |
</tr> |
|
176 |
<tr height="5"></tr> |
|
177 |
<tr class=listheading> |
|
178 |
<th> </th> |
|
179 |
<th class=listheading>| . $locale->text('Customer Number') . qq|</th> |
|
180 |
<th class=listheading>| . $locale->text('Company Name') . qq|</th> |
|
181 |
<th class=listheading>| . $locale->text('Street') . qq|</th> |
|
182 |
<th class=listheading>| . $locale->text('Zipcode') . qq|</th> |
|
183 |
<th class=listheading>| . $locale->text('City') . qq|</th> |
|
184 |
</tr> |
|
185 |
|); |
|
186 |
|
|
187 |
print(qq|<tr><td colspan=6><hr size=3 noshade></td></tr>|); |
|
188 |
|
|
189 |
my $j = 1; |
|
190 |
for (my $i = 1; $i <= scalar(@{ $form->{"all_customers"} }); $i++) { |
|
191 |
my %c = %{ $form->{"all_customers"}->[$i - 1] }; |
|
192 |
my $checked; |
|
193 |
if ($i == 1) { |
|
194 |
$checked = "checked"; |
|
195 |
} else { |
|
196 |
$checked = ""; |
|
197 |
} |
|
198 |
|
|
199 |
print( |
|
200 |
qq|<tr class=listrow$j> |
|
201 |
<td><input name=ndx class=radio type=radio value=$i $checked></td> |
|
202 |
<td><input name=\"new_customer_id_$i\" type=hidden value=\"| |
|
203 |
. $c{"id"} . qq|\">$c{"customernumber"}</td> |
|
204 |
<td><input name=\"new_customer_name_$i\" type=hidden value=\"| |
|
205 |
. $c{"name"} . qq|\">$c{"name"}</td> |
|
206 |
<td>$c{"street"}</td> |
|
207 |
<td>$c{"zipcode"}</td> |
|
208 |
<td>$c{"city"}</td> |
|
209 |
</tr>|); |
|
210 |
|
|
211 |
$j = ($j + 1) % 2; |
|
212 |
} |
|
213 |
|
|
214 |
print( |
|
215 |
qq| |
|
216 |
</table> |
|
217 |
|
|
218 |
<input type=hidden name=nextsub value=\"do_add\"> |
|
219 |
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|); |
|
220 |
|
|
221 |
form_footer(); |
|
222 |
$main::lxdebug->leave_sub(); |
|
223 |
} |
|
224 |
|
|
225 |
sub print_license_form { |
|
226 |
$main::lxdebug->enter_sub(); |
|
227 |
|
|
228 |
$main::auth->assert('license_edit'); |
|
229 |
|
|
230 |
my $form = $main::form; |
|
231 |
my %myconfig = %main::myconfig; |
|
232 |
my $locale = $main::locale; |
|
233 |
|
|
234 |
print( |
|
235 |
qq| |
|
236 |
<table width=100%> |
|
237 |
<tr> |
|
238 |
<th class=listtop>| . $locale->text("Add License") . qq|</th> |
|
239 |
</tr> |
|
240 |
<tr> |
|
241 |
<table> |
|
242 |
<tr> |
|
243 |
<th align=right>| . $locale->text('Part Number') . qq|</th> |
|
244 |
<td><input name=partnumber value=\"| |
|
245 |
. quot($form->{"partnumber"}) . qq|\"></td> |
|
246 |
</tr> |
|
247 |
<tr> |
|
248 |
<th align=right>| . $locale->text('Description') . qq|</th> |
|
249 |
<td><input name=description value=\"| |
|
250 |
. quot($form->{"description"}) . qq|\"></td> |
|
251 |
</tr> |
|
252 |
<tr> |
|
253 |
<th align=right>| . $locale->text('Company Name') . qq|</th>|); |
|
254 |
if ($form->{"all_customer"}) { |
|
255 |
print(qq|<td><select name=\"customer\">|); |
|
256 |
foreach (@{ $form->{"all_customer"} }) { |
|
257 |
if (!defined($form->{"customer_id"})) { |
|
258 |
$form->{"customer_id"} = $_->{"id"}; |
|
259 |
} |
|
260 |
my $selected = ($_->{"id"} * 1) == $form->{"customer_id"} ? "selected" : ""; |
|
261 |
print(qq|<option $selected> $_->{"name"}--$_->{"id"}</option>|); |
|
262 |
} |
|
263 |
print(qq|</select></td>|); |
|
264 |
} else { |
|
265 |
print( qq|<td><input name=customer_name value=\"| |
|
266 |
. quot($form->{"customer_name"}) |
|
267 |
. qq|\"></td>|); |
|
268 |
} |
|
269 |
print( |
|
270 |
qq|</tr> |
|
271 |
<tr> |
|
272 |
<th align=right>| . $locale->text('Comment') . qq|</th> |
|
273 |
<td><input name=comment value=\"| |
|
274 |
. quot($form->{"comment"}) . qq|\"></td> |
|
275 |
</tr> |
|
276 |
<tr> |
|
277 |
<th align=right>| . $locale->text('Valid until') . qq|</th> |
|
278 |
<td><input id=validuntil name=validuntil value=\"| |
|
279 |
. quot($form->{"validuntil"}) . qq|\"> |
|
280 |
<input type="button" name="validuntil" id="trigger_validuntil" value="?"></td> |
|
281 |
</tr> |
|
282 |
<tr> |
|
283 |
<th align=right>| . $locale->text('Quantity') . qq|</th> |
|
284 |
<td><input name=quantity value=\"| |
|
285 |
. quot($form->{"quantity"}) . qq|\"></td> |
|
286 |
</tr> |
|
287 |
<tr> |
|
288 |
<th align=right>| . $locale->text('License key') . qq|</th> |
|
289 |
<td><input name=licensenumber value=\"| |
|
290 |
. quot($form->{"licensenumber"}) . qq|\"></td> |
|
291 |
</tr> |
|
292 |
<tr> |
|
293 |
<th align=right>| . $locale->text('Own Product') . qq|</th> |
|
294 |
<td><input type=checkbox name=own_product value=1 checked></td> |
|
295 |
</tr> |
|
296 |
</table> |
|
297 |
|
|
298 |
<input type=submit name=action value=\"| . $locale->text('Update') . qq|\"> |
|
299 |
|); |
|
300 |
|
|
301 |
if ($_[0]) { |
|
302 |
print( |
|
303 |
qq| |
|
304 |
<input type=submit name=action value=\"| |
|
305 |
. $locale->text('Save') . qq|\">\n|); |
|
306 |
} |
|
307 |
print( |
|
308 |
qq| |
|
309 |
</tr> |
|
310 |
|
|
311 |
</table>| . |
|
312 |
$form->write_trigger(\%myconfig, 1, "validuntil", "BL", |
|
313 |
"trigger_validuntil")); |
|
314 |
|
|
315 |
$main::lxdebug->leave_sub(); |
|
316 |
} |
|
317 |
|
|
318 |
sub add { |
|
319 |
$main::lxdebug->enter_sub(); |
|
320 |
|
|
321 |
$main::auth->assert('license_edit'); |
|
322 |
|
|
323 |
my $form = $main::form; |
|
324 |
my $locale = $main::locale; |
|
325 |
|
|
326 |
$form->{title} = $locale->text('Add License'); |
|
327 |
|
|
328 |
if (!$::lx_office_conf{features}->{lizenzen}) { |
|
329 |
$form->error( |
|
330 |
$locale->text( |
|
331 |
'The licensing module has been deactivated in the configuration.') |
|
332 |
); |
|
333 |
} |
|
334 |
|
|
335 |
$form->{"initial"} = 1; |
|
336 |
|
|
337 |
do_add(); |
|
338 |
$main::lxdebug->leave_sub(); |
|
339 |
} |
|
340 |
|
|
341 |
sub do_add { |
|
342 |
$main::lxdebug->enter_sub(); |
|
343 |
|
|
344 |
$main::auth->assert('license_edit'); |
|
345 |
|
|
346 |
my $form = $main::form; |
|
347 |
my %myconfig = %main::myconfig; |
|
348 |
|
|
349 |
$form->{"hidden"} = ["parts_id"]; |
|
350 |
form_header(); |
|
351 |
|
|
352 |
if ($form->{"ndx"}) { |
|
353 |
my $ndx = $form->{"ndx"}; |
|
354 |
foreach (keys(%{$form})) { |
|
355 |
next unless (/^new_.*_${ndx}$/); |
|
356 |
s/^new_//; |
|
357 |
s/_${ndx}$//; |
|
358 |
$form->{$_} = $form->{"new_${_}_${ndx}"}; |
|
359 |
} |
|
360 |
} |
|
361 |
|
|
362 |
if ($form->{"customer"}) { |
|
363 |
$form->{"customer_id"} = (split(/--/, $form->{"customer"}))[1]; |
|
364 |
} |
|
365 |
|
|
366 |
if ($form->{"customer_name"}) { |
|
367 |
LICENSES->get_customers(\%myconfig, $form); |
|
368 |
if (scalar(@{ $form->{"all_customers"} }) == 1) { |
|
369 |
my %c = %{ $form->{"all_customers"}->[0] }; |
|
370 |
$form->{"customer_id"} = $c{"id"}; |
|
371 |
$form->{"customer_name"} = $c{"name"}; |
|
372 |
} elsif (scalar(@{ $form->{"all_customers"} }) == 0) { |
|
373 |
$form->{"customer_name"} = ""; |
|
374 |
delete($form->{"customer_id"}); |
|
375 |
} else { |
|
376 |
print_customer_selection(); |
|
377 |
return; |
|
378 |
} |
|
379 |
} elsif (defined($form->{"customer_name"})) { |
|
380 |
delete($form->{"customer_id"}); |
|
381 |
} |
|
382 |
|
|
383 |
if ($form->{"partnumber"} || $form->{"description"}) { |
|
384 |
$form->{"sort"} = "p.partnumber"; |
|
385 |
$form->{searchitems} = "part"; |
|
386 |
IC->all_parts(\%myconfig, $form); |
|
387 |
if (scalar(@{ $form->{"parts"} }) == 1) { |
|
388 |
map({ $form->{$_} = $form->{"parts"}->[0]->{$_}; } |
|
389 |
("partnumber", "description")); |
|
390 |
$form->{"parts_id"} = $form->{"parts"}->[0]->{"id"}; |
|
391 |
|
|
392 |
} elsif (scalar(@{ $form->{"parts"} }) == 0) { |
|
393 |
map({ $form->{$_} = ""; }("partnumber", "description", "parts_id")); |
|
394 |
|
|
395 |
} else { |
|
396 |
print_part_selection(); |
|
397 |
return; |
|
398 |
} |
|
399 |
} else { |
|
400 |
delete($form->{"parts_id"}); |
|
401 |
} |
|
402 |
|
|
403 |
$form->all_vc(\%myconfig, "customer", ""); |
|
404 |
|
|
405 |
print_license_form($form->{"parts_id"} && $form->{"customer_id"}); |
|
406 |
|
|
407 |
form_footer(); |
|
408 |
$main::lxdebug->leave_sub(); |
|
409 |
} |
|
410 |
|
|
411 |
sub update { |
|
412 |
$main::lxdebug->enter_sub(); |
|
413 |
|
|
414 |
$main::auth->assert('license_edit'); |
|
415 |
|
|
416 |
my $form = $main::form; |
|
417 |
|
|
418 |
do_add(); |
|
419 |
|
|
420 |
$main::lxdebug->leave_sub(); |
|
421 |
} |
|
422 |
|
|
423 |
sub continue { |
|
424 |
$main::lxdebug->enter_sub(); |
|
425 |
|
|
426 |
my $form = $main::form; |
|
427 |
|
|
428 |
call_sub($form->{"nextsub"}); |
|
429 |
$main::lxdebug->leave_sub(); |
|
430 |
} |
|
431 |
|
|
432 |
sub save { |
|
433 |
$main::lxdebug->enter_sub(); |
|
434 |
|
|
435 |
$main::auth->assert('license_edit'); |
|
436 |
|
|
437 |
my $form = $main::form; |
|
438 |
my %myconfig = %main::myconfig; |
|
439 |
my $locale = $main::locale; |
|
440 |
|
|
441 |
($form->{customername}, $form->{customer_id}) = split /--/, |
|
442 |
$form->{customer}; |
|
443 |
|
|
444 |
$form->isblank("customer", $locale->text('Customer missing!')); |
|
445 |
|
|
446 |
if ( $form->{quantity} eq "" |
|
447 |
|| $form->{quantity} !~ /^[0-9]*$/ |
|
448 |
|| $form->{quantity} < 1) { |
|
449 |
$form->error($locale->text('Please enter a number of licenses.')); |
|
450 |
} |
|
451 |
|
|
452 |
if (!$form->{licensenumber} || $form->{licensenumber} eq "") { |
|
453 |
$form->error($locale->text('Please enter a license key.')); |
|
454 |
} |
|
455 |
|
|
456 |
my $rc = LICENSES->save_license(\%myconfig, \%$form); |
|
457 |
|
|
458 |
# load previous variables |
|
459 |
if ($form->{previousform}) { |
|
460 |
|
|
461 |
# save the new form variables before splitting previousform |
|
462 |
my %newform; |
|
463 |
map { $newform{$_} = $form->{$_} } keys %$form; |
|
464 |
|
|
465 |
my $previousform = $form->unescape($form->{previousform}); |
|
466 |
|
|
467 |
# don't trample on previous variables |
|
468 |
map { delete $form->{$_} } keys %newform; |
|
469 |
|
|
470 |
# now take it apart and restore original values |
|
471 |
foreach my $item (split /&/, $previousform) { |
|
472 |
my ($key, $value) = split /=/, $item, 2; |
|
473 |
$value =~ s/%26/&/g; |
|
474 |
$form->{$key} = $value; |
|
475 |
} |
|
476 |
|
|
477 |
$form->{"lizenzen_$form->{row}"} = |
|
478 |
"<option value=$rc>$newform{licensenumber}</option>"; |
|
479 |
$form->{rowcount}--; |
|
480 |
|
|
481 |
delete $form->{action}; |
|
482 |
|
|
483 |
# restore original callback |
|
484 |
my $callback = $form->unescape($form->{callback}); |
|
485 |
$form->{callback} = $form->unescape($form->{old_callback}); |
|
486 |
delete $form->{old_callback}; |
|
487 |
|
|
488 |
# put callback together |
|
489 |
foreach my $key (keys %$form) { |
|
490 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
|
491 |
|
|
492 |
# do single escape for Apache 2.0 |
|
493 |
my $value = $form->escape($form->{$key}, 1); |
|
494 |
$callback .= qq|&$key=$value|; |
|
495 |
} |
|
496 |
$form->{callback} = $callback; |
|
497 |
|
|
498 |
# redirect |
|
499 |
$form->redirect; |
|
500 |
|
|
501 |
} else { |
|
502 |
form_header(); |
|
503 |
|
|
504 |
print("Die Lizenz wurde gespeichert.\n"); |
|
505 |
form_footer(); |
|
506 |
} |
|
507 |
|
|
508 |
$main::lxdebug->leave_sub(); |
|
509 |
} |
|
510 |
|
|
511 |
sub search { |
|
512 |
$main::lxdebug->enter_sub(); |
|
513 |
|
|
514 |
$main::auth->assert('license_edit'); |
|
515 |
|
|
516 |
my $form = $main::form; |
|
517 |
my $locale = $main::locale; |
|
518 |
|
|
519 |
$form->{title} = $locale->text('Licenses'); |
|
520 |
|
|
521 |
if (!$::lx_office_conf{features}->{lizenzen}) { |
|
522 |
$form->error( |
|
523 |
$locale->text( |
|
524 |
'The licensing module has been deactivated in the configuration.') |
|
525 |
); |
|
526 |
} |
|
527 |
|
|
528 |
form_header(); |
|
529 |
|
|
530 |
print( |
|
531 |
qq| |
|
532 |
<table width=100%> |
|
533 |
<tr> |
|
534 |
<th class=listtop>| . $locale->text("Licenses") . qq|</th> |
|
535 |
</tr> |
|
536 |
<tr> |
|
537 |
<table> |
|
538 |
<tr> |
|
539 |
<th align=right>| . $locale->text('Part Number') . qq|</th> |
|
540 |
<td><input name=partnumber></td> |
|
541 |
</tr> |
|
542 |
<tr> |
|
543 |
<th align=right>| . $locale->text('Description') . qq|</th> |
|
544 |
<td><input name=description></td> |
|
545 |
</tr> |
|
546 |
<tr> |
|
547 |
<th align=right>| . $locale->text('Company Name') . qq|</th> |
|
548 |
<td><input name=customer_name></td> |
|
549 |
</tr> |
|
550 |
<tr> |
|
551 |
<th align=right>| . $locale->text('Include in Report') . qq|</th> |
|
552 |
<td><input type=radio name=all value=1 checked>| |
|
553 |
. $locale->text('All') |
|
554 |
. qq| <input type=radio name=all value=0>| |
|
555 |
. $locale->text('Expiring in x month(s)') |
|
556 |
. qq| <input size=4 name=expiring_in value="1"><br> |
|
557 |
<input type=checkbox name=show_expired value=1>| |
|
558 |
. $locale->text('Expired licenses') . qq|</td> |
|
559 |
</tr> |
|
560 |
</table> |
|
561 |
</tr> |
|
562 |
<tr><td colspan=4><hr size=3 noshade></td></tr> |
|
563 |
</table> |
|
564 |
|
|
565 |
<input type=hidden name=nextsub value=\"do_search\"> |
|
566 |
<input type=submit name=action value=\"| . $locale->text('Continue') . qq|\"> |
|
567 |
|
|
568 |
|); |
|
569 |
|
|
570 |
form_footer(); |
|
571 |
$main::lxdebug->leave_sub(); |
|
572 |
} |
|
573 |
|
|
574 |
sub do_search { |
|
575 |
$main::lxdebug->enter_sub(); |
|
576 |
|
|
577 |
$main::auth->assert('license_edit'); |
|
578 |
|
|
579 |
my $form = $main::form; |
|
580 |
my %myconfig = %main::myconfig; |
|
581 |
my $locale = $main::locale; |
|
582 |
|
|
583 |
LICENSES->search(\%myconfig, $form); |
|
584 |
|
|
585 |
my $callback = ""; |
|
586 |
map { $callback .= "\&${_}=" . $form->escape($form->{$_}, 1) } |
|
587 |
qw(db partnumber description customer_name all expiring_in show_expired); |
|
588 |
my $details = $form->{"script"} . "?action=details" . $callback . "\&id="; |
|
589 |
my $invdetails = "is.pl?action=edit" . $callback . "\&id="; |
|
590 |
$callback = $form->{"script"} . "?action=do_search" . $callback; |
|
591 |
|
|
592 |
$form->{"sortby"} = "validuntil" unless ($form->{"sortby"}); |
|
593 |
$form->{"sortasc"} *= 1; |
|
594 |
my %columns; |
|
595 |
foreach (("partnumber", "description", "name", "validuntil", "invnumber")) { |
|
596 |
$columns{$_} = $callback . "\&sortby=${_}\&sortasc="; |
|
597 |
if ($form->{"sortby"} eq $_) { |
|
598 |
$columns{$_} .= (1 - $form->{"sortasc"}); |
|
599 |
} else { |
|
600 |
$columns{$_} .= "1"; |
|
601 |
} |
|
602 |
} |
|
603 |
|
|
604 |
form_header(); |
|
605 |
|
|
606 |
print( |
|
607 |
qq| |
|
608 |
<table width=100%> |
|
609 |
<tr> |
|
610 |
<th class=listtop>| . $locale->text("Licenses") . qq|</th> |
|
611 |
</tr> |
|
612 |
|); |
|
613 |
if (scalar(@{ $form->{"licenses"} }) == 0) { |
|
614 |
print(qq|</table>| |
|
615 |
. $locale->text( |
|
616 |
"No licenses were found that match the search criteria.") |
|
617 |
. qq|</body></html>|); |
|
618 |
::end_of_request(); |
|
619 |
} |
|
620 |
|
|
621 |
print( |
|
622 |
qq| |
|
623 |
<tr> |
|
624 |
<table> |
|
625 |
<tr> |
|
626 |
<th class=listtop><a class=listheading href=\"| |
|
627 |
. $columns{"partnumber"} . "\">" |
|
628 |
. $locale->text('Part Number') |
|
629 |
. qq|</a></th> |
|
630 |
<th class=listtop><a class=listheading href=\"| |
|
631 |
. $columns{"description"} . "\">" |
|
632 |
. $locale->text('Description') |
|
633 |
. qq|</a></th> |
|
634 |
<th class=listtop><a class=listheading href=\"| |
|
635 |
. $columns{"name"} . "\">" . $locale->text('Company Name') . qq|</a></th> |
|
636 |
<th class=listtop><a class=listheading href=\"| |
|
637 |
. $columns{"validuntil"} . "\">" |
|
638 |
. $locale->text('Valid until') |
|
639 |
. qq|</a></th> |
|
640 |
<th class=listtop><a class=listheading href=\"| |
|
641 |
. $columns{"invnumber"} . "\">" |
|
642 |
. $locale->text('Invoice Number') |
|
643 |
. qq|</a></th> |
|
644 |
</tr> |
|
645 |
|); |
|
646 |
|
|
647 |
my $j = 1; |
|
648 |
for (my $i = 0; $i < scalar(@{ $form->{"licenses"} }); $i++) { |
|
649 |
my $ref = $form->{"licenses"}->[$i]; |
|
650 |
print( |
|
651 |
qq| |
|
652 |
<tr class=listrow$j> |
|
653 |
<td><input type=hidden name=id_$i value=| . $ref->{"id"} . qq| |
|
654 |
<a href=\"${details}$ref->{"id"}\">$ref->{"partnumber"}</a></td> |
|
655 |
<td><a href=\"${details}$ref->{"id"}\">$ref->{"description"}</a></td> |
|
656 |
<td><a href=\"${details}$ref->{"id"}\">$ref->{"name"}</a></td> |
|
657 |
<td><a href=\"${details}$ref->{"id"}\">$ref->{"validuntil"}</a></td> |
|
658 |
<td align=right>| |
|
659 |
. ( |
|
660 |
$ref->{"invnumber"} |
|
661 |
? qq|<a href=\"${invdetails}$ref->{"invnumber"}\">$ref->{"invnumber"}</a>| |
|
662 |
: qq| | |
|
663 |
) |
|
664 |
. qq|</td> |
|
665 |
</tr>|); |
|
666 |
$j = ($j + 1) % 2; |
|
667 |
} |
|
668 |
|
|
669 |
$form->{"num_licenses"} = scalar(@{ $form->{"licenses"} }); |
|
670 |
push(@{ $form->{"hidden"} }, "num_licenses"); |
|
671 |
|
|
672 |
print( |
|
673 |
qq| |
|
674 |
</table> |
|
675 |
</tr> |
|
676 |
<tr> |
|
677 |
<td><hr size=3 noshade></td> |
|
678 |
</tr> |
|
679 |
</table> |
|
680 |
|
|
681 |
<p> |
|
682 |
|
|
683 |
<input type=submit name=action value=\"| . $locale->text("Add") . qq|\"> |
|
684 |
|); |
|
685 |
|
|
686 |
form_footer(); |
|
687 |
$main::lxdebug->leave_sub(); |
|
688 |
} |
|
689 |
|
|
690 |
sub details { |
|
691 |
$main::lxdebug->enter_sub(); |
|
692 |
|
|
693 |
$main::auth->assert('license_edit'); |
|
694 |
|
|
695 |
my $form = $main::form; |
|
696 |
my %myconfig = %main::myconfig; |
|
697 |
my $locale = $main::locale; |
|
698 |
|
|
699 |
LICENSES->get_license(\%myconfig, $form); |
|
700 |
map( |
|
701 |
{ $form->{$_} = $form->{"license"}->{$_}; } keys(%{ $form->{"license"} })); |
|
702 |
|
|
703 |
form_header(); |
|
704 |
|
|
705 |
print( |
|
706 |
qq| |
|
707 |
<table width=100%> |
|
708 |
<tr> |
|
709 |
<th class=listtop>| . $locale->text("View License") . qq|</th> |
|
710 |
</tr> |
|
711 |
<tr> |
|
712 |
<table> |
|
713 |
<tr> |
|
714 |
<th align=right>| . $locale->text('Part Number') . qq|</th> |
|
715 |
<td>$form->{"partnumber"}</td> |
|
716 |
</tr> |
|
717 |
<tr> |
|
718 |
<th align=right>| . $locale->text('Description') . qq|</th> |
|
719 |
<td>$form->{"description"}</td> |
|
720 |
</tr> |
|
721 |
<tr> |
|
722 |
<th align=right>| . $locale->text('Company Name') . qq|</th> |
|
723 |
<td>$form->{"name"}</td> |
|
724 |
</tr> |
|
725 |
<tr> |
|
726 |
<th align=right>| . $locale->text('Comment') . qq|</th> |
|
727 |
<td>$form->{"comment"}</td> |
|
728 |
</tr> |
|
729 |
<tr> |
|
730 |
<th align=right>| . $locale->text('Valid until') . qq|</th> |
|
731 |
<td>$form->{"validuntil"}</td> |
|
732 |
</tr> |
|
733 |
<tr> |
|
734 |
<th align=right>| . $locale->text('Quantity') . qq|</th> |
|
735 |
<td>$form->{"quantity"}</td> |
|
736 |
</tr> |
|
737 |
<tr> |
|
738 |
<th align=right>| . $locale->text('License key') . qq|</th> |
|
739 |
<td>$form->{"licensenumber"}</td> |
|
740 |
</tr> |
|
741 |
</table> |
|
742 |
</tr> |
|
743 |
<tr> |
|
744 |
<td><hr size=3 noshade></td> |
|
745 |
</tr> |
|
746 |
</table> |
|
747 |
|
|
748 |
<input type=submit name=action value=\"| . $locale->text("Add") . qq|\"> |
|
749 |
|); |
|
750 |
|
|
751 |
form_footer(); |
|
752 |
$main::lxdebug->leave_sub(); |
|
753 |
} |
|
754 |
|
|
755 |
1; |
config/lx_office.conf.default | ||
---|---|---|
73 | 73 |
[features] |
74 | 74 |
# Activate certain optional features and modules. |
75 | 75 |
webdav = 0 |
76 |
lizenzen = 1 |
|
77 | 76 |
vertreter = 0 |
78 | 77 |
|
79 | 78 |
# Show fields used for the best before date |
locale/de/all | ||
---|---|---|
783 | 783 |
'Expense/Asset' => 'Aufwand/Anlagen', |
784 | 784 |
'Expenses EU with UStId' => 'Aufwand EU m. UStId', |
785 | 785 |
'Expenses EU without UStId' => 'Aufwand EU o. UStId', |
786 |
'Expired licenses' => 'Abgelaufene Lizenzen', |
|
787 |
'Expiring in x month(s)' => 'Die in x Monat(en) ablaufen', |
|
788 | 786 |
'Export Buchungsdaten' => 'Export Buchungsdaten', |
789 | 787 |
'Export Stammdaten' => 'Export Stammdaten', |
790 | 788 |
'Export as CSV' => 'Als CSV exportieren', |
... | ... | |
1020 | 1018 |
'Leave host and port field empty unless you want to make a remote connection.' => 'Für lokale Verbindungen "Rechner" und "Port" freilassen.', |
1021 | 1019 |
'Left' => 'Links', |
1022 | 1020 |
'Liability' => 'Passiva/Mittelherkunft', |
1023 |
'License' => 'Lizenz', |
|
1024 |
'License key' => 'Lizenzschlüssel', |
|
1025 | 1021 |
'Licenses' => 'Lizenzen', |
1026 | 1022 |
'Limit part selection' => 'Artikelauswahl eingrenzen', |
1027 | 1023 |
'Line Total' => 'Zeilensumme', |
... | ... | |
1077 | 1073 |
'Make (with X being a number)' => 'Lieferant (X ist eine fortlaufende Zahl)', |
1078 | 1074 |
'Make default profile' => 'Zu Standardprofil machen', |
1079 | 1075 |
'Manage Custom Variables' => 'Benutzerdefinierte Variablen', |
1080 |
'Manage license keys' => 'Lizenzschlüssel verwalten', |
|
1081 | 1076 |
'Mandantennummer' => 'Mandantennummer', |
1082 | 1077 |
'Mandatory Departments' => 'Benutzer muss Abteilungen vergeben', |
1083 | 1078 |
'Mar' => 'März', |
... | ... | |
1171 | 1166 |
'No file has been uploaded yet.' => 'Es wurde noch keine Datei hochgeladen.', |
1172 | 1167 |
'No group has been selected, or the group does not exist anymore.' => 'Es wurde keine Gruppe ausgewählt, oder die Gruppe wurde in der Zwischenzeit gelöscht.', |
1173 | 1168 |
'No groups have been added yet.' => 'Es wurden noch keine Gruppen angelegt.', |
1174 |
'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.', |
|
1175 | 1169 |
'No or an unknown authenticantion module specified in "config/lx_office.conf".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/lx_office.conf" angegeben.', |
1176 | 1170 |
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', |
1177 | 1171 |
'No payment term has been created yet.' => 'Es wurden noch keine Zahlungsbedingungen angelegt.', |
... | ... | |
1258 | 1252 |
'Output Number Format' => 'Zahlenformat (Ausgabe)', |
1259 | 1253 |
'Outputformat' => 'Ausgabeformat', |
1260 | 1254 |
'Overdue sales quotations and requests for quotations' => 'Überfällige Angebote und Preisanfragen', |
1261 |
'Own Product' => 'eigenes Produkt', |
|
1262 | 1255 |
'PAYMENT POSTED' => 'Rechung gebucht', |
1263 | 1256 |
'PDF' => 'PDF', |
1264 | 1257 |
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)', |
... | ... | |
1315 | 1308 |
'Please Check the bank information for each customer:' => 'Bitte überprüfen Sie die Bankinformationen der Kunden:', |
1316 | 1309 |
'Please Check the bank information for each vendor:' => 'Bitte überprüfen Sie die Kontoinformationen der Lieferanten:', |
1317 | 1310 |
'Please ask your administrator to create warehouses and bins.' => 'Bitten Sie Ihren Administrator, dass er Lager und Lagerplätze anlegt.', |
1318 |
'Please enter a license key.' => 'Bitte geben Sie einen Lizenzschlüssel an.', |
|
1319 |
'Please enter a number of licenses.' => 'Bitte geben Sie die Anzahl Lizenzschlüssel an.', |
|
1320 | 1311 |
'Please enter a profile name.' => 'Bitte geben Sie einen Profilnamen an.', |
1321 | 1312 |
'Please enter the login for the new user.' => 'Bitte geben Sie das Login für den neuen Benutzer ein.', |
1322 | 1313 |
'Please enter the name of the database that will be used as the template for the new database:' => 'Bitte geben Sie den Namen der Datenbank an, die als Vorlage für die neue Datenbank benutzt wird:', |
... | ... | |
1785 | 1776 |
'The group has been saved.' => 'Die Gruppe wurde gespeichert.', |
1786 | 1777 |
'The group memberships have been saved.' => 'Die Gruppenmitgliedschaften wurden gespeichert.', |
1787 | 1778 |
'The group name is missing.' => 'Der Gruppenname fehlt.', |
1788 |
'The licensing module has been deactivated in the configuration.' => 'Das Lizenzverwaltungsmodul wurde in der Konfiguration deaktiviert.', |
|
1789 | 1779 |
'The list has been printed.' => 'Die Liste wurde ausgedruckt.', |
1790 | 1780 |
'The login is missing.' => 'Das Login fehlt.', |
1791 | 1781 |
'The long description is missing.' => 'Der Langtext fehlt.', |
... | ... | |
2009 | 1999 |
'Vendors' => 'Lieferanten', |
2010 | 2000 |
'Verrechnungseinheit' => 'Verrechnungseinheit', |
2011 | 2001 |
'Version' => 'Version', |
2012 |
'View License' => 'Lizenz ansehen', |
|
2013 | 2002 |
'View SEPA export' => 'SEPA-Export-Details ansehen', |
2014 | 2003 |
'View warehouse content' => 'Lagerbestand ansehen', |
2015 | 2004 |
'View/edit all employees sales documents' => 'Bearbeiten/ansehen der Verkaufsdokumente aller Mitarbeiter', |
scripts/mklinks.sh | ||
---|---|---|
4 | 4 |
rm $i.pl 2> /dev/null |
5 | 5 |
ln -s admin.pl $i.pl |
6 | 6 |
done |
7 |
for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do
|
|
7 |
for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do |
|
8 | 8 |
rm $i.pl 2> /dev/null |
9 | 9 |
ln -s am.pl $i.pl |
10 | 10 |
done |
11 |
rm generictranslations.pl 2> /dev/null |
|
11 |
rm generictranslations.pl licenses.pl 2> /dev/null
|
|
12 | 12 |
ln -s common.pl generictranslations.pl |
13 | 13 |
rm dispatcher.fcgi 2> /dev/null |
14 | 14 |
ln -s dispatcher.fpl dispatcher.fcgi |
templates/webpages/ir/form_header.html | ||
---|---|---|
22 | 22 |
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]"> |
23 | 23 |
<input type="hidden" name="follow_up_rowcount" value="1"> |
24 | 24 |
|
25 |
<input type="hidden" name="lizenzen" value="[% lizenzen %]"> |
Auch abrufbar als: Unified diff
Feature "Lizenzen" entfernt
Hat grob gesehen niemand benutzt, es funktionierte nicht, und wurde
seit gefühlten 20 Jahren nicht weiter entwickelt.