Skip to content

Commit

Permalink
Use correct getter
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Jul 10, 2024
1 parent f269499 commit 50ae07f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/org/openpsa/expenses/handler/hours/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ private function parse_input(ParameterBag $input, string $action) : int|bool
if ($action == 'invoiceable') {
return $input->getBoolean('value');
}
if ($selection = $input->get('selection')) {
if ($selection = $input->all('selection')) {
return (int) array_pop($selection);
}

return 0;
}
}
18 changes: 18 additions & 0 deletions test/org/openpsa/expenses/handler/hours/adminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,22 @@ public function testHandler_hours_create_invoice()

midcom::get()->auth->drop_sudo();
}

public function testHandler_hours_batch()
{
midcom::get()->auth->request_sudo('org.openpsa.expenses');

$data = $this->run_handler('org.openpsa.expenses', ['hours', 'task', 'batch']);
$this->assertEquals('hours_task_action', $data['handler_id']);

$invoice = $this->create_object(\org_openpsa_invoices_invoice_dba::class);
$_POST = [
'action' => 'invoice',
'entries' => [self::$_report->id],
'selection' => [$invoice->id]
];
$this->run_handler('org.openpsa.expenses', ['hours', 'task', 'batch']);

midcom::get()->auth->drop_sudo();
}
}

0 comments on commit 50ae07f

Please sign in to comment.