X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FForm.pm;h=21508383067ac8023d3f6d64fec8cb82a5374ea3;hb=e9a4d347c175c51f66a6270e349f66866b19f532;hp=712f655c2f9369753ca3c99c204c236fc04e353b;hpb=1084d82b1208ac5a0e6f64f67e61fe4163d13e59;p=kivitendo-erp.git
diff --git a/SL/Form.pm b/SL/Form.pm
index 712f655c2..215083830 100644
--- a/SL/Form.pm
+++ b/SL/Form.pm
@@ -382,8 +382,8 @@ function fokus(){document.$self->{fokus}.focus();}
$jsscript = qq|
-
-
+
+
$self->{javascript}
|;
}
@@ -450,25 +450,25 @@ sub write_trigger {
$trigger_1 = qq|
Calendar.setup(
- {
- inputField : "$inputField_1",
- ifFormat :"$ifFormat",
- align : "$align_1",
- button : "$button_1"
- }
- );
+ {
+ inputField : "$inputField_1",
+ ifFormat :"$ifFormat",
+ align : "$align_1",
+ button : "$button_1"
+ }
+ );
|;
if ($qty == 2) {
$trigger_2 = qq|
Calendar.setup(
{
- inputField : "$inputField_2",
- ifFormat :"$ifFormat",
- align : "$align_2",
- button : "$button_2"
- }
- );
+ inputField : "$inputField_2",
+ ifFormat :"$ifFormat",
+ align : "$align_2",
+ button : "$button_2"
+ }
+ );
|;
}
$jsscript = qq|
@@ -540,19 +540,19 @@ sub format_amount {
$amount =~ s/\d{3,}?/$&,/g;
$amount =~ s/,$//;
$amount = join '', reverse split //, $amount;
- $amount .= "\.$dec".$fillup;
+ $amount .= "\.$dec".$fillup if ($places ne '' && $places*1 != 0);
}
if ($myconfig->{numberformat} eq '1.000,00') {
$amount =~ s/\d{3,}?/$&./g;
$amount =~ s/\.$//;
$amount = join '', reverse split //, $amount;
- $amount .= ",$dec" .$fillup;
+ $amount .= ",$dec".$fillup if ($places ne '' && $places*1 != 0);
}
if ($myconfig->{numberformat} eq '1000,00') {
$amount = "$whole";
- $amount .= ",$dec" .$fillup;
+ $amount .= ",$dec" .$fillup if ($places ne '' && $places*1 != 0);
}
if ($dash =~ /-/) {
@@ -618,6 +618,7 @@ sub round_amount {
$main::lxdebug->leave_sub();
return $round_amount;
+
}
@@ -631,7 +632,7 @@ sub parse_template {
# Some variables used for page breaks
my ($chars_per_line, $lines_on_first_page, $lines_on_second_page) =
(0, 0, 0);
- my ($current_page, $current_line) = (1, 1);
+ my ($current_page, $current_line, $current_row) = (1, 1, 0);
my $pagebreak = "";
my $sum = 0;
@@ -735,8 +736,9 @@ sub parse_template {
$lpp = $lines_on_second_page;
}
- # Yes we need a manual page break
- if (($current_line + $lines) > $lpp) {
+ # Yes we need a manual page break -- or the user has forced one
+ if ((($current_line + $lines) > $lpp) ||
+ ($self->{"_forced_pagebreaks"} && grep(/^${current_row}$/, @{$self->{"_forced_pagebreaks"}}))) {
my $pb = $pagebreak;
# replace the special variables <%sumcarriedforward%>
@@ -757,6 +759,7 @@ sub parse_template {
$current_line = 1;
}
$current_line += $lines;
+ $current_row++;
}
$sum += $self->parse_amount($myconfig, $self->{"linetotal"}[$i]);
@@ -1022,6 +1025,18 @@ sub format_string {
%unique_fields = map({ $_ => 1 } @fields);
@fields = keys(%unique_fields);
+
+ foreach my $field (@fields) {
+ next unless ($self->{$field} =~ /\/);
+ $self->{$field} =~ s/\//g;
+ if ($field =~ /.*_(\d+)$/) {
+ if ($self->{"_forced_pagebreaks"}) {
+ $self->{"_forced_pagebreaks"} = [];
+ }
+ push(@{ $self->{"_forced_pagebreaks"} }, "$1");
+ }
+ }
+
my $format = $self->{format};
if ($self->{format} =~ /(postscript|pdf)/) {
$format = 'tex';
@@ -2105,6 +2120,38 @@ sub get_partsgroup {
}
+sub get_pricegroup {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $p) = @_;
+
+ my $dbh = $self->dbconnect($myconfig);
+
+ my $query = qq|SELECT p.id, p.pricegroup
+ FROM pricegroup p|;
+
+ $query .= qq|
+ ORDER BY pricegroup|;
+
+ if ($p->{all}) {
+ $query = qq|SELECT id, pricegroup FROM pricegroup
+ ORDER BY pricegroup|;
+ }
+
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $self->dberror($query);
+
+ $self->{all_pricegroup} = ();
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $self->{all_pricegroup} }, $ref;
+ }
+ $sth->finish;
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
+
sub audittrail {
my ($self, $dbh, $myconfig, $audittrail) = @_;