Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 010ec97d

Von Philip Reetz vor fast 19 Jahren hinzugefügt

  • ID 010ec97da07a51f2dc0d11fa326fbed1328082ce
  • Vorgänger 5d1cdfab
  • Nachfolger 5e3e1260

Bei Preisgruppen werden die Preisgruppen nun auch direkt beim Anlegen eines Artikel angezeigt

Unterschiede anzeigen:

SL/IC.pm
231 231
  $main::lxdebug->leave_sub();
232 232
}
233 233

  
234
sub get_pricegroups {
235
  $main::lxdebug->enter_sub();
236

  
237
  my ($self, $myconfig, $form) = @_;
238
  my $dbh = $form->dbconnect($myconfig);
239
  my $i = 1;
240
  my @pricegroups_not_used = ();
241

  
242
  # get pricegroups
243
  my $query = qq|SELECT p.id, p.pricegroup FROM pricegroup p|;
244

  
245
  my $pkq = $dbh->prepare($query);
246
  $pkq->execute || $form->dberror($query);
247
  while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
248
    push @{ $form->{PRICEGROUPS} }, $pkr;
249
  }
250
  $pkq->finish;
251

  
252
  #find not used pricegroups
253
  while ($tmp = pop @{ $form->{PRICEGROUPS} }) {
254
    push @pricegroups_not_used, $tmp;
255
  }
256

  
257
  # if not used pricegroups are avaible
258
  if (@pricegroups_not_used) {
259

  
260
    foreach $name (@pricegroups_not_used) {
261
      $form->{"klass_$i"} = "$name->{id}";
262
      $form->{"price_$i"} = $form->round_amount($form->{sellprice}, 5);
263
      $form->{"price_$i"} =
264
        $form->format_amount($myconfig, $form->{"price_$i"}, 5);
265
      $form->{"pricegroup_id_$i"} = "$name->{id}";
266
      $form->{"pricegroup_$i"}    = "$name->{pricegroup}\n";
267
      $i++;
268
    }
269
  }
270

  
271
  #correct rows
272
  $form->{price_rows} = $i - 1;
273

  
274
  $dbh->disconnect;
275

  
276
  $main::lxdebug->leave_sub();
277
}
278

  
279

  
234 280
sub save {
235 281
  $main::lxdebug->enter_sub();
236 282

  
......
409 455

  
410 456
  # insert price records only if different to sellprice
411 457
  for my $i (1 .. $form->{price_rows}) {
458
    if ($form->{"price_$i"} eq "0") {
459
       $form->{"price_$i"} = $form->{sellprice};
460
    }
412 461
    if ((   $form->{"price_$i"} 
413 462
        || $form->{"klass_$i"}
414 463
        || $form->{"pricegroup_id_$i"}) and $form->{"price_$i"} != $form->{sellprice}) {

Auch abrufbar als: Unified diff