Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision aff32344

Von Moritz Bunkus vor fast 11 Jahren hinzugefügt

  • ID aff323443f53c620df903bce841d92ad71c372ba
  • Vorgänger bdab7dfa
  • Nachfolger 99724025

OE.pm: SL::TransNumber anstelle von Form->update_defaults für Nummernkreise nutzen

Unterschiede anzeigen:

SL/OE.pm
46 46
use SL::DB::Tax;
47 47
use SL::DBUtils;
48 48
use SL::IC;
49
use SL::TransNumber;
49 50

  
50 51
use strict;
51 52

  
......
314 315

  
315 316
  my $ml = ($form->{type} eq 'sales_order') ? 1 : -1;
316 317

  
318
  my $number_field         = $form->{type} =~ m{order} ? 'ordnumber' : 'quonumber';
319
  my $trans_number         = SL::TransNumber->new(type => $form->{type}, dbh => $dbh, number => $form->{$number_field}, id => $form->{id});
320
  $form->{$number_field} ||= $trans_number->create_unique;
321

  
317 322
  if ($form->{id}) {
318 323
    $query = qq|DELETE FROM custom_variables
319 324
                WHERE (config_id IN (SELECT id FROM custom_variable_configs WHERE module = 'IC'))
bin/mozilla/oe.pl
1122 1122

  
1123 1123
  }
1124 1124

  
1125
  # get new number in sequence if no number is given or if saveasnew was requested
1126
  if (!$form->{$ordnumber} || $form->{saveasnew}) {
1127
    $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld);
1128
  }
1125
  # get new number in sequence if saveasnew was requested
1126
  delete $form->{$ordnumber} if $form->{saveasnew};
1129 1127

  
1130 1128
  relink_accounts();
1131 1129

  
......
1232 1230

  
1233 1231
  }
1234 1232

  
1235
  # value of $ordnumber is ordnumber or quonumber
1236
  $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
1237
    unless $form->{$ordnumber};
1238

  
1239 1233
  relink_accounts();
1240 1234

  
1241 1235
  OE->save(\%myconfig, \%$form);

Auch abrufbar als: Unified diff