move writing remarks to a more centralized class
This commit is contained in:
@ -16,20 +16,17 @@ declare(strict_types=1);
|
||||
namespace D3\Linkmobility4OXID\Application\Controller\Admin;
|
||||
|
||||
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
||||
use D3\Linkmobility4OXID\Application\Model\Sms;
|
||||
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
|
||||
use D3\Linkmobility4OXID\Application\Model\UserRecipients;
|
||||
use D3\LinkmobilityClient\Response\ResponseInterface;
|
||||
use D3\LinkmobilityClient\ValueObject\Recipient;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
|
||||
use OxidEsales\Eshop\Application\Model\Remark;
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class AdminUser extends AdminController
|
||||
{
|
||||
public const REMARK_IDENT = 'LMSMS';
|
||||
|
||||
protected $_sThisTemplate = 'd3adminuser.tpl';
|
||||
|
||||
/**
|
||||
@ -86,7 +83,6 @@ class AdminUser extends AdminController
|
||||
|
||||
$sms = oxNew(Sms::class, $messageBody);
|
||||
if ($sms->sendUserAccountMessage($user)) {
|
||||
$this->setRemark($sms->getRecipientsList(), $sms->getMessage());
|
||||
Registry::getUtilsView()->addErrorToDisplay(
|
||||
sprintf(
|
||||
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
|
||||
@ -103,21 +99,4 @@ class AdminUser extends AdminController
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $recipients
|
||||
* @param $messageBody
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function setRemark($recipients, $messageBody)
|
||||
{
|
||||
$remark = oxNew(Remark::class);
|
||||
$remark->assign([
|
||||
'oxtype' => AdminUser::REMARK_IDENT,
|
||||
'oxparentid' => $this->getEditObjectId(),
|
||||
'oxtext' => $recipients.PHP_EOL.$messageBody
|
||||
]);
|
||||
$remark->save();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user