Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fcde4c20

Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt

  • ID fcde4c2096c1494984940ddc4650e49933471dd9
  • Vorgänger 8b2c6778
  • Nachfolger 73b9848f

Ware/Erzeugnis/Dienstleistung per parts.part_type unterscheiden 2

kivitendo Code angepasst.

Unterschiede anzeigen:

SL/IC.pm
78 78
  $form->{lastmtime} = $form->{mtime};
79 79
  $form->{onhand} *= 1;
80 80

  
81
  die "part needs a part_type" unless $form->{part_type}; # TODO from part_type enum conversion
81 82
  # part or service item
82
  $form->{item} = ($form->{inventory_accno}) ? 'part' : 'service';
83
  if ($form->{assembly}) {
84
    $form->{item} = 'assembly';
83
  $form->{item} = $form->{part_type};
84
  if ($form->{item} eq 'assembly') {
85 85

  
86 86
    # retrieve assembly items
87 87
    $query =
......
256 256

  
257 257
  my $makemodel = ($form->{make_1} || $form->{model_1} || ($form->{makemodel_rows} > 1)) ? 1 : 0;
258 258

  
259
  $form->{assembly} = ($form->{item} eq 'assembly') ? 1 : 0;
260 259

  
261 260
  my ($query, $sth);
262 261

  
......
300 299
    $form->{partnumber} ||= $trans_number->create_unique;
301 300

  
302 301
    ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('id')|);
303
    do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit) VALUES (?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit});
302
    do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit, part_type) VALUES (?, ?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit}, $form->{item});
304 303

  
305 304
    $form->{orphaned} = 1;
306 305
  }
......
336 335
         partnumber = ?,
337 336
         description = ?,
338 337
         makemodel = ?,
339
         assembly = ?,
340 338
         listprice = ?,
341 339
         sellprice = ?,
342 340
         lastcost = ?,
......
362 360
         has_sernumber = ?,
363 361
         not_discountable = ?,
364 362
         microfiche = ?,
363
         part_type = ?,
365 364
         partsgroup_id = ?,
366 365
         price_factor_id = ?
367 366
         $priceupdate
......
369 368
  @values = ($form->{partnumber},
370 369
             $form->{description},
371 370
             $makemodel ? 't' : 'f',
372
             $form->{assembly} ? 't' : 'f',
373 371
             $form->{listprice},
374 372
             $form->{sellprice},
375 373
             $form->{lastcost},
......
393 391
             $form->{has_sernumber} ? 't' : 'f',
394 392
             $form->{not_discountable} ? 't' : 'f',
395 393
             $form->{microfiche},
394
             $form->{item},
396 395
             conv_i($partsgroup_id),
397 396
             conv_i($form->{price_factor_id}),
398 397
             conv_i($form->{id})
......
576 575
          FROM parts p2, assembly a
577 576
          WHERE (p2.id = a.parts_id) AND (a.id = p.id)) AS inventory
578 577
       FROM parts p
579
       WHERE NOT p.obsolete AND p.assembly $where|;
578
       WHERE NOT p.obsolete AND p.part_type = 'assembly' $where|;
580 579

  
581 580
  $form->{assembly_items} = selectall_hashref_query($form, $dbh, $query, @values);
582 581

  
......
893 892
  }
894 893

  
895 894
  for ($form->{searchitems}) {
896
    push @where_tokens, 'p.inventory_accno_id > 0'     if /part/;
897
    push @where_tokens, 'p.inventory_accno_id IS NULL' if /service/;
898
    push @where_tokens, 'NOT p.assembly'               if /service/;
899
    push @where_tokens, '    p.assembly'               if /assembly/;
895
    push @where_tokens, "p.part_type = 'part'"     if /part/;
896
    push @where_tokens, "p.part_type = 'service'"  if /service/;
897
    push @where_tokens, "p.part_type = 'assembly'" if /assembly/;
900 898
  }
901 899

  
902 900
  for ($form->{itemstatus}) {

Auch abrufbar als: Unified diff