X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=82f2906a680125ae803d656f68115b55c22d4848;hb=42985d5fd1375d137ddcb32b2601fa7b0f98f042;hp=c62e694a3e3c266afe0265757df2a745d913950d;hpb=85743ebe243343d54454245d295aa436945b598d;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index c62e694a3..82f2906a6 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -419,8 +419,9 @@ sub setup_oe_action_bar { ], action => [ t8('E Mail'), - call => [ 'kivi.SalesPurchase.show_email_dialog' ], - checks => [ 'kivi.validate_form' ], + 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'), @@ -524,7 +525,8 @@ sub form_header { "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; + $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"}); @@ -651,7 +653,7 @@ sub form_header { taxpart taxservice taxaccounts cursor_fokus show_details useasnew), @custom_hiddens, - map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ]; # deleted: discount + map { $_.'_rate', $_.'_description', $_.'_taxnumber', $_.'_tax_id' } split / /, $form->{taxaccounts} ]; # deleted: discount $TMPL_VAR->{$_} = $type_check_vars{$_} for keys %type_check_vars; @@ -1026,7 +1028,7 @@ sub orders { "curr", "employee", "salesman", "shipvia", "globalprojectnumber", - "transaction_description", "open", + "transaction_description", "department", "open", "delivered", "periodic_invoices", "marge_total", "marge_percent", "vcnumber", "ustid", @@ -1111,6 +1113,7 @@ sub orders { 'shipvia' => { 'text' => $locale->text('Ship via'), }, 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), }, 'transaction_description' => { 'text' => $locale->text('Transaction description'), }, + 'department' => { 'text' => $locale->text('Department'), }, 'open' => { 'text' => $locale->text('Open'), }, 'delivered' => { 'text' => $locale->text('Delivery Order created'), }, 'marge_total' => { 'text' => $locale->text('Ertrag'), }, @@ -1129,7 +1132,7 @@ sub orders { %column_defs_cvars, ); - foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone insertdate payment_terms)) { + foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone insertdate payment_terms department)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } @@ -2169,18 +2172,20 @@ sub edit_periodic_invoices_config { $config = SL::YAML::Load($::form->{periodic_invoices_config}) if $::form->{periodic_invoices_config}; if ('HASH' ne ref $config) { - my $lang_id = $::form->{language_id}; $config = { periodicity => 'm', order_value_periodicity => 'p', # = same as periodicity start_date_as_date => $::form->{transdate} || $::form->current_date, extend_automatically_by => 12, active => 1, - email_subject => GenericTranslations->get(language_id => $lang_id, - translation_type =>"preset_text_periodic_invoices_email_subject"), - email_body => GenericTranslations->get(language_id => $lang_id, - translation_type =>"preset_text_periodic_invoices_email_body"), }; } + # for older configs, replace email preset text if not yet set. + $config->{email_subject} ||= GenericTranslations->get(language_id => $::form->{lanuage_id}, translation_type => "preset_text_periodic_invoices_email_subject"); + $config->{email_body} ||= GenericTranslations->get(language_id => $::form->{lanuage_id}, translation_type => "salutation_general") + . GenericTranslations->get(language_id => $::form->{lanuage_id}, translation_type => "salutation_punctuation_mark") + . "\n\n" + . GenericTranslations->get(language_id => $::form->{lanuage_id}, translation_type => "preset_text_periodic_invoices_email_body"); + $config->{email_body} =~ s{\A[ \n\r]+|[ \n\r]+\Z}{}g; $config->{periodicity} = 'm' if none { $_ eq $config->{periodicity} } @SL::DB::PeriodicInvoicesConfig::PERIODICITIES; $config->{order_value_periodicity} = 'p' if none { $_ eq $config->{order_value_periodicity} } ('p', @SL::DB::PeriodicInvoicesConfig::ORDER_VALUE_PERIODICITIES); @@ -2194,6 +2199,7 @@ sub edit_periodic_invoices_config { if ($::form->{customer_id}) { $::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(where => [ cp_cv_id => $::form->{customer_id} ]); + $::form->{email_recipient_invoice_address} = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id})->invoice_mail; } $::form->header(no_layout => 1);