Skip to content

Commit

Permalink
Ticket unacms#4834 - Agents: Edit automation doesn't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Nov 8, 2024
1 parent f54a0e0 commit 838be8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions studio/template/scripts/BxBaseStudioAgentsAutomators.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function performActionAdd()
{
$sAction = 'add';

$oTemplate = BxDolStudioTemplate::getInstance();
$oAI = BxDolAI::getInstance();

$aForm = $this->_getForm($sAction);
Expand Down Expand Up @@ -150,7 +151,7 @@ public function performActionAdd()
'assistant_id' => $iAssistantId
]);

if(($oCmts = BxDolCmts::getObjectInstance($this->_sCmts, $iId)) !== null) {
if(($oCmts = BxDolAI::getInstance()->getAutomatorCmtsObject($iId, $oTemplate)) !== null) {
if($bMessage) {
$iProfileId = bx_get_logged_profile_id();

Expand Down Expand Up @@ -205,6 +206,7 @@ public function performActionEdit()
{
$sAction = 'edit';

$oTemplate = BxDolStudioTemplate::getInstance();
$oAI = BxDolAI::getInstance();

$iId = $this->_getId();
Expand Down Expand Up @@ -308,7 +310,7 @@ public function performActionEdit()
foreach($aAssistantsValues as $iAssistantsValue)
$this->_oDb->insertAutomatorAssistant([
'automator_id' => $iId,
'helper_id' => (int)$iAssistantsValue,
'assistant_id' => (int)$iAssistantsValue,
]);
}

Expand All @@ -326,7 +328,7 @@ public function performActionEdit()
$aValsToAdd['params'] = json_encode(['scheduler_time' => $sSchedulerTime]);

if($oForm->update($iId, $aValsToAdd) !== false) {
if(($oCmts = BxDolCmts::getObjectInstance($this->_sCmts, $iId)) !== null) {
if(($oCmts = BxDolAI::getInstance()->getAutomatorCmtsObject($iId, $oTemplate)) !== null) {
$sInstructions = $oAI->getAutomatorInstruction('profile', $iProfileId);

$aProviders = $this->_oDb->getAutomatorsBy(['sample' => 'providers_by_id_pairs', 'id' => $iId]);
Expand Down

0 comments on commit 838be8c

Please sign in to comment.