Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 039f2101

Von Cem Aydin vor etwa 1 Jahr hinzugefügt

  • ID 039f2101e258e94a46d7080a90d32683b0bbde50
  • Vorgänger 6accc5b8
  • Nachfolger 73ce43f0

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

- dadurch obsolet gewordenen code, JavaScript sowie im Controller entfernt

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
76 76

  
77 77
__PACKAGE__->run_before('check_auth_for_edit',
78 78
  except => [ qw(
79
    update_stock_information edit show_customer_vendor_details_dialog
79
    update_stock_information edit
80 80
    price_popup stock_in_out_dialog load_second_rows
81 81
    ) ]);
82 82

  
......
611 611
  $self->js->render();
612 612
}
613 613

  
614
# open the dialog for customer/vendor details
615
sub action_show_customer_vendor_details_dialog {
616
  my ($self) = @_;
617

  
618
  my $is_customer = 'customer' eq $::form->{vc};
619
  my $cv;
620
  if ($is_customer) {
621
    $cv = SL::DB::Customer->new(id => $::form->{vc_id})->load;
622
  } else {
623
    $cv = SL::DB::Vendor->new(id => $::form->{vc_id})->load;
624
  }
625

  
626
  my %details = map { $_ => $cv->$_ } @{$cv->meta->columns};
627
  $details{discount_as_percent} = $cv->discount_as_percent;
628
  $details{creditlimt}          = $cv->creditlimit_as_number;
629
  $details{business}            = $cv->business->description      if $cv->business;
630
  $details{language}            = $cv->language_obj->description  if $cv->language_obj;
631
  $details{delivery_terms}      = $cv->delivery_term->description if $cv->delivery_term;
632
  $details{payment_terms}       = $cv->payment->description       if $cv->payment;
633
  $details{pricegroup}          = $cv->pricegroup->pricegroup     if $is_customer && $cv->pricegroup;
634

  
635
  foreach my $entry (@{ $cv->shipto }) {
636
    push @{ $details{SHIPTO} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
637
  }
638
  foreach my $entry (@{ $cv->contacts }) {
639
    push @{ $details{CONTACTS} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
640
  }
641

  
642
  $_[0]->render('common/show_vc_details', { layout => 0 },
643
                is_customer => $is_customer,
644
                %details);
645
}
646

  
647 614
# called if a unit in an existing item row is changed
648 615
sub action_unit_changed {
649 616
  my ($self) = @_;
js/kivi.DeliveryOrder.js
627 627
    $.post("controller.pl", data, kivi.eval_json_result);
628 628
  };
629 629

  
630
  ns.show_vc_details_dialog = function() {
631
    if (!ns.check_cv()) return;
632
    var vc;
633
    var vc_id;
634
    var title;
635
    if ($('#order_customer_id').val()) {
636
      vc    = 'customer';
637
      vc_id = $('#order_customer_id').val();
638
      title = kivi.t8('Customer details');
639
    } else {
640
      vc    = 'vendor';
641
      vc_id = $('#order_vendor_id').val();
642
      title = kivi.t8('Vendor details');
643
    }
644

  
645
    kivi.popup_dialog({
646
      url:    'controller.pl',
647
      data:   { action: 'DeliveryOrder/show_customer_vendor_details_dialog',
648
                type  : $('#type').val(),
649
                vc    : vc,
650
                vc_id : vc_id
651
              },
652
      id:     'jq_customer_vendor_details_dialog',
653
      dialog: {
654
        title:  title,
655
        width:  800,
656
        height: 650
657
      }
658
    });
659
    return true;
660
  };
661

  
662 630
  ns.update_row_from_master_data = function(clicked) {
663 631
    var row = $(clicked).parents("tbody").first();
664 632
    var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
templates/design40_webpages/delivery_order/tabs/basic_data.html
22 22
        <th>[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
23 23
        [% SET cv_id = SELF.cv _ '_id' %]
24 24
        <td class="wi-lightwide">
25
          [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, class='wi-lightwide') %]
26
          [%- L.img_tag(src="image/detail.png",
27
                      alt=LxERP.t8('Show details'),
28
                      title= LxERP.t8('Show details'),
29
                      onclick="kivi.DeliveryOrder.show_vc_details_dialog();",
30
                      class="button-image info") %]
25
         [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv,
26
              show_details="1") %]
31 27
        </td>
32 28
      </tr>
33 29

  
templates/webpages/delivery_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.DeliveryOrder.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
18
              [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px',
19
                   show_details="1") %]
20 20
            </td>
21 21
          </tr>
22 22

  

Auch abrufbar als: Unified diff