Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 03c310de

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID 03c310de8edb970a56ba51d0969979d0fe63f1b8
  • Vorgänger b8b43236
  • Nachfolger 913fe339

Hilfsfunktionen für Form::get_lists() weiter ausgelagert und mit einem Unterstrich vor dem Namen als interne Funktionen gekennzeichnet.

Unterschiede anzeigen:

SL/Form.pm
1396 1396
}
1397 1397

  
1398 1398
# get contacts for id, if no contact return {"","","","",""}
1399
sub get_contacts {
1399
sub _get_contacts {
1400 1400
  $main::lxdebug->enter_sub();
1401 1401

  
1402 1402
  my ($self, $dbh, $id, $key) = @_;
......
1425 1425
  $main::lxdebug->leave_sub();
1426 1426
}
1427 1427

  
1428
sub get_projects {
1428
sub _get_projects {
1429 1429
  $main::lxdebug->enter_sub();
1430 1430

  
1431 1431
  my ($self, $dbh, $key) = @_;
......
1482 1482
  $main::lxdebug->leave_sub();
1483 1483
}
1484 1484

  
1485
sub _get_shipto {
1486
  $main::lxdebug->enter_sub();
1487

  
1488
  my ($self, $dbh, $vc_id, $key) = @_;
1489

  
1490
  $key = "all_shipto" unless ($key);
1491
  $self->{$key} = [];
1492

  
1493
  # get shipping addresses
1494
  my $query =
1495
    qq|SELECT s.shipto_id,s.shiptoname,s.shiptodepartment_1 | .
1496
    qq|FROM shipto s | .
1497
    qq|WHERE s.trans_id = ?|;
1498
  my $sth = $dbh->prepare($query);
1499
  $sth->execute($vc_id) || $self->dberror($query . " ($vc_id)");
1500

  
1501
  while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
1502
    push(@{ $self->{$key} }, $ref);
1503
  }
1504
  $sth->finish;
1505

  
1506
  $main::lxdebug->leave_sub();
1507
}
1508

  
1509
sub _get_printers {
1510
  $main::lxdebug->enter_sub();
1511

  
1512
  my ($self, $dbh, $key) = @_;
1513

  
1514
  $key = "all_printers" unless ($key);
1515
  $self->{$key} = [];
1516

  
1517
  my $query = qq|SELECT id, printer_description, printer_command FROM printers|;
1518
  my $sth = $dbh->prepare($query);
1519
  $sth->execute() || $self->dberror($query);
1520

  
1521
  while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
1522
    push(@{ $self->{$key} }, $ref);
1523
  }
1524
  $sth->finish;
1525

  
1526
  $main::lxdebug->leave_sub();
1527
}
1528

  
1485 1529
sub get_lists {
1486 1530
  $main::lxdebug->enter_sub();
1487 1531

  
......
1495 1539
  my $vc_id = $self->{"${vc}_id"};
1496 1540

  
1497 1541
  if ($params{"contacts"}) {
1498
    $self->get_contacts($dbh, $vc_id, $params{"contacts"});
1542
    $self->_get_contacts($dbh, $vc_id, $params{"contacts"});
1499 1543
  }
1500 1544

  
1501 1545
  if ($params{"shipto"}) {
1502
    # get shipping addresses
1503
    $query =
1504
      qq|SELECT s.shipto_id,s.shiptoname,s.shiptodepartment_1 | .
1505
      qq|FROM shipto s | .
1506
      qq|WHERE s.trans_id = ?|;
1507
    $sth = $dbh->prepare($query);
1508
    $sth->execute($vc_id) || $self->dberror($query . " ($vc_id)");
1509

  
1510
    $self->{$params{"shipto"}} = [];
1511
    while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
1512
      push(@{ $self->{$params{"shipto"}} }, $ref);
1513
    }
1514
    $sth->finish;
1546
    $self->_get_shipto($dbh, $vc_id, $params{"shipto"});
1515 1547
  }
1516 1548

  
1517 1549
  if ($params{"projects"} || $params{"all_projects"}) {
1518
    $self->get_projects($dbh, $params{"all_projects"} ?
1519
                        $params{"all_projects"} : $params{"projects"},
1520
                        $params{"all_projects"} ? 1 : 0);
1550
    $self->_get_projects($dbh, $params{"all_projects"} ?
1551
                         $params{"all_projects"} : $params{"projects"},
1552
                         $params{"all_projects"} ? 1 : 0);
1521 1553
  }
1522 1554

  
1523 1555
  if ($params{"printers"}) {
1524
    $query = qq|SELECT id, printer_description, printer_command FROM printers|;
1525
    $sth = $dbh->prepare($query);
1526
    $sth->execute() || $self->dberror($query);
1527

  
1528
    $self->{$params{"printers"}} = [];
1529
    while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
1530
      push(@{ $self->{$params{"printers"}} }, $ref);
1531
    }
1532
    $sth->finish;
1556
    $self->_get_printers($dbh, $params{"printers"});
1533 1557
  }
1534 1558

  
1535 1559
  $dbh->disconnect();

Auch abrufbar als: Unified diff