From: Sven Schöling Date: Sun, 5 Dec 2021 23:20:02 +0000 (+0100) Subject: Lieferschein: Suche angepasst auf neue Typen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~41 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=092d31105afe7d3dd180502fec1272df07713815;p=kivitendo-erp.git Lieferschein: Suche angepasst auf neue Typen --- diff --git a/SL/DB/DeliveryOrder/TypeData.pm b/SL/DB/DeliveryOrder/TypeData.pm index c65e7ffe4..77838a91a 100644 --- a/SL/DB/DeliveryOrder/TypeData.pm +++ b/SL/DB/DeliveryOrder/TypeData.pm @@ -37,6 +37,7 @@ my %type_data = ( save_and_ap_transaction => 0, save_and_invoice => 0, delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, + new_controller => 0, }, properties => { customervendor => "customer", @@ -65,6 +66,7 @@ my %type_data = ( save_and_ap_transaction => 0, save_and_invoice => 0, delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, + new_controller => 0, }, properties => { customervendor => "vendor", @@ -93,6 +95,7 @@ my %type_data = ( save_and_ap_transaction => 0, save_and_invoice => 0, delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, + new_controller => 1, }, properties => { customervendor => "vendor", @@ -121,6 +124,7 @@ my %type_data = ( save_and_ap_transaction => 0, save_and_invoice => 0, delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, + new_controller => 1, }, properties => { customervendor => "customer", diff --git a/SL/DO.pm b/SL/DO.pm index 86c65ea14..14d61a1d4 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -42,6 +42,7 @@ use SL::AM; use SL::Common; use SL::CVar; use SL::DB::DeliveryOrder; +use SL::DB::DeliveryOrder::TypeData qw(:types is_valid_type); use SL::DB::Status; use SL::DBUtils; use SL::Helper::ShippedQty; @@ -79,6 +80,7 @@ sub transactions { dord.transaction_description, dord.itime::DATE AS insertdate, pr.projectnumber AS globalprojectnumber, dep.description AS department, + dord.order_type, e.name AS employee, sm.name AS salesman FROM delivery_orders dord @@ -90,7 +92,10 @@ sub transactions { LEFT JOIN department dep ON (dord.department_id = dep.id) |; - push @where, ($form->{type} eq 'sales_delivery_order' ? '' : 'NOT ') . qq|COALESCE(dord.is_sales, FALSE)|; + if ($form->{type} && is_valid_type($form->{type})) { + push @where, 'dord.order_type = ?'; + push @values, $form->{type}; + } if ($form->{department_id}) { push @where, qq|dord.department_id = ?|; @@ -515,7 +520,7 @@ SQL shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, billing_address_id = ?, globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, - is_sales = ?, taxzone_id = ?, taxincluded = ?, payment_id = ?, currency_id = (SELECT id FROM currencies WHERE name = ?), + order_type = ?, taxzone_id = ?, taxincluded = ?, payment_id = ?, currency_id = (SELECT id FROM currencies WHERE name = ?), delivery_term_id = ? WHERE id = ?|; @@ -529,7 +534,7 @@ SQL conv_i($form->{globalproject_id}), conv_i($form->{employee_id}), conv_i($form->{salesman_id}), conv_i($form->{cp_id}), $form->{transaction_description}, - $form->{type} =~ /^sales/ ? 't' : 'f', + $form->{type} =~ /^sales/ ? SALES_DELIVERY_ORDER_TYPE : PURCHASE_DELIVERY_ORDER_TYPE, conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{payment_id}), $form->{currency}, conv_i($form->{delivery_term_id}), conv_i($form->{id})); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 923ec3835..7a51a6a48 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -36,7 +36,9 @@ use List::MoreUtils qw(uniq); use List::Util qw(max sum); use POSIX qw(strftime); +use SL::Controller::DeliveryOrder; use SL::DB::DeliveryOrder; +use SL::DB::DeliveryOrder::TypeData qw(:types validate_type); use SL::DO; use SL::IR; use SL::IS; @@ -56,7 +58,10 @@ use strict; # end of main sub check_do_access { - $main::auth->assert($main::form->{type} . '_edit'); + validate_type($::form->{type}); + + my $right = SL::DB::DeliveryOrder::TypeData::get($::form->{type}, "right"); + $main::auth->assert($right); } sub set_headings { @@ -887,7 +892,9 @@ sub orders { 'align' => 'center', }; - $row->{donumber}->{link} = $edit_url . "&id=" . E($dord->{id}) . "&callback=${callback}"; + $row->{donumber}->{link} = SL::DB::DeliveryOrder::TypeData::get3($dord->{order_type}, "show_menu", "new_controller") + ? SL::Controller::DeliveryOrder->url_for(action => "edit", id => $dord->{id}, type => $dord->{order_type}) + : $edit_url . "&id=" . E($dord->{id}) . "&callback=${callback}"; $row->{ordnumber}->{link} = $edit_order_url . "&id=" . E($dord->{oe_id}) . "&callback=${callback}" if $dord->{oe_id}; $report->add_data($row); diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 52d7b0707..ba7336f23 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -470,6 +470,15 @@ params: action: search type: purchase_delivery_order +- parent: ap_reports + id: ap_reports_delivery_orders + name: Supplier Delivery Orders + order: 350 + access: purchase_delivery_order_edit + module: do.pl + params: + action: search + type: supplier_delivery_order - parent: ap_reports id: ap_reports_vendor_invoices_ap_transactions name: Vendor Invoices & AP Transactions