Hide total in columns
This commit is contained in:
@@ -19,6 +19,13 @@ class FinanceHelper extends Base
|
||||
const INSTALLMENT_CURRENT_KEY = 'financebuddy_installment_current';
|
||||
const INSTALLMENT_TOTAL_KEY = 'financebuddy_installment_total';
|
||||
|
||||
// Per-column opt-out of the header total. Stored per column in PROJECT metadata as
|
||||
// financebuddy_hide_total_<column_id> = 'on' (hidden) or 'off' (shown, the default). Literal
|
||||
// on/off, never 1/0, so the flag is never dropped by the metadata save (PHP empty("0") === true).
|
||||
const HIDE_TOTAL_PREFIX = 'financebuddy_hide_total_';
|
||||
const HIDE_TOTAL_ON = 'on';
|
||||
const HIDE_TOTAL_OFF = 'off';
|
||||
|
||||
// Hidden marker present only when the task form was submitted with the finance fieldset, so
|
||||
// non-finance task updates (moves, API calls) are ignored by the persistence hooks.
|
||||
const FORM_MARKER = 'financebuddy_form';
|
||||
@@ -110,6 +117,18 @@ class FinanceHelper extends Base
|
||||
return $net;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has this column's header total been hidden (per-column opt-out)?
|
||||
*
|
||||
* @param integer $project_id
|
||||
* @param integer $column_id
|
||||
* @return bool
|
||||
*/
|
||||
public function isTotalHidden($project_id, $column_id)
|
||||
{
|
||||
return $this->projectMetadataModel->get((int) $project_id, self::HIDE_TOTAL_PREFIX.(int) $column_id, self::HIDE_TOTAL_OFF) === self::HIDE_TOTAL_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
* Values to prefill the task-form fields: a re-post (after a validation error) wins, then the
|
||||
* stored metadata for an existing task, otherwise blanks for a new task.
|
||||
|
||||
Reference in New Issue
Block a user