Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 97954312

Von Bernd Bleßmann vor etwa 12 Jahren hinzugefügt

  • ID 979543127ce95408792573c99fc7eb09c30448c3
  • Vorgänger 20366719
  • Nachfolger 4b31e6ba

Controller für Mandantenkonfiguration.

Im Moment lässt sich hier die Änderbarkeit für Zahlungen einstellen. Es
sollen demnächst auch noch anderen Konfig-Einstellungen aus der Konfig-Datei
hierher wandern.

Unterschiede anzeigen:

SL/AP.pm
38 38
use SL::DBUtils;
39 39
use SL::IO;
40 40
use SL::MoreCommon;
41

  
41
use SL::DB::Default;
42 42
use Data::Dumper;
43 43

  
44 44
use strict;
......
251 251
  # add paid transactions
252 252
  for my $i (1 .. $form->{paidaccounts}) {
253 253

  
254
    if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
254
    if ($form->{"acc_trans_id_$i"} && $payments_only && (SL::DB::Default->get->payments_changeable == 0)) {
255 255
      next;
256 256
    }
257 257

  
......
593 593
  $old_form = save_form();
594 594

  
595 595
  # Delete all entries in acc_trans from prior payments.
596
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
596
  if (SL::DB::Default->get->payments_changeable != 0) {
597 597
    $self->_delete_payments($form, $dbh);
598 598
  }
599 599

  
SL/AR.pm
39 39
use SL::DBUtils;
40 40
use SL::IO;
41 41
use SL::MoreCommon;
42
use SL::DB::Default;
42 43

  
43 44
use strict;
44 45

  
......
203 204
  # add paid transactions
204 205
  for my $i (1 .. $form->{paidaccounts}) {
205 206

  
206
    if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
207
    if ($form->{"acc_trans_id_$i"} && $payments_only && (SL::DB::Default->get->payments_changeable == 0)) {
207 208
      next;
208 209
    }
209 210

  
......
356 357
  $old_form = save_form();
357 358

  
358 359
  # Delete all entries in acc_trans from prior payments.
359
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
360
  if (SL::DB::Default->get->payments_changeable != 0) {
360 361
    $self->_delete_payments($form, $dbh);
361 362
  }
362 363

  
SL/Controller/ClientConfig.pm
1
package SL::Controller::ClientConfig;
2

  
3
use strict;
4
use parent qw(SL::Controller::Base);
5

  
6
use SL::DB::Default;
7
use SL::Helper::Flash;
8

  
9
__PACKAGE__->run_before('check_auth');
10

  
11

  
12
sub action_edit {
13
  my ($self, %params) = @_;
14

  
15
  $self->{payment_options} = [ { title => $::locale->text("never"), value => 0 },
16
                               { title => $::locale->text("every time"), value => 1 },
17
                               { title => $::locale->text("on the same day"), value => 2 }, ];
18

  
19
  $self->{payments_changeable} = SL::DB::Default->get->payments_changeable;
20

  
21
  $self->render('client_config/form', title => $::locale->text('Client Configuration'));
22
}
23

  
24

  
25
sub action_save {
26
  my ($self, %params) = @_;
27

  
28
  SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable});
29

  
30
  flash_later('info', $::locale->text('Client Configuration saved!'));
31

  
32
  $self->redirect_to(action => 'edit');
33
}
34

  
35

  
36
#################### private stuff ##########################
37

  
38
sub check_auth {
39
  $::auth->assert('admin');
40
}
41

  
42
1;
SL/DB/MetaSetup/Default.pm
47 47
    inventory_system           => { type => 'text' },
48 48
    profit_determination       => { type => 'text' },
49 49
    language_id                => { type => 'integer' },
50
    payments_changeable        => { type => 'integer', default => '0', not_null => 1 },
50 51
  ],
51 52

  
52 53
  primary_key_columns => [ 'id' ],
SL/Form.pm
638 638
  $additional_params->{"conf_parts_image_css"}        = $::lx_office_conf{features}->{parts_image_css};
639 639
  $additional_params->{"conf_parts_listing_images"}   = $::lx_office_conf{features}->{parts_listing_images};
640 640
  $additional_params->{"conf_parts_show_image"}       = $::lx_office_conf{features}->{parts_show_image};
641
  $additional_params->{"conf_payments_changeable"}    = $::lx_office_conf{features}->{payments_changeable};
642 641
  $additional_params->{"INSTANCE_CONF"}               = $::instance_conf;
643 642

  
644 643
  if (my $debug_options = $::lx_office_conf{debug}{options}) {
SL/IR.pm
44 44
use SL::GenericTranslations;
45 45
use SL::IO;
46 46
use SL::MoreCommon;
47
use SL::DB::Default;
47 48
use List::Util qw(min);
48 49

  
49 50
use strict;
......
502 503
  for my $i (1 .. $form->{paidaccounts}) {
503 504
    if ($form->{"acc_trans_id_$i"}
504 505
        && $payments_only
505
        && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
506
        && (SL::DB::Default->get->payments_changeable == 0)) {
506 507
      next;
507 508
    }
508 509

  
......
1437 1438
  $old_form = save_form();
1438 1439

  
1439 1440
  # Delete all entries in acc_trans from prior payments.
1440
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
1441
  if (SL::DB::Default->get->payments_changeable != 0) {
1441 1442
    $self->_delete_payments($form, $dbh);
1442 1443
  }
1443 1444

  
SL/IS.pm
48 48
use SL::IC;
49 49
use SL::IO;
50 50
use SL::TransNumber;
51
use SL::DB::Default;
51 52
use Data::Dumper;
52 53

  
53 54
use strict;
......
886 887

  
887 888
      if ($form->{"acc_trans_id_$i"}
888 889
          && $payments_only
889
          && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
890
          && (SL::DB::Default->get->payments_changeable == 0)) {
890 891
        next;
891 892
      }
892 893

  
......
1157 1158
  $old_form = save_form();
1158 1159

  
1159 1160
  # Delete all entries in acc_trans from prior payments.
1160
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
1161
  if (SL::DB::Default->get->payments_changeable != 0) {
1161 1162
    $self->_delete_payments($form, $dbh);
1162 1163
  }
1163 1164

  
bin/mozilla/ap.pl
40 40
use SL::IS;
41 41
use SL::PE;
42 42
use SL::ReportGenerator;
43
use SL::DB::Default;
43 44

  
44 45
require "bin/mozilla/arap.pl";
45 46
require "bin/mozilla/common.pl";
......
693 694
    print qq|<input type=hidden name="acc_trans_id_$i" value=$form->{"acc_trans_id_$i"}>\n|;
694 695
    print qq|<input type=hidden name="gldate_$i" value=$form->{"gldate_$i"}>\n|;
695 696
    my $changeable = 1;
696
    if ($::lx_office_conf{features}->{payments_changeable} == 0) {
697
    if (SL::DB::Default->get->payments_changeable == 0) {
697 698
      # never
698 699
      $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1;
699 700
    }
700
    if ($::lx_office_conf{features}->{payments_changeable} == 2) {
701
    if (SL::DB::Default->get->payments_changeable == 2) {
701 702
      # on the same day
702 703
      $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"});
703 704
    }
bin/mozilla/ar.pl
38 38
use SL::FU;
39 39
use SL::IS;
40 40
use SL::PE;
41
use SL::DB::Default;
41 42
use SL::ReportGenerator;
42 43

  
43 44
require "bin/mozilla/arap.pl";
......
421 422

  
422 423

  
423 424
    $payment->{changeable} =
424
        $::lx_office_conf{features}->{payments_changeable} == 0 ? !$payment->{acc_trans_id} # never
425
      : $::lx_office_conf{features}->{payments_changeable} == 2 ? $payment->{gldate} eq '' || $payment->{gldate} eq $now
425
        SL::DB::Default->get->payments_changeable == 0 ? !$payment->{acc_trans_id} # never
426
      : SL::DB::Default->get->payments_changeable == 2 ? $payment->{gldate} eq '' || $payment->{gldate} eq $now
426 427
      :                                                           1;
427 428

  
428 429
    push @payments, $payment;
bin/mozilla/ir.pl
35 35
use SL::IR;
36 36
use SL::IS;
37 37
use SL::PE;
38
use SL::DB::Default;
38 39
use List::Util qw(max sum);
39 40

  
40 41
require "bin/mozilla/io.pl";
......
415 416

  
416 417
  for my $i (1 .. $form->{paidaccounts}) {
417 418
    $form->{"changeable_$i"} = 1;
418
    if ($::lx_office_conf{features}->{payments_changeable} == 0) {
419
    if (SL::DB::Default->get->payments_changeable == 0) {
419 420
      # never
420 421
      $form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
421
    } elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
422
    } elsif (SL::DB::Default->get->payments_changeable == 2) {
422 423
      # on the same day
423 424
      $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
424 425
                                  ($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
bin/mozilla/is.pl
35 35
use SL::IS;
36 36
use SL::PE;
37 37
use SL::OE;
38
use SL::DB::Default;
38 39
use Data::Dumper;
39 40
use List::Util qw(max sum);
40 41

  
......
444 445

  
445 446
  for my $i (1 .. $form->{paidaccounts}) {
446 447
    $form->{"changeable_$i"} = 1;
447
    if ($::lx_office_conf{features}->{payments_changeable} == 0) {
448
    if (SL::DB::Default->get->payments_changeable == 0) {
448 449
      # never
449 450
      $form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
450
    } elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
451
    } elsif (SL::DB::Default->get->payments_changeable == 2) {
451 452
      # on the same day
452 453
      $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
453 454
                                  ($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
config/kivitendo.conf.default
93 93
# Show the picture in the results when you search for parts
94 94
parts_listing_images = 0
95 95

  
96
# Should payments be changeable after posting (0 = never; 1 = every time; 2 = on the same day)
97
payments_changeable = 0
98

  
99 96
[paths]
100 97
# path to temporary files (must be writeable by the web server)
101 98
userspath = users
locale/de/all
406 406
  'Cleared Balance'             => 'abgeschlossen',
407 407
  'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
408 408
  'Click on login name to edit!' => 'Zum Bearbeiten den Benutzernamen anklicken!',
409
  'Client Configuration'        => 'Mandantenkonfiguration',
410
  'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
409 411
  'Close'                       => 'Übernehmen',
410 412
  'Close Books up to'           => 'Die Bücher abschließen bis zum',
411 413
  'Close Dialog'                => 'Schließen',
......
1369 1371
  'Payment terms (database ID)' => 'Zahlungsbedingungen (Datenbank-ID)',
1370 1372
  'Payment terms (name)'        => 'Zahlungsbedingungen (Name)',
1371 1373
  'Payments'                    => 'Zahlungsausgänge',
1374
  'Payments Changeable'         => 'Änderbarkeit von Zahlungen',
1372 1375
  'Per. Inv.'                   => 'Wied. Rech.',
1373 1376
  'Period'                      => 'Zeitraum',
1374 1377
  'Period:'                     => 'Zeitraum:',
......
1417 1420
  'Post'                        => 'Buchen',
1418 1421
  'Post Payment'                => 'Zahlung buchen',
1419 1422
  'Post payments'               => 'Zahlungen buchen',
1423
  'Posting Configuration'       => 'Buchungskonfiguration',
1420 1424
  'Postscript'                  => 'Postscript',
1421 1425
  'Posustva_coa'                => 'USTVA Kennz.',
1422 1426
  'Preferences'                 => 'Einstellungen',
......
1681 1685
  'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.',
1682 1686
  'Shopartikel'                 => 'Shopartikel',
1683 1687
  'Short'                       => 'Knapp',
1688
  'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?',
1684 1689
  'Show'                        => 'Zeigen',
1685 1690
  'Show Filter'                 => 'Filter zeigen',
1686 1691
  'Show Salesman'               => 'Verkäufer anzeigen',
......
2285 2290
  'ea'                          => 'St.',
2286 2291
  'emailed to'                  => 'gemailt an',
2287 2292
  'empty'                       => 'leer',
2293
  'every time'                  => 'immer',
2288 2294
  'executed'                    => 'ausgeführt',
2289 2295
  'failed'                      => 'fehlgeschlagen',
2290 2296
  'female'                      => 'weiblich',
......
2343 2349
  'number'                      => 'Nummer',
2344 2350
  'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen',
2345 2351
  'one-time execution'          => 'einmalige Ausführung',
2352
  'on the same day'             => 'am selben Tag',
2346 2353
  'only OB Transactions'        => 'nur EB-Buchungen',
2347 2354
  'open'                        => 'Offen',
2348 2355
  'order'                       => 'Reihenfolge',
locale/de_DE/all
397 397
  'Cleared Balance'             => 'abgeschlossen',
398 398
  'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
399 399
  'Click on login name to edit!' => 'Zum Bearbeiten den Benutzernamen anklicken!',
400
  'Client Configuration'        => 'Mandantenkonfiguration',
401
  'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
400 402
  'Close'                       => 'Übernehmen',
401 403
  'Close Books up to'           => 'Die Bücher abschließen bis zum',
402 404
  'Close Dialog'                => 'Schließen',
......
1333 1335
  'Payment terms (database ID)' => 'Zahlungsbedingungen (Datenbank-ID)',
1334 1336
  'Payment terms (name)'        => 'Zahlungsbedingungen (Name)',
1335 1337
  'Payments'                    => 'Zahlungsausgänge',
1338
  'Payments Changeable'         => 'Änderbarkeit von Zahlungen',
1336 1339
  'Per. Inv.'                   => 'Wied. Rech.',
1337 1340
  'Period'                      => 'Zeitraum',
1338 1341
  'Period:'                     => 'Zeitraum:',
......
1381 1384
  'Post'                        => 'Buchen',
1382 1385
  'Post Payment'                => 'Zahlung buchen',
1383 1386
  'Post payments'               => 'Zahlungen buchen',
1387
  'Posting Configuration'       => 'Buchungskonfiguration',
1384 1388
  'Postscript'                  => 'Postscript',
1385 1389
  'Posustva_coa'                => 'USTVA Kennz.',
1386 1390
  'Preferences'                 => 'Einstellungen',
......
1636 1640
  'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.',
1637 1641
  'Shopartikel'                 => 'Shopartikel',
1638 1642
  'Short'                       => 'Knapp',
1643
  'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?',
1639 1644
  'Show'                        => 'Zeigen',
1640 1645
  'Show Salesman'               => 'Verkäufer anzeigen',
1641 1646
  'Show TODO list'              => 'Meine Aufgaben',
......
2209 2214
  'eMail?'                      => 'eMail?',
2210 2215
  'ea'                          => 'St.',
2211 2216
  'emailed to'                  => 'gemailt an',
2217
  'every time'                  => 'immer',
2212 2218
  'executed'                    => 'ausgeführt',
2213 2219
  'female'                      => 'weiblich',
2214 2220
  'follow_up_list'              => 'wiedervorlageliste',
......
2250 2256
  'not yet executed'            => 'Noch nicht ausgeführt',
2251 2257
  'number'                      => 'Nummer',
2252 2258
  'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen',
2259
  'on the same day'             => 'am selben Tag',
2253 2260
  'only OB Transactions'        => 'nur EB-Buchungen',
2254 2261
  'open'                        => 'Offen',
2255 2262
  'order'                       => 'Reihenfolge',
locale/en/all
398 398
  'Cleared Balance'             => '',
399 399
  'Clearing Tax Received (No 71)' => '',
400 400
  'Click on login name to edit!' => '',
401
  'Client Configuration'        => '',
402
  'Client Configuration saved!' => '',
401 403
  'Close'                       => '',
402 404
  'Close Books up to'           => '',
403 405
  'Close Dialog'                => '',
......
1349 1351
  'Payment terms (database ID)' => '',
1350 1352
  'Payment terms (name)'        => '',
1351 1353
  'Payments'                    => '',
1354
  'Payments Changeable'         => '',
1352 1355
  'Per. Inv.'                   => '',
1353 1356
  'Period'                      => '',
1354 1357
  'Period:'                     => '',
......
1397 1400
  'Post'                        => '',
1398 1401
  'Post Payment'                => '',
1399 1402
  'Post payments'               => '',
1403
  'Posting Configuration'       => '',
1400 1404
  'Postscript'                  => '',
1401 1405
  'Posustva_coa'                => '',
1402 1406
  'Preferences'                 => '',
......
1658 1662
  'Shipto is in use and was flagged invalid.' => '',
1659 1663
  'Shopartikel'                 => '',
1660 1664
  'Short'                       => '',
1665
  'Should payments be and when should they be changeable after posting?' => '',
1661 1666
  'Show'                        => '',
1662 1667
  'Show Filter'                 => '',
1663 1668
  'Show Salesman'               => '',
......
2238 2243
  'ea'                          => '',
2239 2244
  'emailed to'                  => '',
2240 2245
  'empty'                       => '',
2246
  'every time'                  => '',
2241 2247
  'executed'                    => '',
2242 2248
  'female'                      => '',
2243 2249
  'follow_up_list'              => '',
......
2273 2279
  'missing'                     => '',
2274 2280
  'month'                       => '',
2275 2281
  'monthly'                     => '',
2282
  'never'                       => '',
2276 2283
  'new Window'                  => '',
2277 2284
  'next'                        => '',
2278 2285
  'no'                          => '',
......
2288 2295
  'not yet executed'            => '',
2289 2296
  'number'                      => '',
2290 2297
  'oe.pl::search called with unknown type' => '',
2298
  'on the same day'             => '',
2291 2299
  'only OB Transactions'        => '',
2292 2300
  'open'                        => '',
2293 2301
  'order'                       => '',
menu.ini
824 824
module=am.pl
825 825
action=show_history_search
826 826

  
827
[System--Client Configuration]
828
ACCESS=admin
829
module=controller.pl
830
action=ClientConfig/edit
831

  
827 832
[System--Employees]
828 833
ACCESS=admin
829 834
module=controller.pl
sql/Pg-upgrade2/defaults_posting_config.pl
1
# @tag: defaults_posting_config
2
# @description: Einstellung, ob und wann Zahlungen änderbar sind, vom Config-File in die DB verlagern.
3
# @depends: release_2_7_0
4
# @charset: utf-8
5

  
6
use utf8;
7
use strict;
8

  
9
die("This script cannot be run from the command line.") unless ($main::form);
10

  
11
sub mydberror {
12
  my ($msg) = @_;
13
  die($dbup_locale->text("Database update error:") .
14
      "<br>$msg<br>" . $DBI::errstr);
15
}
16

  
17
sub do_query {
18
  my ($query, $may_fail) = @_;
19

  
20
  if (!$dbh->do($query)) {
21
    mydberror($query) unless ($may_fail);
22
    $dbh->rollback();
23
    $dbh->begin_work();
24
  }
25
}
26

  
27
sub do_update {
28

  
29
  # this query will fail if column already exist (new database)
30
  do_query(qq|ALTER TABLE defaults ADD COLUMN payments_changeable integer NOT NULL DEFAULT 0|, 1);
31

  
32
  # check current configuration and set default variables accordingly, so that
33
  # Lx-Office behaviour isn't changed by this update
34
  # if payments_changeable is not set in config set it to 0
35
  my $payments_changeable = 0;
36
  if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
37
    $payments_changeable = 1;
38
  } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
39
    $payments_changeable = 2;
40
  }
41

  
42
  my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
43
  do_query($update_column);
44

  
45
  return 1;
46
}
47

  
48
return do_update();
49

  
templates/webpages/client_config/form.html
1
[%- USE T8 %][%- USE L %][% USE LxERP %]
2

  
3
<h1>[% title | html %]</h1>
4

  
5
[% PROCESS 'common/flash.html' %]
6

  
7
<form action='controller.pl' method='POST'>
8

  
9
<table>
10
 <tr class='listheading'>
11
   <th colspan="3">[% 'Posting Configuration' | $T8 %]</th>
12
 </tr>
13
 <tr>
14
   <td align="right">[% 'Payments Changeable' | $T8 %]</td>
15
   <td>[% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %]</td>
16
   <td>[% 'Should payments be and when should they be changeable after posting?' | $T8 %]</td>
17
 </tr>
18
</table>
19

  
20
<br>
21

  
22
[%- L.hidden_tag('action',  'ClientConfig/dispatch')  %]
23
[%- L.submit_tag('action_save',  LxERP.t8('Save'))  %]
24

  
25
</form>

Auch abrufbar als: Unified diff