X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e0f5deeae4cdcf3faf3bc68a202f20ec6cd9af2e..b166ba3bdc7dbc69b5be36501905508fd3dce242:/bin/mozilla/gl.pl diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 42ac4a008..2c5f74a7e 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -24,7 +24,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Genereal Ledger @@ -40,9 +41,10 @@ use List::Util qw(sum); use SL::FU; use SL::GL; use SL::IS; -use SL::PE; use SL::ReportGenerator; use SL::DBUtils qw(selectrow_query selectall_hashref_query); +use SL::Webdav; +use SL::Locale::String qw(t8); require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -200,6 +202,18 @@ sub edit { $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details}; + if ($form->{reference} && $::instance_conf->get_webdav) { + my $webdav = SL::Webdav->new( + type => 'general_ledger', + number => $form->{reference}, + ); + my $webdav_path = $webdav->webdav_path; + my @all_objects = $webdav->get_all_objects; + @{ $form->{WEBDAV} } = map { { name => $_->filename, + type => t8('File'), + link => File::Spec->catdir($webdav_path, $_->filename), + } } @all_objects; + } form_header(); display_rows(); form_footer(); @@ -210,7 +224,7 @@ sub edit { sub search { $::lxdebug->enter_sub; - $::auth->assert('gl_transactions'); + $::auth->assert('general_ledger | gl_transactions'); $::form->all_departments(\%::myconfig); $::form->get_lists( @@ -249,7 +263,7 @@ sub create_subtotal_row { sub generate_report { $main::lxdebug->enter_sub(); - $main::auth->assert('gl_transactions'); + $main::auth->assert('general_ledger | gl_transactions'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -510,6 +524,12 @@ sub generate_report { $main::lxdebug->leave_sub(); } +sub show_draft { + $::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate}; + $::form->{gldate} = $::form->{transdate} if !$::form->{gldate}; + update(); +} + sub update { $main::lxdebug->enter_sub(); @@ -1162,6 +1182,11 @@ sub post { $form->{storno} = 0; post_transaction(); + if ($::instance_conf->get_webdav) { + SL::Webdav->new(type => 'general_ledger', + number => $form->{reference}, + )->webdav_path; + } $form->{callback} = build_std_url("action=add", "show_details"); $form->redirect($form->{callback});