Revision 5aa9b450
Von Cem Aydin vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
except => [ qw(close_quotations) ]);
|
||
|
||
__PACKAGE__->run_before('check_auth_for_edit',
|
||
except => [ qw(edit show_customer_vendor_details_dialog price_popup load_second_rows close_quotations) ]);
|
||
except => [ qw(edit price_popup load_second_rows close_quotations) ]);
|
||
__PACKAGE__->run_before('get_basket_info_from_from');
|
||
|
||
#
|
||
... | ... | |
$self->js->render();
|
||
}
|
||
|
||
# open the dialog for customer/vendor details
|
||
sub action_show_customer_vendor_details_dialog {
|
||
my ($self) = @_;
|
||
|
||
my $is_customer = $self->type_data->properties('is_customer');
|
||
my $cv;
|
||
if ($is_customer) {
|
||
$cv = SL::DB::Customer->new(id => $::form->{vc_id})->load;
|
||
} else {
|
||
$cv = SL::DB::Vendor->new(id => $::form->{vc_id})->load;
|
||
}
|
||
|
||
my %details = map { $_ => $cv->$_ } @{$cv->meta->columns};
|
||
$details{discount_as_percent} = $cv->discount_as_percent;
|
||
$details{creditlimt} = $cv->creditlimit_as_number;
|
||
$details{business} = $cv->business->description if $cv->business;
|
||
$details{language} = $cv->language_obj->description if $cv->language_obj;
|
||
$details{delivery_terms} = $cv->delivery_term->description if $cv->delivery_term;
|
||
$details{payment_terms} = $cv->payment->description if $cv->payment;
|
||
$details{pricegroup} = $cv->pricegroup->pricegroup if $is_customer && $cv->pricegroup;
|
||
|
||
if ($is_customer) {
|
||
foreach my $entry (@{ $cv->additional_billing_addresses }) {
|
||
push @{ $details{ADDITIONAL_BILLING_ADDRESSES} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
|
||
}
|
||
}
|
||
foreach my $entry (@{ $cv->shipto }) {
|
||
push @{ $details{SHIPTO} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
|
||
}
|
||
foreach my $entry (@{ $cv->contacts }) {
|
||
push @{ $details{CONTACTS} }, { map { $_ => $entry->$_ } @{$entry->meta->columns} };
|
||
}
|
||
|
||
$_[0]->render('common/show_vc_details', { layout => 0 },
|
||
is_customer => $is_customer,
|
||
%details);
|
||
|
||
}
|
||
|
||
# called if a unit in an existing item row is changed
|
||
sub action_unit_changed {
|
||
my ($self) = @_;
|
js/kivi.Order.js | ||
---|---|---|
return true;
|
||
};
|
||
|
||
ns.show_vc_details_dialog = function() {
|
||
if (!ns.check_cv()) return;
|
||
var vc;
|
||
var vc_id;
|
||
var title;
|
||
if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
|
||
vc = 'customer';
|
||
vc_id = $('#order_customer_id').val();
|
||
title = kivi.t8('Customer details');
|
||
} else {
|
||
vc = 'vendor';
|
||
vc_id = $('#order_vendor_id').val();
|
||
title = kivi.t8('Vendor details');
|
||
}
|
||
|
||
kivi.popup_dialog({
|
||
url: 'controller.pl',
|
||
data: { action: 'Order/show_customer_vendor_details_dialog',
|
||
type : $('#type').val(),
|
||
vc : vc,
|
||
vc_id : vc_id
|
||
},
|
||
id: 'jq_customer_vendor_details_dialog',
|
||
dialog: {
|
||
title: title,
|
||
width: 800,
|
||
height: 650
|
||
}
|
||
});
|
||
return true;
|
||
};
|
||
|
||
ns.update_row_from_master_data = function(clicked) {
|
||
var row = $(clicked).parents("tbody").first();
|
||
var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
|
||
... | ... | |
$.post("controller.pl", data, kivi.eval_json_result);
|
||
};
|
||
|
||
ns.open_customervendor_tab = function(id_selector, db) {
|
||
if (!ns.check_cv()) return;
|
||
window.open("controller.pl?action=CustomerVendor/edit&db=" + encodeURIComponent(db) + "&id=" + encodeURIComponent($(id_selector).val()), '_blank');
|
||
};
|
||
|
||
ns.show_purchase_delivery_order_select_items = function(params) {
|
||
var data = $('#order_form').serializeArray();
|
||
data.push({ name: 'action', value: 'Order/show_conversion_to_purchase_delivery_order_item_selection' });
|
templates/design40_webpages/order/tabs/basic_data.html | ||
---|---|---|
<th>[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
|
||
[% SET cv_id = SELF.cv _ '_id' %]
|
||
<td class="wi-lightwide">
|
||
[% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, class='wi-lightwide') %]
|
||
[%- L.img_tag(src="image/detail.png",
|
||
alt=LxERP.t8('Show details'),
|
||
title= LxERP.t8('Show details'),
|
||
onclick="kivi.Order.show_vc_details_dialog();",
|
||
class="button-image info") %]
|
||
[% 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}')") %]
|
||
[% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, show_details="1") %]
|
||
</td>
|
||
</tr>
|
||
<tr id='cp_row' [% IF !SELF.order.${SELF.cv}.contacts.size %]style='display:none'[% END %]>
|
templates/webpages/order/tabs/basic_data.html | ||
---|---|---|
<th align="right">[%- SELF.cv == "customer" ? LxERP.t8('Customer') : LxERP.t8('Vendor') -%]</th>
|
||
[% SET cv_id = SELF.cv _ '_id' %]
|
||
<td>
|
||
[% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]
|
||
[% P.button_tag("kivi.Order.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
|
||
[% 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}')") %]
|
||
[% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, show_details="1",
|
||
style='width: 300px') %]
|
||
</td>
|
||
</tr>
|
||
|
Auch abrufbar als: Unified diff
Auftrag/Angebot (neuer controller): Kunden-/Lieferanten picker mit Details Option verwenden
- dadurch obsolet gewordenen code, JavaScript sowie im Controller entfernt