# 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.
#======================================================================
#
# Inventory received module
use SL::FU;
use SL::IR;
use SL::IS;
-use SL::PE;
use SL::DB::Default;
use SL::DB::PurchaseInvoice;
use List::Util qw(max sum);
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
"all" => 0,
"old_id" => \@old_project_ids },
- "taxzones" => "ALL_TAXZONES",
+ "taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
"currencies" => "ALL_CURRENCIES",
"vendors" => "ALL_VENDORS",
"departments" => "all_departments",
# follow ups
if ($form->{id}) {
- $form->{follow_ups} = FU->follow_ups('trans_id' => $form->{id}) || [];
+ $form->{follow_ups} = FU->follow_ups('trans_id' => $form->{id}, 'not_done' => 1) || [];
$form->{follow_ups_unfinished} = ( sum map { $_->{due} * 1 } @{ $form->{follow_ups} } ) || 0;
}
}
sub mark_as_paid {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
+ $::auth->assert('vendor_invoice_edit');
- $main::auth->assert('vendor_invoice_edit');
+ SL::DB::PurchaseInvoice->new(id => $::form->{id})->load->mark_as_paid;
- &mark_as_paid_common(\%myconfig,"ap");
+ $::form->redirect($::locale->text("Marked as paid"));
+}
- $main::lxdebug->leave_sub();
+sub show_draft {
+ update();
}
sub update {