Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 29795499

Von Sven Schöling vor etwa 17 Jahren hinzugefügt

  • ID 29795499e0623f7ff7ea739ed3b61d66dad0e7c6
  • Vorgänger dec4d40f
  • Nachfolger 7a611f95

Verbesserungen am Tag Script.

Ausserdem Merge der Revisionen 5239 5259 5340 5341 5342 und 5343.

Unterschiede anzeigen:

SL/AM.pm
594 594
  $sth = $dbh->prepare($query);
595 595
  $sth->execute || $form->dberror($query);
596 596

  
597
  $form->{ALL};
598 597
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
599 598
    push @{ $form->{ALL} }, $ref;
600 599
  }
......
690 689
  $sth = $dbh->prepare($query);
691 690
  $sth->execute || $form->dberror($query);
692 691

  
693
  $form->{ALL};
694 692
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
695 693
    push @{ $form->{ALL} }, $ref;
696 694
  }
......
962 960
  $main::lxdebug->enter_sub();
963 961

  
964 962
  my ($self, $myconfig, $form) = @_;
963
  my $query;
965 964

  
966 965
  # connect to database
967 966
  my $dbh = $form->dbconnect($myconfig);
968 967

  
969 968
  if ($form->{id}) {
970
    my $query =
969
    $query =
971 970
      qq|SELECT description, inventory_accno_id,
972 971
         (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno,
973 972
         income_accno_id_0,
......
997 996

  
998 997
    $sth->finish;
999 998

  
1000
    my $query =
999
    $query =
1001 1000
      qq|SELECT count(id) = 0 AS orphaned
1002 1001
         FROM parts
1003 1002
         WHERE buchungsgruppen_id = ?|;
......
1538 1537
  # save first currency in myconfig
1539 1538
  $form->{currency} = substr($form->{curr}, 0, 3);
1540 1539

  
1541
  my $myconfig = new User "$memberfile", "$form->{login}";
1540
  $myconfig = new User "$memberfile", "$form->{login}";
1542 1541

  
1543 1542
  foreach my $item (keys %$form) {
1544 1543
    $myconfig->{$item} = $form->{$item};
SL/Form.pm
49 49
use SL::User;
50 50
use SL::Common;
51 51
use CGI;
52
use List::Util qw(max min sum);
52 53

  
53 54
my $standard_dbh;
54 55

  
......
98 99
    if (($line eq $boundary) || ($line eq "$boundary\r")) {
99 100
      $params{$name} =~ s|\r?\n$|| if $name;
100 101

  
101
      undef $name, $filename;
102
      undef $name;
103
      undef $filename;
102 104

  
103 105
      $headers_done   = 0;
104 106
      $content_type   = "text/plain";
......
331 333
  $main::lxdebug->leave_sub();
332 334
}
333 335

  
336
# calculates the number of rows in a textarea based on the content and column number
337
# can be capped with maxrows
334 338
sub numtextrows {
335 339
  $main::lxdebug->enter_sub();
336

  
337 340
  my ($self, $str, $cols, $maxrows) = @_;
338 341

  
339
  my $rows = 0;
340

  
341
  map { $rows += int(((length) - 2) / $cols) + 1 } split /\r/, $str;
342

  
343
  $maxrows = $rows unless defined $maxrows;
342
  my $rows   = sum map { int((length() - 2) / $cols) + 1 } split /\r/, $str;
343
  $maxrows ||= $rows;
344 344

  
345 345
  $main::lxdebug->leave_sub();
346

  
347
  return ($rows > $maxrows) ? $maxrows : $rows;
346
  return min $rows, $maxrows;
348 347
}
349 348

  
350 349
sub dberror {
......
1206 1205
  $main::lxdebug->enter_sub();
1207 1206

  
1208 1207
  my ($self, $dbh, $curr, $transdate, $buy, $sell) = @_;
1209

  
1208
  my ($query);
1210 1209
  # some sanity check for currency
1211 1210
  if ($curr eq '') {
1212 1211
    $main::lxdebug->leave_sub();
1213 1212
    return;
1214 1213
  }  
1215
  my $query = qq|SELECT curr FROM defaults|;
1214
  $query = qq|SELECT curr FROM defaults|;
1216 1215

  
1217 1216
  my ($currency) = selectrow_query($self, $dbh, $query);
1218 1217
  my ($defaultcurrency) = split m/:/, $currency;
......
1223 1222
    return;
1224 1223
  }
1225 1224

  
1226
  my $query = qq|SELECT e.curr FROM exchangerate e
1225
  $query = qq|SELECT e.curr FROM exchangerate e
1227 1226
                 WHERE e.curr = ? AND e.transdate = ?
1228 1227
                 FOR UPDATE|;
1229 1228
  my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate);
......
1288 1287
  $main::lxdebug->enter_sub();
1289 1288

  
1290 1289
  my ($self, $dbh, $curr, $transdate, $fld) = @_;
1290
  my ($query);
1291 1291

  
1292 1292
  unless ($transdate) {
1293 1293
    $main::lxdebug->leave_sub();
1294 1294
    return 1;
1295 1295
  }
1296 1296

  
1297
  my $query = qq|SELECT curr FROM defaults|;
1297
  $query = qq|SELECT curr FROM defaults|;
1298 1298

  
1299 1299
  my ($currency) = selectrow_query($self, $dbh, $query);
1300 1300
  my ($defaultcurrency) = split m/:/, $currency;
......
1304 1304
    return 1;
1305 1305
  }
1306 1306

  
1307
  my $query = qq|SELECT e.$fld FROM exchangerate e
1307
  $query = qq|SELECT e.$fld FROM exchangerate e
1308 1308
                 WHERE e.curr = ? AND e.transdate = ?|;
1309 1309
  my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate);
1310 1310

  
......
2500 2500

  
2501 2501
  my @ndx = ();
2502 2502

  
2503
  map { push @ndx, { num => $new->[$_ - 1]->{runningnumber}, ndx => $_ } }
2504
    (1 .. $count);
2503
  map { push @ndx, { num => $new->[$_ - 1]->{runningnumber}, ndx => $_ } } 1 .. $count;
2505 2504

  
2506 2505
  my $i = 0;
2507 2506

  
......
2587 2586
  my $formnames  = $self->{printed};
2588 2587
  my $emailforms = $self->{emailed};
2589 2588

  
2590
  my $query = qq|DELETE FROM status
2589
  $query = qq|DELETE FROM status
2591 2590
                 WHERE (formname = ?) AND (trans_id = ?)|;
2592 2591
  do_query($self, $dbh, $query, $self->{formname}, $self->{id});
2593 2592

  
SL/IC.pm
839 839

  
840 840
  $form->{parts} = +{ };
841 841

  
842
  my @simple_filters       = qw(partnumber ean description partsgroup microfiche drawing);
842
  my @simple_filters       = qw(partnumber ean description partsgroup microfiche drawing onhand);
843 843
  my @makemodel_filters    = qw(make model);
844 844
  my @invoice_oi_filters   = qw(serialnumber soldtotal);
845 845
  my @apoe_filters         = qw(transdate);
......
1395 1395
  my $group;
1396 1396
  my $limit;
1397 1397

  
1398
  my @where_values;
1399

  
1400 1398
  if ($item ne 'make') {
1401 1399
    foreach my $item (qw(partnumber drawing microfiche make model pg.partsgroup)) {
1402 1400
      my $column = $item;
SL/IR.pm
305 305

  
306 306
  $h_item_unit->finish();
307 307

  
308
  my $project_id = conv_i($form->{"globalproject_id"});
308
  $project_id = conv_i($form->{"globalproject_id"});
309 309

  
310 310
  $form->{datepaid} = $form->{invdate};
311 311

  
......
637 637
  $main::lxdebug->enter_sub();
638 638

  
639 639
  my ($self, $myconfig, $form) = @_;
640

  
640
  my $query;
641 641
  # connect to database
642 642
  my $dbh = $form->dbconnect_noauto($myconfig);
643 643

  
644 644
  &reverse_invoice($dbh, $form);
645 645

  
646 646
  # delete zero entries
647
  my $query = qq|DELETE FROM acc_trans WHERE amount = 0|;
647
  $query = qq|DELETE FROM acc_trans WHERE amount = 0|;
648 648
  do_query($form, $dbh, $query);
649 649

  
650 650
  # delete AP record
651
  my $query = qq|DELETE FROM ap WHERE id = ?|;
651
  $query = qq|DELETE FROM ap WHERE id = ?|;
652 652
  do_query($form, $dbh, $query, conv_i($form->{id}));
653 653

  
654 654
  my $rc = $dbh->commit;
SL/Template.pm
1366 1366

  
1367 1367
  foreach my $key (keys(%markup_replace)) {
1368 1368
    my $value = $markup_replace{$key};
1369
    $variable =~ s|\&lt;${key}\&gt;|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi;
1369
    $variable =~ s|\&lt;${key}\&gt;|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi; #"
1370 1370
    $variable =~ s|\&lt;/${key}\&gt;|</text:span>|gi;
1371 1371
  }
1372 1372

  
scripts/create_tags_file.pl
20 20
use warnings FATAL =>'all';
21 21
use diagnostics;
22 22

  
23
my $dir = IO::Dir->new("SL/");
23
use Getopt::Long;
24 24

  
25
my @files = grep {/\.pm$/} $dir->read();
25
my $parse_SL         = 1;
26
my $parse_binmozilla = 0;
27
GetOptions("sl!"         => \$parse_SL,
28
           "pm!"         => \$parse_SL,
29
           "binmozilla!" => \$parse_binmozilla,
30
           "pl!"         => \$parse_binmozilla,
31
           );
26 32

  
27
@files = grep { s{^}{SL\/}gxms } @files;
33
my @files = ();
34
push @files, grep { /\.pm$/ && s{^}{SL/}gxms         } IO::Dir->new("SL/")->read()          if $parse_SL;
35
push @files, grep { /\.pl$/ && s{^}{bin/mozilla/}gxms} IO::Dir->new("bin/mozilla/")->read() if $parse_binmozilla;
36

  
37
#map { s{^}{SL\/}gxms } @files;
28 38

  
29 39
#print Dumper(@files);
30 40

  

Auch abrufbar als: Unified diff