Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 97954312

Von Bernd Bleßmann vor mehr als 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
use SL::DBUtils;
use SL::IO;
use SL::MoreCommon;
use SL::DB::Default;
use Data::Dumper;
use strict;
......
# add paid transactions
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
if ($form->{"acc_trans_id_$i"} && $payments_only && (SL::DB::Default->get->payments_changeable == 0)) {
next;
}
......
$old_form = save_form();
# Delete all entries in acc_trans from prior payments.
if ($::lx_office_conf{features}->{payments_changeable} != 0) {
if (SL::DB::Default->get->payments_changeable != 0) {
$self->_delete_payments($form, $dbh);
}
SL/AR.pm
use SL::DBUtils;
use SL::IO;
use SL::MoreCommon;
use SL::DB::Default;
use strict;
......
# add paid transactions
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
if ($form->{"acc_trans_id_$i"} && $payments_only && (SL::DB::Default->get->payments_changeable == 0)) {
next;
}
......
$old_form = save_form();
# Delete all entries in acc_trans from prior payments.
if ($::lx_office_conf{features}->{payments_changeable} != 0) {
if (SL::DB::Default->get->payments_changeable != 0) {
$self->_delete_payments($form, $dbh);
}
SL/Controller/ClientConfig.pm
package SL::Controller::ClientConfig;
use strict;
use parent qw(SL::Controller::Base);
use SL::DB::Default;
use SL::Helper::Flash;
__PACKAGE__->run_before('check_auth');
sub action_edit {
my ($self, %params) = @_;
$self->{payment_options} = [ { title => $::locale->text("never"), value => 0 },
{ title => $::locale->text("every time"), value => 1 },
{ title => $::locale->text("on the same day"), value => 2 }, ];
$self->{payments_changeable} = SL::DB::Default->get->payments_changeable;
$self->render('client_config/form', title => $::locale->text('Client Configuration'));
}
sub action_save {
my ($self, %params) = @_;
SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable});
flash_later('info', $::locale->text('Client Configuration saved!'));
$self->redirect_to(action => 'edit');
}
#################### private stuff ##########################
sub check_auth {
$::auth->assert('admin');
}
1;
SL/DB/MetaSetup/Default.pm
inventory_system => { type => 'text' },
profit_determination => { type => 'text' },
language_id => { type => 'integer' },
payments_changeable => { type => 'integer', default => '0', not_null => 1 },
],
primary_key_columns => [ 'id' ],
SL/Form.pm
$additional_params->{"conf_parts_image_css"} = $::lx_office_conf{features}->{parts_image_css};
$additional_params->{"conf_parts_listing_images"} = $::lx_office_conf{features}->{parts_listing_images};
$additional_params->{"conf_parts_show_image"} = $::lx_office_conf{features}->{parts_show_image};
$additional_params->{"conf_payments_changeable"} = $::lx_office_conf{features}->{payments_changeable};
$additional_params->{"INSTANCE_CONF"} = $::instance_conf;
if (my $debug_options = $::lx_office_conf{debug}{options}) {
SL/IR.pm
use SL::GenericTranslations;
use SL::IO;
use SL::MoreCommon;
use SL::DB::Default;
use List::Util qw(min);
use strict;
......
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"acc_trans_id_$i"}
&& $payments_only
&& ($::lx_office_conf{features}->{payments_changeable} == 0)) {
&& (SL::DB::Default->get->payments_changeable == 0)) {
next;
}
......
$old_form = save_form();
# Delete all entries in acc_trans from prior payments.
if ($::lx_office_conf{features}->{payments_changeable} != 0) {
if (SL::DB::Default->get->payments_changeable != 0) {
$self->_delete_payments($form, $dbh);
}
SL/IS.pm
use SL::IC;
use SL::IO;
use SL::TransNumber;
use SL::DB::Default;
use Data::Dumper;
use strict;
......
if ($form->{"acc_trans_id_$i"}
&& $payments_only
&& ($::lx_office_conf{features}->{payments_changeable} == 0)) {
&& (SL::DB::Default->get->payments_changeable == 0)) {
next;
}
......
$old_form = save_form();
# Delete all entries in acc_trans from prior payments.
if ($::lx_office_conf{features}->{payments_changeable} != 0) {
if (SL::DB::Default->get->payments_changeable != 0) {
$self->_delete_payments($form, $dbh);
}
bin/mozilla/ap.pl
use SL::IS;
use SL::PE;
use SL::ReportGenerator;
use SL::DB::Default;
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
......
print qq|<input type=hidden name="acc_trans_id_$i" value=$form->{"acc_trans_id_$i"}>\n|;
print qq|<input type=hidden name="gldate_$i" value=$form->{"gldate_$i"}>\n|;
my $changeable = 1;
if ($::lx_office_conf{features}->{payments_changeable} == 0) {
if (SL::DB::Default->get->payments_changeable == 0) {
# never
$changeable = ($form->{"acc_trans_id_$i"})? 0 : 1;
}
if ($::lx_office_conf{features}->{payments_changeable} == 2) {
if (SL::DB::Default->get->payments_changeable == 2) {
# on the same day
$changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"});
}
bin/mozilla/ar.pl
use SL::FU;
use SL::IS;
use SL::PE;
use SL::DB::Default;
use SL::ReportGenerator;
require "bin/mozilla/arap.pl";
......
$payment->{changeable} =
$::lx_office_conf{features}->{payments_changeable} == 0 ? !$payment->{acc_trans_id} # never
: $::lx_office_conf{features}->{payments_changeable} == 2 ? $payment->{gldate} eq '' || $payment->{gldate} eq $now
SL::DB::Default->get->payments_changeable == 0 ? !$payment->{acc_trans_id} # never
: SL::DB::Default->get->payments_changeable == 2 ? $payment->{gldate} eq '' || $payment->{gldate} eq $now
: 1;
push @payments, $payment;
bin/mozilla/ir.pl
use SL::IR;
use SL::IS;
use SL::PE;
use SL::DB::Default;
use List::Util qw(max sum);
require "bin/mozilla/io.pl";
......
for my $i (1 .. $form->{paidaccounts}) {
$form->{"changeable_$i"} = 1;
if ($::lx_office_conf{features}->{payments_changeable} == 0) {
if (SL::DB::Default->get->payments_changeable == 0) {
# never
$form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
} elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
} elsif (SL::DB::Default->get->payments_changeable == 2) {
# on the same day
$form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
bin/mozilla/is.pl
use SL::IS;
use SL::PE;
use SL::OE;
use SL::DB::Default;
use Data::Dumper;
use List::Util qw(max sum);
......
for my $i (1 .. $form->{paidaccounts}) {
$form->{"changeable_$i"} = 1;
if ($::lx_office_conf{features}->{payments_changeable} == 0) {
if (SL::DB::Default->get->payments_changeable == 0) {
# never
$form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
} elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
} elsif (SL::DB::Default->get->payments_changeable == 2) {
# on the same day
$form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') ||
($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
config/kivitendo.conf.default
# Show the picture in the results when you search for parts
parts_listing_images = 0
# Should payments be changeable after posting (0 = never; 1 = every time; 2 = on the same day)
payments_changeable = 0
[paths]
# path to temporary files (must be writeable by the web server)
userspath = users
locale/de/all
'Cleared Balance' => 'abgeschlossen',
'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
'Click on login name to edit!' => 'Zum Bearbeiten den Benutzernamen anklicken!',
'Client Configuration' => 'Mandantenkonfiguration',
'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
'Close' => 'Übernehmen',
'Close Books up to' => 'Die Bücher abschließen bis zum',
'Close Dialog' => 'Schließen',
......
'Payment terms (database ID)' => 'Zahlungsbedingungen (Datenbank-ID)',
'Payment terms (name)' => 'Zahlungsbedingungen (Name)',
'Payments' => 'Zahlungsausgänge',
'Payments Changeable' => 'Änderbarkeit von Zahlungen',
'Per. Inv.' => 'Wied. Rech.',
'Period' => 'Zeitraum',
'Period:' => 'Zeitraum:',
......
'Post' => 'Buchen',
'Post Payment' => 'Zahlung buchen',
'Post payments' => 'Zahlungen buchen',
'Posting Configuration' => 'Buchungskonfiguration',
'Postscript' => 'Postscript',
'Posustva_coa' => 'USTVA Kennz.',
'Preferences' => 'Einstellungen',
......
'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.',
'Shopartikel' => 'Shopartikel',
'Short' => 'Knapp',
'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?',
'Show' => 'Zeigen',
'Show Filter' => 'Filter zeigen',
'Show Salesman' => 'Verkäufer anzeigen',
......
'ea' => 'St.',
'emailed to' => 'gemailt an',
'empty' => 'leer',
'every time' => 'immer',
'executed' => 'ausgeführt',
'failed' => 'fehlgeschlagen',
'female' => 'weiblich',
......
'number' => 'Nummer',
'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen',
'one-time execution' => 'einmalige Ausführung',
'on the same day' => 'am selben Tag',
'only OB Transactions' => 'nur EB-Buchungen',
'open' => 'Offen',
'order' => 'Reihenfolge',
locale/de_DE/all
'Cleared Balance' => 'abgeschlossen',
'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
'Click on login name to edit!' => 'Zum Bearbeiten den Benutzernamen anklicken!',
'Client Configuration' => 'Mandantenkonfiguration',
'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
'Close' => 'Übernehmen',
'Close Books up to' => 'Die Bücher abschließen bis zum',
'Close Dialog' => 'Schließen',
......
'Payment terms (database ID)' => 'Zahlungsbedingungen (Datenbank-ID)',
'Payment terms (name)' => 'Zahlungsbedingungen (Name)',
'Payments' => 'Zahlungsausgänge',
'Payments Changeable' => 'Änderbarkeit von Zahlungen',
'Per. Inv.' => 'Wied. Rech.',
'Period' => 'Zeitraum',
'Period:' => 'Zeitraum:',
......
'Post' => 'Buchen',
'Post Payment' => 'Zahlung buchen',
'Post payments' => 'Zahlungen buchen',
'Posting Configuration' => 'Buchungskonfiguration',
'Postscript' => 'Postscript',
'Posustva_coa' => 'USTVA Kennz.',
'Preferences' => 'Einstellungen',
......
'Shipto is in use and was flagged invalid.' => 'Lieferadresse ist noch in Verwendung, und wurde als ungültig markiert.',
'Shopartikel' => 'Shopartikel',
'Short' => 'Knapp',
'Should payments be and when should they be changeable after posting?' => 'Sollen Zahlungen nach dem Buchen änderbar sein, und wenn ja, wann?',
'Show' => 'Zeigen',
'Show Salesman' => 'Verkäufer anzeigen',
'Show TODO list' => 'Meine Aufgaben',
......
'eMail?' => 'eMail?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
'every time' => 'immer',
'executed' => 'ausgeführt',
'female' => 'weiblich',
'follow_up_list' => 'wiedervorlageliste',
......
'not yet executed' => 'Noch nicht ausgeführt',
'number' => 'Nummer',
'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen',
'on the same day' => 'am selben Tag',
'only OB Transactions' => 'nur EB-Buchungen',
'open' => 'Offen',
'order' => 'Reihenfolge',
locale/en/all
'Cleared Balance' => '',
'Clearing Tax Received (No 71)' => '',
'Click on login name to edit!' => '',
'Client Configuration' => '',
'Client Configuration saved!' => '',
'Close' => '',
'Close Books up to' => '',
'Close Dialog' => '',
......
'Payment terms (database ID)' => '',
'Payment terms (name)' => '',
'Payments' => '',
'Payments Changeable' => '',
'Per. Inv.' => '',
'Period' => '',
'Period:' => '',
......
'Post' => '',
'Post Payment' => '',
'Post payments' => '',
'Posting Configuration' => '',
'Postscript' => '',
'Posustva_coa' => '',
'Preferences' => '',
......
'Shipto is in use and was flagged invalid.' => '',
'Shopartikel' => '',
'Short' => '',
'Should payments be and when should they be changeable after posting?' => '',
'Show' => '',
'Show Filter' => '',
'Show Salesman' => '',
......
'ea' => '',
'emailed to' => '',
'empty' => '',
'every time' => '',
'executed' => '',
'female' => '',
'follow_up_list' => '',
......
'missing' => '',
'month' => '',
'monthly' => '',
'never' => '',
'new Window' => '',
'next' => '',
'no' => '',
......
'not yet executed' => '',
'number' => '',
'oe.pl::search called with unknown type' => '',
'on the same day' => '',
'only OB Transactions' => '',
'open' => '',
'order' => '',
menu.ini
module=am.pl
action=show_history_search
[System--Client Configuration]
ACCESS=admin
module=controller.pl
action=ClientConfig/edit
[System--Employees]
ACCESS=admin
module=controller.pl
sql/Pg-upgrade2/defaults_posting_config.pl
# @tag: defaults_posting_config
# @description: Einstellung, ob und wann Zahlungen änderbar sind, vom Config-File in die DB verlagern.
# @depends: release_2_7_0
# @charset: utf-8
use utf8;
use strict;
die("This script cannot be run from the command line.") unless ($main::form);
sub mydberror {
my ($msg) = @_;
die($dbup_locale->text("Database update error:") .
"<br>$msg<br>" . $DBI::errstr);
}
sub do_query {
my ($query, $may_fail) = @_;
if (!$dbh->do($query)) {
mydberror($query) unless ($may_fail);
$dbh->rollback();
$dbh->begin_work();
}
}
sub do_update {
# this query will fail if column already exist (new database)
do_query(qq|ALTER TABLE defaults ADD COLUMN payments_changeable integer NOT NULL DEFAULT 0|, 1);
# check current configuration and set default variables accordingly, so that
# Lx-Office behaviour isn't changed by this update
# if payments_changeable is not set in config set it to 0
my $payments_changeable = 0;
if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
$payments_changeable = 1;
} elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
$payments_changeable = 2;
}
my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
do_query($update_column);
return 1;
}
return do_update();
templates/webpages/client_config/form.html
[%- USE T8 %][%- USE L %][% USE LxERP %]
<h1>[% title | html %]</h1>
[% PROCESS 'common/flash.html' %]
<form action='controller.pl' method='POST'>
<table>
<tr class='listheading'>
<th colspan="3">[% 'Posting Configuration' | $T8 %]</th>
</tr>
<tr>
<td align="right">[% 'Payments Changeable' | $T8 %]</td>
<td>[% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %]</td>
<td>[% 'Should payments be and when should they be changeable after posting?' | $T8 %]</td>
</tr>
</table>
<br>
[%- L.hidden_tag('action', 'ClientConfig/dispatch') %]
[%- L.submit_tag('action_save', LxERP.t8('Save')) %]
</form>

Auch abrufbar als: Unified diff