Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2e3bdf1a

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 2e3bdf1ae149f89f0cd9dbdda70372de38247f77
  • Vorgänger d3b2be26
  • Nachfolger 65a06b57

Verwaltung von Kundenquellen entfernt

Diese Funktionalität wird in der ERP nicht genutzt.

Unterschiede anzeigen:

SL/AM.pm
410 410
  return 1;
411 411
}
412 412

  
413
sub lead {
414
  $main::lxdebug->enter_sub();
415

  
416
  my ($self, $myconfig, $form) = @_;
417

  
418
  my $dbh = SL::DB->client->dbh;
419

  
420
  my $query = qq|SELECT id, lead
421
                 FROM leads
422
                 ORDER BY 2|;
423

  
424
  my $sth = $dbh->prepare($query);
425
  $sth->execute || $form->dberror($query);
426

  
427
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
428
    push @{ $form->{ALL} }, $ref;
429
  }
430

  
431
  $sth->finish;
432

  
433
  $main::lxdebug->leave_sub();
434
}
435

  
436
sub get_lead {
437
  $main::lxdebug->enter_sub();
438

  
439
  my ($self, $myconfig, $form) = @_;
440

  
441
  my $dbh = SL::DB->client->dbh;
442

  
443
  my $query =
444
    qq|SELECT l.id, l.lead | .
445
    qq|FROM leads l | .
446
    qq|WHERE l.id = ?|;
447
  my $sth = $dbh->prepare($query);
448
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
449

  
450
  my $ref = $sth->fetchrow_hashref("NAME_lc");
451

  
452
  map { $form->{$_} = $ref->{$_} } keys %$ref;
453

  
454
  $sth->finish;
455

  
456
  $main::lxdebug->leave_sub();
457
}
458

  
459
sub save_lead {
460
  $main::lxdebug->enter_sub();
461

  
462
  my ($self, $myconfig, $form) = @_;
463
  my ($query);
464

  
465
  my $dbh = SL::DB->client->dbh;
466

  
467
  my @values = ($form->{description});
468
  # id is the old record
469
  if ($form->{id}) {
470
    $query = qq|UPDATE leads SET
471
                lead = ?
472
                WHERE id = ?|;
473
    push(@values, $form->{id});
474
  } else {
475
    $query = qq|INSERT INTO leads
476
                (lead)
477
                VALUES (?)|;
478
  }
479
  do_query($form, $dbh, $query, @values);
480

  
481
  $main::lxdebug->leave_sub();
482
}
483

  
484
sub delete_lead {
485
  $main::lxdebug->enter_sub();
486

  
487
  my ($self, $myconfig, $form) = @_;
488
  my ($query);
489

  
490
  SL::DB->client->with_transaction(sub {
491
    $query = qq|DELETE FROM leads WHERE id = ?|;
492
    do_query($form, SL::DB->client->dbh, $query, $form->{id});
493
    1;
494
  }) or do { die SL::DB->client->error };
495

  
496
  $main::lxdebug->leave_sub();
497
}
498

  
499 413
sub language {
500 414
  $main::lxdebug->enter_sub();
501 415

  

Auch abrufbar als: Unified diff