Revision 36c672e1
Von Niklas Schmidt vor 3 Monaten hinzugefügt
bin/mozilla/oe.pl | ||
---|---|---|
return 0;
|
||
}
|
||
|
||
sub set_headings {
|
||
$main::lxdebug->enter_sub();
|
||
|
||
my $form = $main::form;
|
||
my $locale = $main::locale;
|
||
|
||
check_oe_access();
|
||
|
||
my ($action) = @_;
|
||
|
||
if ($form->{type} eq 'purchase_order') {
|
||
$form->{title} = $action eq "edit" ?
|
||
$locale->text('Edit Purchase Order') :
|
||
$locale->text('Add Purchase Order');
|
||
$form->{heading} = $locale->text('Purchase Order');
|
||
$form->{vc} = 'vendor';
|
||
}
|
||
if ($form->{type} eq 'sales_order') {
|
||
$form->{title} = $action eq "edit" ?
|
||
$locale->text('Edit Sales Order') :
|
||
$locale->text('Add Sales Order');
|
||
$form->{heading} = $locale->text('Sales Order');
|
||
$form->{vc} = 'customer';
|
||
}
|
||
if ($form->{type} eq 'request_quotation') {
|
||
$form->{title} = $action eq "edit" ?
|
||
$locale->text('Edit Request for Quotation') :
|
||
$locale->text('Add Request for Quotation');
|
||
$form->{heading} = $locale->text('Request for Quotation');
|
||
$form->{vc} = 'vendor';
|
||
}
|
||
if ($form->{type} eq 'sales_quotation') {
|
||
$form->{title} = $action eq "edit" ?
|
||
$locale->text('Edit Quotation') :
|
||
$locale->text('Add Quotation');
|
||
$form->{heading} = $locale->text('Quotation');
|
||
$form->{vc} = 'customer';
|
||
}
|
||
|
||
$main::lxdebug->leave_sub();
|
||
}
|
||
|
||
sub convert_to_delivery_orders {
|
||
# collect order ids
|
||
my @multi_ids = map {
|
||
... | ... | |
$main::lxdebug->leave_sub();
|
||
}
|
||
|
||
sub setup_oe_action_bar {
|
||
my %params = @_;
|
||
my $form = $::form;
|
||
|
||
my $has_active_periodic_invoice;
|
||
if ($params{oe_obj}) {
|
||
$has_active_periodic_invoice =
|
||
$params{oe_obj}->is_type('sales_order')
|
||
&& $params{oe_obj}->periodic_invoices_config
|
||
&& $params{oe_obj}->periodic_invoices_config->active
|
||
&& ( !$params{oe_obj}->periodic_invoices_config->end_date
|
||
|| ($params{oe_obj}->periodic_invoices_config->end_date > DateTime->today_local))
|
||
&& $params{oe_obj}->periodic_invoices_config->get_previous_billed_period_start_date;
|
||
}
|
||
|
||
my $allow_invoice = $params{is_req_quo}
|
||
|| $params{is_pur_ord}
|
||
|| ($params{is_sales_quo} && $::instance_conf->get_allow_sales_invoice_from_sales_quotation)
|
||
|| ($params{is_sales_ord} && $::instance_conf->get_allow_sales_invoice_from_sales_order);
|
||
my @req_trans_cost_art = qw(kivi.SalesPurchase.check_transport_cost_article_presence) x!!$::instance_conf->get_transport_cost_reminder_article_number_id;
|
||
my @warn_p_invoice = qw(kivi.SalesPurchase.oe_warn_save_active_periodic_invoice) x!!$has_active_periodic_invoice;
|
||
|
||
for my $bar ($::request->layout->get('actionbar')) {
|
||
$bar->add(
|
||
action => [
|
||
t8('Update'),
|
||
submit => [ '#form', { action => "update" } ],
|
||
id => 'update_button',
|
||
accesskey => 'enter',
|
||
],
|
||
|
||
combobox => [
|
||
action => [
|
||
t8('Save'),
|
||
submit => [ '#form', { action => "save" } ],
|
||
checks => [ 'kivi.validate_form', @req_trans_cost_art, @warn_p_invoice ],
|
||
],
|
||
action => [
|
||
t8('Save as new'),
|
||
submit => [ '#form', { action => "save_as_new" } ],
|
||
checks => [ 'kivi.validate_form', @req_trans_cost_art ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
],
|
||
action => [
|
||
t8('Save and Close'),
|
||
submit => [ '#form', { action => "save_and_close" } ],
|
||
checks => [ 'kivi.validate_form', @req_trans_cost_art, @warn_p_invoice ],
|
||
],
|
||
action => [
|
||
t8('Delete'),
|
||
submit => [ '#form', { action => "delete" } ],
|
||
confirm => t8('Do you really want to delete this object?'),
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.')
|
||
: ( ($params{is_sales_ord} && !$::instance_conf->get_sales_order_show_delete)
|
||
|| ($params{is_pur_ord} && !$::instance_conf->get_purchase_order_show_delete)) ? t8('Deleting this type of record has been disabled in the configuration.')
|
||
: undef,
|
||
],
|
||
], # end of combobox "Save"
|
||
|
||
'separator',
|
||
|
||
combobox => [
|
||
action => [ t8('Workflow') ],
|
||
action => [
|
||
t8('Sales Order'),
|
||
submit => [ '#form', { action => "sales_order" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $params{is_sales_quo} || $params{is_pur_ord},
|
||
],
|
||
action => [
|
||
t8('Purchase Order'),
|
||
submit => [ '#form', { action => "purchase_order" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $params{is_sales_ord} || $params{is_req_quo},
|
||
],
|
||
action => [
|
||
t8('Delivery Order'),
|
||
submit => [ '#form', { action => "delivery_order" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $params{is_sales_ord} || $params{is_pur_ord},
|
||
],
|
||
action => [
|
||
t8('Invoice'),
|
||
submit => [ '#form', { action => "invoice" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $allow_invoice,
|
||
],
|
||
action => [
|
||
t8('Quotation'),
|
||
submit => [ '#form', { action => "quotation" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $params{is_sales_ord},
|
||
],
|
||
action => [
|
||
t8('Request for Quotation'),
|
||
submit => [ '#form', { action => "request_for_quotation" } ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
checks => [ 'kivi.validate_form' ],
|
||
only_if => $params{is_pur_ord},
|
||
],
|
||
], # end of combobox "Workflow"
|
||
|
||
combobox => [
|
||
action => [ t8('Export') ],
|
||
action => [
|
||
t8('Print'),
|
||
call => [ 'kivi.SalesPurchase.show_print_dialog' ],
|
||
checks => [ 'kivi.validate_form' ],
|
||
],
|
||
action => [
|
||
t8('E Mail'),
|
||
call => [ 'kivi.SalesPurchase.show_email_dialog' ],
|
||
checks => [ 'kivi.validate_form' ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
],
|
||
action => [
|
||
t8('Download attachments of all parts'),
|
||
call => [ 'kivi.File.downloadOrderitemsFiles', $::form->{type}, $::form->{id} ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
only_if => $::instance_conf->get_doc_storage,
|
||
],
|
||
], #end of combobox "Export"
|
||
|
||
combobox => [
|
||
action => [ t8('more') ],
|
||
action => [
|
||
t8('History'),
|
||
call => [ 'set_history_window', $form->{id} * 1, 'id' ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
],
|
||
action => [
|
||
t8('Follow-Up'),
|
||
call => [ 'follow_up_window' ],
|
||
disabled => !$form->{id} ? t8('This record has not been saved yet.') : undef,
|
||
],
|
||
], # end of combobox "more"
|
||
);
|
||
}
|
||
$::request->layout->add_javascripts('kivi.Validator.js');
|
||
}
|
||
|
||
sub setup_oe_search_action_bar {
|
||
my %params = @_;
|
||
|
||
... | ... | |
}
|
||
}
|
||
|
||
sub form_header {
|
||
$main::lxdebug->enter_sub();
|
||
my @custom_hiddens;
|
||
|
||
my $form = $main::form;
|
||
my %myconfig = %main::myconfig;
|
||
my $locale = $main::locale;
|
||
my $cgi = $::request->{cgi};
|
||
|
||
check_oe_access();
|
||
|
||
# Container for template variables. Unfortunately this has to be
|
||
# visible in form_footer too, so package local level and not my here.
|
||
my $TMPL_VAR = $::request->cache('tmpl_var', {});
|
||
if ($form->{id}) {
|
||
$TMPL_VAR->{oe_obj} = SL::DB::Order->new(id => $form->{id})->load;
|
||
}
|
||
$TMPL_VAR->{vc_obj} = SL::DB::Customer->new(id => $form->{customer_id})->load if $form->{customer_id};
|
||
$TMPL_VAR->{vc_obj} = SL::DB::Vendor->new(id => $form->{vendor_id})->load if $form->{vendor_id};
|
||
|
||
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
|
||
|
||
my $current_employee = SL::DB::Manager::Employee->current;
|
||
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
|
||
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
|
||
$form->{employee_id} ||= $current_employee->id;
|
||
$form->{salesman_id} ||= $current_employee->id;
|
||
|
||
# openclosed checkboxes
|
||
my @tmp;
|
||
push @tmp, sprintf qq|<input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" %s><label for="delivered">%s</label>|,
|
||
$form->{"delivered"} ? "checked" : "", $locale->text('Delivery Order(s) for full qty created') if $form->{"type"} =~ /_order$/;
|
||
push @tmp, sprintf qq|<input name="closed" id="closed" type="checkbox" class="checkbox" value="1" %s><label for="closed">%s</label>|,
|
||
$form->{"closed"} ? "checked" : "", $locale->text('Closed') if $form->{id};
|
||
$TMPL_VAR->{openclosed} = sprintf qq|<tr><td colspan=%d align=center>%s</td></tr>\n|, 2 * scalar @tmp, join "\n", @tmp if @tmp;
|
||
|
||
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
|
||
|
||
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
|
||
"currencies" => "ALL_CURRENCIES",
|
||
"price_factors" => "ALL_PRICE_FACTORS");
|
||
$form->{ALL_PAYMENTS} = SL::DB::Manager::PaymentTerm->get_all( where => [ or => [ obsolete => 0, id => $form->{payment_id} || undef ] ]);
|
||
|
||
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
|
||
$form->{ALL_LANGUAGES} = SL::DB::Manager::Language->get_all_sorted;
|
||
|
||
# Projects
|
||
my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
|
||
my @old_ids_cond = @old_project_ids ? (id => \@old_project_ids) : ();
|
||
my @customer_cond;
|
||
if (($vc eq 'customers') && $::instance_conf->get_customer_projects_only_in_sales) {
|
||
@customer_cond = (
|
||
or => [
|
||
customer_id => $::form->{customer_id},
|
||
bin/mozilla/oe.pl: entferne toten Code (Schritt 2)
-sub set_headings {
-sub setup_oe_action_bar {
-sub form_header {
-sub form_footer {
-sub display_form {
Beachte: in sub invoice wird sub display_form aus ir.pl aufgerufen