29 lines
757 B
PHP
29 lines
757 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Kanboard\Plugin\FinanceBuddy\Helper;
|
||
|
|
|
||
|
|
use Kanboard\Core\Base;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Template/controller helper for FinanceBuddy.
|
||
|
|
*
|
||
|
|
* FinanceBuddy is opt-in per board: every render and save point is gated on isEnabled(), so an
|
||
|
|
* un-enabled board is untouched. The flag lives in project metadata (key financebuddy_enabled),
|
||
|
|
* written by the checkbox on the project's Integrations page.
|
||
|
|
*/
|
||
|
|
class FinanceHelper extends Base
|
||
|
|
{
|
||
|
|
const ENABLED_KEY = 'financebuddy_enabled';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Is FinanceBuddy enabled for this board?
|
||
|
|
*
|
||
|
|
* @param integer $project_id
|
||
|
|
* @return bool
|
||
|
|
*/
|
||
|
|
public function isEnabled($project_id)
|
||
|
|
{
|
||
|
|
return (int) $this->projectMetadataModel->get($project_id, self::ENABLED_KEY, 0) === 1;
|
||
|
|
}
|
||
|
|
}
|