Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 73ce43f0

Von Cem Aydin vor etwa 1 Jahr hinzugefügt

  • ID 73ce43f0055dbcce1e5a7d38a719af62d40961c8
  • Vorgänger 039f2101
  • Nachfolger 0b8d41e7

Auftrag/Angebot (neuer controller): Kunden-/Lieferanten picker mit Details Option verwenden

- dadurch obsolet gewordenen code, JavaScript sowie im Controller entfernt

Unterschiede anzeigen:

SL/Controller/Order.pm
73 73
                        except => [ qw(close_quotations) ]);
74 74

  
75 75
__PACKAGE__->run_before('check_auth_for_edit',
76
                        except => [ qw(edit show_customer_vendor_details_dialog price_popup load_second_rows close_quotations) ]);
76
                        except => [ qw(edit price_popup load_second_rows close_quotations) ]);
77 77
__PACKAGE__->run_before('get_basket_info_from_from');
78 78

  
79 79
#
......
999 999
  $self->js->render();
1000 1000
}
1001 1001

  
1002
# open the dialog for customer/vendor details
1003
sub action_show_customer_vendor_details_dialog {
1004
  my ($self) = @_;
1005

  
1006
  my $is_customer = $self->type_data->properties('is_customer');
1007
  my $cv;
1008
  if ($is_customer) {
1009
    $cv = SL::DB::Customer->new(id => $::form->{vc_id})->load;
1010
  } else {
1011
    $cv = SL::DB::Vendor->new(id => $::form->{vc_id})->load;
1012
  }
1013

  
1014
  my %details = map { $_ => $cv->$_ } @{$cv->meta->columns};
1015
  $details{discount_as_percent} = $cv->discount_as_percent;
1016
  $details{creditlimt}          = $cv->creditlimit_as_number;
1017
  $details{business}            = $cv->business->description      if $cv->business;
1018
  $details{language}            = $cv->language_obj->description  if $cv->language_obj;
1019
  $details{delivery_terms}      = $cv->delivery_term->description if $cv->delivery_term;
1020
  $details{payment_terms}       = $cv->payment->description       if $cv->payment;
1021
  $details{pricegroup}          = $cv->pricegroup->pricegroup     if $is_customer && $cv->pricegroup;
1022

  
1023
  if ($is_customer) {
1024
    foreach my $entry (@{ $cv->additional_billing_addresses }) {
1025
      push @{ $details{ADDITIONAL_BILLING_ADDRESSES} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
1026
    }
1027
  }
1028
  foreach my $entry (@{ $cv->shipto }) {
1029
    push @{ $details{SHIPTO} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
1030
  }
1031
  foreach my $entry (@{ $cv->contacts }) {
1032
    push @{ $details{CONTACTS} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
1033
  }
1034

  
1035
  $_[0]->render('common/show_vc_details', { layout => 0 },
1036
                is_customer => $is_customer,
1037
                %details);
1038

  
1039
}
1040

  
1041 1002
# called if a unit in an existing item row is changed
1042 1003
sub action_unit_changed {
1043 1004
  my ($self) = @_;
js/kivi.Order.js
718 718
    return true;
719 719
  };
720 720

  
721
  ns.show_vc_details_dialog = function() {
722
    if (!ns.check_cv()) return;
723
    var vc;
724
    var vc_id;
725
    var title;
726
    if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
727
      vc    = 'customer';
728
      vc_id = $('#order_customer_id').val();
729
      title = kivi.t8('Customer details');
730
    } else {
731
      vc    = 'vendor';
732
      vc_id = $('#order_vendor_id').val();
733
      title = kivi.t8('Vendor details');
734
    }
735

  
736
    kivi.popup_dialog({
737
      url:    'controller.pl',
738
      data:   { action: 'Order/show_customer_vendor_details_dialog',
739
                type  : $('#type').val(),
740
                vc    : vc,
741
                vc_id : vc_id
742
              },
743
      id:     'jq_customer_vendor_details_dialog',
744
      dialog: {
745
        title:  title,
746
        width:  800,
747
        height: 650
748
      }
749
    });
750
    return true;
751
  };
752

  
753 721
  ns.update_row_from_master_data = function(clicked) {
754 722
    var row = $(clicked).parents("tbody").first();
755 723
    var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
......
960 928
    $.post("controller.pl", data, kivi.eval_json_result);
961 929
  };
962 930

  
963
  ns.open_customervendor_tab = function(id_selector, db) {
964
    if (!ns.check_cv()) return;
965
    window.open("controller.pl?action=CustomerVendor/edit&db=" + encodeURIComponent(db) + "&id=" + encodeURIComponent($(id_selector).val()), '_blank');
966
  };
967

  
968 931
  ns.show_purchase_delivery_order_select_items = function(params) {
969 932
    var data = $('#order_form').serializeArray();
970 933
    data.push({ name: 'action', value: 'Order/show_conversion_to_purchase_delivery_order_item_selection' });
templates/design40_webpages/order/tabs/basic_data.html
23 23
        <th>[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
24 24
        [% SET cv_id = SELF.cv _ '_id' %]
25 25
        <td class="wi-lightwide">
26
          [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, class='wi-lightwide') %]
27
          [%- L.img_tag(src="image/detail.png",
28
                      alt=LxERP.t8('Show details'),
29
                      title= LxERP.t8('Show details'),
30
                      onclick="kivi.Order.show_vc_details_dialog();",
31
                      class="button-image info") %]
32
          [% P.link_tag("javascript:void(0);", LxERP.t8('Edit'), title=LxERP.t8('Open in new window'), onclick="kivi.Order.open_customervendor_tab('#order_${SELF.cv}_id', '${SELF.cv}')") %]
26
          [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, show_details="1") %]
33 27
        </td>
34 28
      </tr>
35 29
      <tr id='cp_row' [% IF !SELF.order.${SELF.cv}.contacts.size %]style='display:none'[% END %]>
templates/webpages/order/tabs/basic_data.html
15 15
            <th align="right">[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
16 16
            [% SET cv_id = SELF.cv _ '_id' %]
17 17
            <td>
18
              [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]
19
              [% P.button_tag("kivi.Order.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
20
              [% P.link_tag("javascript:void(0);", LxERP.t8('Edit'), title=LxERP.t8('Open in new window'), onclick="kivi.Order.open_customervendor_tab('#order_${SELF.cv}_id', '${SELF.cv}')") %]
18
              [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, show_details="1",
19
                   style='width: 300px') %]
21 20
            </td>
22 21
          </tr>
23 22

  

Auch abrufbar als: Unified diff