projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Wechselkurs beim Einlesen parsen
[kivitendo-erp.git]
/
bin
/
mozilla
/
licenses.pl
diff --git
a/bin/mozilla/licenses.pl
b/bin/mozilla/licenses.pl
index
fd8f01d
..
95f520f
100644
(file)
--- a/
bin/mozilla/licenses.pl
+++ b/
bin/mozilla/licenses.pl
@@
-37,15
+37,22
@@
use SL::LICENSES;
require "bin/mozilla/common.pl";
require "bin/mozilla/common.pl";
+use strict;
+
sub quot {
sub quot {
- $lxdebug->enter_sub();
+ $
main::
lxdebug->enter_sub();
$_[0] =~ s/\"/\"/g;
$_[0] =~ s/\"/\"/g;
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
return $_[0];
}
sub form_header {
return $_[0];
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+
$form->{jsscript} = 1;
$form->header();
$form->{jsscript} = 1;
$form->header();
@@
-53,34
+60,48
@@
sub form_header {
qq|<body>
<form method=post action=$form->{script}>|);
qq|<body>
<form method=post action=$form->{script}>|);
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub form_footer {
}
sub form_footer {
- $lxdebug->enter_sub();
- my @items = qw(login password old_callback previousform);
- push(@items, @{ $form->{"hidden"} });
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+
+ my @items = qw(old_callback previousform);
+ push @items, @{ $form->{"hidden"} } if ref $form->{hidden} eq 'ARRAY';
map({
print("<input type=hidden name=$_ value=\"" . quot($form->{$_}) . "\">\n"
);
} @items);
print(
map({
print("<input type=hidden name=$_ value=\"" . quot($form->{$_}) . "\">\n"
);
} @items);
print(
- qq|</form>
+ qq|<
input type="hidden" name="cursor_field" value='$form->{cursor_field}'><
/form>
</body>
</html>
|);
</body>
</html>
|);
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub set_std_hidden {
}
sub set_std_hidden {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
$form->{"hidden"} = ["comment", "validuntil", "quantity", @_];
$form->{"hidden"} = ["comment", "validuntil", "quantity", @_];
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub print_part_selection {
}
sub print_part_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
form_header();
set_std_hidden("business");
form_header();
set_std_hidden("business");
@@
-100,9
+121,10
@@
sub print_part_selection {
</tr>
|);
</tr>
|);
- $j = 1;
- for ($i = 1; $i <= scalar(@{ $form->{"parts"} }); $i++) {
- %p = %{ $form->{"parts"}->[$i - 1] };
+ my $j = 1;
+ for (my $i = 1; $i <= scalar(@{ $form->{"parts"} }); $i++) {
+ my %p = %{ $form->{"parts"}->[$i - 1] };
+ my $checked;
if ($i == 1) {
$checked = "checked";
} else {
if ($i == 1) {
$checked = "checked";
} else {
@@
-130,11
+152,17
@@
sub print_part_selection {
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub print_customer_selection {
}
sub print_customer_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
form_header();
set_std_hidden("parts_id", "partnumber", "description");
form_header();
set_std_hidden("parts_id", "partnumber", "description");
@@
-158,9
+186,10
@@
sub print_customer_selection {
print(qq|<tr><td colspan=6><hr size=3 noshade></td></tr>|);
print(qq|<tr><td colspan=6><hr size=3 noshade></td></tr>|);
- $j = 1;
- for ($i = 1; $i <= scalar(@{ $form->{"all_customers"} }); $i++) {
- %c = %{ $form->{"all_customers"}->[$i - 1] };
+ my $j = 1;
+ for (my $i = 1; $i <= scalar(@{ $form->{"all_customers"} }); $i++) {
+ my %c = %{ $form->{"all_customers"}->[$i - 1] };
+ my $checked;
if ($i == 1) {
$checked = "checked";
} else {
if ($i == 1) {
$checked = "checked";
} else {
@@
-190,11
+219,18
@@
sub print_customer_selection {
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub print_license_form {
}
sub print_license_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
print(
qq|
<table width=100%>
print(
qq|
<table width=100%>
@@
-221,7
+257,7
@@
sub print_license_form {
if (!defined($form->{"customer_id"})) {
$form->{"customer_id"} = $_->{"id"};
}
if (!defined($form->{"customer_id"})) {
$form->{"customer_id"} = $_->{"id"};
}
- $selected = ($_->{"id"} * 1) == $form->{"customer_id"} ? "selected" : "";
+
my
$selected = ($_->{"id"} * 1) == $form->{"customer_id"} ? "selected" : "";
print(qq|<option $selected> $_->{"name"}--$_->{"id"}</option>|);
}
print(qq|</select></td>|);
print(qq|<option $selected> $_->{"name"}--$_->{"id"}</option>|);
}
print(qq|</select></td>|);
@@
-276,12
+312,20
@@
sub print_license_form {
$form->write_trigger(\%myconfig, 1, "validuntil", "BL",
"trigger_validuntil"));
$form->write_trigger(\%myconfig, 1, "validuntil", "BL",
"trigger_validuntil"));
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub add {
}
sub add {
- $lxdebug->enter_sub();
- if (!$lizenzen) {
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $form->{title} = $locale->text('Add License');
+
+ if (!$main::lizenzen) {
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
@@
-291,16
+335,22
@@
sub add {
$form->{"initial"} = 1;
do_add();
$form->{"initial"} = 1;
do_add();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub do_add {
}
sub do_add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$form->{"hidden"} = ["parts_id"];
form_header();
if ($form->{"ndx"}) {
$form->{"hidden"} = ["parts_id"];
form_header();
if ($form->{"ndx"}) {
- $ndx = $form->{"ndx"};
+
my
$ndx = $form->{"ndx"};
foreach (keys(%{$form})) {
next unless (/^new_.*_${ndx}$/);
s/^new_//;
foreach (keys(%{$form})) {
next unless (/^new_.*_${ndx}$/);
s/^new_//;
@@
-316,7
+366,7
@@
sub do_add {
if ($form->{"customer_name"}) {
LICENSES->get_customers(\%myconfig, $form);
if (scalar(@{ $form->{"all_customers"} }) == 1) {
if ($form->{"customer_name"}) {
LICENSES->get_customers(\%myconfig, $form);
if (scalar(@{ $form->{"all_customers"} }) == 1) {
- %c = %{ $form->{"all_customers"}->[0] };
+
my
%c = %{ $form->{"all_customers"}->[0] };
$form->{"customer_id"} = $c{"id"};
$form->{"customer_name"} = $c{"name"};
} elsif (scalar(@{ $form->{"all_customers"} }) == 0) {
$form->{"customer_id"} = $c{"id"};
$form->{"customer_name"} = $c{"name"};
} elsif (scalar(@{ $form->{"all_customers"} }) == 0) {
@@
-355,23
+405,38
@@
sub do_add {
print_license_form($form->{"parts_id"} && $form->{"customer_id"});
form_footer();
print_license_form($form->{"parts_id"} && $form->{"customer_id"});
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub update {
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+
do_add();
do_add();
- $lxdebug->leave_sub();
+
+ $main::lxdebug->leave_sub();
}
sub continue {
}
sub continue {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
call_sub($form->{"nextsub"});
call_sub($form->{"nextsub"});
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub save {
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
($form->{customername}, $form->{customer_id}) = split /--/,
$form->{customer};
($form->{customername}, $form->{customer_id}) = split /--/,
$form->{customer};
@@
-388,22
+453,23
@@
sub save {
$form->error($locale->text('Please enter a license key.'));
}
$form->error($locale->text('Please enter a license key.'));
}
- $rc = LICENSES->save_license(\%myconfig, \%$form);
+
my
$rc = LICENSES->save_license(\%myconfig, \%$form);
# load previous variables
if ($form->{previousform}) {
# save the new form variables before splitting previousform
# load previous variables
if ($form->{previousform}) {
# save the new form variables before splitting previousform
+ my %newform;
map { $newform{$_} = $form->{$_} } keys %$form;
map { $newform{$_} = $form->{$_} } keys %$form;
- $previousform = $form->unescape($form->{previousform});
+
my
$previousform = $form->unescape($form->{previousform});
# don't trample on previous variables
map { delete $form->{$_} } keys %newform;
# now take it apart and restore original values
# don't trample on previous variables
map { delete $form->{$_} } keys %newform;
# now take it apart and restore original values
- foreach $item (split /&/, $previousform) {
- ($key, $value) = split /=/, $item, 2;
+ foreach
my
$item (split /&/, $previousform) {
+
my
($key, $value) = split /=/, $item, 2;
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
@@
-415,15
+481,16
@@
sub save {
delete $form->{action};
# restore original callback
delete $form->{action};
# restore original callback
- $callback = $form->unescape($form->{callback});
+
my
$callback = $form->unescape($form->{callback});
$form->{callback} = $form->unescape($form->{old_callback});
delete $form->{old_callback};
# put callback together
$form->{callback} = $form->unescape($form->{old_callback});
delete $form->{old_callback};
# put callback together
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
+ next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
# do single escape for Apache 2.0
# do single escape for Apache 2.0
- $value = $form->escape($form->{$key}, 1);
+
my
$value = $form->escape($form->{$key}, 1);
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
@@
-438,12
+505,20
@@
sub save {
form_footer();
}
form_footer();
}
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub search {
}
sub search {
- $lxdebug->enter_sub();
- if (!$lizenzen) {
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $form->{title} = $locale->text('Licenses');
+
+ if (!$main::lizenzen) {
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
@@
-493,22
+568,30
@@
sub search {
|);
form_footer();
|);
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub do_search {
}
sub do_search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
LICENSES->search(\%myconfig, $form);
LICENSES->search(\%myconfig, $form);
- $callback = "";
+
my
$callback = "";
map { $callback .= "\&${_}=" . $form->escape($form->{$_}, 1) }
map { $callback .= "\&${_}=" . $form->escape($form->{$_}, 1) }
- qw(db
login password
partnumber description customer_name all expiring_in show_expired);
- $details = $form->{"script"} . "?action=details" . $callback . "\&id=";
- $invdetails = "is.pl?action=edit" . $callback . "\&id=";
+ qw(db partnumber description customer_name all expiring_in show_expired);
+
my
$details = $form->{"script"} . "?action=details" . $callback . "\&id=";
+
my
$invdetails = "is.pl?action=edit" . $callback . "\&id=";
$callback = $form->{"script"} . "?action=do_search" . $callback;
$form->{"sortby"} = "validuntil" unless ($form->{"sortby"});
$form->{"sortasc"} *= 1;
$callback = $form->{"script"} . "?action=do_search" . $callback;
$form->{"sortby"} = "validuntil" unless ($form->{"sortby"});
$form->{"sortasc"} *= 1;
+ my %columns;
foreach (("partnumber", "description", "name", "validuntil", "invnumber")) {
$columns{$_} = $callback . "\&sortby=${_}\&sortasc=";
if ($form->{"sortby"} eq $_) {
foreach (("partnumber", "description", "name", "validuntil", "invnumber")) {
$columns{$_} = $callback . "\&sortby=${_}\&sortasc=";
if ($form->{"sortby"} eq $_) {
@@
-532,7
+615,7
@@
sub do_search {
. $locale->text(
"No licenses were found that match the search criteria.")
. qq|</body></html>|);
. $locale->text(
"No licenses were found that match the search criteria.")
. qq|</body></html>|);
-
exit(0
);
+
::end_of_request(
);
}
print(
}
print(
@@
-561,9
+644,9
@@
sub do_search {
</tr>
|);
</tr>
|);
- $j = 1;
- for ($i = 0; $i < scalar(@{ $form->{"licenses"} }); $i++) {
- $ref = $form->{"licenses"}->[$i];
+
my
$j = 1;
+ for (
my
$i = 0; $i < scalar(@{ $form->{"licenses"} }); $i++) {
+
my
$ref = $form->{"licenses"}->[$i];
print(
qq|
<tr class=listrow$j>
print(
qq|
<tr class=listrow$j>
@@
-601,11
+684,18
@@
sub do_search {
|);
form_footer();
|);
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub details {
}
sub details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
LICENSES->get_license(\%myconfig, $form);
map(
{ $form->{$_} = $form->{"license"}->{$_}; } keys(%{ $form->{"license"} }));
LICENSES->get_license(\%myconfig, $form);
map(
{ $form->{$_} = $form->{"license"}->{$_}; } keys(%{ $form->{"license"} }));
@@
-659,7
+749,7
@@
sub details {
|);
form_footer();
|);
form_footer();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
1;
}
1;