+# Reset the $::form field 'salesman_id' to the ID of the currently
+# logged in user. Useful when changing to a customer/vendor that has
+# no salesman listed in their master data.
+sub _reset_salesman_id {
+ my $current_employee = SL::DB::Manager::Employee->current;
+ $::form->{salesman_id} = $current_employee->id if $current_employee && exists $::form->{salesman_id};
+}
+
+sub select_project {
+ $::lxdebug->enter_sub;
+
+ $::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
+
+ my ($is_global, $nextsub) = @_;
+ my $project_list = delete $::form->{project_list};
+
+ map { delete $::form->{$_} } qw(action header update);
+
+ my @hiddens;
+ for my $key (keys %$::form) {
+ next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
+ push @hiddens, { key => $key, value => $::form->{$key} };
+ }
+ push @hiddens, { key => 'is_global', value => $is_global },
+ { key => 'project_selected_nextsub', value => $nextsub };
+
+ $::form->header;
+ print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
+
+ $::lxdebug->leave_sub;
+}
+
+sub project_selected {