Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0b8d41e7

Von Cem Aydin vor 8 Monaten hinzugefügt

  • ID 0b8d41e7bd24f654d26f51ede1be287cff245b09
  • Vorgänger 73ce43f0
  • Nachfolger 670dad35

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

- dadurch obsolet gewordenen code, JavaScript sowie im Controller entfernt

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
601 601
  $self->js->render();
602 602
}
603 603

  
604
# open the dialog for customer/vendor details
605
sub action_show_customer_vendor_details_dialog {
606
  my ($self) = @_;
607

  
608
  my $is_customer = ($self->type_data->properties('is_customer'));
609
  my $cv;
610
  if ($is_customer) {
611
    $cv = SL::DB::Customer->new(id => $::form->{cv_id})->load;
612
  } else {
613
    $cv = SL::DB::Vendor->new(id => $::form->{cv_id})->load;
614
  }
615

  
616
  my %details = map { $_ => $cv->$_ } @{$cv->meta->columns};
617
  $details{discount_as_percent} = $cv->discount_as_percent;
618
  $details{creditlimt}          = $cv->creditlimit_as_number;
619
  $details{business}            = $cv->business->description      if $cv->business;
620
  $details{language}            = $cv->language_obj->description  if $cv->language_obj;
621
  $details{delivery_terms}      = $cv->delivery_term->description if $cv->delivery_term;
622
  $details{payment_terms}       = $cv->payment->description       if $cv->payment;
623
  $details{pricegroup}          = $cv->pricegroup->pricegroup     if !$is_customer && $cv->pricegroup;
624

  
625
  foreach my $entry (@{ $cv->shipto }) {
626
    push @{ $details{SHIPTO} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
627
  }
628
  foreach my $entry (@{ $cv->contacts }) {
629
    push @{ $details{CONTACTS} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
630
  }
631

  
632
  $_[0]->render('common/show_vc_details', { layout => 0 },
633
                is_customer => $is_customer,
634
                %details);
635
}
636

  
637 604
# called if a unit in an existing item row is changed
638 605
sub action_unit_changed {
639 606
  my ($self) = @_;
js/kivi.Reclamation.js
632 632
    kivi.io.close_dialog();
633 633
  };
634 634

  
635
  ns.show_cv_details_dialog = function() {
636
    if (!ns.check_cv()) return;
637
    var cv;
638
    var cv_id;
639
    var title;
640
    if ($('#type').val() == 'sales_reclamation') {
641
      cv    = 'customer';
642
      cv_id = $('#reclamation_customer_id').val();
643
      title = kivi.t8('Customer details');
644
    } else {
645
      cv    = 'vendor';
646
      cv_id = $('#reclamation_vendor_id').val();
647
      title = kivi.t8('Vendor details');
648
    }
649

  
650
    kivi.popup_dialog({
651
      url:    'controller.pl',
652
      data:   { action: 'Reclamation/show_customer_vendor_details_dialog',
653
                type  : $('#type').val(),
654
                cv    : cv,
655
                cv_id : cv_id
656
              },
657
      id:     'jq_customer_vendor_details_dialog',
658
      dialog: {
659
        title:  title,
660
        width:  800,
661
        height: 650
662
      }
663
    });
664
    return true;
665
  };
666

  
667 635
  ns.update_row_from_master_data = function(clicked) {
668 636
    var row = $(clicked).parents("tbody").first();
669 637
    var item_id_dom = $(row).find('[name="reclamation_item_ids[+]"]');
......
840 808
    $.post("controller.pl", data, kivi.eval_json_result);
841 809
  };
842 810

  
843
  ns.open_customervendor_tab = function(id_selector, db) {
844
    if (!ns.check_cv()) return;
845
    window.open("controller.pl?action=CustomerVendor/edit&db=" + encodeURIComponent(db) + "&id=" + encodeURIComponent($(id_selector).val()), '_blank');
846
  };
847

  
848 811
  ns.get_selected_rows = function() {
849 812
    let selected_rows = [];
850 813
    $('[name^="multi_id_"]').each( function() {
templates/design40_webpages/reclamation/tabs/basic_data.html
21 21
        <th>[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
22 22
        [% SET cv_id = SELF.cv _ '_id' %]
23 23
        <td class="wi-lightwide">
24
          [% P.customer_vendor.picker("reclamation.${SELF.cv}" _ '_id', SELF.reclamation.$cv_id, type=SELF.cv, class='wi-lightwide') %]
25
          [%- L.img_tag(src="image/detail.png",
26
                      alt=LxERP.t8('Show details'),
27
                      title= LxERP.t8('Show details'),
28
                      onclick="kivi.Reclamation.show_cv_details_dialog();",
29
                      class="button-image info") %]
30
          [% P.link_tag("javascript:void(0);", LxERP.t8('Edit'), title=LxERP.t8('Open in new window'), onclick="kivi.Reclamation.open_customervendor_tab('#reclamation_${SELF.cv}_id', '${SELF.cv}')") %]
24
          [% P.customer_vendor.picker("reclamation.${SELF.cv}" _ '_id', SELF.reclamation.$cv_id, type=SELF.cv, show_details="1") %]
31 25
        </td>
32 26
      </tr>
33 27

  
templates/webpages/reclamation/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("reclamation.${SELF.cv}" _ '_id', SELF.reclamation.$cv_id, type=SELF.cv, style='width: 300px') %]
19
              [% P.button_tag("kivi.Reclamation.show_cv_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.Reclamation.open_customervendor_tab('#reclamation_${SELF.cv}_id', '${SELF.cv}')") %]
18
              [% P.customer_vendor.picker("reclamation.${SELF.cv}" _ '_id', SELF.reclamation.$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