Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6ea1dd9b

Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt

  • ID 6ea1dd9bb2e7965da7d0ef66a0b464267ce41a9b
  • Vorgänger 11fcc435
  • Nachfolger a809ab0a

item_selected: Multiselect bzw. Mengeneingabe beim Artikelselektor

Dieses Feature kann in den Benutzereinstellungen aktiviert werden.

Unterschiede anzeigen:

SL/DB/AuthUser.pm
11 11
use constant CONFIG_VARS => qw(copies countrycode dateformat timeformat default_media default_printer_id
12 12
                               email favorites fax hide_cvar_search_options mandatory_departments menustyle name
13 13
                               numberformat show_form_details signature stylesheet taxincluded_checked tel
14
                               template_format vclimit focus_position form_cvars_nr_cols);
14
                               template_format vclimit focus_position form_cvars_nr_cols item_multiselect);
15 15

  
16 16
__PACKAGE__->meta->add_relationship(
17 17
  groups => {
bin/mozilla/do.pl
419 419

  
420 420
      if ($rows > 1) {
421 421

  
422
        select_item(mode => $mode);
422
        select_item(mode => $mode, pre_entered_qty => $form->{"qty_$i"});
423 423
        ::end_of_request();
424 424

  
425 425
      } else {
bin/mozilla/ic.pl
1845 1845

  
1846 1846
        if ($rows > 1) {
1847 1847
          $form->{makemodel_rows}--;
1848
          select_item(mode => 'IC');
1848
          select_item(mode => 'IC', pre_entered_qty => $form->parse_amount(\%myconfig, $form->{"qty_$i"}));
1849 1849
          ::end_of_request();
1850 1850
        } else {
1851 1851
          map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
bin/mozilla/io.pl
497 497
  $main::lxdebug->enter_sub();
498 498

  
499 499
  my %params = @_;
500
  my $mode   = $params{mode} || croak "Missing parameter 'mode'";
501

  
500
  my $mode            = $params{mode}            || croak "Missing parameter 'mode'";
501
  my $pre_entered_qty = $params{pre_entered_qty} || 1;
502 502
  _check_io_auth();
503 503

  
504 504
  my $previous_form = $::auth->save_form_in_session(form => $::form);
......
513 513
  # delete action variable
514 514
  delete @{$::form}{qw(action item_list)};
515 515

  
516
  print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM => $previous_form,
517
                                                         MODE          => $mode,
518
                                                         ITEM_LIST     => \@item_list,
519
                                                         IS_ASSEMBLY   => $mode eq 'IC',
520
                                                         IS_PURCHASE   => $mode eq 'IS' });
516
  print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM   => $previous_form,
517
                                                         MODE            => $mode,
518
                                                         ITEM_LIST       => \@item_list,
519
                                                         IS_ASSEMBLY     => $mode eq 'IC',
520
                                                         IS_PURCHASE     => $mode eq 'IS',
521
                                                         PRE_ENTERED_QTY => $pre_entered_qty, });
521 522

  
522 523
  $main::lxdebug->leave_sub();
523 524
}
......
536 537

  
537 538
  $::auth->restore_form_from_session($form->{select_item_previous_form} || croak('Missing previous form ID'), form => $form);
538 539

  
539
  my $mode = delete($form->{select_item_mode}) || croak 'Missing item selection mode';
540
  my $id   = delete($form->{select_item_id})   || croak 'Missing item selection ID';
541
  my $i    = $form->{ $mode eq 'IC' ? 'assembly_rows' : 'rowcount' };
540
  my $mode     = delete($form->{select_item_mode}) || croak 'Missing item selection mode';
541
  my $row_key  = $mode eq 'IC' ? 'assembly_rows' : 'rowcount';
542
  my $curr_row = $form->{ $row_key };
543

  
544
  my $row = $curr_row;
545

  
546
  if ($myconfig{item_multiselect}) {
547
    foreach (grep(/^select_qty_/, keys(%{ $form }))) {
548
      next unless $form->{$_};
549
      $_ =~ /^select_qty_(\d+)/;
550
      $form->{"id_${row}"}  = $1;
551
      $form->{"qty_${row}"} = $form->{$_};
552
      $row++;
553
    }
554
  } else {
555
    $form->{"id_${row}"} = delete($form->{select_item_id}) || croak 'Missing item selection ID';
556
    $row++;
557
  }
558

  
559
  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
560
    qw(sellprice listprice weight);
542 561

  
543 562
  if ( $mode eq 'IC' ) {
544 563
    # assembly mode:
545
    # the qty variables of the existing assembly items are all still formatted, so we parse them here (1 .. $i-1)
546
    # including the qty of the just added part ($i)
547
    $form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for (1 .. $i);
564
    # the qty variables of the existing assembly items are all still formatted, so we parse them here
565
    # including the qty of the just added part
566
    $form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for (1 .. $row - 1);
567
  } else {
568
    if ($myconfig{item_multiselect}) {
569
      # other modes and multiselection:
570
      # parse all newly entered qtys
571
      $form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for ($curr_row .. $row - 1);
572
    }
548 573
  }
549 574

  
550
  $form->{"id_${i}"} = $id;
575
  for my $i ($curr_row .. $row - 1) {
576
    $form->{ $row_key } = $i;
577

  
578
    my $id = $form->{"id_${i}"};
579

  
580
    delete $form->{item_list};
551 581

  
552 582
  if ($mode eq 'IS') {
553 583
    IS->retrieve_item(\%myconfig, \%$form);
......
617 647
    }
618 648
  }
619 649

  
620
  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
621
    qw(sellprice listprice weight);
622

  
623 650
  # at this stage qty of newly added part needs to be have been parsed
624 651
  $form->{weight}    += ($form->{"weight_$i"} * $form->{"qty_$i"});
625 652

  
......
640 667

  
641 668
  $form->{"runningnumber_$i"} = $i;
642 669

  
643
  delete $form->{nextsub};
644

  
645 670
  # format amounts
646 671
  map {
647 672
    $form->{"${_}_$i"} =
648 673
      $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
649 674
  } qw(sellprice listprice lastcost qty) if $form->{item} ne 'assembly';
650 675

  
676
  delete $form->{nextsub};
677

  
678
  }
679

  
651 680
  &display_form;
652 681

  
653 682
  $main::lxdebug->leave_sub();
bin/mozilla/ir.pl
492 492

  
493 493
      if ($rows > 1) {
494 494

  
495
        select_item(mode => 'IR');
495
        select_item(mode => 'IR', pre_entered_qty => $form->{"qty_$i"});
496 496
        ::end_of_request();
497 497

  
498 498
      } else {
bin/mozilla/is.pl
568 568

  
569 569
      if ($rows > 1) {
570 570

  
571
        select_item(mode => 'IS');
571
        select_item(mode => 'IS', pre_entered_qty => $form->{"qty_$i"});
572 572
        ::end_of_request();
573 573

  
574 574
      } else {
bin/mozilla/oe.pl
648 648

  
649 649
      if ($rows > 1) {
650 650

  
651
        select_item(mode => $mode);
651
        select_item(mode => $mode, pre_entered_qty => $form->{"qty_$i"});
652 652
        ::end_of_request();
653 653

  
654 654
      } else {
doc/changelog
10 10
- Briefe werden auch im WebDAV archiviert. Ferner bessere Fehlerbehandlung und
11 11
  E-Mail-Funktion aktiviert.
12 12

  
13
- Mehrfachauswahl und Mengeneingabe für Artikel:
14
  Wenn in den Belegmasken die Artikeleingabe nicht eindeutig ist, erscheint
15
  eine Maske zur Artikelauswahl. Hierzu kann jetzt in den Benutzereinstellungen
16
  eingestellt werden, dass in dieser Maske mehrere Artikel mit Mengen ausgewählt
17
  werden können.
13 18

  
14 19
2015-04-10 - Release 3.2.1
15 20

  
locale/de/all
1402 1402
  'It will simply set the taxkey to 0 (meaning "no taxes") which is the correct value for such inventory transactions.' => 'Es wird einfach die Steuerschlüssel auf  0 setzen, was "keine Steuer" bedeutet und für solche Warenbestandsbuchungen der richtige Wert ist.',
1403 1403
  'Item deleted!'               => 'Artikel gelöscht!',
1404 1404
  'Item mode'                   => 'Artikelmodus',
1405
  'Item multi selection with qty' => 'Artikel-Mehrfachauswahl mit Menge',
1405 1406
  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
1406 1407
  'Item values'                 => 'Artikelwerte',
1407 1408
  'Item variables'              => 'Artikelvariablen',
locale/en/all
1192 1192
  'It will simply set the taxkey to 0 (meaning "no taxes") which is the correct value for such inventory transactions.' => '',
1193 1193
  'Item deleted!'               => '',
1194 1194
  'Item mode'                   => '',
1195
  'Item multi selection with qty' => '',
1195 1196
  'Item not on file!'           => '',
1196 1197
  'Item values'                 => '',
1197 1198
  'Item variables'              => '',
templates/webpages/am/config.html
78 78
        </td>
79 79
      </tr>
80 80

  
81
      <tr>
82
        <th align="right">[% 'Item multi selection with qty' | $T8 %]</th>
83
        <td>
84
          [% L.yes_no_tag('item_multiselect', myconfig_item_multiselect) %]
85
        </td>
86
      </tr>
87

  
81 88
    </table>
82 89
   </div>
83 90

  
templates/webpages/io/select_item.html
5 5

  
6 6
  <table width="100%">
7 7
   <tr class="listheading">
8
    <th>&nbsp;</th>
8
    [%- IF myconfig_item_multiselect %]
9
      <th>[% LxERP.t8('Qty') %]</th>
10
    [%- ELSE %]
11
      <th>&nbsp;</th>
12
    [%- END %]
9 13
    <th>[% LxERP.t8('Number') %]</th>
10 14
    <th>[% LxERP.t8('Part Description') %]</th>
11 15
    <th>[% LxERP.t8('Other Matches') %]</th>
......
19 23

  
20 24
   [%- FOREACH item = ITEM_LIST %]
21 25
   <tr class="listrow[% loop.count % 2 %]">
22
    <td><input name="select_item_id" class="radio" type="radio" value="[% HTML.escape(item.id) %]"[% IF loop.first %] checked[% END %]></td>
26
    [%- IF myconfig_item_multiselect %]
27
      <td>[% L.input_tag('select_qty_' _ HTML.escape(item.id), '', size => 5) %]</td>
28
    [%- ELSE %]
29
      <td><input name="select_item_id" class="radio" type="radio" value="[% HTML.escape(item.id) %]"[% IF loop.first %] checked[% END %]></td>
30
    [%- END %]
23 31
    <td>[% HTML.escape(item.partnumber) %]</td>
24 32
    <td>[% HTML.escape(item.description) %]</td>
25 33
    <td>[% HTML.escape(item.matches).join('<br>') %]</td>
......
41 49

  
42 50
  [% L.submit_tag('action', LxERP.t8('Continue')) %]
43 51
 </form>
52

  
53
[%- IF myconfig_item_multiselect %]
54
 <script type='text/javascript'>
55
   var first_click = 1;;
56
   [%- FOREACH item = ITEM_LIST %]
57
     [% SET THIS_ID = 'select_qty_' _ HTML.escape(item.id) %]
58
     $('#[% THIS_ID %]').click(function(){
59
       var qty = '1';
60
       if (first_click) {
61
         qty = '[% LxERP.format_amount(PRE_ENTERED_QTY, 5) %]';
62
       }
63
       first_click = 0;
64
       if ($('#[% THIS_ID %]').attr('value') == '') {
65
         $('#[% THIS_ID %]').attr('value', qty); $('#[% THIS_ID %]').select();
66
       }
67
     });
68
   [%- END %]
69
 </script>
70
[%- END %]

Auch abrufbar als: Unified diff