X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/62726dfdf4f763efa65c25fcfe8658d98649c8a8..dec270d227e4e9c199001064f32cef1ef37c4296:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 25ee60262..3440f93fb 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.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. #====================================================================== # # Accounts Payables @@ -39,10 +40,11 @@ use SL::AP; use SL::FU; use SL::IR; use SL::IS; -use SL::PE; use SL::ReportGenerator; use SL::DB::Default; use SL::DB::PurchaseInvoice; +use SL::Webdav; +use SL::Locale::String qw(t8); require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; @@ -88,7 +90,7 @@ sub add { my $form = $main::form; my %myconfig = %main::myconfig; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); $form->{title} = "Add"; @@ -98,6 +100,7 @@ sub add { $form->{initial_transdate} = $form->{transdate}; create_links(dont_save => 1); $form->{transdate} = $form->{initial_transdate}; + &display_form; $main::lxdebug->leave_sub(); @@ -108,7 +111,7 @@ sub edit { my $form = $main::form; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); $form->{title} = "Edit"; @@ -123,8 +126,21 @@ sub display_form { my $form = $main::form; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); + # get all files stored in the webdav folder + if ($form->{invnumber} && $::instance_conf->get_webdav) { + my $webdav = SL::Webdav->new( + type => 'accounts_payable', + number => $form->{invnumber}, + ); + my $webdav_path = $webdav->webdav_path; + my @all_objects = $webdav->get_all_objects; + @{ $form->{WEBDAV} } = map { { name => $_->filename, + type => t8('File'), + link => File::Spec->catfile($_->full_filedescriptor), + } } @all_objects; + } &form_header; &form_footer; @@ -139,13 +155,15 @@ sub create_links { my $form = $main::form; my %myconfig = %main::myconfig; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); $form->create_links("AP", \%myconfig, "vendor"); my %saved; if (!$params{dont_save}) { %saved = map { ($_ => $form->{$_}) } qw(direct_debit taxincluded); $saved{duedate} = $form->{duedate} if $form->{duedate}; + $saved{currency} = $form->{currency} if $form->{currency}; + $saved{taxincluded} = $form->{taxincluded} if $form->{taxincluded}; } IR->get_vendor(\%myconfig, \%$form); @@ -160,6 +178,7 @@ sub create_links { # currencies $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); + $form->{selectcurrency} = ""; map { my $quoted = H($_); $form->{selectcurrency} .= "