1) { exit(json_encode(['error' => 'Those were paid by ' . count($agents) . ' different agents - tick one agent\'s expenses at a time.'])); } $user_id = $agents ? intval(array_key_first($agents)) : 0; } $agent = $user_id ? (expenseToReimburse($user_id)[$user_id] ?? null) : null; if (!$agent) { exit(json_encode(['error' => $picked ? 'None of those are waiting to be paid back - they were paid from an account, or paid back already.' : 'Nothing is waiting to be paid back to them.'])); } $accounts = paymentAccounts(); $methods = paymentMethods('out'); $default_account = intval($config_default_expense_account); $currency = (string) $session_company_currency; ob_start(); ?>