Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 13dcc338

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

  • ID 13dcc338c2e0051e091d2b7f70be023205600cad
  • Vorgänger c510d88b
  • Nachfolger 3314d7c2

wh strict

Unterschiede anzeigen:

bin/mozilla/wh.pl
49 49
require "bin/mozilla/common.pl";
50 50
require "bin/mozilla/reportgenerator.pl";
51 51

  
52
use strict;
53

  
52 54
# parserhappy(R):
53 55

  
54 56
# contents of the "transfer_type" table:
......
69 71
# --------------------------------------------------------------------
70 72

  
71 73
sub transfer_warehouse_selection {
72
  $lxdebug->enter_sub();
74
  $main::lxdebug->enter_sub();
73 75

  
74
  $auth->assert('warehouse_management');
76
  $main::auth->assert('warehouse_management');
77

  
78
  my $form     = $main::form;
79
  my %myconfig = %main::myconfig;
80
  my $locale   = $main::locale;
75 81

  
76 82
  $form->get_lists('warehouses' => { 'key'    => 'WAREHOUSES',
77 83
                                     'bins'   => 'BINS', });
......
112 118
  $form->header();
113 119
  print $content;
114 120

  
115
  $lxdebug->leave_sub();
121
  $main::lxdebug->leave_sub();
116 122
}
117 123

  
118 124
sub transfer_parts_selection {
119
  $lxdebug->enter_sub();
125
  $main::lxdebug->enter_sub();
126

  
127
  $main::auth->assert('warehouse_management');
120 128

  
121
  $auth->assert('warehouse_management');
129
  my $form     = $main::form;
130
  my %myconfig = %main::myconfig;
131
  my $locale   = $main::locale;
122 132

  
123 133
  transfer_or_removal_prepare_contents('direction' => 'transfer');
124 134

  
......
126 136
  $form->header();
127 137
  print $form->parse_html_template("wh/transfer_parts_selection");
128 138

  
129
  $lxdebug->leave_sub();
139
  $main::lxdebug->leave_sub();
130 140
}
131 141

  
132 142
sub transfer_or_removal_prepare_contents {
133
  $lxdebug->enter_sub();
143
  $main::lxdebug->enter_sub();
134 144

  
135
  $auth->assert('warehouse_management');
145
  $main::auth->assert('warehouse_management');
136 146

  
137 147
  my %args = @_;
138 148

  
149
  my $form     = $main::form;
150
  my %myconfig = %main::myconfig;
151
  my $locale   = $main::locale;
152

  
139 153
  $form->get_lists('warehouses' => { 'key'    => 'WAREHOUSES',
140 154
                                     'bins'   => 'BINS', });
141 155

  
......
183 197
  $form->{CONTENTS}       = \@contents;
184 198
  $form->{TRANSFER_TYPES} = $transfer_types;
185 199

  
186
  $lxdebug->leave_sub();
200
  $main::lxdebug->leave_sub();
187 201
}
188 202

  
189 203

  
190 204
sub transfer_parts {
191
  $lxdebug->enter_sub();
205
  $main::lxdebug->enter_sub();
192 206

  
193
  $auth->assert('warehouse_management');
207
  $main::auth->assert('warehouse_management');
208

  
209
  my $form     = $main::form;
210
  my %myconfig = %main::myconfig;
211
  my $locale   = $main::locale;
194 212

  
195 213
  $form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', 'bins' => 'BINS' });
196 214

  
......
268 286

  
269 287
  transfer_warehouse_selection();
270 288

  
271
  $lxdebug->leave_sub();
289
  $main::lxdebug->leave_sub();
272 290
}
273 291

  
274 292
# --------------------------------------------------------------------
......
276 294
# --------------------------------------------------------------------
277 295

  
278 296
sub transfer_stock_update_part {
279
  $lxdebug->enter_sub();
297
  $main::lxdebug->enter_sub();
298

  
299
  my $form     = $main::form;
300
  my %myconfig = %main::myconfig;
301
  my $locale   = $main::locale;
280 302

  
281 303
  $form->{trans_type} = 'stock';
282 304
  $form->{qty}        = $form->parse_amount(\%myconfig, $form->{qty});
......
308 330
    transfer_warehouse_selection();
309 331
  }
310 332

  
311
  $lxdebug->leave_sub();
333
  $main::lxdebug->leave_sub();
312 334
}
313 335

  
314 336
# --------------------------------------------------------------------
......
320 342
# --------------------------------------------------------------------
321 343

  
322 344
sub transfer_assembly_update_part {
323
  $lxdebug->enter_sub();
345
  $main::lxdebug->enter_sub();
346

  
347
  my $form     = $main::form;
348
  my %myconfig = %main::myconfig;
349
  my $locale   = $main::locale;
324 350

  
325 351
  $form->{trans_type} = 'assembly';
326 352
  $form->{qty}        = $form->parse_amount(\%myconfig, $form->{qty});
......
348 374

  
349 375
# hier die oben benannte idee
350 376
#    my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh);
351
  $lxdebug->leave_sub();
377
  $main::lxdebug->leave_sub();
352 378
}
379

  
353 380
sub transfer_stock_part_selected {
354
  $lxdebug->enter_sub();
381
  $main::lxdebug->enter_sub();
355 382

  
356 383
  my $part = shift;
357 384

  
385
  my $form     = $main::form;
386

  
358 387
  @{$form}{qw(parts_id partnumber description ean)} = @{$part}{qw(id partnumber description ean)};
359 388

  
360 389
  transfer_stock_get_partunit();
361 390
  transfer_warehouse_selection();
362 391

  
363
  $lxdebug->leave_sub();
392
  $main::lxdebug->leave_sub();
364 393
}
365 394

  
366 395
sub transfer_stock_get_partunit {
367
  $lxdebug->enter_sub();
396
  $main::lxdebug->enter_sub();
397

  
398
  my $form     = $main::form;
368 399

  
369 400
  if ($form->{parts_id}) {
370 401
    my $part_info     = IC->get_basic_part_info('id' => $form->{parts_id});
371 402
    $form->{partunit} = $part_info->{unit};
372 403
  }
373 404

  
374
  $lxdebug->leave_sub();
405
  $main::lxdebug->leave_sub();
375 406
}
376 407

  
377 408
# vorüberlegung jb 22.2.2009
......
382 413
# Laut Absprache in KW11 09 übernimmt mb hier den rest im April ... jb 18.3.09
383 414

  
384 415
sub create_assembly {
385
  $lxdebug->enter_sub();
416
  $main::lxdebug->enter_sub();
417

  
418
  my $form     = $main::form;
419
  my %myconfig = %main::myconfig;
420
  my $locale   = $main::locale;
386 421

  
387 422
  $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
388 423
  if ($form->{qty} <= 0) {
......
427 462

  
428 463
  transfer_warehouse_selection();
429 464

  
430
  $lxdebug->leave_sub();
465
  $main::lxdebug->leave_sub();
431 466
}
432 467

  
433 468
sub transfer_stock {
434
  $lxdebug->enter_sub();
469
  $main::lxdebug->enter_sub();
470

  
471
  my $form     = $main::form;
472
  my %myconfig = %main::myconfig;
473
  my $locale   = $main::locale;
435 474

  
436 475
  $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
437 476

  
......
463 502

  
464 503
  transfer_warehouse_selection();
465 504

  
466
  $lxdebug->leave_sub();
505
  $main::lxdebug->leave_sub();
467 506
}
468 507

  
469 508
# --------------------------------------------------------------------
......
471 510
# --------------------------------------------------------------------
472 511

  
473 512
sub removal_parts_selection {
474
  $lxdebug->enter_sub();
513
  $main::lxdebug->enter_sub();
514

  
515
  $main::auth->assert('warehouse_management');
475 516

  
476
  $auth->assert('warehouse_management');
517
  my $form     = $main::form;
518
  my %myconfig = %main::myconfig;
519
  my $locale   = $main::locale;
477 520

  
478 521
  transfer_or_removal_prepare_contents('direction' => 'out');
479 522

  
......
481 524
  $form->header();
482 525
  print $form->parse_html_template("wh/removal_parts_selection");
483 526

  
484
  $lxdebug->leave_sub();
527
  $main::lxdebug->leave_sub();
485 528
}
486 529

  
487 530
sub remove_parts {
488
  $lxdebug->enter_sub();
531
  $main::lxdebug->enter_sub();
532

  
533
  $main::auth->assert('warehouse_management');
489 534

  
490
  $auth->assert('warehouse_management');
535
  my $form     = $main::form;
536
  my %myconfig = %main::myconfig;
537
  my $locale   = $main::locale;
491 538

  
492 539
  $form->get_lists('warehouses' => { 'key'    => 'WAREHOUSES',
493 540
                                     'bins'   => 'BINS', });
......
566 613

  
567 614
  transfer_warehouse_selection();
568 615

  
569
  $lxdebug->leave_sub();
616
  $main::lxdebug->leave_sub();
570 617
}
571 618

  
572 619
# --------------------------------------------------------------------
......
574 621
# --------------------------------------------------------------------
575 622

  
576 623
sub journal {
577
  $lxdebug->enter_sub();
624
  $main::lxdebug->enter_sub();
578 625

  
579
  $auth->assert('warehouse_management');
626
  $main::auth->assert('warehouse_management');
627

  
628
  my $form     = $main::form;
629
  my %myconfig = %main::myconfig;
580 630

  
581 631
  $form->get_lists('warehouses' => { 'key'  => 'WAREHOUSES',
582 632
                                     'bins' => 'BINS', });
......
588 638
  $form->header();
589 639
  print $form->parse_html_template("wh/journal_filter", { "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
590 640

  
591
  $lxdebug->leave_sub();
641
  $main::lxdebug->leave_sub();
592 642
}
593 643

  
594 644
sub generate_journal {
595
  $lxdebug->enter_sub();
645
  $main::lxdebug->enter_sub();
596 646

  
597
  $auth->assert('warehouse_management');
647
  $main::auth->assert('warehouse_management');
648

  
649
  my $form     = $main::form;
650
  my %myconfig = %main::myconfig;
651
  my $locale   = $main::locale;
598 652

  
599 653
  $form->{title}   = $locale->text("WHJournal");
600 654
  $form->{sort}  ||= 'date';
......
607 661

  
608 662
  $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
609 663
  if ($filter{qty_op}) {
610
    $form->isblank(qty,      $locale->text('Quantity missing.'));
611
    $form->isblank(qty_unit, $locale->text('Unit missing.'));
664
    $form->isblank("qty",      $locale->text('Quantity missing.'));
665
    $form->isblank("qty_unit", $locale->text('Unit missing.'));
612 666

  
613 667
    $filter{qty}      = $form->{qty};
614 668
    $filter{qty_unit} = $form->{qty_unit};
......
670 724
                    'purchase_invoice'        => { script => 'ir', title => $locale->text('Purchase Invoice') },
671 725
                  );
672 726

  
673
  foreach $entry (@contents) {
727
  foreach my $entry (@contents) {
674 728
    $entry->{qty}        = $form->format_amount_units('amount'     => $entry->{qty},
675 729
                                                      'part_unit'  => $entry->{partunit},
676 730
                                                      'conv_units' => 'convertible');
......
707 761

  
708 762
  $report->generate_with_headers();
709 763

  
710
  $lxdebug->leave_sub();
764
  $main::lxdebug->leave_sub();
711 765
}
712 766

  
713 767
# --------------------------------------------------------------------
......
715 769
# --------------------------------------------------------------------
716 770

  
717 771
sub report {
718
  $lxdebug->enter_sub();
772
  $main::lxdebug->enter_sub();
773

  
774
  $main::auth->assert('warehouse_contents | warehouse_management');
719 775

  
720
  $auth->assert('warehouse_contents | warehouse_management');
776
  my $form     = $main::form;
777
  my %myconfig = %main::myconfig;
778
  my $locale   = $main::locale;
721 779

  
722 780
  $form->get_lists('warehouses' => { 'key'    => 'WAREHOUSES',
723 781
                                     'bins'   => 'BINS', });
......
734 792
                                     "WAREHOUSES" => $form->{WAREHOUSES},
735 793
                                     "UNITS"      => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
736 794

  
737
  $lxdebug->leave_sub();
795
  $main::lxdebug->leave_sub();
738 796
}
739 797

  
740 798
sub generate_report {
741
  $lxdebug->enter_sub();
799
  $main::lxdebug->enter_sub();
800

  
801
  $main::auth->assert('warehouse_contents | warehouse_management');
742 802

  
743
  $auth->assert('warehouse_contents | warehouse_management');
803
  my $form     = $main::form;
804
  my %myconfig = %main::myconfig;
805
  my $locale   = $main::locale;
744 806

  
745 807
  $form->{title}   = $locale->text("Report about wareouse contents");
746 808
  $form->{sort}  ||= 'partnumber';
......
754 816

  
755 817
  $filter{qty_op} = WH->convert_qty_op($form->{qty_op});
756 818
  if ($filter{qty_op}) {
757
    $form->isblank(qty,      $locale->text('Quantity missing.'));
758
    $form->isblank(qty_unit, $locale->text('Unit missing.'));
819
    $form->isblank("qty",      $locale->text('Quantity missing.'));
820
    $form->isblank("qty_unit", $locale->text('Unit missing.'));
759 821

  
760 822
    $filter{qty}      = $form->{qty};
761 823
    $filter{qty_unit} = $form->{qty_unit};
......
809 871

  
810 872
  my $total_stock_value = 0;
811 873

  
812
  foreach $entry (@contents) {
874
  foreach my $entry (@contents) {
813 875
    map { $subtotals{$_} += $entry->{$_} } @subtotals_columns;
814 876
    $total_stock_value   += $entry->{stock_value} * 1;
815 877

  
......
818 880
                                                       'conv_units' => 'convertible');
819 881
    $entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2);
820 882

  
821
    $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
883
    my $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
822 884

  
823 885
    if (($form->{subtotal} eq 'Y')
824 886
        && (($idx == (scalar @contents - 1))
......
856 918

  
857 919
  $report->generate_with_headers();
858 920

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

  
862 924
# --------------------------------------------------------------------
......
864 926
# --------------------------------------------------------------------
865 927

  
866 928
sub show_no_warehouses_error {
867
  $lxdebug->enter_sub();
929
  $main::lxdebug->enter_sub();
930

  
931
  my $form     = $main::form;
932
  my %myconfig = %main::myconfig;
933
  my $locale   = $main::locale;
868 934

  
869 935
  my $msg = $locale->text('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
870 936

  
871
  if ($auth->check_right($form->{login}, 'config')) {
937
  if ($main::auth->check_right($form->{login}, 'config')) {
872 938
    $msg .= $locale->text('You can create warehouses and bins via the menu "System -> Warehouses".');
873 939
  } else {
874 940
    $msg .= $locale->text('Please ask your administrator to create warehouses and bins.');
......
876 942

  
877 943
  $form->show_generic_error($msg);
878 944

  
879
  $lxdebug->leave_sub();
945
  $main::lxdebug->leave_sub();
880 946
}
881 947

  
882 948
sub get_warehouse_idx {
883 949
  my ($warehouse_id) = @_;
884 950

  
951
  my $form     = $main::form;
952

  
885 953
  for (my $i = 0; $i < scalar @{$form->{WAREHOUSES}}; $i++) {
886 954
    return $i if ($form->{WAREHOUSES}->[$i]->{id} == $warehouse_id);
887 955
  }
......
892 960
sub get_bin_idx {
893 961
  my ($warehouse_index, $bin_id) = @_;
894 962

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

  
895 965
  my $warehouse = $form->{WAREHOUSES}->[$warehouse_index];
896 966

  
897 967
  return -1 if (!$warehouse);
......
915 985
  $main::lxdebug->enter_sub();
916 986
  my %params = @_;
917 987

  
988
  my $form     = $main::form;
989

  
918 990
  # change callback
919 991
  $form->{old_callback} = $form->escape($form->{callback}, 1);
920 992
  $form->{callback}     = $form->escape("$form->{script}?action=$params{action}", 1);
921 993

  
922 994
  # save all form variables except action in a previousform variable
923 995
  my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
996
  my @HIDDENS = ();
924 997

  
925 998
#  push @HIDDENS,      { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
926 999
  push @HIDDENS, map +{ 'name' => $_,             'value' => $form->{$_} }, qw(partnumber description unit vc sellprice ean);
......
934 1007
}
935 1008

  
936 1009
sub update {
1010
  my $form     = $main::form;
937 1011
  call_sub($form->{update_nextsub} || $form->{nextsub});
938 1012
}
939 1013

  
940 1014
sub continue {
1015
  my $form     = $main::form;
941 1016
  call_sub($form->{continue_nextsub} || $form->{nextsub});
942 1017
}
943 1018

  
944 1019
sub stock {
1020
  my $form     = $main::form;
945 1021
  call_sub($form->{stock_nextsub} || $form->{nextsub});
946 1022
}
947 1023

  

Auch abrufbar als: Unified diff