X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Flicenses.pl;h=fd8f01d9f514e8c24f914a8d26882a4978671315;hb=250a086bfcb9cb51fce6f347b295b3de6166ad83;hp=1dfcb4e285ada55ae5ecb6df4af5b2084498a5d6;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git
diff --git a/bin/mozilla/licenses.pl b/bin/mozilla/licenses.pl
index 1dfcb4e28..fd8f01d9f 100644
--- a/bin/mozilla/licenses.pl
+++ b/bin/mozilla/licenses.pl
@@ -35,6 +35,8 @@ use SL::IC;
use SL::IS;
use SL::LICENSES;
+require "bin/mozilla/common.pl";
+
sub quot {
$lxdebug->enter_sub();
$_[0] =~ s/\"/\"/g;
@@ -44,9 +46,11 @@ sub quot {
sub form_header {
$lxdebug->enter_sub();
+ $form->{jsscript} = 1;
$form->header();
- print(qq|
+ print(
+ qq|
+ print(
+ qq|
|);
@@ -69,11 +75,7 @@ sub form_footer {
sub set_std_hidden {
$lxdebug->enter_sub();
- $form->{"hidden"} =
- ["comment",
- "validuntil",
- "quantity",
- @_];
+ $form->{"hidden"} = ["comment", "validuntil", "quantity", @_];
$lxdebug->leave_sub();
}
@@ -82,44 +84,46 @@ sub print_part_selection {
form_header();
set_std_hidden("business");
- print(qq|
+ print(
+ qq|
@@ -134,40 +138,42 @@ sub print_customer_selection {
form_header();
set_std_hidden("parts_id", "partnumber", "description");
- print(qq|
+ print(
+ qq|
@@ -188,7 +195,8 @@ sub print_customer_selection {
sub print_license_form {
$lxdebug->enter_sub();
- print(qq|
+ print(
+ qq|
| . $locale->text("Add License") . qq| |
@@ -197,19 +205,19 @@ sub print_license_form {
|);
+
| .
+ $form->write_trigger(\%myconfig, 1, "validuntil", "BL",
+ "trigger_validuntil"));
+
$lxdebug->leave_sub();
}
sub add {
$lxdebug->enter_sub();
if (!$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.')
+ );
}
$form->{"initial"} = 1;
@@ -295,11 +315,11 @@ sub do_add {
if ($form->{"customer_name"}) {
LICENSES->get_customers(\%myconfig, $form);
- if (scalar(@{$form->{"all_customers"}}) == 1) {
- %c = %{$form->{"all_customers"}->[0]};
- $form->{"customer_id"} = $c{"id"};
+ if (scalar(@{ $form->{"all_customers"} }) == 1) {
+ %c = %{ $form->{"all_customers"}->[0] };
+ $form->{"customer_id"} = $c{"id"};
$form->{"customer_name"} = $c{"name"};
- } elsif (scalar(@{$form->{"all_customers"}}) == 0) {
+ } elsif (scalar(@{ $form->{"all_customers"} }) == 0) {
$form->{"customer_name"} = "";
delete($form->{"customer_id"});
} else {
@@ -314,13 +334,13 @@ sub do_add {
$form->{"sort"} = "p.partnumber";
$form->{searchitems} = "part";
IC->all_parts(\%myconfig, $form);
- if (scalar(@{$form->{"parts"}}) == 1) {
+ if (scalar(@{ $form->{"parts"} }) == 1) {
map({ $form->{$_} = $form->{"parts"}->[0]->{$_}; }
("partnumber", "description"));
$form->{"parts_id"} = $form->{"parts"}->[0]->{"id"};
- } elsif (scalar(@{$form->{"parts"}}) == 0) {
- map({ $form->{$_} = ""; } ("partnumber", "description", "parts_id"));
+ } elsif (scalar(@{ $form->{"parts"} }) == 0) {
+ map({ $form->{$_} = ""; }("partnumber", "description", "parts_id"));
} else {
print_part_selection();
@@ -346,29 +366,33 @@ sub update {
sub continue {
$lxdebug->enter_sub();
- &{ $form->{nextsub} };
+ call_sub($form->{"nextsub"});
$lxdebug->leave_sub();
}
sub save {
$lxdebug->enter_sub();
-
- ($form->{customername}, $form->{customer_id}) = split /--/, $form->{customer};
+
+ ($form->{customername}, $form->{customer_id}) = split /--/,
+ $form->{customer};
$form->isblank("customer", $locale->text('Customer missing!'));
-
- if ($form->{quantity} eq "" || $form->{quantity} !~ /^[0-9]*$/ || $form->{quantity} < 1) {
+
+ if ( $form->{quantity} eq ""
+ || $form->{quantity} !~ /^[0-9]*$/
+ || $form->{quantity} < 1) {
$form->error($locale->text('Please enter a number of licenses.'));
}
if (!$form->{licensenumber} || $form->{licensenumber} eq "") {
$form->error($locale->text('Please enter a license key.'));
}
-
+
$rc = LICENSES->save_license(\%myconfig, \%$form);
- # load previous variables
+ # load previous variables
if ($form->{previousform}) {
+
# save the new form variables before splitting previousform
map { $newform{$_} = $form->{$_} } keys %$form;
@@ -383,32 +407,33 @@ sub save {
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
-
- $form->{"lizenzen_$form->{row}"} = "";
+
+ $form->{"lizenzen_$form->{row}"} =
+ "";
$form->{rowcount}--;
-
+
delete $form->{action};
# restore original callback
$callback = $form->unescape($form->{callback});
$form->{callback} = $form->unescape($form->{old_callback});
delete $form->{old_callback};
-
# put callback together
foreach $key (keys %$form) {
+
# do single escape for Apache 2.0
$value = $form->escape($form->{$key}, 1);
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
-
+
# redirect
$form->redirect;
-
+
} else {
form_header();
-
+
print("Die Lizenz wurde gespeichert.\n");
form_footer();
}
@@ -419,12 +444,16 @@ sub save {
sub search {
$lxdebug->enter_sub();
if (!$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.')
+ );
}
form_header();
- print(qq|
+ print(
+ qq|
-
|
+
|
@@ -470,13 +501,11 @@ sub do_search {
LICENSES->search(\%myconfig, $form);
$callback = "";
- foreach (("db", "path", "login", "password", "partnumber", "description",
- "customer_name", "all", "expiring_in", "show_expired")) {
- $callback .= "\&${_}=" . $form->escape($form->{$_}, 1);
- }
- $details = $form->{"script"} . "?action=details" . $callback . "\&id=";
+ 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=";
- $callback = $form->{"script"} . "?action=do_search" . $callback;
+ $callback = $form->{"script"} . "?action=do_search" . $callback;
$form->{"sortby"} = "validuntil" unless ($form->{"sortby"});
$form->{"sortasc"} *= 1;
@@ -491,63 +520,74 @@ sub do_search {
form_header();
- print(qq|
+ print(
+ qq|
| . $locale->text("Licenses") . qq| |
|);
- if (scalar(@{$form->{"licenses"}}) == 0) {
- print(qq|
| .
- $locale->text("No licenses were found that match the search criteria.") .
- qq|