= 2); $fields = [ 'category' => ['label' => 'Category', 'icon' => 'fa-tag'], 'account' => ['label' => 'Account', 'icon' => 'fa-piggy-bank'], 'method' => ['label' => 'Payment Method', 'icon' => 'fa-credit-card'], 'client' => ['label' => 'Client', 'icon' => 'fa-building'], ]; if (!moduleOn('bookkeeping')) { unset($fields['account']); // Bookkeeping off (Admin > Settings > Modules) } if (!isset($fields[$field])) { echo json_encode(['error' => 'Pick what to set from the Bulk Action menu.']); exit; } if (!$count) { echo json_encode(['error' => 'Tick the income to change first.']); exit; } // What the ticked rows are, in words - and what of it this leaves alone $ticked = implode(' and ', array_filter([ $payments ? $payments . ' invoice payment' . ($payments === 1 ? '' : 's') : '', $others ? $others . ' other income' : '', ])); $notes = []; if ($payments && $field === 'client') { $notes[] = "A payment's client is its invoice's - the " . ($payments === 1 ? 'payment stays' : "$payments payments stay") . ' as ' . ($payments === 1 ? 'it is' : 'they are') . '.'; } elseif ($payments && !$can_payments) { $notes[] = ($field === 'category' ? "A payment's category is its invoice's, and changing the invoice takes write access to Sales" : 'Changing a payment takes write access to Financial') . ' - the ' . ($payments === 1 ? 'payment stays' : "$payments payments stay") . ' as ' . ($payments === 1 ? 'it is' : 'they are') . '.'; } elseif ($payments && $field === 'category') { $notes[] = "A payment's category is its invoice's - the invoice" . ($payments === 1 ? '' : 's') . ' behind the ' . ($payments === 1 ? 'payment takes' : 'payments take') . ' it, and with it every payment on ' . ($payments === 1 ? 'it' : 'them') . '.'; } if ($field === 'account') { $notes[] = 'The currency stays as it was entered.'; } $changes = $field === 'client' || !$can_payments ? $others : $count; ob_start(); ?>
">