Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8688e71e

Von Moritz Bunkus vor fast 17 Jahren hinzugefügt

  • ID 8688e71eb56abdd9641f07a47135bb02841607fb
  • Vorgänger 7f2cf947
  • Nachfolger eeae6c90

Implementation des Features "Benutzerdefinierte Variablen für Kunden- und Lieferantenstammdaten".

Unterschiede anzeigen:

bin/mozilla/ct.pl
42 42
use POSIX qw(strftime);
43 43

  
44 44
use SL::CT;
45
use SL::CVar;
45 46
use SL::ReportGenerator;
46 47

  
47 48
require "bin/mozilla/common.pl";
......
80 81
  $form->get_lists("business_types" => "ALL_BUSINESS_TYPES");
81 82
  $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
82 83

  
83
  $form->{title} = $form->{IS_CUSTOMER} ? $locale->text('Customers') : $locale->text('Vendors');
84
  $form->{fokus} = 'Form.name';
84
  $form->{CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
85
  ($form->{CUSTOM_VARIABLES_FILTER_CODE},
86
   $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables'      => $form->{CUSTOM_VARIABLES},
87
                                                                           'include_prefix' => 'l_',
88
                                                                           'include_value'  => 'Y');
89

  
90
  $form->{jsscript} = 1;
91
  $form->{title}    = $form->{IS_CUSTOMER} ? $locale->text('Customers') : $locale->text('Vendors');
92
  $form->{fokus}    = 'Form.name';
85 93

  
86 94
  $form->header();
87 95
  print $form->parse_html_template('ct/search');
......
98 106

  
99 107
  CT->search(\%myconfig, \%$form);
100 108

  
109
  my $cvar_configs = CVar->get_configs('module' => 'CT');
110

  
101 111
  my @options;
102 112
  if ($form->{status} eq 'all') {
103 113
    push @options, $locale->text('All');
......
125 135
    'ordnumber', 'quonumber'
126 136
  );
127 137

  
138
  my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
139
  my %column_defs_cvars            = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables;
140

  
141
  push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables;
142

  
128 143
  my %column_defs = (
129 144
    'id'                => { 'text' => $locale->text('ID'), },
130 145
    "$form->{db}number" => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Customer Number') : $locale->text('Vendor Number'), },
......
141 156
    'invnumber'         => { 'text' => $locale->text('Invoice'), },
142 157
    'ordnumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Sales Order') : $locale->text('Purchase Order'), },
143 158
    'quonumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Quotation')   : $locale->text('Request for Quotation'), },
159
    %column_defs_cvars,
144 160
  );
145 161

  
146 162
  map { $column_defs{$_}->{visible} = $form->{"l_$_"} eq 'Y' } @columns;
......
183 199

  
184 200
  $report->set_sort_indicator($form->{sort}, 1);
185 201

  
202
  CVar->add_custom_variables_to_report('module'         => 'CT',
203
                                       'trans_id_field' => 'id',
204
                                       'configs'        => $cvar_configs,
205
                                       'column_defs'    => \%column_defs,
206
                                       'data'           => $form->{CT});
207

  
186 208
  my $previous_id;
187 209

  
188 210
  foreach my $ref (@{ $form->{CT} }) {
......
273 295
  map { $form->{"MB_$_"} = [ map +{ id => $_, description => $_ }, @{ $form->{$_} } ] } qw(TITLES GREETINGS COMPANY_GREETINGS DEPARTMENT);
274 296
## /LINET
275 297

  
298
  $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'CT', 'trans_id' => $form->{id});
299

  
300
  CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
301

  
302
  $main::lxdebug->dump(0, "cvar", $form->{CUSTOM_VARIABLES});
303

  
276 304
  $form->header;
277 305
  print $form->parse_html_template('ct/form_header');
278 306

  

Auch abrufbar als: Unified diff