4 Commits
Author SHA1 Message Date
bs cf5a3b73ed Merge branch 'dev' into prod
CI / testsuite (mysql, 8.2, ) (push) Successful in 3m19s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 3m21s
CI / testsuite (mysql, 8.4, ) (push) Successful in 6m7s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 3m8s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 3m22s
CI / Coding Standard & Static Analysis (push) Successful in 3m21s
Release / build (push) Successful in 11s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 6m2s
2026-09-15 22:03:06 -07:00
bs 49772771d0 dont add in unit tests - so controllers which use the component can be tested easier 2026-09-15 22:03:00 -07:00
bs 0ea3971ac1 remove logging in component on getErrors() 2026-09-15 19:18:15 -07:00
bs 0aebf454c7 use base migration not abstract migration
CI / testsuite (mysql, 8.4, ) (push) Successful in 2m42s
CI / testsuite (mysql, 8.2, ) (push) Successful in 4m1s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 3m58s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m3s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 4m8s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 2m46s
Release / build (push) Successful in 14s
CI / Coding Standard & Static Analysis (push) Successful in 2m14s
2026-08-26 21:09:01 -07:00
2 changed files with 4 additions and 17 deletions
@@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Migrations\AbstractMigration; use Migrations\BaseMigration;
class CreateContactUsFormSubmissions extends AbstractMigration { class CreateContactUsFormSubmissions extends BaseMigration {
/** /**
* Change Method. * Change Method.
@@ -8,7 +8,6 @@ use Cake\Core\Configure;
use Cake\Datasource\EntityInterface; use Cake\Datasource\EntityInterface;
use Cake\Http\Response; use Cake\Http\Response;
use Cake\I18n\DateTime; use Cake\I18n\DateTime;
use Cake\Log\Log;
use Cake\ORM\Table; use Cake\ORM\Table;
use Cake\ORM\TableRegistry; use Cake\ORM\TableRegistry;
use CakeContactUs\CakeContactUsPlugin; use CakeContactUs\CakeContactUsPlugin;
@@ -55,7 +54,6 @@ class ContactUsComponent extends Component {
$this->setConfig('requireEmail', Configure::readOrFail('ContactUs.fields.email')); $this->setConfig('requireEmail', Configure::readOrFail('ContactUs.fields.email'));
$this->setConfig('requireCaptcha', $requireCaptcha); $this->setConfig('requireCaptcha', $requireCaptcha);
if ($requireCaptcha) { if ($requireCaptcha) {
// $this->_registry->load('Captcha.Captcha');
$this->getController()->viewBuilder()->addHelpers(['Captcha.Captcha']); $this->getController()->viewBuilder()->addHelpers(['Captcha.Captcha']);
} }
} }
@@ -64,7 +62,7 @@ class ContactUsComponent extends Component {
* @return \Cake\Datasource\EntityInterface|\CakeContactUs\Model\Entity\ContactUsFormSubmission * @return \Cake\Datasource\EntityInterface|\CakeContactUs\Model\Entity\ContactUsFormSubmission
*/ */
public function newContactUsForm() { public function newContactUsForm() {
if ($this->getConfig('requireCaptcha')) { if ($this->getConfig('requireCaptcha') && PHP_SAPI !== 'cli') {
$this->ContactUsFormSubmissions->addBehavior('Captcha.Captcha'); $this->ContactUsFormSubmissions->addBehavior('Captcha.Captcha');
} }
@@ -80,8 +78,7 @@ class ContactUsComponent extends Component {
if (!isset($postData)) { if (!isset($postData)) {
$postData = $this->getController()->getRequest()->getData(); $postData = $this->getController()->getRequest()->getData();
} }
$postData['client_ip'] = array_key_exists('client_ip', $postData) && $postData['client_ip'] ? $postData['client_ip'] = $postData['client_ip'] ??
$postData['client_ip'] :
($this->getConfig('clientIpHeader') ? ($this->getConfig('clientIpHeader') ?
$this->getController()->getRequest()->getHeaderLine($this->getConfig('clientIpHeader')) : $this->getController()->getRequest()->getHeaderLine($this->getConfig('clientIpHeader')) :
$this->getController()->getRequest()->clientIp() $this->getController()->getRequest()->clientIp()
@@ -92,14 +89,9 @@ class ContactUsComponent extends Component {
'contactUsFormSubmission' => $contactUsFormSubmission, 'contactUsFormSubmission' => $contactUsFormSubmission,
], $this->getController()); ], $this->getController());
$result = $event->getResult(); $result = $event->getResult();
if ($result instanceof EntityInterface) { if ($result instanceof EntityInterface) {
$postData = $result->toArray(); $postData = $result->toArray();
$contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData); $contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData);
if ($contactUsFormSubmission->getErrors()) {
Log::debug(print_r('$contactUsFormSubmission->getErrors()', true));
Log::debug(print_r($contactUsFormSubmission->getErrors(), true));
}
$contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission); $contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission);
if ($contactUsFormSubmissionSaved) { if ($contactUsFormSubmissionSaved) {
return $this->_afterFormSaved($contactUsFormSubmissionSaved); return $this->_afterFormSaved($contactUsFormSubmissionSaved);
@@ -115,11 +107,6 @@ class ContactUsComponent extends Component {
} }
$contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData); $contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData);
if ($contactUsFormSubmission->getErrors()) {
Log::debug(print_r('$contactUsFormSubmission->getErrors()', true));
Log::debug(print_r($contactUsFormSubmission->getErrors(), true));
}
$contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission); $contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission);
if ($contactUsFormSubmissionSaved) { if ($contactUsFormSubmissionSaved) {