1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29 #======================================================================
31 # common routines for gl, ar, ap, is, ir, oe
36 # any custom scripts for this one
37 if (-f "bin/mozilla/custom_arap.pl") {
38 eval { require "bin/mozilla/custom_arap.pl"; };
40 if (-f "bin/mozilla/$::myconfig{login}_arap.pl") {
41 eval { require "bin/mozilla/$::myconfig{login}_arap.pl"; };
46 require "bin/mozilla/common.pl";
51 $::lxdebug->enter_sub;
53 $::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
54 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
56 my ($is_global, $nextsub) = @_;
57 my $project_list = delete $::form->{project_list};
59 map { delete $::form->{$_} } qw(action header update);
62 for my $key (keys %$::form) {
63 next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
64 push @hiddens, { key => $key, value => $::form->{$key} };
66 push @hiddens, { key => 'is_global', value => $is_global },
67 { key => 'project_selected_nextsub', value => $nextsub };
70 print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
72 $::lxdebug->leave_sub;
75 sub project_selected {
76 $main::lxdebug->enter_sub();
78 my $form = $main::form;
80 $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
81 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
83 # replace the variable with the one checked
88 my $prefix = $form->{"is_global"} ? "global" : "";
89 my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
91 $form->{"${prefix}projectnumber${suffix}"} =
92 $form->{"new_projectnumber_$i"};
93 $form->{"old${prefix}projectnumber${suffix}"} =
94 $form->{"new_projectnumber_$i"};
95 $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"};
97 # delete all the new_ variables
98 for $i (1 .. $form->{lastndx}) {
99 map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description);
102 my $nextsub = $form->{project_selected_nextsub} || 'update';
104 map { delete $form->{$_} } qw(ndx lastndx nextsub is_global project_selected_nextsub);
108 $main::lxdebug->leave_sub();
111 sub continue { call_sub($main::form->{"nextsub"}); }
119 arap.pl - helper functions or customer/vendor retrieval
127 Don't use anyting in this file without extreme care, and even then be prepared for massive headaches.
129 It's a collection of helper routines that wrap the customer/vendor dropdown/textfield duality into something even complexer.