Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a0b8d78b

Von Sven Schöling vor fast 9 Jahren hinzugefügt

  • ID a0b8d78b54fc1ff2fc2f0f527ec4c9630444e590
  • Vorgänger a2bab345
  • Nachfolger dbcf08e9

Revert "country_mode entfernt."

Originalcommit: b05b5075ac0f3cbb0823c2f513cdbcacfb17bede.

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_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers
24
                                  all_dateformats all_numberformats all_countrycodes all_countrymodes 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

  
555 560
#
556 561
# filters
557 562
#
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;
33 34
  $self->edit_form;
34 35
}
35 36

  
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 },
40 41
  datev_check_on_ap_transaction             => { type => 'boolean', default => 'true' },
41 42
  datev_check_on_ar_transaction             => { type => 'boolean', default => 'true' },
42 43
  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

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

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

  
51 50
use strict;
52 51

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

  
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 294

  
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
  }
295
  # load chart of accounts
296
  $dbupdater->process_query($dbh, "sql/$form->{chart}-chart.sql");
314 297

  
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
  );
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));
323 300

  
324 301
  $dbh->disconnect;
325 302

  
......
447 424

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

  
452 428
  return (
453
    countrycode  => $defaults->language('de'),
429
    countrycode  => 'de',
454 430
    css_path     => 'css',      # Needed for menunew, see SL::Layout::Base::get_stylesheet_for_user
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'),
431
    dateformat   => 'dd.mm.yy',
432
    numberformat => '1.000,00',
433
    stylesheet   => 'kivitendo.css',
434
    timeformat   => 'hh:mm',
459 435
    %user_config,
460 436
  );
461 437
}
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

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

Auch abrufbar als: Unified diff