Revision c510d88b
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
SL/Auth/DB.pm | ||
---|---|---|
5 | 5 |
#use SL::Auth; |
6 | 6 |
use SL::DBUtils; |
7 | 7 |
|
8 |
use strict; |
|
9 |
|
|
8 | 10 |
sub new { |
9 | 11 |
$main::lxdebug->enter_sub(); |
10 | 12 |
|
... | ... | |
32 | 34 |
|
33 | 35 |
if (!$dbh) { |
34 | 36 |
$main::lxdebug->leave_sub(); |
35 |
return SL::Auth::ERR_BACKEND;
|
|
37 |
return SL::Auth->ERR_BACKEND();
|
|
36 | 38 |
} |
37 | 39 |
|
38 | 40 |
my $query = qq|SELECT password FROM auth."user" WHERE login = ?|; |
... | ... | |
43 | 45 |
|
44 | 46 |
$main::lxdebug->leave_sub(); |
45 | 47 |
|
46 |
return $password eq $stored_password ? SL::Auth::OK : SL::Auth::ERR_PASSWORD;
|
|
48 |
return $password eq $stored_password ? SL::Auth->OK() : SL::Auth->ERR_PASSWORD();
|
|
47 | 49 |
} |
48 | 50 |
|
49 | 51 |
sub can_change_password { |
... | ... | |
62 | 64 |
|
63 | 65 |
if (!$dbh) { |
64 | 66 |
$main::lxdebug->leave_sub(); |
65 |
return SL::Auth::ERR_BACKEND
|
|
67 |
return SL::Auth->ERR_BACKEND()
|
|
66 | 68 |
} |
67 | 69 |
|
68 | 70 |
$password = crypt $password, substr($login, 0, 2) if (!$is_crypted); |
SL/Auth/LDAP.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
#use SL::Auth; |
6 | 6 |
|
7 |
use strict; |
|
8 |
|
|
7 | 9 |
sub new { |
8 | 10 |
$main::lxdebug->enter_sub(); |
9 | 11 |
|
... | ... | |
144 | 146 |
|
145 | 147 |
if ($is_crypted) { |
146 | 148 |
$main::lxdebug->leave_sub(); |
147 |
return SL::Auth::ERR_BACKEND;
|
|
149 |
return SL::Auth->ERR_BACKEND();
|
|
148 | 150 |
} |
149 | 151 |
|
150 | 152 |
my $ldap = $self->_connect(); |
151 | 153 |
|
152 | 154 |
if (!$ldap) { |
153 | 155 |
$main::lxdebug->leave_sub(); |
154 |
return SL::Auth::ERR_BACKEND;
|
|
156 |
return SL::Auth->ERR_BACKEND();
|
|
155 | 157 |
} |
156 | 158 |
|
157 | 159 |
my $dn = $self->_get_user_dn($ldap, $login); |
158 | 160 |
|
159 |
$main::lxdebug->message(LXDebug::DEBUG2, "LDAP authenticate: dn $dn");
|
|
161 |
$main::lxdebug->message(LXDebug->DEBUG2(), "LDAP authenticate: dn $dn");
|
|
160 | 162 |
|
161 | 163 |
if (!$dn) { |
162 | 164 |
$main::lxdebug->leave_sub(); |
163 |
return SL::Auth::ERR_BACKEND;
|
|
165 |
return SL::Auth->ERR_BACKEND();
|
|
164 | 166 |
} |
165 | 167 |
|
166 | 168 |
my $mesg = $ldap->bind($dn, 'password' => $password); |
167 | 169 |
|
168 |
$main::lxdebug->message(LXDebug::DEBUG2, "LDAP authenticate: bind mesg " . $mesg->error());
|
|
170 |
$main::lxdebug->message(LXDebug->DEBUG2(), "LDAP authenticate: bind mesg " . $mesg->error());
|
|
169 | 171 |
|
170 | 172 |
$main::lxdebug->leave_sub(); |
171 | 173 |
|
172 |
return $mesg->is_error() ? SL::Auth::ERR_PASSWORD : SL::Auth::OK;
|
|
174 |
return $mesg->is_error() ? SL::Auth->ERR_PASSWORD() : SL::Auth->OK();
|
|
173 | 175 |
} |
174 | 176 |
|
175 | 177 |
sub can_change_password { |
... | ... | |
177 | 179 |
} |
178 | 180 |
|
179 | 181 |
sub change_password { |
180 |
return SL::Auth::ERR_BACKEND;
|
|
182 |
return SL::Auth->ERR_BACKEND();
|
|
181 | 183 |
} |
182 | 184 |
|
183 | 185 |
sub verify_config { |
184 | 186 |
$main::lxdebug->enter_sub(); |
185 | 187 |
|
188 |
my $form = $main::form; |
|
189 |
my $locale = $main::locale; |
|
190 |
|
|
186 | 191 |
my $self = shift; |
187 | 192 |
my $cfg = $self->{auth}->{LDAP_config}; |
188 | 193 |
|
SL/CT.pm | ||
---|---|---|
45 | 45 |
use SL::FU; |
46 | 46 |
use SL::Notes; |
47 | 47 |
|
48 |
use strict; |
|
49 |
|
|
48 | 50 |
sub get_tuple { |
49 | 51 |
$main::lxdebug->enter_sub(); |
50 | 52 |
|
SL/DATEV.pm | ||
---|---|---|
36 | 36 |
use File::Path; |
37 | 37 |
use Time::HiRes qw(gettimeofday); |
38 | 38 |
|
39 |
use strict; |
|
40 |
|
|
39 | 41 |
sub _get_export_path { |
40 | 42 |
$main::lxdebug->enter_sub(); |
41 | 43 |
|
... | ... | |
125 | 127 |
# connect to database |
126 | 128 |
my $dbh = $form->dbconnect($myconfig); |
127 | 129 |
|
128 |
$query = qq|SELECT * FROM datev|; |
|
129 |
$sth = $dbh->prepare($query); |
|
130 |
my $query = qq|SELECT * FROM datev|;
|
|
131 |
my $sth = $dbh->prepare($query);
|
|
130 | 132 |
$sth->execute || $form->dberror($query); |
131 | 133 |
|
132 |
my $ref = $sth->fetchrow_hashref(NAME_lc);
|
|
134 |
my $ref = $sth->fetchrow_hashref("NAME_lc");
|
|
133 | 135 |
|
134 | 136 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
135 | 137 |
|
... | ... | |
146 | 148 |
# connect to database |
147 | 149 |
my $dbh = $form->dbconnect_noauto($myconfig); |
148 | 150 |
|
149 |
$query = qq|DELETE FROM datev|; |
|
151 |
my $query = qq|DELETE FROM datev|;
|
|
150 | 152 |
$dbh->do($query) || $form->dberror($query); |
151 | 153 |
|
152 | 154 |
$query = qq|INSERT INTO datev |
... | ... | |
159 | 161 |
. $dbh->quote($form->{mandantennr}) . qq|,| |
160 | 162 |
. $dbh->quote($form->{datentraegernr}) . qq|,| |
161 | 163 |
. $dbh->quote($form->{abrechnungsnr}) . qq|)|; |
162 |
$sth = $dbh->prepare($query); |
|
164 |
my $sth = $dbh->prepare($query);
|
|
163 | 165 |
$sth->execute || $form->dberror($query); |
164 | 166 |
$sth->finish; |
165 | 167 |
|
... | ... | |
201 | 203 |
$main::lxdebug->enter_sub(); |
202 | 204 |
|
203 | 205 |
my ($zeitraum, $monat, $quartal, $transdatefrom, $transdateto) = @_; |
206 |
my ($fromto, $jahr, $leap); |
|
207 |
|
|
208 |
my $form = $main::form; |
|
204 | 209 |
|
205 | 210 |
$fromto = "transdate >= "; |
206 | 211 |
|
... | ... | |
322 | 327 |
|
323 | 328 |
my $dbh = $form->get_standard_dbh($myconfig); |
324 | 329 |
|
330 |
my ($notsplitindex); |
|
325 | 331 |
my @errors = (); |
326 | 332 |
|
327 | 333 |
$fromto =~ s/transdate/ac\.transdate/g; |
... | ... | |
379 | 385 |
my $sth = prepare_execute_query($form, $dbh, $query); |
380 | 386 |
|
381 | 387 |
my $counter = 0; |
382 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
388 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
|
|
383 | 389 |
$counter++; |
384 | 390 |
if (($counter % 500) == 0) { |
385 | 391 |
print("$counter "); |
... | ... | |
391 | 397 |
my $firstrun = 1; |
392 | 398 |
|
393 | 399 |
while (abs($count) > 0.01 || $firstrun) { |
394 |
my $ref2 = $sth->fetchrow_hashref(NAME_lc);
|
|
400 |
my $ref2 = $sth->fetchrow_hashref("NAME_lc");
|
|
395 | 401 |
last unless ($ref2); |
396 | 402 |
|
397 | 403 |
if ($ref2->{trans_id} != $trans->[0]->{trans_id}) { |
... | ... | |
490 | 496 |
|
491 | 497 |
my $idx = 0; |
492 | 498 |
my $correction = 0; |
499 |
our @taxed; # most likely defunct |
|
493 | 500 |
while (abs($absumsatz) >= 0.01) { |
494 | 501 |
if ($idx >= scalar @taxed) { |
495 | 502 |
last if (!$correction); |
... | ... | |
542 | 549 |
$main::lxdebug->enter_sub(); |
543 | 550 |
|
544 | 551 |
my ($myconfig, $form, $fromto, $start_jahr) = @_; |
552 |
my ($primanota); |
|
545 | 553 |
|
546 | 554 |
my $jahr = $start_jahr; |
547 | 555 |
if (!$jahr) { |
... | ... | |
626 | 634 |
|
627 | 635 |
my ($date, $six) = @_; |
628 | 636 |
|
629 |
($day, $month, $year) = split(/\./, $date); |
|
637 |
my ($day, $month, $year) = split(/\./, $date);
|
|
630 | 638 |
|
631 | 639 |
if ($day =~ /^0/) { |
632 | 640 |
$day = substr($day, 1, 1); |
... | ... | |
668 | 676 |
if ($fromto ne "") { |
669 | 677 |
$versionset .= "0000" . substr($header, 28, 19); |
670 | 678 |
} else { |
671 |
$datum = " " x 16; |
|
679 |
my $datum = " " x 16;
|
|
672 | 680 |
$versionset .= $datum . "001" . substr($header, 28, 4); |
673 | 681 |
} |
674 | 682 |
|
... | ... | |
711 | 719 |
my $export_path = _get_export_path() . "/"; |
712 | 720 |
my $filename = "ED00000"; |
713 | 721 |
my $evfile = "EV01"; |
714 |
my @ed_versionsets;
|
|
722 |
my @ed_versionset; |
|
715 | 723 |
my $fileno = 0; |
716 | 724 |
|
717 | 725 |
$form->header; |
... | ... | |
721 | 729 |
Buchungssätze verarbeitet: |
722 | 730 |
|; |
723 | 731 |
|
724 |
($fromto, $start_jahr) = |
|
732 |
my ($fromto, $start_jahr) =
|
|
725 | 733 |
&get_dates($form->{zeitraum}, $form->{monat}, |
726 | 734 |
$form->{quartal}, $form->{transdatefrom}, |
727 | 735 |
$form->{transdateto}); |
... | ... | |
733 | 741 |
$filename++; |
734 | 742 |
my $ed_filename = $export_path . $filename; |
735 | 743 |
push(@filenames, $filename); |
736 |
$header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr); |
|
744 |
my $header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr);
|
|
737 | 745 |
|
738 | 746 |
my $kne_file = SL::DATEV::KNEFile->new(); |
739 | 747 |
$kne_file->add_block($header); |
740 | 748 |
|
741 | 749 |
while (scalar(@{ $form->{DATEV} }) > 0) { |
742 |
$transaction = shift @{ $form->{DATEV} }; |
|
743 |
$trans_lines = scalar(@{$transaction}); |
|
750 |
my $transaction = shift @{ $form->{DATEV} };
|
|
751 |
my $trans_lines = scalar(@{$transaction});
|
|
744 | 752 |
$counter++; |
745 | 753 |
if (($counter % 500) == 0) { |
746 | 754 |
print("$counter "); |
... | ... | |
757 | 765 |
my $datevautomatik = 0; |
758 | 766 |
my $taxkey = 0; |
759 | 767 |
my $charttax = 0; |
768 |
my ($haben, $soll); |
|
760 | 769 |
my $iconv = $main::locale->{iconv_iso8859}; |
761 | 770 |
my %umlaute = ($iconv->convert('?') => 'ae', |
762 | 771 |
$iconv->convert('?') => 'oe', |
... | ... | |
792 | 801 |
} |
793 | 802 |
|
794 | 803 |
# Umwandlung von Umlauten und Sonderzeichen in erlaubte Zeichen bei Textfeldern |
795 |
foreach $umlaut (keys(%umlaute)) { |
|
804 |
foreach my $umlaut (keys(%umlaute)) {
|
|
796 | 805 |
$transaction->[$haben]->{'invnumber'} =~ s/${umlaut}/${umlaute{$umlaut}}/g; |
797 | 806 |
$transaction->[$haben]->{'name'} =~ s/${umlaut}/${umlaute{$umlaut}}/g; |
798 | 807 |
} |
... | ... | |
856 | 865 |
} |
857 | 866 |
|
858 | 867 |
#Make EV Verwaltungsdatei |
859 |
$ev_header = &make_ev_header($form, $fileno); |
|
860 |
$ev_filename = $export_path . $evfile; |
|
868 |
my $ev_header = &make_ev_header($form, $fileno);
|
|
869 |
my $ev_filename = $export_path . $evfile;
|
|
861 | 870 |
push(@filenames, $evfile); |
862 | 871 |
open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; |
863 | 872 |
print(EV $ev_header); |
864 | 873 |
|
865 |
foreach $file (@ed_versionset) { |
|
874 |
foreach my $file (@ed_versionset) {
|
|
866 | 875 |
print(EV $ed_versionset[$file]); |
867 | 876 |
} |
868 | 877 |
close(EV); |
... | ... | |
891 | 900 |
my $export_path = _get_export_path() . "/"; |
892 | 901 |
my $filename = "ED00000"; |
893 | 902 |
my $evfile = "EV01"; |
894 |
my @ed_versionsets;
|
|
903 |
my @ed_versionset; |
|
895 | 904 |
my $fileno = 1; |
896 | 905 |
my $i = 0; |
897 | 906 |
my $blockcount = 1; |
... | ... | |
902 | 911 |
my $ed_filename = $export_path . $filename; |
903 | 912 |
push(@filenames, $filename); |
904 | 913 |
open(ED, "> $ed_filename") or die "can't open outputfile: $!\n"; |
905 |
$header = &make_kne_data_header($myconfig, $form, ""); |
|
914 |
my $header = &make_kne_data_header($myconfig, $form, "");
|
|
906 | 915 |
$remaining_bytes -= length($header); |
907 | 916 |
|
917 |
my $fuellzeichen; |
|
918 |
our $fromto; |
|
919 |
|
|
908 | 920 |
# connect to database |
909 | 921 |
my $dbh = $form->dbconnect($myconfig); |
910 | 922 |
|
... | ... | |
928 | 940 |
my $sth = $dbh->prepare($query); |
929 | 941 |
$sth->execute(@values) || $form->dberror($query); |
930 | 942 |
|
931 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
943 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
|
|
932 | 944 |
if (($remaining_bytes - length("t" . $ref->{'accno'})) <= 6) { |
933 | 945 |
$fuellzeichen = ($blockcount * 256 - length($buchungssatz . $header)); |
934 | 946 |
$buchungssatz .= "\x00" x $fuellzeichen; |
... | ... | |
958 | 970 |
print(ED $header); |
959 | 971 |
print(ED $buchungssatz); |
960 | 972 |
$fuellzeichen = 256 - (length($header . $buchungssatz . "z") % 256); |
961 |
$dateiende = "\x00" x $fuellzeichen; |
|
973 |
my $dateiende = "\x00" x $fuellzeichen;
|
|
962 | 974 |
print(ED "z"); |
963 | 975 |
print(ED $dateiende); |
964 | 976 |
close(ED); |
... | ... | |
967 | 979 |
$ed_versionset[0] = |
968 | 980 |
&make_ed_versionset($header, $filename, $blockcount, $fromto); |
969 | 981 |
|
970 |
$ev_header = &make_ev_header($form, $fileno); |
|
971 |
$ev_filename = $export_path . $evfile; |
|
982 |
my $ev_header = &make_ev_header($form, $fileno);
|
|
983 |
my $ev_filename = $export_path . $evfile;
|
|
972 | 984 |
push(@filenames, $evfile); |
973 | 985 |
open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; |
974 | 986 |
print(EV $ev_header); |
975 | 987 |
|
976 |
foreach $file (@ed_versionset) { |
|
988 |
foreach my $file (@ed_versionset) {
|
|
977 | 989 |
print(EV $ed_versionset[$file]); |
978 | 990 |
} |
979 | 991 |
close(EV); |
SL/DATEV/KNEFile.pm | ||
---|---|---|
1 | 1 |
package SL::DATEV::KNEFile; |
2 | 2 |
|
3 |
use strict; |
|
4 |
|
|
3 | 5 |
sub new { |
4 | 6 |
my $type = shift; |
5 | 7 |
my $self = {}; |
... | ... | |
69 | 71 |
my $self = shift; |
70 | 72 |
my $amount = shift; |
71 | 73 |
my $width = shift; |
74 |
our $stellen; |
|
72 | 75 |
|
73 | 76 |
$amount =~ s/-//; |
74 | 77 |
my ($places, $decimal_places) = split m/\./, "$amount"; |
SL/FU.pm | ||
---|---|---|
8 | 8 |
use SL::DBUtils; |
9 | 9 |
use SL::Notes; |
10 | 10 |
|
11 |
use strict; |
|
12 |
|
|
11 | 13 |
sub save { |
12 | 14 |
$main::lxdebug->enter_sub(); |
13 | 15 |
|
SL/Form.pm | ||
---|---|---|
37 | 37 |
|
38 | 38 |
package Form; |
39 | 39 |
|
40 |
#use strict; |
|
41 |
|
|
42 | 40 |
use Data::Dumper; |
43 | 41 |
|
44 | 42 |
use CGI; |
... | ... | |
59 | 57 |
use List::Util qw(first max min sum); |
60 | 58 |
use List::MoreUtils qw(any); |
61 | 59 |
|
60 |
use strict; |
|
61 |
|
|
62 | 62 |
my $standard_dbh; |
63 | 63 |
|
64 | 64 |
END { |
... | ... | |
314 | 314 |
_recode_recursively($iconv, $self); |
315 | 315 |
} |
316 | 316 |
|
317 |
delete $self{INPUT_ENCODING}; |
|
317 |
delete $self->{INPUT_ENCODING};
|
|
318 | 318 |
} |
319 | 319 |
|
320 | 320 |
$self->{action} = lc $self->{action}; |
... | ... | |
1588 | 1588 |
my ($self, $myconfig) = @_; |
1589 | 1589 |
|
1590 | 1590 |
if ($standard_dbh && !$standard_dbh->{Active}) { |
1591 |
$main::lxdebug->message(LXDebug::INFO, "get_standard_dbh: \$standard_dbh is defined but not Active anymore");
|
|
1591 |
$main::lxdebug->message(LXDebug->INFO(), "get_standard_dbh: \$standard_dbh is defined but not Active anymore");
|
|
1592 | 1592 |
undef $standard_dbh; |
1593 | 1593 |
} |
1594 | 1594 |
|
SL/Iconv.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use vars qw(%converters); |
8 | 8 |
|
9 |
use strict; |
|
10 |
|
|
9 | 11 |
sub get_converter { |
10 | 12 |
my ($from_charset, $to_charset) = @_; |
11 | 13 |
|
SL/MIME.pm | ||
---|---|---|
1 | 1 |
package SL::MIME; |
2 | 2 |
|
3 |
use strict; |
|
4 |
|
|
3 | 5 |
sub mime_type_from_ext { |
4 | 6 |
$main::lxdebug->enter_sub(); |
5 | 7 |
|
SL/Mailer.pm | ||
---|---|---|
36 | 36 |
use SL::MIME; |
37 | 37 |
use SL::Template; |
38 | 38 |
|
39 |
use strict; |
|
40 |
|
|
39 | 41 |
my $num_sent = 0; |
40 | 42 |
|
41 | 43 |
sub new { |
SL/Num2text.pm | ||
---|---|---|
32 | 32 |
# |
33 | 33 |
#===================================================================== |
34 | 34 |
|
35 |
use strict; |
|
36 |
|
|
35 | 37 |
sub init { |
36 | 38 |
my $self = shift; |
37 | 39 |
|
... | ... | |
129 | 131 |
|
130 | 132 |
# add thousand, million |
131 | 133 |
if ($i) { |
132 |
$num = 10**($i * 3); |
|
134 |
my $num = 10**($i * 3);
|
|
133 | 135 |
push(@textnumber, $self->{numbername}{$num}); |
134 | 136 |
} |
135 | 137 |
|
SL/OE.pm | ||
---|---|---|
41 | 41 |
use SL::DBUtils; |
42 | 42 |
use SL::IC; |
43 | 43 |
|
44 |
use strict; |
|
45 |
|
|
44 | 46 |
=head1 NAME |
45 | 47 |
|
46 | 48 |
OE.pm - Order entry module |
SL/OP.pm | ||
---|---|---|
36 | 36 |
|
37 | 37 |
use SL::DBUtils; |
38 | 38 |
|
39 |
use strict; |
|
40 |
|
|
39 | 41 |
sub overpayment { |
40 | 42 |
$main::lxdebug->enter_sub(); |
41 | 43 |
|
... | ... | |
70 | 72 |
do_query($form, $dbh, $query, @values); |
71 | 73 |
|
72 | 74 |
# add AR/AP |
73 |
($accno) = split /--/, $form->{ $form->{ARAP} }; |
|
75 |
my ($accno) = split /--/, $form->{ $form->{ARAP} };
|
|
74 | 76 |
|
75 | 77 |
$query = |
76 | 78 |
qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | . |
SL/RP.pm | ||
---|---|---|
37 | 37 |
use SL::DBUtils; |
38 | 38 |
use Data::Dumper; |
39 | 39 |
use List::Util qw(sum); |
40 |
# use strict; |
|
41 |
# use warnings; |
|
42 | 40 |
|
41 |
# use warnings; |
|
42 |
use strict; |
|
43 | 43 |
|
44 | 44 |
# new implementation of balance sheet |
45 | 45 |
# readme! |
... | ... | |
439 | 439 |
my $glwhere = ""; |
440 | 440 |
my $prwhere = ""; |
441 | 441 |
my $subwhere = ""; |
442 |
my $inwhere = ""; |
|
442 | 443 |
my $item; |
443 | 444 |
|
444 | 445 |
if ($fromdate) { |
... | ... | |
776 | 777 |
my $glwhere = ''; |
777 | 778 |
my $glsumwhere = ''; |
778 | 779 |
my $tofrom; |
780 |
my ($fromdate, $todate); |
|
779 | 781 |
|
780 | 782 |
if ($form->{fromdate} || $form->{todate}) { |
781 | 783 |
if ($form->{fromdate}) { |
SL/Template.pm | ||
---|---|---|
5 | 5 |
# Web http://www.lx-office.org |
6 | 6 |
# |
7 | 7 |
#==================================================================== |
8 |
# |
|
9 |
# |
|
10 |
# NOTE: strict checks are package global. don't check this file |
|
11 |
# with perl -sc, it will only capture SimpleTemplate |
|
12 |
# |
|
13 |
# |
|
8 | 14 |
|
9 | 15 |
package SimpleTemplate; |
10 | 16 |
|
17 |
use strict; |
|
18 |
|
|
11 | 19 |
# Parameters: |
12 | 20 |
# 1. The template's file name |
13 | 21 |
# 2. A reference to the Form object |
... | ... | |
219 | 227 |
|
220 | 228 |
@ISA = qw(SimpleTemplate); |
221 | 229 |
|
230 |
use strict; |
|
231 |
|
|
222 | 232 |
sub new { |
223 | 233 |
my $type = shift; |
224 | 234 |
|
... | ... | |
666 | 676 |
|
667 | 677 |
@ISA = qw(LaTeXTemplate); |
668 | 678 |
|
679 |
use strict; |
|
680 |
|
|
669 | 681 |
sub new { |
670 | 682 |
my $type = shift; |
671 | 683 |
|
... | ... | |
790 | 802 |
|
791 | 803 |
@ISA = qw(LaTeXTemplate); |
792 | 804 |
|
805 |
use strict; |
|
806 |
|
|
793 | 807 |
sub new { |
794 | 808 |
my $type = shift; |
795 | 809 |
|
... | ... | |
828 | 842 |
|
829 | 843 |
@ISA = qw(SimpleTemplate); |
830 | 844 |
|
845 |
use strict; |
|
846 |
|
|
831 | 847 |
sub new { |
832 | 848 |
my $type = shift; |
833 | 849 |
|
834 |
$self = $type->SUPER::new(@_); |
|
850 |
my $self = $type->SUPER::new(@_);
|
|
835 | 851 |
|
836 | 852 |
foreach my $module (qw(Archive::Zip Text::Iconv)) { |
837 | 853 |
eval("use ${module};"); |
... | ... | |
1040 | 1056 |
} |
1041 | 1057 |
|
1042 | 1058 |
my $zip = Archive::Zip->new(); |
1043 |
if (Archive::Zip::AZ_OK != $zip->read($file_name)) {
|
|
1059 |
if (Archive::Zip->AZ_OK != $zip->read($file_name)) {
|
|
1044 | 1060 |
$self->{"error"} = "File not found/is not a OpenDocument file."; |
1045 | 1061 |
$main::lxdebug->leave_sub(); |
1046 | 1062 |
return 0; |
... | ... | |
1117 | 1133 |
my $dfname = $self->{"userspath"} . "/xvfb_display"; |
1118 | 1134 |
my $display; |
1119 | 1135 |
|
1120 |
$main::lxdebug->message(LXDebug::DEBUG2, " Looking for $dfname\n");
|
|
1136 |
$main::lxdebug->message(LXDebug->DEBUG2(), " Looking for $dfname\n");
|
|
1121 | 1137 |
if ((-f $dfname) && open(IN, $dfname)) { |
1122 | 1138 |
my $pid = <IN>; |
1123 | 1139 |
chomp($pid); |
... | ... | |
1127 | 1143 |
chomp($xauthority); |
1128 | 1144 |
close(IN); |
1129 | 1145 |
|
1130 |
$main::lxdebug->message(LXDebug::DEBUG2, " found with $pid and $display\n");
|
|
1146 |
$main::lxdebug->message(LXDebug->DEBUG2(), " found with $pid and $display\n");
|
|
1131 | 1147 |
|
1132 | 1148 |
if ((! -d "/proc/$pid") || !open(IN, "/proc/$pid/cmdline")) { |
1133 |
$main::lxdebug->message(LXDebug::DEBUG2, " no/wrong process #1\n");
|
|
1149 |
$main::lxdebug->message(LXDebug->DEBUG2(), " no/wrong process #1\n");
|
|
1134 | 1150 |
unlink($dfname, $xauthority); |
1135 | 1151 |
$main::lxdebug->leave_sub(); |
1136 | 1152 |
return undef; |
... | ... | |
1138 | 1154 |
my $line = <IN>; |
1139 | 1155 |
close(IN); |
1140 | 1156 |
if ($line !~ /xvfb/i) { |
1141 |
$main::lxdebug->message(LXDebug::DEBUG2, " no/wrong process #2\n");
|
|
1157 |
$main::lxdebug->message(LXDebug->DEBUG2(), " no/wrong process #2\n");
|
|
1142 | 1158 |
unlink($dfname, $xauthority); |
1143 | 1159 |
$main::lxdebug->leave_sub(); |
1144 | 1160 |
return undef; |
... | ... | |
1147 | 1163 |
$ENV{"XAUTHORITY"} = $xauthority; |
1148 | 1164 |
$ENV{"DISPLAY"} = $display; |
1149 | 1165 |
} else { |
1150 |
$main::lxdebug->message(LXDebug::DEBUG2, " not found\n");
|
|
1166 |
$main::lxdebug->message(LXDebug->DEBUG2(), " not found\n");
|
|
1151 | 1167 |
} |
1152 | 1168 |
|
1153 | 1169 |
$main::lxdebug->leave_sub(); |
... | ... | |
1160 | 1176 |
|
1161 | 1177 |
my ($self) = @_; |
1162 | 1178 |
|
1163 |
$main::lxdebug->message(LXDebug::DEBUG2, "spawn_xvfb()\n");
|
|
1179 |
$main::lxdebug->message(LXDebug->DEBUG2, "spawn_xvfb()\n");
|
|
1164 | 1180 |
|
1165 | 1181 |
my $display = $self->is_xvfb_running(); |
1166 | 1182 |
|
... | ... | |
1174 | 1190 |
$display++; |
1175 | 1191 |
} |
1176 | 1192 |
$display = ":${display}"; |
1177 |
$main::lxdebug->message(LXDebug::DEBUG2, " display $display\n");
|
|
1193 |
$main::lxdebug->message(LXDebug->DEBUG2(), " display $display\n");
|
|
1178 | 1194 |
|
1179 | 1195 |
my $mcookie = `mcookie`; |
1180 | 1196 |
die("Installation error: mcookie not found.") if ($? != 0); |
1181 | 1197 |
chomp($mcookie); |
1182 | 1198 |
|
1183 |
$main::lxdebug->message(LXDebug::DEBUG2, " mcookie $mcookie\n");
|
|
1199 |
$main::lxdebug->message(LXDebug->DEBUG2(), " mcookie $mcookie\n");
|
|
1184 | 1200 |
|
1185 | 1201 |
my $xauthority = "/tmp/.Xauthority-" . $$ . "-" . time() . "-" . int(rand(9999999)); |
1186 | 1202 |
$ENV{"XAUTHORITY"} = $xauthority; |
1187 | 1203 |
|
1188 |
$main::lxdebug->message(LXDebug::DEBUG2, " xauthority $xauthority\n");
|
|
1204 |
$main::lxdebug->message(LXDebug->DEBUG2(), " xauthority $xauthority\n");
|
|
1189 | 1205 |
|
1190 | 1206 |
system("xauth add \"${display}\" . \"${mcookie}\""); |
1191 | 1207 |
if ($? != 0) { |
... | ... | |
1194 | 1210 |
return undef; |
1195 | 1211 |
} |
1196 | 1212 |
|
1197 |
$main::lxdebug->message(LXDebug::DEBUG2, " about to fork()\n");
|
|
1213 |
$main::lxdebug->message(LXDebug->DEBUG2(), " about to fork()\n");
|
|
1198 | 1214 |
|
1199 | 1215 |
my $pid = fork(); |
1200 | 1216 |
if (0 == $pid) { |
1201 |
$main::lxdebug->message(LXDebug::DEBUG2, " Child execing\n");
|
|
1217 |
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
|
|
1202 | 1218 |
exec($main::xvfb_bin, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp"); |
1203 | 1219 |
} |
1204 | 1220 |
sleep(3); |
1205 |
$main::lxdebug->message(LXDebug::DEBUG2, " parent dont sleeping\n");
|
|
1221 |
$main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n");
|
|
1206 | 1222 |
|
1207 | 1223 |
local *OUT; |
1208 | 1224 |
my $dfname = $self->{"userspath"} . "/xvfb_display"; |
... | ... | |
1216 | 1232 |
print(OUT "$pid\n$display\n$xauthority\n"); |
1217 | 1233 |
close(OUT); |
1218 | 1234 |
|
1219 |
$main::lxdebug->message(LXDebug::DEBUG2, " parent re-testing\n");
|
|
1235 |
$main::lxdebug->message(LXDebug->DEBUG2(), " parent re-testing\n");
|
|
1220 | 1236 |
|
1221 | 1237 |
if (!$self->is_xvfb_running()) { |
1222 | 1238 |
$self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started."; |
... | ... | |
1226 | 1242 |
return undef; |
1227 | 1243 |
} |
1228 | 1244 |
|
1229 |
$main::lxdebug->message(LXDebug::DEBUG2, " spawn OK\n");
|
|
1245 |
$main::lxdebug->message(LXDebug->DEBUG2(), " spawn OK\n");
|
|
1230 | 1246 |
|
1231 | 1247 |
$main::lxdebug->leave_sub(); |
1232 | 1248 |
|
... | ... | |
1239 | 1255 |
system("./scripts/oo-uno-test-conn.py $main::openofficeorg_daemon_port " . |
1240 | 1256 |
"> /dev/null 2> /dev/null"); |
1241 | 1257 |
my $res = $? == 0; |
1242 |
$main::lxdebug->message(LXDebug::DEBUG2, " is_openoffice_running(): $?\n");
|
|
1258 |
$main::lxdebug->message(LXDebug->DEBUG2(), " is_openoffice_running(): $?\n");
|
|
1243 | 1259 |
|
1244 | 1260 |
$main::lxdebug->leave_sub(); |
1245 | 1261 |
|
... | ... | |
1251 | 1267 |
|
1252 | 1268 |
my ($self) = @_; |
1253 | 1269 |
|
1254 |
$main::lxdebug->message(LXDebug::DEBUG2, "spawn_openoffice()\n");
|
|
1270 |
$main::lxdebug->message(LXDebug->DEBUG2(), "spawn_openoffice()\n");
|
|
1255 | 1271 |
|
1256 | 1272 |
my ($try, $spawned_oo, $res); |
1257 | 1273 |
|
... | ... | |
1265 | 1281 |
if (!$spawned_oo) { |
1266 | 1282 |
my $pid = fork(); |
1267 | 1283 |
if (0 == $pid) { |
1268 |
$main::lxdebug->message(LXDebug::DEBUG2, " Child daemonizing\n");
|
|
1284 |
$main::lxdebug->message(LXDebug->DEBUG2(), " Child daemonizing\n");
|
|
1269 | 1285 |
chdir('/'); |
1270 | 1286 |
open(STDIN, '/dev/null'); |
1271 | 1287 |
open(STDOUT, '>/dev/null'); |
1272 | 1288 |
my $new_pid = fork(); |
1273 | 1289 |
exit if ($new_pid); |
1274 | 1290 |
my $ssres = setsid(); |
1275 |
$main::lxdebug->message(LXDebug::DEBUG2, " Child execing\n");
|
|
1291 |
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
|
|
1276 | 1292 |
my @cmdline = ($main::openofficeorg_writer_bin, |
1277 | 1293 |
"-minimized", "-norestore", "-nologo", "-nolockcheck", |
1278 | 1294 |
"-headless", |
... | ... | |
1281 | 1297 |
exec(@cmdline); |
1282 | 1298 |
} |
1283 | 1299 |
|
1284 |
$main::lxdebug->message(LXDebug::DEBUG2, " Parent after fork\n");
|
|
1300 |
$main::lxdebug->message(LXDebug->DEBUG2(), " Parent after fork\n");
|
|
1285 | 1301 |
$spawned_oo = 1; |
1286 | 1302 |
sleep(3); |
1287 | 1303 |
} |
... | ... | |
1386 | 1402 |
} |
1387 | 1403 |
|
1388 | 1404 |
sub get_mime_type() { |
1405 |
my ($self) = @_; |
|
1406 |
|
|
1389 | 1407 |
if ($self->{"form"}->{"format"} =~ /pdf/) { |
1390 | 1408 |
return "application/pdf"; |
1391 | 1409 |
} else { |
... | ... | |
1410 | 1428 |
|
1411 | 1429 |
@ISA = qw(HTMLTemplate); |
1412 | 1430 |
|
1431 |
use strict; |
|
1432 |
|
|
1413 | 1433 |
sub new { |
1414 | 1434 |
#evtl auskommentieren |
1415 | 1435 |
my $type = shift; |
SL/Template/Plugin/JavaScript.pm | ||
---|---|---|
3 | 3 |
use base qw( Template::Plugin ); |
4 | 4 |
use Template::Plugin; |
5 | 5 |
|
6 |
use strict; |
|
7 |
|
|
6 | 8 |
sub new { |
7 | 9 |
my $class = shift; |
8 | 10 |
my $context = shift; |
SL/Template/Plugin/LxERP.pm | ||
---|---|---|
7 | 7 |
|
8 | 8 |
use SL::AM; |
9 | 9 |
|
10 |
use strict; |
|
11 |
|
|
10 | 12 |
sub new { |
11 | 13 |
my $class = shift; |
12 | 14 |
my $context = shift; |
SL/Template/Plugin/MultiColumnIterator.pm | ||
---|---|---|
1 | 1 |
package SL::Template::Plugin::MultiColumnIterator; |
2 | 2 |
|
3 |
#use strict; |
|
4 | 3 |
use base 'Template::Plugin'; |
5 | 4 |
use Template::Constants; |
6 | 5 |
use Template::Exception; |
... | ... | |
8 | 7 |
use SL::LXDebug; |
9 | 8 |
use Data::Dumper; |
10 | 9 |
|
10 |
use strict; |
|
11 |
|
|
11 | 12 |
our $AUTOLOAD; |
12 | 13 |
|
13 | 14 |
sub new { |
14 |
$main::lxdebug->enter_sub();
|
|
15 |
$main::lxdebug->enter_sub(); |
|
15 | 16 |
my $class = shift; |
16 | 17 |
my $context = shift; |
17 | 18 |
my $data = shift || [ ]; |
... | ... | |
36 | 37 |
$data = [ $data ] ; |
37 | 38 |
} |
38 | 39 |
|
39 |
$main::lxdebug->leave_sub();
|
|
40 |
$main::lxdebug->leave_sub(); |
|
40 | 41 |
|
41 | 42 |
bless { |
42 | 43 |
_DATA => $data, |
... | ... | |
47 | 48 |
|
48 | 49 |
|
49 | 50 |
sub get_first { |
50 |
$main::lxdebug->enter_sub();
|
|
51 |
$main::lxdebug->enter_sub(); |
|
51 | 52 |
my $self = shift; |
52 | 53 |
my $data = $self->{ _DATA }; |
53 | 54 |
my $dim = $self->{ _DIM }; |
... | ... | |
55 | 56 |
$self->{ _DATASET } = $self->{ _DATA }; |
56 | 57 |
my $size = int ((scalar @$data - 1) / $dim) + 1; |
57 | 58 |
my $index = 0; |
58 |
|
|
59 |
|
|
59 | 60 |
return (undef, Template::Constants::STATUS_DONE) unless $size; |
60 | 61 |
|
61 | 62 |
# initialise various counters, flags, etc. |
... | ... | |
63 | 64 |
@$self{ qw( PREV ) } = ( undef ); |
64 | 65 |
$$self{ qw( NEXT ) } = [ @{ $self->{ _DATASET } }[ map { $index + 1 + $_ * $size } 0 .. ($dim - 1) ] ]; |
65 | 66 |
|
66 |
$main::lxdebug->leave_sub();
|
|
67 |
$main::lxdebug->leave_sub(); |
|
67 | 68 |
return [ @{ $self->{ _DATASET } }[ map { $index + $_ * $size } 0 .. ($dim - 1) ] ]; |
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
sub get_next { |
71 |
$main::lxdebug->enter_sub();
|
|
72 |
$main::lxdebug->enter_sub(); |
|
72 | 73 |
my $self = shift; |
73 | 74 |
my ($max, $index) = @$self{ qw( MAX INDEX ) }; |
74 | 75 |
my $data = $self->{ _DATASET }; |
... | ... | |
89 | 90 |
@$self{ qw( INDEX COUNT FIRST LAST ) } = ( $index, $index + 1, 0, $index == $max ? 1 : 0 ); |
90 | 91 |
$$self{ qw( PREV ) } = [ @{ $self->{ _DATASET } }[ map { $index - 1 + $_ * $size } 0 .. ($dim - 1) ] ]; |
91 | 92 |
$$self{ qw( NEXT ) } = [ @{ $self->{ _DATASET } }[ map { $index + 1 + $_ * $size } 0 .. ($dim - 1) ] ]; |
92 |
$main::lxdebug->leave_sub();
|
|
93 |
$main::lxdebug->leave_sub(); |
|
93 | 94 |
return [ @{ $self->{ _DATASET } }[ map { $index + $_ * $size } 0 .. ($dim - 1) ] ]; |
94 | 95 |
} |
95 | 96 |
else { |
96 |
$main::lxdebug->leave_sub();
|
|
97 |
$main::lxdebug->leave_sub(); |
|
97 | 98 |
return (undef, Template::Constants::STATUS_DONE); ## RETURN ## |
98 | 99 |
} |
99 | 100 |
} |
... | ... | |
131 | 132 |
} |
132 | 133 |
|
133 | 134 |
sub dump { |
134 |
$main::lxdebug->enter_sub();
|
|
135 |
$main::lxdebug->enter_sub(); |
|
135 | 136 |
my $self = shift; |
136 |
$main::lxdebug->leave_sub();
|
|
137 |
$main::lxdebug->leave_sub(); |
|
137 | 138 |
return join('', |
138 | 139 |
"<pre>", |
139 | 140 |
" Data: ", Dumper($self->{ _DATA }), "\n", |
... | ... | |
149 | 150 |
} |
150 | 151 |
|
151 | 152 |
sub index { |
152 |
$main::lxdebug->enter_sub();
|
|
153 |
$main::lxdebug->enter_sub(); |
|
153 | 154 |
my ($self) = @_; |
154 |
$main::lxdebug->leave_sub();
|
|
155 |
$main::lxdebug->leave_sub(); |
|
155 | 156 |
return $self->{ INDEX }; |
156 | 157 |
} |
157 | 158 |
|
158 | 159 |
sub number { |
159 |
$main::lxdebug->enter_sub();
|
|
160 |
$main::lxdebug->enter_sub(); |
|
160 | 161 |
my ($self) = @_; |
161 |
$main::lxdebug->leave_sub();
|
|
162 |
$main::lxdebug->leave_sub(); |
|
162 | 163 |
return $self->{ NUMBER }; |
163 | 164 |
} |
164 | 165 |
|
165 | 166 |
sub count { |
166 |
$main::lxdebug->enter_sub();
|
|
167 |
$main::lxdebug->enter_sub(); |
|
167 | 168 |
my ($self) = @_; |
168 |
$main::lxdebug->leave_sub();
|
|
169 |
$main::lxdebug->leave_sub(); |
|
169 | 170 |
return $self->{ COUNT }; |
170 | 171 |
} |
171 | 172 |
sub max { |
172 |
$main::lxdebug->enter_sub();
|
|
173 |
$main::lxdebug->enter_sub(); |
|
173 | 174 |
my ($self) = @_; |
174 |
$main::lxdebug->leave_sub();
|
|
175 |
$main::lxdebug->leave_sub(); |
|
175 | 176 |
return $self->{ MAX }; |
176 | 177 |
} |
177 | 178 |
|
178 | 179 |
sub size { |
179 |
$main::lxdebug->enter_sub();
|
|
180 |
$main::lxdebug->enter_sub(); |
|
180 | 181 |
my ($self) = @_; |
181 |
$main::lxdebug->leave_sub();
|
|
182 |
$main::lxdebug->leave_sub(); |
|
182 | 183 |
return $self->{ SIZE }; |
183 | 184 |
} |
184 | 185 |
|
185 | 186 |
sub first { |
186 |
$main::lxdebug->enter_sub();
|
|
187 |
$main::lxdebug->enter_sub(); |
|
187 | 188 |
my ($self) = @_; |
188 |
$main::lxdebug->leave_sub();
|
|
189 |
$main::lxdebug->leave_sub(); |
|
189 | 190 |
return $self->{ FIRST }; |
190 | 191 |
} |
191 | 192 |
|
192 | 193 |
sub last { |
193 |
$main::lxdebug->enter_sub();
|
|
194 |
$main::lxdebug->enter_sub(); |
|
194 | 195 |
my ($self) = @_; |
195 |
$main::lxdebug->leave_sub();
|
|
196 |
$main::lxdebug->leave_sub(); |
|
196 | 197 |
return $self->{ LAST}; |
197 | 198 |
} |
198 | 199 |
|
SL/WH.pm | ||
---|---|---|
37 | 37 |
use SL::AM; |
38 | 38 |
use SL::DBUtils; |
39 | 39 |
use SL::Form; |
40 |
|
|
40 | 41 |
use warnings; |
41 |
#use strict; |
|
42 |
use strict; |
|
43 |
|
|
42 | 44 |
sub transfer { |
43 | 45 |
$main::lxdebug->enter_sub(); |
44 | 46 |
|
... | ... | |
242 | 244 |
my $dbh = $form->get_standard_dbh($myconfig); |
243 | 245 |
|
244 | 246 |
# filters |
245 |
my (@filter_ary, @filter_vars, $joins); |
|
247 |
my (@filter_ary, @filter_vars, $joins, %select_tokens, %select);
|
|
246 | 248 |
|
247 | 249 |
if ($filter{warehouse_id} ne '') { |
248 | 250 |
push @filter_ary, "w1.id = ? OR w2.id = ?"; |
... | ... | |
448 | 450 |
} |
449 | 451 |
|
450 | 452 |
my @contents = (); |
451 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
453 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
|
|
452 | 454 |
map { /^r_/; $ref->{"$'"} = $ref->{$_} } keys %$ref; |
453 | 455 |
my $qty = $ref->{"qty"} * 1; |
454 | 456 |
|
... | ... | |
628 | 630 |
|
629 | 631 |
my (%non_empty_bins, @all_fields, @contents); |
630 | 632 |
|
631 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
633 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
|
|
632 | 634 |
$ref->{qty} *= 1; |
633 | 635 |
my $qty = $ref->{qty}; |
634 | 636 |
|
Auch abrufbar als: Unified diff
und die restlichen .pm Module.