X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=29d9d6c137c4bb5568985718693141bbfd0eab5c;hb=2644d2a93d051b4040354c87c0410ebf494a15df;hp=e6cb33271c5843ce5c7903beeaab7cc1b410d9d3;hpb=7608d92e4dca034db1ebdf07a0ef376c8704b725;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index e6cb33271..29d9d6c13 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -61,6 +61,7 @@ use SL::DBConnect; use SL::DBUtils; use SL::DB::AdditionalBillingAddress; use SL::DB::Customer; +use SL::DB::CustomVariableConfig; use SL::DB::Default; use SL::DB::PaymentTerm; use SL::DB::Vendor; @@ -2713,6 +2714,8 @@ sub lastname_used { } sub get_variable_content_types { + my ($self) = @_; + my %html_variables = ( longdescription => 'html', partnotes => 'html', @@ -2725,7 +2728,34 @@ sub get_variable_content_types { header_text => 'html', footer_text => 'html', ); - return \%html_variables; + + return { + %html_variables, + $self->get_variable_content_types_for_cvars, + }; +} + +sub get_variable_content_types_for_cvars { + my ($self) = @_; + my $html_configs = SL::DB::Manager::CustomVariableConfig->get_all(where => [ type => 'htmlfield' ]); + my %types; + + if (@{ $html_configs }) { + my %prefix_by_module = ( + Contacts => 'cp_cvar_', + CT => 'vc_cvar_', + IC => 'ic_cvar_', + Projects => 'project_cvar_', + ShipTo => 'shiptocvar_', + ); + + foreach my $cfg (@{ $html_configs }) { + my $prefix = $prefix_by_module{$cfg->module}; + $types{$prefix . $cfg->name} = 'html' if $prefix; + } + } + + return %types; } sub current_date { @@ -2956,7 +2986,7 @@ sub get_history { qq|SELECT h.employee_id, h.itime::timestamp(0) AS itime, h.addition, h.what_done, emp.name, h.snumbers, h.trans_id AS id | . qq|FROM history_erp h | . qq|LEFT JOIN employee emp ON (emp.id = h.employee_id) | . - qq|WHERE (trans_id = | . $trans_id . qq|) $restriction | . + qq|WHERE (trans_id = | . $dbh->quote($trans_id) . qq|) $restriction | . $order; my $sth = $dbh->prepare($query) || $self->dberror($query);