From e94e5e634cb9ea73a8615e0e337e3ee2936238ff Mon Sep 17 00:00:00 2001 From: objec Date: Wed, 8 Apr 2026 14:09:59 +0400 Subject: [PATCH] Update Config Controller - Removed postSaveMailchimp(). This is handled in the plugin - Removed view $data related additions from mailchimp. Those are handled in the plugin - Removed extra whitespace Signed-off-by: objec --- app/Controllers/Config.php | 65 +++----------------------------------- 1 file changed, 4 insertions(+), 61 deletions(-) diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 0dc8cd5e0..4a7e6e42d 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -250,32 +250,6 @@ class Config extends Secure_Controller $data['image_allowed_types'] = array_combine($image_allowed_types, $image_allowed_types); $data['selected_image_allowed_types'] = explode(',', $this->config['image_allowed_types']); - // Integrations Related fields - $data['mailchimp'] = []; - - if (check_encryption()) { // TODO: Hungarian notation - if (!isset($this->encrypter)) { - helper('security'); - $this->encrypter = Services::encrypter(); - } - - $data['mailchimp']['api_key'] = (isset($this->config['mailchimp_api_key']) && !empty($this->config['mailchimp_api_key'])) - ? $this->encrypter->decrypt($this->config['mailchimp_api_key']) - : ''; - - $data['mailchimp']['list_id'] = (isset($this->config['mailchimp_list_id']) && !empty($this->config['mailchimp_list_id'])) - ? $this->encrypter->decrypt($this->config['mailchimp_list_id']) - : ''; - - // Remove any backup of .env created by check_encryption() - remove_backup(); - } else { - $data['mailchimp']['api_key'] = ''; - $data['mailchimp']['list_id'] = ''; - } - - $data['mailchimp']['lists'] = $this->_mailchimp(); - return view('configs/manage', $data); } @@ -601,37 +575,6 @@ class Config extends Secure_Controller ]); } - /** - * Saves Mailchimp configuration. Used in app/Views/configs/integrations_config.php - * - * @throws ReflectionException - * @return ResponseInterface - * @noinspection PhpUnused - */ - public function postSaveMailchimp(): ResponseInterface - { - $api_key = ''; - $list_id = ''; - - if (check_encryption()) { - $api_key_unencrypted = $this->request->getPost('mailchimp_api_key'); - if (!empty($api_key_unencrypted)) { - $api_key = $this->encrypter->encrypt($api_key_unencrypted); - } - - $list_id_unencrypted = $this->request->getPost('mailchimp_list_id'); - if (!empty($list_id_unencrypted)) { - $list_id = $this->encrypter->encrypt($list_id_unencrypted); - } - } - - $batch_save_data = ['mailchimp_api_key' => $api_key, 'mailchimp_list_id' => $list_id]; - - $success = $this->appconfig->batch_save($batch_save_data); - - return $this->response->setJSON(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]); - } - /** * Gets all stock locations. Used in app/Views/configs/stock_config.php * @@ -959,8 +902,8 @@ class Config extends Secure_Controller 'work_order_enable' => $this->request->getPost('work_order_enable') != null, 'work_order_format' => $this->request->getPost('work_order_format'), 'last_used_work_order_number' => $this->request->getPost('last_used_work_order_number', FILTER_SANITIZE_NUMBER_INT), - 'invoice_type' => Sale_lib::isValidInvoiceType($this->request->getPost('invoice_type')) - ? $this->request->getPost('invoice_type') + 'invoice_type' => Sale_lib::isValidInvoiceType($this->request->getPost('invoice_type')) + ? $this->request->getPost('invoice_type') : 'invoice' ]; @@ -1006,8 +949,8 @@ class Config extends Secure_Controller return $fieldType === 'first' ? 'name' : ''; } - $allowed = $fieldType === 'first' - ? Item::ALLOWED_SUGGESTIONS_COLUMNS + $allowed = $fieldType === 'first' + ? Item::ALLOWED_SUGGESTIONS_COLUMNS : Item::ALLOWED_SUGGESTIONS_COLUMNS_WITH_EMPTY; $fallback = $fieldType === 'first' ? 'name' : '';