Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f404e525

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID f404e52525ddcbfca571073a62b08c4cac420164
  • Vorgänger 3ae0915d
  • Nachfolger 58e4b809

do strict

Unterschiede anzeigen:

bin/mozilla/do.pl
1
# #=====================================================================
1
#=====================================================================
2 2
# LX-Office ERP
3 3
# Copyright (C) 2004
4 4
# Based on SQL-Ledger Version 2.1.9
......
46 46
require "bin/mozilla/io.pl";
47 47
require "bin/mozilla/reportgenerator.pl";
48 48

  
49
use strict;
50

  
49 51
1;
50 52

  
51 53
# end of main
52 54

  
55
my $print_post;
56

  
53 57
sub check_do_access {
54
  $auth->assert($form->{type} . '_edit');
58
  $main::auth->assert($main::form->{type} . '_edit');
55 59
}
56 60

  
57 61
sub set_headings {
58
  $lxdebug->enter_sub();
62
  $main::lxdebug->enter_sub();
59 63

  
60 64
  check_do_access();
61 65

  
62 66
  my ($action) = @_;
63 67

  
68
  my $form     = $main::form;
69
  my $locale   = $main::locale;
70

  
64 71
  if ($form->{type} eq 'purchase_delivery_order') {
65 72
    $form->{vc}    = 'vendor';
66 73
    $form->{title} = $action eq "edit" ? $locale->text('Edit Purchase Delivery Order') : $locale->text('Add Purchase Delivery Order');
......
71 78

  
72 79
  $form->{heading} = $locale->text('Delivery Order');
73 80

  
74
  $lxdebug->leave_sub();
81
  $main::lxdebug->leave_sub();
75 82
}
76 83

  
77 84
sub add {
78
  $lxdebug->enter_sub();
85
  $main::lxdebug->enter_sub();
79 86

  
80 87
  check_do_access();
81 88

  
89
  my $form     = $main::form;
90

  
82 91
  set_headings("add");
83 92

  
84 93
  $form->{callback} = build_std_url('action=add', 'type', 'vc') unless ($form->{callback});
......
87 96
  prepare_order();
88 97
  display_form();
89 98

  
90
  $lxdebug->leave_sub();
99
  $main::lxdebug->leave_sub();
91 100
}
92 101

  
93 102
sub edit {
94
  $lxdebug->enter_sub();
103
  $main::lxdebug->enter_sub();
95 104

  
96 105
  check_do_access();
97 106

  
107
  my $form     = $main::form;
108

  
98 109
  # show history button
99 110
  $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
100 111
  #/show hhistory button
......
111 122
      # reset rowcount
112 123
      undef $form->{rowcount};
113 124
      add();
114
      $lxdebug->leave_sub();
125
      $main::lxdebug->leave_sub();
115 126
      return;
116 127
#     }
117 128
  } elsif (!$form->{id}) {
118 129
    add();
119
    $lxdebug->leave_sub();
130
    $main::lxdebug->leave_sub();
120 131
    return;
121 132
  }
122 133

  
134
  my ($language_id, $printer_id);
123 135
  if ($form->{print_and_save}) {
124 136
    $form->{action}   = "dispatcher";
125 137
    $form->{action_print} = "1";
......
140 152

  
141 153
  display_form();
142 154

  
143
  $lxdebug->leave_sub();
155
  $main::lxdebug->leave_sub();
144 156
}
145 157

  
146 158
sub order_links {
147
  $lxdebug->enter_sub();
159
  $main::lxdebug->enter_sub();
148 160

  
149 161
  check_do_access();
150 162

  
163
  my $form     = $main::form;
164
  my %myconfig = %main::myconfig;
165

  
151 166
  # get customer/vendor
152 167
  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
153 168

  
154 169
  # retrieve order/quotation
155
  $form->{webdav}   = $webdav;
170
  $form->{webdav}   = $main::webdav;
156 171
  $form->{jsscript} = 1;
157 172

  
158 173
  my $editing = $form->{id};
......
185 200

  
186 201
  $form->{employee} = "$form->{employee}--$form->{employee_id}";
187 202

  
188
  $lxdebug->leave_sub();
203
  $main::lxdebug->leave_sub();
189 204
}
190 205

  
191 206
sub prepare_order {
192
  $lxdebug->enter_sub();
207
  $main::lxdebug->enter_sub();
193 208

  
194 209
  check_do_access();
195 210

  
211
  my $form     = $main::form;
212
  my %myconfig = %main::myconfig;
213

  
196 214
  $form->{formname} = $form->{type} unless $form->{formname};
197 215

  
198 216
  my $i = 0;
199
  foreach $ref (@{ $form->{form_details} }) {
217
  foreach my $ref (@{ $form->{form_details} }) {
200 218
    $form->{rowcount} = ++$i;
201 219

  
202 220
    map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
......
207 225
    } else {
208 226
      $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"});
209 227
    }
210
    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
228
    my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
211 229
    $dec           = length $dec;
212
    $decimalplaces = ($dec > 2) ? $dec : 2;
230
    my $decimalplaces = ($dec > 2) ? $dec : 2;
213 231

  
214 232
    # copy reqdate from deliverydate for invoice -> order conversion
215 233
    $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"};
......
221 239
    $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
222 240
  }
223 241

  
224
  $lxdebug->leave_sub();
242
  $main::lxdebug->leave_sub();
225 243
}
226 244

  
227 245
sub form_header {
228
  $lxdebug->enter_sub();
246
  $main::lxdebug->enter_sub();
229 247

  
230 248
  check_do_access();
231 249

  
250
  my $form     = $main::form;
251
  my %myconfig = %main::myconfig;
252

  
232 253
  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
233 254
  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
234 255

  
......
236 257
  $form->{jsscript} = 1;
237 258

  
238 259
  #write Trigger
239
  $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
260
  my $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
240 261

  
241 262
  my @old_project_ids = ($form->{"globalproject_id"});
242 263
  map({ push(@old_project_ids, $form->{"project_id_$_"})
......
282 303

  
283 304
  print $form->parse_html_template('do/form_header');
284 305

  
285
  $lxdebug->leave_sub();
306
  $main::lxdebug->leave_sub();
286 307
}
287 308

  
288 309
sub form_footer {
289
  $lxdebug->enter_sub();
310
  $main::lxdebug->enter_sub();
290 311

  
291 312
  check_do_access();
292 313

  
314
  my $form     = $main::form;
315

  
293 316
  $form->{PRINT_OPTIONS} = print_options('inline' => 1);
294 317

  
295 318
  print $form->parse_html_template('do/form_footer');
296 319

  
297
  $lxdebug->leave_sub();
320
  $main::lxdebug->leave_sub();
298 321
}
299 322

  
300 323
sub update_delivery_order {
301
  $lxdebug->enter_sub();
324
  $main::lxdebug->enter_sub();
302 325

  
303 326
  check_do_access();
304 327

  
328
  my $form     = $main::form;
329
  my %myconfig = %main::myconfig;
330

  
305 331
  set_headings($form->{"id"} ? "edit" : "add");
306 332

  
307 333
  $form->{update} = 1;
308 334

  
335
  my $payment_id;
309 336
  $payment_id = $form->{payment_id} if $form->{payment_id};
310 337

  
311 338
  check_name($form->{vc});
......
313 340
  $form->{payment_id} = $payment_id if $form->{payment_id} eq "";
314 341

  
315 342
  # for pricegroups
316
  $i = $form->{rowcount};
343
  my $i = $form->{rowcount};
317 344

  
318 345
  if (   ($form->{"partnumber_$i"} eq "")
319 346
      && ($form->{"description_$i"} eq "")
......
369 396
    }
370 397
  }
371 398

  
372
  $lxdebug->leave_sub();
399
  $main::lxdebug->leave_sub();
373 400
}
374 401

  
375 402
sub search {
376
  $lxdebug->enter_sub();
403
  $main::lxdebug->enter_sub();
377 404

  
378 405
  check_do_access();
379 406

  
407
  my $form     = $main::form;
408
  my %myconfig = %main::myconfig;
409
  my $locale   = $main::locale;
410

  
380 411
  $form->{vc} = $form->{type} eq 'purchase_delivery_order' ? 'vendor' : 'customer';
381 412

  
382 413
  $form->get_lists("projects"     => { "key" => "ALL_PROJECTS",
......
393 424

  
394 425
  print $form->parse_html_template('do/search');
395 426

  
396
  $lxdebug->leave_sub();
427
  $main::lxdebug->leave_sub();
397 428
}
398 429

  
399 430
sub orders {
400
  $lxdebug->enter_sub();
431
  $main::lxdebug->enter_sub();
401 432

  
402 433
  check_do_access();
403 434

  
404
  ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} });
435
  my $form     = $main::form;
436
  my %myconfig = %main::myconfig;
437
  my $locale   = $main::locale;
438
  my $cgi      = $main::cgi;
439

  
440
  ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
405 441

  
406 442
  report_generator_set_default_sort('transdate', 1);
407 443

  
......
474 510
    push @options, $locale->text('Vendor') . " : $form->{vendor}";
475 511
  }
476 512
  if ($form->{department}) {
477
    ($department) = split /--/, $form->{department};
513
    my ($department) = split /--/, $form->{department};
478 514
    push @options, $locale->text('Department') . " : $department";
479 515
  }
480 516
  if ($form->{donumber}) {
......
518 554
  $form->{callback} = $href .= "&sort=$form->{sort}";
519 555

  
520 556
  # escape callback for href
521
  $callback = $form->escape($href);
557
  my $callback = $form->escape($href);
522 558

  
523 559
  my $edit_url       = build_std_url('action=edit', 'type', 'vc');
524 560
  my $edit_order_url = build_std_url('script=oe.pl', 'type=' . ($form->{type} eq 'sales_delivery_order' ? 'sales_order' : 'purchase_order'), 'action=edit');
525 561

  
526 562
  my $idx            = 1;
527 563

  
528
  foreach $dord (@{ $form->{DO} }) {
564
  foreach my $dord (@{ $form->{DO} }) {
529 565
    $dord->{open}      = $dord->{closed}    ? $locale->text('No')  : $locale->text('Yes');
530 566
    $dord->{delivered} = $dord->{delivered} ? $locale->text('Yes') : $locale->text('No');
531 567

  
......
548 584

  
549 585
  $report->generate_with_headers();
550 586

  
551
  $lxdebug->leave_sub();
587
  $main::lxdebug->leave_sub();
552 588
}
553 589

  
554 590
sub save {
555
  $lxdebug->enter_sub();
591
  $main::lxdebug->enter_sub();
556 592

  
557 593
  check_do_access();
558 594

  
595
  my $form     = $main::form;
596
  my %myconfig = %main::myconfig;
597
  my $locale   = $main::locale;
598

  
559 599
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
560 600

  
561 601
  $form->isblank("transdate", $locale->text('Delivery Order Date missing!'));
......
563 603
  $form->{donumber} =~ s/^\s*//g;
564 604
  $form->{donumber} =~ s/\s*$//g;
565 605

  
566
  $msg = ucfirst $form->{vc};
606
  my $msg = ucfirst $form->{vc};
567 607
  $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
568 608

  
569 609
  # $locale->text('Customer missing!');
......
595 635
    update();
596 636
    exit;
597 637
  }
598
  $lxdebug->leave_sub();
638
  $main::lxdebug->leave_sub();
599 639
}
600 640

  
601 641
sub delete {
602
  $lxdebug->enter_sub();
642
  $main::lxdebug->enter_sub();
603 643

  
604 644
  check_do_access();
605 645

  
646
  my $form     = $main::form;
647
  my $locale   = $main::locale;
648

  
606 649
  map { delete $form->{$_} } qw(action header login password);
607 650
  my @variables = map { { 'key' => $_, 'value' => $form->{$_} } } grep { '' eq ref $form->{$_} } keys %{ $form };
608 651

  
......
611 654

  
612 655
  print $form->parse_html_template('do/delete', { 'VARIABLES' => \@variables });
613 656

  
614
  $lxdebug->leave_sub();
657
  $main::lxdebug->leave_sub();
615 658
}
616 659

  
617 660
sub delete_delivery_order {
618
  $lxdebug->enter_sub();
661
  $main::lxdebug->enter_sub();
619 662

  
620 663
  check_do_access();
621 664

  
665
  my $form     = $main::form;
666
  my %myconfig = %main::myconfig;
667
  my $locale   = $main::locale;
668

  
622 669
  if (DO->delete()) {
623 670
    # saving the history
624 671
    if(!exists $form->{addition}) {
......
634 681

  
635 682
  $form->error($locale->text('Cannot delete delivery order!'));
636 683

  
637
  $lxdebug->leave_sub();
684
  $main::lxdebug->leave_sub();
638 685
}
639 686

  
640 687
sub invoice {
641
  $lxdebug->enter_sub();
688
  $main::lxdebug->enter_sub();
689

  
690
  my $form     = $main::form;
691
  my %myconfig = %main::myconfig;
692
  my $locale   = $main::locale;
642 693

  
643 694
  check_do_access();
644
  $auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
695
  $main::auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
645 696

  
646 697
  $form->{convert_from_do_ids} = $form->{id};
647 698
  $form->{deliverydate}        = $form->{transdate};
......
653 704

  
654 705
  delete @{$form}{qw(id closed delivered)};
655 706

  
707
  my ($script, $buysell);
656 708
  if ($form->{type} eq 'purchase_delivery_order') {
657 709
    $form->{title}  = $locale->text('Add Vendor Invoice');
658 710
    $form->{script} = 'ir.pl';
......
666 718
    $buysell        = 'buy';
667 719
  }
668 720

  
669
  for $i (1 .. $form->{rowcount}) {
721
  for my $i (1 .. $form->{rowcount}) {
670 722
    map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice basefactor);
671 723
  }
672 724

  
......
688 740
  prepare_invoice();
689 741

  
690 742
  # format amounts
691
  for $i (1 .. $form->{rowcount}) {
743
  for my $i (1 .. $form->{rowcount}) {
692 744
    $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"});
693 745

  
694
    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
746
    my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
695 747
    $dec           = length $dec;
696
    $decimalplaces = ($dec > 2) ? $dec : 2;
748
    my $decimalplaces = ($dec > 2) ? $dec : 2;
697 749

  
698 750
    # copy delivery date from reqdate for order -> invoice conversion
699 751
    $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
......
712 764

  
713 765
  display_form();
714 766

  
715
  $lxdebug->leave_sub();
767
  $main::lxdebug->leave_sub();
716 768
}
717 769

  
718 770
sub invoice_multi {
719
  $lxdebug->enter_sub();
771
  $main::lxdebug->enter_sub();
772

  
773
  my $form     = $main::form;
774
  my %myconfig = %main::myconfig;
775
  my $locale   = $main::locale;
720 776

  
721 777
  check_do_access();
722
  $auth->assert($form->{type} eq 'sales_delivery_order' ? 'invoice_edit' : 'vendor_invoice_edit');
778
  $main::auth->assert($form->{type} eq 'sales_delivery_order' ? 'invoice_edit' : 'vendor_invoice_edit');
723 779

  
724 780
  my @do_ids = map { $form->{"trans_id_$_"} } grep { $form->{"multi_id_$_"} } (1..$form->{rowcount});
725 781

  
......
750 806
  $form->{closed}              = 0;
751 807
  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
752 808

  
753
  my $buysell;
809
  my ($script, $buysell);
754 810
  if ($source_type eq 'purchase_delivery_order') {
755 811
    $form->{title}  = $locale->text('Add Vendor Invoice');
756 812
    $form->{script} = 'ir.pl';
......
786 842
  prepare_invoice();
787 843
  display_form();
788 844

  
789
  $lxdebug->leave_sub();
845
  $main::lxdebug->leave_sub();
790 846
}
791 847

  
792 848
sub save_as_new {
793
  $lxdebug->enter_sub();
849
  $main::lxdebug->enter_sub();
794 850

  
795 851
  check_do_access();
796 852

  
853
  my $form     = $main::form;
854

  
797 855
  $form->{saveasnew} = 1;
798 856
  $form->{closed}    = 0;
799 857
  $form->{delivered} = 0;
......
809 867

  
810 868
  save();
811 869

  
812
  $lxdebug->leave_sub();
870
  $main::lxdebug->leave_sub();
813 871
}
814 872

  
815 873
sub e_mail {
816
  $lxdebug->enter_sub();
874
  $main::lxdebug->enter_sub();
817 875

  
818 876
  check_do_access();
819 877

  
878
  my $form     = $main::form;
879

  
820 880
  $form->{print_and_save} = 1;
821 881

  
822 882
  $print_post = 1;
......
829 889

  
830 890
  edit_e_mail();
831 891

  
832
  $lxdebug->leave_sub();
892
  $main::lxdebug->leave_sub();
833 893
}
834 894

  
835 895
sub calculate_stock_in_out {
836
  $lxdebug->enter_sub();
896
  $main::lxdebug->enter_sub();
897

  
898
  my $form     = $main::form;
837 899

  
838 900
  my $i = shift;
839 901

  
840 902
  if (!$form->{"id_${i}"}) {
841
    $lxdebug->leave_sub();
903
    $main::lxdebug->leave_sub();
842 904
    return '';
843 905
  }
844 906

  
845
  AM->retrieve_all_units();
907
  my $all_units = AM->retrieve_all_units();
846 908

  
847 909
  my $in_out   = $form->{type} =~ /^sales/ ? 'out' : 'in';
848 910
  my $sinfo    = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
......
856 918
                                            'max_places'  => 2);
857 919
  $content    .= qq| <input type="button" onclick="open_stock_in_out_window('${in_out}', $i);" value="?">|;
858 920

  
859
  $lxdebug->leave_sub();
921
  $main::lxdebug->leave_sub();
860 922

  
861 923
  return $content;
862 924
}
863 925

  
864 926
sub get_basic_bin_wh_info {
865
  $lxdebug->enter_sub();
927
  $main::lxdebug->enter_sub();
866 928

  
867 929
  my $stock_info = shift;
868 930

  
931
  my $form     = $main::form;
932

  
869 933
  foreach my $sinfo (@{ $stock_info }) {
870 934
    next unless ($sinfo->{bin_id});
871 935

  
......
873 937
    map { $sinfo->{"${_}_description"} = $sinfo->{"${_}description"} = $bin_info->{"${_}_description"} } qw(bin warehouse);
874 938
  }
875 939

  
876
  $lxdebug->leave_sub();
940
  $main::lxdebug->leave_sub();
877 941
}
878 942

  
879 943
sub stock_in_out_form {
880
  $lxdebug->enter_sub();
944
  $main::lxdebug->enter_sub();
945

  
946
  my $form     = $main::form;
881 947

  
882 948
  if ($form->{in_out} eq 'out') {
883 949
    stock_out_form();
......
885 951
    stock_in_form();
886 952
  }
887 953

  
888
  $lxdebug->leave_sub();
954
  $main::lxdebug->leave_sub();
889 955
}
890 956

  
891 957
sub redo_stock_info {
892
  $lxdebug->enter_sub();
958
  $main::lxdebug->enter_sub();
893 959

  
894 960
  my %params    = @_;
895 961

  
962
  my $form     = $main::form;
963

  
896 964
  my @non_empty = grep { $_->{qty} } @{ $params{stock_info} };
897 965

  
898 966
  if ($params{add_empty_row}) {
......
904 972

  
905 973
  @{ $params{stock_info} } = @non_empty;
906 974

  
907
  $lxdebug->leave_sub();
975
  $main::lxdebug->leave_sub();
908 976
}
909 977

  
910 978
sub update_stock_in {
911
  $lxdebug->enter_sub();
979
  $main::lxdebug->enter_sub();
980

  
981
  my $form     = $main::form;
982
  my %myconfig = %main::myconfig;
912 983

  
913 984
  my $stock_info = [];
914 985

  
......
919 990

  
920 991
  display_stock_in_form($stock_info);
921 992

  
922
  $lxdebug->leave_sub();
993
  $main::lxdebug->leave_sub();
923 994
}
924 995

  
925 996
sub stock_in_form {
926
  $lxdebug->enter_sub();
997
  $main::lxdebug->enter_sub();
998

  
999
  my $form     = $main::form;
927 1000

  
928 1001
  my $stock_info = DO->unpack_stock_information('packed' => $form->{stock});
929 1002

  
930 1003
  display_stock_in_form($stock_info);
931 1004

  
932
  $lxdebug->leave_sub();
1005
  $main::lxdebug->leave_sub();
933 1006
}
934 1007

  
935 1008
sub display_stock_in_form {
936
  $lxdebug->enter_sub();
1009
  $main::lxdebug->enter_sub();
937 1010

  
938 1011
  my $stock_info = shift;
939 1012

  
1013
  my $form     = $main::form;
1014
  my %myconfig = %main::myconfig;
1015
  my $locale   = $main::locale;
1016

  
940 1017
  $form->{title} = $locale->text('Stock');
941 1018

  
942 1019
  my $part_info  = IC->get_basic_part_info('id' => $form->{parts_id});
......
956 1033
                                                         'STOCK_INFO' => $stock_info,
957 1034
                                                         'PART_INFO'  => $part_info, });
958 1035

  
959
  $lxdebug->leave_sub();
1036
  $main::lxdebug->leave_sub();
960 1037
}
961 1038

  
962 1039
sub set_stock_in {
963
  $lxdebug->enter_sub();
1040
  $main::lxdebug->enter_sub();
1041

  
1042
  my $form     = $main::form;
1043
  my %myconfig = %main::myconfig;
964 1044

  
965 1045
  my $stock_info = [];
966 1046

  
......
977 1057
  $form->header();
978 1058
  print $form->parse_html_template('do/set_stock_in_out');
979 1059

  
980
  $lxdebug->leave_sub();
1060
  $main::lxdebug->leave_sub();
981 1061
}
982 1062

  
983 1063
sub stock_out_form {
984
  $lxdebug->enter_sub();
1064
  $main::lxdebug->enter_sub();
1065

  
1066
  my $form     = $main::form;
1067
  my %myconfig = %main::myconfig;
1068
  my $locale   = $main::locale;
985 1069

  
986 1070
  $form->{title} = $locale->text('Release From Stock');
987 1071

  
......
1023 1107
                                                          'WHCONTENTS' => $form->{delivered} ? $stock_info : \@contents,
1024 1108
                                                          'PART_INFO'  => $part_info, });
1025 1109

  
1026
  $lxdebug->leave_sub();
1110
  $main::lxdebug->leave_sub();
1027 1111
}
1028 1112

  
1029 1113
sub set_stock_out {
1030
  $lxdebug->enter_sub();
1114
  $main::lxdebug->enter_sub();
1115

  
1116
  my $form     = $main::form;
1117
  my %myconfig = %main::myconfig;
1118
  my $locale   = $main::locale;
1031 1119

  
1032 1120
  my $stock_info = [];
1033 1121

  
......
1061 1149
    print $form->parse_html_template('do/set_stock_in_out');
1062 1150
  }
1063 1151

  
1064
  $lxdebug->leave_sub();
1152
  $main::lxdebug->leave_sub();
1065 1153
}
1066 1154

  
1067 1155
sub transfer_in {
1068
  $lxdebug->enter_sub();
1156
  $main::lxdebug->enter_sub();
1157

  
1158
  my $form     = $main::form;
1159
  my %myconfig = %main::myconfig;
1160
  my $locale   = $main::locale;
1069 1161

  
1070 1162
  if (DO->is_marked_as_delivered('id' => $form->{id})) {
1071 1163
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.'), 'back_button' => 1);
......
1108 1200
      push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
1109 1201

  
1110 1202
      update();
1111
      $lxdebug->leave_sub();
1203
      $main::lxdebug->leave_sub();
1112 1204

  
1113 1205
      exit 0;
1114 1206
    }
......
1121 1213

  
1122 1214
  save();
1123 1215

  
1124
  $lxdebug->leave_sub();
1216
  $main::lxdebug->leave_sub();
1125 1217
}
1126 1218

  
1127 1219
sub transfer_out {
1128
  $lxdebug->enter_sub();
1220
  $main::lxdebug->enter_sub();
1221

  
1222
  my $form     = $main::form;
1223
  my %myconfig = %main::myconfig;
1224
  my $locale   = $main::locale;
1129 1225

  
1130 1226
  if (DO->is_marked_as_delivered('id' => $form->{id})) {
1131 1227
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.'), 'back_button' => 1);
......
1185 1281
        $request->{ok} = $request->{sum_base_qty} <= $inv->{qty};
1186 1282
      }
1187 1283

  
1188
      foreach $request (values %request_map) {
1284
      foreach my $request (values %request_map) {
1189 1285
        next if ($request->{ok});
1190 1286

  
1191 1287
        my $pinfo = $part_info_map{$request->{parts_id}};
......
1204 1300
      push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
1205 1301

  
1206 1302
      update();
1207
      $lxdebug->leave_sub();
1303
      $main::lxdebug->leave_sub();
1208 1304

  
1209 1305
      exit 0;
1210 1306
    }
......
1217 1313

  
1218 1314
  save();
1219 1315

  
1220
  $lxdebug->leave_sub();
1316
  $main::lxdebug->leave_sub();
1221 1317
}
1222 1318

  
1223 1319
sub mark_closed {
1224
  $lxdebug->enter_sub();
1320
  $main::lxdebug->enter_sub();
1321

  
1322
  my $form     = $main::form;
1225 1323

  
1226 1324
  DO->close_orders('ids' => [ $form->{id} ]);
1227 1325

  
......
1229 1327

  
1230 1328
  update();
1231 1329

  
1232
  $lxdebug->leave_sub();
1330
  $main::lxdebug->leave_sub();
1233 1331
}
1234 1332

  
1235 1333

  
1236 1334
sub yes {
1237
  call_sub($form->{yes_nextsub});
1335
  call_sub($main::form->{yes_nextsub});
1238 1336
}
1239 1337

  
1240 1338
sub no {
1241
  call_sub($form->{no_nextsub});
1339
  call_sub($main::form->{no_nextsub});
1242 1340
}
1243 1341

  
1244 1342
sub update {
1245
  call_sub($form->{update_nextsub} || $form->{nextsub} || 'update_delivery_order');
1343
  call_sub($main::form->{update_nextsub} || $main::form->{nextsub} || 'update_delivery_order');
1246 1344
}
1247 1345

  
1248 1346
sub dispatcher {
1347
  my $form     = $main::form;
1348
  my $locale   = $main::locale;
1349

  
1249 1350
  foreach my $action (qw(update ship_to print e_mail save transfer_out transfer_in mark_closed save_as_new invoice delete)) {
1250 1351
    if ($form->{"action_${action}"}) {
1251 1352
      call_sub($action);

Auch abrufbar als: Unified diff