Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7712480e

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID 7712480e4a082f84a2229f5b1a90d79a6c01255b
  • Vorgänger 9fd46de3
  • Nachfolger f790c80a

Rechnungs- und Gutschriftsnummern werden nun direkt innerhalb der Backend-Routinen innerhalb der gleichen Transaktion vergeben, in der auch die eigentliche Rechnung etc gespeichert wird. Damit soll besser verhindert werden, dass sich Löcher in den Nummernkreisen ergeben.

Unterschiede anzeigen:

SL/AR.pm
170 170

  
171 171
    $query = qq|INSERT INTO ar (id, invnumber, employee_id) VALUES (?, 'dummy', ?)|;
172 172
    do_query($form, $dbh, $query, $form->{id}, $form->{employee_id});
173

  
174
    if (!$form->{invnumber}) {
175
      $form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh);
176
    }
173 177
  }
174 178

  
175 179
  # update department
SL/Form.pm
2448 2448
sub update_defaults {
2449 2449
  $main::lxdebug->enter_sub();
2450 2450

  
2451
  my ($self, $myconfig, $fld) = @_;
2451
  my ($self, $myconfig, $fld, $provided_dbh) = @_;
2452 2452

  
2453
  my $dbh   = $self->dbconnect_noauto($myconfig);
2453
  my $dbh;
2454
  if ($provided_dbh) {
2455
    $dbh = $provided_dbh;
2456
  } else {
2457
    $dbh = $self->dbconnect_noauto($myconfig);
2458
  }
2454 2459
  my $query = qq|SELECT $fld FROM defaults FOR UPDATE|;
2455 2460
  my $sth   = $dbh->prepare($query);
2456 2461

  
......
2464 2469
              SET $fld = '$var'|;
2465 2470
  $dbh->do($query) || $self->dberror($query);
2466 2471

  
2467
  $dbh->commit;
2468
  $dbh->disconnect;
2472
  if (!$provided_dbh) {
2473
    $dbh->commit;
2474
    $dbh->disconnect;
2475
  }
2469 2476

  
2470 2477
  $main::lxdebug->leave_sub();
2471 2478

  
SL/IS.pm
550 550

  
551 551
    ($form->{id}) = $sth->fetchrow_array;
552 552
    $sth->finish;
553

  
554
    if (!$form->{invnumber}) {
555
      $form->{invnumber} =
556
        $form->update_defaults($myconfig, $form->{type} eq "credit_note" ?
557
                               "cnnumber" : "invnumber", $dbh);
558
    }
553 559
  }
554 560

  
555 561
  map { $form->{$_} =~ s/\'/\'\'/g }
bin/mozilla/ar.pl
1050 1050

  
1051 1051
  $form->{AR}{receivables} = $form->{ARselected};
1052 1052

  
1053
  $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
1054
    unless $form->{invnumber};
1055

  
1056 1053
  $form->{id} = 0 if $form->{postasnew};
1057 1054
  if (AR->post_transaction(\%myconfig, \%$form)) {
1058 1055
    # saving the history
bin/mozilla/io.pl
1864 1864

  
1865 1865
  # assign number
1866 1866
  $form->{what_done} = $form->{formname};
1867
  if (!$form->{"${inv}number"} && !$form->{preview}) {
1867
  if (!$form->{"${inv}number"} && !$form->{preview} && !$form->{id}) {
1868 1868
    $form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
1869 1869
    if ($form->{media} ne 'email') {
1870 1870

  
bin/mozilla/is.pl
1441 1441
  $form->{id} = 0 if $form->{postasnew};
1442 1442

  
1443 1443
  # get new invnumber in sequence if no invnumber is given or if posasnew was requested
1444
  if (!$form->{invnumber} || $form->{postasnew}) {
1444
  if ($form->{postasnew}) {
1445 1445
    if ($form->{type} eq "credit_note") {
1446
      $form->{invnumber} = $form->update_defaults(\%myconfig, "cnnumber");
1446
      undef($form->{cnnumber});
1447 1447
    } else {
1448
      $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber");
1448
      undef($form->{invnumber});
1449 1449
    }
1450 1450
  }
1451

  
1451 1452
  relink_accounts();
1452 1453
  if ($print_post) {
1453 1454
    if (!(IS->post_invoice(\%myconfig, \%$form))) {

Auch abrufbar als: Unified diff