X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/935b8083e67fa9b2871ae0f6a3ea5b8ca1661172..1b9a64fa292f375c82b4af788d0606354bc4e8ff:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 7b16657e5..00ab61801 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 @@ -32,7 +33,8 @@ #====================================================================== use POSIX qw(strftime); -use List::Util qw(sum); +use List::Util qw(max sum); +use List::UtilsBy qw(sort_by); use SL::AP; use SL::FU; @@ -41,10 +43,10 @@ use SL::IS; use SL::PE; use SL::ReportGenerator; use SL::DB::Default; +use SL::DB::PurchaseInvoice; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; -require "bin/mozilla/drafts.pl"; require "bin/mozilla/reportgenerator.pl"; use strict; @@ -87,13 +89,11 @@ sub add { my $form = $main::form; my %myconfig = %main::myconfig; - $main::auth->assert('general_ledger'); - - return $main::lxdebug->leave_sub() if (load_draft_maybe()); + $main::auth->assert('ap_transactions'); $form->{title} = "Add"; - $form->{callback} = "ap.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback}; + $form->{callback} = "ap.pl?action=add" unless $form->{callback}; AP->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; @@ -109,7 +109,7 @@ sub edit { my $form = $main::form; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); $form->{title} = "Edit"; @@ -124,7 +124,7 @@ sub display_form { my $form = $main::form; - $main::auth->assert('general_ledger'); + $main::auth->assert('ap_transactions'); &form_header; &form_footer; @@ -140,13 +140,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); @@ -161,6 +163,7 @@ sub create_links { # currencies $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); + $form->{selectcurrency} = ""; map { my $quoted = H($_); $form->{selectcurrency} .= "