Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a66591cc

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

  • ID a66591ccf74ff3d32ac31b6a91849a0476e54eb7
  • Vorgänger 4db13ebb
  • Nachfolger 7fdf9ecf

Auftrags-Controller: Kunden- bzw. Lieferanten-Art-Nr. in Pos-Zeile anzeigen.

… sofern in den Benutzereinstellungen auch die Suche danach ausgewählt ist.

Unterschiede anzeigen:

SL/Controller/Order.pm
39 39
use Rose::Object::MakeMethods::Generic
40 40
(
41 41
 scalar => [ qw(item_ids_to_delete) ],
42
 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors) ],
42
 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors search_cvpartnumber) ],
43 43
);
44 44

  
45 45

  
......
685 685
    ->focus(      '#order_' . $self->cv . '_id');
686 686

  
687 687
  $self->js_redisplay_amounts_and_taxes;
688
  $self->js_redisplay_cvpartnumbers;
688 689
  $self->js->render();
689 690
}
690 691

  
......
755 756

  
756 757
  $self->recalc();
757 758

  
759
  $self->get_item_cvpartnumber($item);
760

  
758 761
  my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
759 762
  my $row_as_html = $self->p->render('order/tabs/_row',
760
                                     ITEM              => $item,
761
                                     ID                => $item_id,
762
                                     TYPE              => $self->type,
763
                                     ALL_PRICE_FACTORS => $self->all_price_factors
763
                                     ITEM                => $item,
764
                                     ID                  => $item_id,
765
                                     TYPE                => $self->type,
766
                                     ALL_PRICE_FACTORS   => $self->all_price_factors,
767
                                     SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
764 768
  );
765 769

  
766 770
  $self->js
......
781 785

  
782 786
      $self->order->add_items( $item );
783 787
      $self->recalc();
788
      $self->get_item_cvpartnumber($item);
784 789
      my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
785 790
      my $row_as_html = $self->p->render('order/tabs/_row',
786
                                         ITEM              => $item,
787
                                         ID                => $item_id,
788
                                         TYPE              => $self->type,
789
                                         ALL_PRICE_FACTORS => $self->all_price_factors
791
                                         ITEM                => $item,
792
                                         ID                  => $item_id,
793
                                         TYPE                => $self->type,
794
                                         ALL_PRICE_FACTORS   => $self->all_price_factors,
795
                                         SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
790 796
      );
791 797
      $self->js
792 798
        ->append('#row_table_id', $row_as_html);
......
862 868
  $self->recalc();
863 869

  
864 870
  foreach my $item (@items) {
871
    $self->get_item_cvpartnumber($item);
865 872
    my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
866 873
    my $row_as_html = $self->p->render('order/tabs/_row',
867
                                       ITEM              => $item,
868
                                       ID                => $item_id,
869
                                       TYPE              => $self->type,
870
                                       ALL_PRICE_FACTORS => $self->all_price_factors
874
                                       ITEM                => $item,
875
                                       ID                  => $item_id,
876
                                       TYPE                => $self->type,
877
                                       ALL_PRICE_FACTORS   => $self->all_price_factors,
878
                                       SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
871 879
    );
872 880

  
873 881
    $self->js->append('#row_table_id', $row_as_html);
......
900 908
  my ($self) = @_;
901 909

  
902 910
  my %sort_keys = (
903
    partnumber  => sub { $_[0]->part->partnumber },
904
    description => sub { $_[0]->description },
905
    qty         => sub { $_[0]->qty },
906
    sellprice   => sub { $_[0]->sellprice },
907
    discount    => sub { $_[0]->discount },
911
    partnumber   => sub { $_[0]->part->partnumber },
912
    description  => sub { $_[0]->description },
913
    qty          => sub { $_[0]->qty },
914
    sellprice    => sub { $_[0]->sellprice },
915
    discount     => sub { $_[0]->discount },
916
    cvpartnumber => sub { $_[0]->{cvpartnumber} },
908 917
  );
909 918

  
919
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
920

  
910 921
  my $method = $sort_keys{$::form->{order_by}};
911 922
  my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted };
912 923
  if ($::form->{sort_dir}) {
......
1054 1065
    ->insertBefore($self->build_tax_rows, '#amount_row_id');
1055 1066
}
1056 1067

  
1068
sub js_redisplay_cvpartnumbers {
1069
  my ($self) = @_;
1070

  
1071
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
1072

  
1073
  my @data = map {[$_->{cvpartnumber}]} @{ $self->order->items_sorted };
1074

  
1075
  $self->js
1076
    ->run('kivi.Order.redisplay_cvpartnumbers', \@data);
1077
}
1078

  
1057 1079
sub js_reset_order_and_item_ids_after_save {
1058 1080
  my ($self) = @_;
1059 1081

  
......
1104 1126
  return $cv;
1105 1127
}
1106 1128

  
1129
sub init_search_cvpartnumber {
1130
  my ($self) = @_;
1131

  
1132
  my $user_prefs = SL::Helper::UserPreferences::PartPickerSearch->new();
1133
  my $search_cvpartnumber;
1134
  $search_cvpartnumber = !!$user_prefs->get_sales_search_customer_partnumber() if $self->cv eq 'customer';
1135
  $search_cvpartnumber = !!$user_prefs->get_purchase_search_makemodel()        if $self->cv eq 'vendor';
1136

  
1137
  return $search_cvpartnumber;
1138
}
1139

  
1107 1140
sub init_p {
1108 1141
  SL::Presenter->get;
1109 1142
}
......
1564 1597
  $self->{order_probabilities}        = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
1565 1598
  $self->{positions_scrollbar_height} = SL::Helper::UserPreferences::PositionsScrollbar->new()->get_height();
1566 1599

  
1567
  my $user_prefs = SL::Helper::UserPreferences::PartPickerSearch->new();
1568
  $self->{search_cvpartnumber} = !!$user_prefs->get_sales_search_customer_partnumber() if $self->cv eq 'customer';
1569
  $self->{search_cvpartnumber} = !!$user_prefs->get_purchase_search_makemodel()        if $self->cv eq 'vendor';
1570

  
1571 1600
  my $print_form = Form->new('');
1572 1601
  $print_form->{type}      = $self->type;
1573 1602
  $print_form->{printers}  = SL::DB::Manager::Printer->get_all_sorted;
......
1605 1634
                                                } } @all_objects;
1606 1635
  }
1607 1636

  
1637
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
1638

  
1608 1639
  $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery edit_periodic_invoices_config calculate_qty);
1609 1640
  $self->setup_edit_action_bar;
1610 1641
}
......
1834 1865
       : '';
1835 1866
}
1836 1867

  
1868
sub get_item_cvpartnumber {
1869
  my ($self, $item) = @_;
1870

  
1871
  if ($self->cv eq 'vendor') {
1872
    my @mms = grep { $_->make eq $self->order->customervendor->id } @{$item->part->makemodels};
1873
    $item->{cvpartnumber} = $mms[0]->model if scalar @mms;
1874
  } elsif ($self->cv eq 'customer') {
1875
    my @cps = grep { $_->customer_id eq $self->order->customervendor->id } @{$item->part->customerprices};
1876
    $item->{cvpartnumber} = $cps[0]->customer_partnumber if scalar @cps;
1877
  }
1878
}
1879

  
1837 1880
sub sales_order_type {
1838 1881
  'sales_order';
1839 1882
}
js/kivi.Order.js
334 334
    });
335 335
  };
336 336

  
337
  ns.redisplay_cvpartnumbers = function(data) {
338
    $('.row_entry').each(function(idx, elt) {
339
      $(elt).find('[name="cvpartnumber"]').html(data[idx][0]);
340
    });
341
  };
342

  
337 343
  ns.renumber_positions = function() {
338 344
    $('.row_entry [name="position"]').each(function(idx, elt) {
339 345
      $(elt).html(idx+1);
locale/de/all
3517 3517
  'These wrong entries cannot be fixed automatically.' => 'Diese Einträge können nicht automatisch bereinigt werden.',
3518 3518
  'They will be updated, new ones for additional parts without a line item added automatically.' => 'Diese Positionen werden automatisch aktualisiert bzw. ergänzt, wenn es noch keine Position zu einem zusätzlichen Artikel gibt.',
3519 3519
  'This Price Rule is no longer valid' => 'Diese Preisregel ist nicht mehr gültig',
3520
  'This also enables displaying a column with the customer partnumber (new order controller).' => 'Hiermit wird auch die Anzeige der Kunden-Art.-Nr. eingeschaltet (neuer Auftrags-Controller).',
3521
  'This also enables displaying a column with the vendor partnumber (model) (new order controller).' => 'Hiermit wird auch die Anzeige der Lieferanten-Art.-Nr. eingeschaltet (neuer Auftrags-Controller).',
3520 3522
  'This can be done with the following query:' => 'Dies kann mit der folgenden Datenbankabfrage erreicht werden:',
3521 3523
  'This could have happened for two reasons:' => 'Dies kann aus zwei Gründen geschehen sein:',
3522 3524
  'This customer has already been added.' => 'Für diesen Kunden ist bereits ein Preis hinzugefügt.',
locale/en/all
3516 3516
  'These wrong entries cannot be fixed automatically.' => '',
3517 3517
  'They will be updated, new ones for additional parts without a line item added automatically.' => '',
3518 3518
  'This Price Rule is no longer valid' => '',
3519
  'This also enables displaying a column with the customer partnumber (new order controller).' => '',
3520
  'This also enables displaying a column with the vendor partnumber (model) (new order controller).' => '',
3519 3521
  'This can be done with the following query:' => '',
3520 3522
  'This could have happened for two reasons:' => '',
3521 3523
  'This customer has already been added.' => '',
templates/webpages/am/config.html
158 158
      <th align="right">[% 'Search parts by vendor partnumber (model) in purchase order forms' | $T8 %]</th>
159 159
      <td>
160 160
        [% L.yes_no_tag('purchase_search_makemodel', purchase_search_makemodel) %]
161
        [%- 'This also enables displaying a column with the vendor partnumber (model) (new order controller).' | $T8 %]
161 162
      </td>
162 163
     </tr>
163 164
     <tr>
164 165
      <th align="right">[% 'Search parts by customer partnumber in sales order forms' | $T8 %]</th>
165 166
      <td>
166 167
        [% L.yes_no_tag('sales_search_customer_partnumber', sales_search_customer_partnumber) %]
168
        [%- 'This also enables displaying a column with the customer partnumber (new order controller).' | $T8 %]
167 169
      </td>
168 170
     </tr>
169 171
     [%- END -%]
templates/webpages/order/tabs/_row.html
35 35
    <td>
36 36
      <div name="partnumber">[% HTML.escape(ITEM.part.partnumber) %]</div>
37 37
    </td>
38
    [%- IF SEARCH_CVPARTNUMBER -%]
39
    <td>
40
      <div name="cvpartnumber">[% HTML.escape(ITEM.cvpartnumber) %]</div>
41
    </td>
42
    [%- END -%]
38 43
    <td>
39 44
      <div name="partclassification">[% ITEM.part.presenter.typeclass_abbreviation %]</div>
40 45
    </td>
templates/webpages/order/tabs/basic_data.html
213 213
                <th class="listheading" nowrap width="3" >[%- 'position'     | $T8 %] </th>
214 214
                <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
215 215
                <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
216
                <th id="partnumber_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
217
                <th id="partclass_header_id"   class="listheading" nowrap width="2">[%- 'Type'  | $T8 %]</th>
218
                <th id="description_header_id" class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.Order.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
216
                <th id="partnumber_header_id"   class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
217
                [%- IF SELF.search_cvpartnumber -%]
218
                <th id="cvpartnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("cvpartnumber")' > [%- SELF.cv == "customer" ? LxERP.t8('Customer Part Number') : LxERP.t8('Model') %]</a></th>
219
                [%- END -%]
220
                <th id="partclass_header_id"    class="listheading" nowrap width="2">[%- 'Type'  | $T8 %]</th>
221
                <th id="description_header_id"  class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.Order.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
219 222
                [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
220
                <th id="shipped_qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
223
                <th id="shipped_qty_header_id"  class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
221 224
                [%- END -%]
222
                <th id="qty_header_id"         class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
225
                <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
223 226
                <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
224 227
                <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
225 228
                <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
......
230 233
            </thead>
231 234

  
232 235
            [%- FOREACH item = SELF.order.items_sorted %]
233
              [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id) TYPE=SELF.type ALL_PRICE_FACTORS=SELF.all_price_factors %]
236
              [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id) TYPE=SELF.type ALL_PRICE_FACTORS=SELF.all_price_factors SEARCH_CVPARTNUMBER=SELF.search_cvpartnumber %]
234 237
            [%- END %]
235 238

  
236 239
          </table>

Auch abrufbar als: Unified diff