'That bulk action isn\'t one your role can use.'])); } [$label, $icon, $about, $button] = $actions[$action]; $set = (string) ($_GET['set'] ?? ''); $invoice_ids = invoiceBulkRecall($set); if (!$invoice_ids) { exit(json_encode(['error' => 'The invoices ticked have been forgotten - tick them again.'])); } $plan = invoiceBulkPlan($action, $invoice_ids); $do = count($plan['do']); $skip = count($plan['skip']); $shown = 40; // What Mark Paid takes in, by currency $owed = []; foreach ($plan['do'] as $row) { $owed[$row['invoice_currency_code']] = ($owed[$row['invoice_currency_code']] ?? 0) + $row['balance_cents']; } $owed_text = implode(', ', array_map(function ($currency, $cents) { return billingMoney($cents / 100, $currency); }, array_keys($owed), $owed)); ob_start(); ?>