Ausserdem Merge der Revisionen 5239 5259 5340 5341 5342 und 5343.
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- $form->{ALL};
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- $form->{ALL};
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
+ my $query;
# connect to database
my $dbh = $form->dbconnect($myconfig);
if ($form->{id}) {
- my $query =
+ $query =
qq|SELECT description, inventory_accno_id,
(SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno,
income_accno_id_0,
$sth->finish;
- my $query =
+ $query =
qq|SELECT count(id) = 0 AS orphaned
FROM parts
WHERE buchungsgruppen_id = ?|;
# save first currency in myconfig
$form->{currency} = substr($form->{curr}, 0, 3);
- my $myconfig = new User "$memberfile", "$form->{login}";
+ $myconfig = new User "$memberfile", "$form->{login}";
foreach my $item (keys %$form) {
$myconfig->{$item} = $form->{$item};
use SL::User;
use SL::Common;
use CGI;
+use List::Util qw(max min sum);
my $standard_dbh;
if (($line eq $boundary) || ($line eq "$boundary\r")) {
$params{$name} =~ s|\r?\n$|| if $name;
- undef $name, $filename;
+ undef $name;
+ undef $filename;
$headers_done = 0;
$content_type = "text/plain";
$main::lxdebug->leave_sub();
}
+# calculates the number of rows in a textarea based on the content and column number
+# can be capped with maxrows
sub numtextrows {
$main::lxdebug->enter_sub();
-
my ($self, $str, $cols, $maxrows) = @_;
- my $rows = 0;
-
- map { $rows += int(((length) - 2) / $cols) + 1 } split /\r/, $str;
-
- $maxrows = $rows unless defined $maxrows;
+ my $rows = sum map { int((length() - 2) / $cols) + 1 } split /\r/, $str;
+ $maxrows ||= $rows;
$main::lxdebug->leave_sub();
-
- return ($rows > $maxrows) ? $maxrows : $rows;
+ return min $rows, $maxrows;
}
sub dberror {
$main::lxdebug->enter_sub();
my ($self, $dbh, $curr, $transdate, $buy, $sell) = @_;
-
+ my ($query);
# some sanity check for currency
if ($curr eq '') {
$main::lxdebug->leave_sub();
return;
}
- my $query = qq|SELECT curr FROM defaults|;
+ $query = qq|SELECT curr FROM defaults|;
my ($currency) = selectrow_query($self, $dbh, $query);
my ($defaultcurrency) = split m/:/, $currency;
return;
}
- my $query = qq|SELECT e.curr FROM exchangerate e
+ $query = qq|SELECT e.curr FROM exchangerate e
WHERE e.curr = ? AND e.transdate = ?
FOR UPDATE|;
my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate);
$main::lxdebug->enter_sub();
my ($self, $dbh, $curr, $transdate, $fld) = @_;
+ my ($query);
unless ($transdate) {
$main::lxdebug->leave_sub();
return 1;
}
- my $query = qq|SELECT curr FROM defaults|;
+ $query = qq|SELECT curr FROM defaults|;
my ($currency) = selectrow_query($self, $dbh, $query);
my ($defaultcurrency) = split m/:/, $currency;
return 1;
}
- my $query = qq|SELECT e.$fld FROM exchangerate e
+ $query = qq|SELECT e.$fld FROM exchangerate e
WHERE e.curr = ? AND e.transdate = ?|;
my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate);
my @ndx = ();
- map { push @ndx, { num => $new->[$_ - 1]->{runningnumber}, ndx => $_ } }
- (1 .. $count);
+ map { push @ndx, { num => $new->[$_ - 1]->{runningnumber}, ndx => $_ } } 1 .. $count;
my $i = 0;
my $formnames = $self->{printed};
my $emailforms = $self->{emailed};
- my $query = qq|DELETE FROM status
+ $query = qq|DELETE FROM status
WHERE (formname = ?) AND (trans_id = ?)|;
do_query($self, $dbh, $query, $self->{formname}, $self->{id});
$form->{parts} = +{ };
- my @simple_filters = qw(partnumber ean description partsgroup microfiche drawing);
+ my @simple_filters = qw(partnumber ean description partsgroup microfiche drawing onhand);
my @makemodel_filters = qw(make model);
my @invoice_oi_filters = qw(serialnumber soldtotal);
my @apoe_filters = qw(transdate);
my $group;
my $limit;
- my @where_values;
-
if ($item ne 'make') {
foreach my $item (qw(partnumber drawing microfiche make model pg.partsgroup)) {
my $column = $item;
$h_item_unit->finish();
- my $project_id = conv_i($form->{"globalproject_id"});
+ $project_id = conv_i($form->{"globalproject_id"});
$form->{datepaid} = $form->{invdate};
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
-
+ my $query;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
&reverse_invoice($dbh, $form);
# delete zero entries
- my $query = qq|DELETE FROM acc_trans WHERE amount = 0|;
+ $query = qq|DELETE FROM acc_trans WHERE amount = 0|;
do_query($form, $dbh, $query);
# delete AP record
- my $query = qq|DELETE FROM ap WHERE id = ?|;
+ $query = qq|DELETE FROM ap WHERE id = ?|;
do_query($form, $dbh, $query, conv_i($form->{id}));
my $rc = $dbh->commit;
foreach my $key (keys(%markup_replace)) {
my $value = $markup_replace{$key};
- $variable =~ s|\<${key}\>|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi;
+ $variable =~ s|\<${key}\>|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi; #"
$variable =~ s|\</${key}\>|</text:span>|gi;
}
use warnings FATAL =>'all';
use diagnostics;
-my $dir = IO::Dir->new("SL/");
+use Getopt::Long;
-my @files = grep {/\.pm$/} $dir->read();
+my $parse_SL = 1;
+my $parse_binmozilla = 0;
+GetOptions("sl!" => \$parse_SL,
+ "pm!" => \$parse_SL,
+ "binmozilla!" => \$parse_binmozilla,
+ "pl!" => \$parse_binmozilla,
+ );
-@files = grep { s{^}{SL\/}gxms } @files;
+my @files = ();
+push @files, grep { /\.pm$/ && s{^}{SL/}gxms } IO::Dir->new("SL/")->read() if $parse_SL;
+push @files, grep { /\.pl$/ && s{^}{bin/mozilla/}gxms} IO::Dir->new("bin/mozilla/")->read() if $parse_binmozilla;
+
+#map { s{^}{SL\/}gxms } @files;
#print Dumper(@files);