Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b8125c17

Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt

  • ID b8125c17c8add08c9b84fb054f797547a853dd3a
  • Vorgänger be42a450
  • Nachfolger cd812c6b

Nicht-editierbare CVars bei "als neu speichern/verwenden" richtig setzen.

Unterschiede anzeigen:

SL/DO.pm
300 300
                                    dbh                => $dbh,
301 301
                                    row                => $i, 
302 302
                                    sub_module         => 'delivery_order_items',
303
                                    may_converted_from => ['orderitems']);
303
                                    may_converted_from => ['orderitems', 'delivery_order_items']);
304 304

  
305 305
    my $position = $i;
306 306

  
......
395 395
                                name_prefix  => 'ic_',
396 396
                                name_postfix => "_$i",
397 397
                                dbh          => $dbh);
398

  
398 399
    # link order items with doi, for future extension look at foreach IS.pm
399
    if ($form->{"converted_from_orderitems_id_$i"}) {
400
    if (!$form->{saveasnew} && $form->{"converted_from_orderitems_id_$i"}) {
400 401
      RecordLinks->create_links('dbh'        => $dbh,
401 402
                                'mode'       => 'ids',
402 403
                                'from_table' => 'orderitems',
......
404 405
                                'to_table'   => 'delivery_order_items',
405 406
                                'to_id'      =>  $form->{"delivery_order_items_id_$i"},
406 407
      );
407
      delete $form->{"converted_from_orderitems_id_$i"};
408 408
    }
409
    delete $form->{"converted_from_orderitems_id_$i"};
409 410
  }
410 411

  
411 412
  # 1. search for orphaned dois; processed_dois may be empty (no transfer) TODO: be supersafe and alter same statement for doi and oi
......
1009 1010
                                    dbh                => $dbh,
1010 1011
                                    row                => $i, 
1011 1012
                                    sub_module         => 'delivery_order_items',
1012
                                    may_converted_from => ['orderitems']);
1013
                                    may_converted_from => ['orderitems', 'delivery_order_items']);
1013 1014

  
1014 1015
    push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} },
1015 1016
      CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_)
SL/IR.pm
373 373
                                    dbh                => $dbh,
374 374
                                    row                => $i, 
375 375
                                    sub_module         => 'invoice',
376
                                    may_converted_from => ['delivery_order_items', 'orderitems']);
376
                                    may_converted_from => ['delivery_order_items', 'orderitems', 'invoice']);
377 377

  
378 378
    if (!$form->{"invoice_id_$i"}) {
379 379
      # there is no persistent id, therefore create one with all necessary constraints
......
416 416
                                name_prefix  => 'ic_',
417 417
                                name_postfix => "_$i",
418 418
                                dbh          => $dbh);
419

  
419 420
    # link previous items with invoice items See IS.pm (no credit note -> no invoice item)
420 421
    foreach (qw(delivery_order_items orderitems)) {
421
      if ($form->{"converted_from_${_}_id_$i"}) {
422
      if (!$form->{useasnew} && $form->{"converted_from_${_}_id_$i"}) {
422 423
        RecordLinks->create_links('dbh'        => $dbh,
423 424
                                  'mode'       => 'ids',
424 425
                                  'from_table' => $_,
......
426 427
                                  'to_table'   => 'invoice',
427 428
                                  'to_id'      => $form->{"invoice_id_$i"},
428 429
        );
429
        delete $form->{"converted_from_${_}_id_$i"};
430 430
      }
431
      delete $form->{"converted_from_${_}_id_$i"};
431 432
    }
432 433
  }
433 434

  
SL/IS.pm
812 812
    }
813 813
    # link previous items with invoice items
814 814
    foreach (qw(delivery_order_items orderitems invoice)) {
815
      if ($form->{"converted_from_${_}_id_$i"}) {
815
      if (!$form->{useasnew} && $form->{"converted_from_${_}_id_$i"}) {
816 816
        RecordLinks->create_links('dbh'        => $dbh,
817 817
                                  'mode'       => 'ids',
818 818
                                  'from_table' => $_,
......
820 820
                                  'to_table'   => 'invoice',
821 821
                                  'to_id'      => $form->{"invoice_id_$i"},
822 822
        );
823
        delete $form->{"converted_from_${_}_id_$i"};
824 823
      }
824
      delete $form->{"converted_from_${_}_id_$i"};
825 825
    }
826 826
  }
827 827

  
SL/OE.pm
568 568
                                  name_prefix  => 'ic_',
569 569
                                  name_postfix => "_$i",
570 570
                                  dbh          => $dbh);
571

  
571 572
      # link previous items with orderitems
572 573
      foreach (qw(orderitems invoice)) {
573
        if ($form->{"converted_from_${_}_id_$i"}) {
574
        if (!$form->{saveasnew} && $form->{"converted_from_${_}_id_$i"}) {
574 575
          RecordLinks->create_links('dbh'        => $dbh,
575 576
                                    'mode'       => 'ids',
576 577
                                    'from_table' => $_,
......
578 579
                                    'to_table'   => 'orderitems',
579 580
                                    'to_id'      => $orderitems_id,
580 581
          );
581
          delete $form->{"converted_from_${_}_id_$i"};
582 582
        }
583
        delete $form->{"converted_from_${_}_id_$i"};
583 584
      }
584 585
    }
585 586
  }
587

  
586 588
  # search for orphaned ids
587 589
  $query  = sprintf 'SELECT id FROM orderitems WHERE trans_id = ? AND NOT id IN (%s)', join ', ', ("?") x scalar @processed_orderitems;
588 590
  @values = (conv_i($form->{id}), map { conv_i($_) } @processed_orderitems);
bin/mozilla/do.pl
962 962
  $form->{delivered} = 0;
963 963
  map { delete $form->{$_} } qw(printed emailed queued);
964 964
  delete @{ $form }{ grep { m/^stock_(?:in|out)_\d+/ } keys %{ $form } };
965
  delete $form->{"delivery_order_items_id_$_"} for 1 .. $form->{"rowcount"};
965
  $form->{"converted_from_delivery_order_items_id_$_"} = delete $form->{"delivery_order_items_id_$_"} for 1 .. $form->{"rowcount"};
966 966
  # Let kivitendo assign a new order number if the user hasn't changed the
967 967
  # previous one. If it has been changed manually then use it as-is.
968 968
  $form->{donumber} =~ s/^\s*//g;
bin/mozilla/io.pl
442 442
      push @hidden_vars, qw(orderitems_id converted_from_orderitems_id converted_from_invoice_id);
443 443
    }
444 444
    if ($is_invoice) {
445
      push @hidden_vars, qw(invoice_id converted_from_orderitems_id converted_from_delivery_order_items_id);
445
      push @hidden_vars, qw(invoice_id converted_from_orderitems_id converted_from_delivery_order_items_id converted_from_invoice_id);
446 446
    }
447 447
    if ($::form->{type} =~ /credit_note/) {
448 448
      push @hidden_vars, qw(invoice_id converted_from_invoice_id);
......
451 451
      map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost);
452 452
      push @hidden_vars, grep { defined $form->{"${_}_${i}"} } qw(sellprice discount not_discountable price_factor_id lastcost);
453 453
      push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}";
454
      push @hidden_vars, qw(delivery_order_items_id converted_from_orderitems_id);
454
      push @hidden_vars, qw(delivery_order_items_id converted_from_orderitems_id converted_from_delivery_order_items_id);
455 455
    }
456 456

  
457 457
    my @HIDDENS = map { value => $_}, (
bin/mozilla/ir.pl
333 333
    max_dunning_level dunning_amount
334 334
    shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax
335 335
    shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus
336
    convert_from_do_ids convert_from_oe_ids show_details gldate
336
    convert_from_do_ids convert_from_oe_ids show_details gldate useasnew
337 337
  ), @custom_hiddens,
338 338
  map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
339 339

  
......
620 620
  $form->{paidaccounts} = 1;
621 621
  $form->{rowcount}--;
622 622
  $form->{invdate} = $form->current_date(\%myconfig);
623
  delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
623

  
624
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
625

  
626
  $form->{useasnew} = 1;
624 627
  &display_form;
625 628

  
626 629
  $main::lxdebug->leave_sub();
bin/mozilla/is.pl
380 380
    max_dunning_level dunning_amount
381 381
    shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax
382 382
    shiptoemail shiptodepartment_1 shiptodepartment_2  shiptocp_gender message email subject cc bcc taxaccounts cursor_fokus
383
    convert_from_do_ids convert_from_oe_ids convert_from_ar_ids
383
    convert_from_do_ids convert_from_oe_ids convert_from_ar_ids useasnew
384 384
    invoice_id
385 385
    show_details
386 386
  ), @custom_hiddens,
......
834 834
  $form->{employee_id}  = SL::DB::Manager::Employee->current->id;
835 835
  $form->{forex}        = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
836 836
  $form->{exchangerate} = $form->{forex} if $form->{forex};
837
  delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
838 837

  
838
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
839

  
840
  $form->{useasnew} = 1;
839 841
  &display_form;
840 842

  
841 843
  $main::lxdebug->leave_sub();
bin/mozilla/oe.pl
1621 1621

  
1622 1622
  $form->{saveasnew} = 1;
1623 1623
  map { delete $form->{$_} } qw(printed emailed queued delivered closed);
1624
  delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};
1624
  $form->{"converted_from_orderitems_id_$_"} = delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};
1625 1625

  
1626 1626
  # Let kivitendo assign a new order number if the user hasn't changed the
1627 1627
  # previous one. If it has been changed manually then use it as-is.

Auch abrufbar als: Unified diff