Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dbcf08e9

Von Rolf Fluehmann vor etwa 8 Jahren hinzugefügt

  • ID dbcf08e9ecb0591f68cc8ee59af7fc8ba9aa62e1
  • Vorgänger a0b8d78b
  • Nachfolger 083aa976

Reapply "country_mode entfernt."

Mit mit neuem Autor neu.

Unterschiede anzeigen:

SL/Controller/Admin.pm
21 21
use Rose::Object::MakeMethods::Generic
22 22
(
23 23
  'scalar --get_set_init' => [ qw(client user group printer db_cfg is_locked
24
                                  all_dateformats all_numberformats all_countrycodes all_countrymodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers
24
                                  all_dateformats all_numberformats all_countrycodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers
25 25
                                  all_dbsources all_used_dbsources all_accounting_methods all_inventory_systems all_profit_determinations all_charts) ],
26 26
);
27 27

  
......
552 552
  return [ map { id => $_, title => $cc{$_} }, sort { $cc{$a} cmp $cc{$b} } keys %cc ];
553 553
}
554 554

  
555
sub init_all_countrymodes {
556
  my %cm = SL::DefaultManager->country_modes;
557
  return [ map { id => $_, title => "$_ ($cm{$_})" }, sort keys %cm ];
558
}
559

  
560 555
#
561 556
# filters
562 557
#
SL/Controller/ClientConfig.pm
30 30
  my ($self, %params) = @_;
31 31

  
32 32
  $::form->{use_templates} = $self->defaults->templates ? 'existing' : 'new';
33
  $::form->{country_mode} = $self->defaults->country_mode;
34 33
  $self->edit_form;
35 34
}
36 35

  
SL/DB/MetaSetup/Default.pm
37 37
  customer_hourly_rate                      => { type => 'numeric', precision => 8, scale => 2 },
38 38
  customer_projects_only_in_sales           => { type => 'boolean', default => 'false', not_null => 1 },
39 39
  customernumber                            => { type => 'text' },
40
  country_mode                              => { type => 'text', default => 'DE', not_null => 1 },
41 40
  datev_check_on_ap_transaction             => { type => 'boolean', default => 'true' },
42 41
  datev_check_on_ar_transaction             => { type => 'boolean', default => 'true' },
43 42
  datev_check_on_gl_transaction             => { type => 'boolean', default => 'true' },
SL/DefaultManager.pm
34 34
  }
35 35
}
36 36

  
37
sub country_modes {
38
  my ($self) = @_;
39
  return (
40
    'CH' => 'Switzerland',
41
    'DE' => 'Germany',
42
  )
43
}
44

  
45 37
sub AUTOLOAD {
46 38
  our $AUTOLOAD;
47 39

  
SL/User.pm
46 46
use SL::Iconv;
47 47
use SL::Inifile;
48 48
use SL::System::InstallationLock;
49
use SL::DefaultManager;
49 50

  
50 51
use strict;
51 52

  
......
291 292
  my $dbupdater = SL::DBUpgrade2->new(form => $form, return_on_error => 1, silent => 1)->parse_dbupdate_controls;
292 293
  # create the tables
293 294
  $dbupdater->process_query($dbh, "sql/lx-office.sql");
294

  
295
  # load chart of accounts
296 295
  $dbupdater->process_query($dbh, "sql/$form->{chart}-chart.sql");
297 296

  
298
  $query = qq|UPDATE defaults SET coa = ?, accounting_method = ?, profit_determination = ?, inventory_system = ?, curr = ?|;
299
  do_query($form, $dbh, $query, map { $form->{$_} } qw(chart accounting_method profit_determination inventory_system defaultcurrency));
297
  $query = qq|UPDATE defaults SET coa = ?|;
298
  do_query($form, $dbh, $query, map { $form->{$_} } qw(chart));
299

  
300
  $dbh->disconnect;
301

  
302
  # update new database
303
  $self->dbupdate2(form => $form, updater => $dbupdater, database => $form->{db}, silent => 1);
304

  
305
  $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
306
    or $form->dberror;
307

  
308
  $query = "SELECT * FROM currencies WHERE name = ?";
309
  my $curr = selectfirst_hashref_query($form, $dbh, $query, $form->{defaultcurrency});
310
  if (!$curr->{id}) {
311
    do_query($form, $dbh, "INSERT INTO currencies (name) VALUES (?)", $form->{defaultcurrency});
312
    $curr = selectfirst_hashref_query($form, $dbh, $query, $form->{defaultcurrency});
313
  }
314

  
315
  $query = qq|UPDATE defaults SET accounting_method = ?, profit_determination = ?, inventory_system = ?, precision = ?, currency_id = ?|;
316
  do_query($form, $dbh, $query,
317
    $form->{accounting_method},
318
    $form->{profit_determination},
319
    $form->{inventory_system},
320
    $form->parse_amount(\%::myconfig, $form->{precision_as_number}),
321
    $curr->{id},
322
  );
300 323

  
301 324
  $dbh->disconnect;
302 325

  
......
424 447

  
425 448
sub get_default_myconfig {
426 449
  my ($self_or_class, %user_config) = @_;
450
  my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
427 451

  
428 452
  return (
429
    countrycode  => 'de',
453
    countrycode  => $defaults->language('de'),
430 454
    css_path     => 'css',      # Needed for menunew, see SL::Layout::Base::get_stylesheet_for_user
431
    dateformat   => 'dd.mm.yy',
432
    numberformat => '1.000,00',
433
    stylesheet   => 'kivitendo.css',
434
    timeformat   => 'hh:mm',
455
    dateformat   => $defaults->dateformat('dd.mm.yy'),
456
    numberformat => $defaults->numberformat('1.000,00'),
457
    stylesheet   => $defaults->stylesheet('kivitendo.css'),
458
    timeformat   => $defaults->timeformat('hh:mm'),
435 459
    %user_config,
436 460
  );
437 461
}
sql/Pg-upgrade2/defaults_add_country_mode.sql
1
-- @tag: defaults_add_country_mode
2
-- @description: adds new column 'country_mode' (ISO-3166) in table defaults used for erp.ini
3
-- @depends: release_3_2_0
4
ALTER TABLE defaults ADD COLUMN country_mode TEXT NOT NULL DEFAULT('DE');
5

  
templates/webpages/admin/create_dataset.html
21 21
   <td>[% L.input_tag('db', FORM.db, class="initial_focus") %]</td>
22 22
  </tr>
23 23

  
24
  <tr>
25
   <th valign="top" align="right" nowrap>[% LxERP.t8('Country') %]</th>
26
   <td>[% L.select_tag('countrymode', SELF.all_countrymodes, title_key="title", default=(FORM.countrymode), onchange='select_country_defaults(this.value)') %]</td>
27
  </tr>
28

  
29 24
  <tr>
30 25
   <td colspan="1"> </td>
31 26
   <td><hr size="1" noshade></td>

Auch abrufbar als: Unified diff