public function actionCatering() { $catering = Yii::$app->request->post('catering'); // TODO: no way to change this using web interface $catering['use_account_type'] = Yii::$app->params['catering']['use_account_type']; Settings::set()->catering(null, $catering); return $this->redirectWithFlash(); }
public function isMaster() { if ($this->checkField === 'login') { $credentials = Settings::get()->collectorLogins(null, true); } else { $credentials = Settings::get()->collectorCardNumbers(null, true); } return in_array($this->checkValue, $credentials); }
/** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { foreach (self::$users as $user) { if (strcasecmp($user['username'], $username) === 0) { $user['password'] = Settings::get()->adminPassword(); return new static($user); } } return null; }
public function __construct() { $this->errors[2] = Yii::t('terminal', 'error_required_field_not_found'); $this->errors[3] = Yii::t('terminal', 'error_invalid_param'); $this->errors[4] = Yii::t('terminal', 'error_invalid_sign_param'); $this->errors[5] = Yii::t('terminal', 'error_account_not_found'); $settings = Settings::get()->catering(); $this->host = $settings['host']; $this->bankId = $settings['bank_id']; $this->password = $settings['password']; }
/** * Creates content that should be printed * * @param Collection $collection * @return string */ public function renderCollectionContent($collection) { $pdf = new \tFPDF('P', 'mm', [72, 80]); $pdf->SetMargins(0, 2); // Запретим автоматический разрыв страниц $pdf->SetAutoPageBreak(false, 0); $pdf->AddPage(); $pdf->AddFont('arial', '', 'arial.ttf', true); $pdf->AddFont('arialbd', '', 'arialbd.ttf', true); $this->makeLine($pdf, Settings::get()->terminalName(), 10, 5)->makeLine($pdf, date('H:i:s d.m.Y', time()), 10, 5)->makeLine($pdf, $collection->sum . ' руб.', 16, 15, true)->makeLine($pdf, 'Инкассация:', 10, 10)->makeLine($pdf, (string) $collection->id, 12, 5)->makeLine($pdf, Settings::get()->contactInfo(), 8, 15)->makeLine($pdf, 'Сохраняйте чек', 8, 4); $fileName = __DIR__ . '/../runtime/pdf/collection_ticket.pdf'; $pdf->Output($fileName, 'F'); return $fileName; }
/** * Creates new Settings row in the database or updates the existing one. * * @param Settings|null $settings * @param string $key * @param mixed $value */ protected function createOrUpdateSettings($settings, $key, $value) { if (is_null($settings)) { $newSettings = new Settings(); $newSettings->key = $key; $newSettings->value = $value; $newSettings->save(); } else { $settings->value = $value; $settings->save(); } }