A new Mautic component, listed under Components > Call Scripts (/s/call-scripts),
built like the other domains on AbstractStandardFormController/FormModel.
- CallScript (mt3s_call_scripts): name, description, category, owner, status,
the publish window shown as start/end date and time, the HTML script with
dynamic tokens kept as typed (html cleaning mask), the calling window
(weekdays, hours, sentinel in the contact's or a fixed timezone) and the retry
policy (max attempts, delay, backoff: none/linear/exponential)
- CallScriptOutcome (mt3s_call_script_outcomes, ON DELETE CASCADE): label,
data type (checkbox/radio/free text/dropdown), options JSON ({value,label})
and position; nested collections reuse the program-collection JS
- validators: ValidCallingWindow, ValidCallScriptOutcomeOptions, and an atPath
option on EndDateAfterStartDate so its violation lands on publishDown
- config: routes, the Components menu item (parent mautic.core.components),
call_script category type, model alias, call_scripts permissions, version 0.19.0
- migration Version_0_19_0 creates both tables and their FKs immediately
(users/categories SET NULL, outcomes CASCADE), idempotent
- translations en_US/fr_FR, unit tests, readme/AGENTS documentation
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
|
|
|
|
use Mautic\CoreBundle\Entity\CommonRepository;
|
|
|
|
/**
|
|
* @extends CommonRepository<CallScript>
|
|
*/
|
|
class CallScriptRepository extends CommonRepository
|
|
{
|
|
public function getTableAlias(): string
|
|
{
|
|
return 'cs';
|
|
}
|
|
|
|
/**
|
|
* Loads the owner and category with the scripts, so that the list doesn't query them one by one.
|
|
*
|
|
* @param array<string, mixed> $args
|
|
*/
|
|
public function getEntities(array $args = [])
|
|
{
|
|
$alias = $this->getTableAlias();
|
|
|
|
$args['qb'] = $this->createQueryBuilder($alias)
|
|
->select($alias, 'o', 'c')
|
|
->leftJoin($alias.'.owner', 'o')
|
|
->leftJoin($alias.'.category', 'c');
|
|
|
|
return parent::getEntities($args);
|
|
}
|
|
|
|
/**
|
|
* The list's search box matches the name.
|
|
*
|
|
* @return array<int, mixed>
|
|
*/
|
|
protected function addCatchAllWhereClause($q, $filter): array
|
|
{
|
|
return $this->addStandardCatchAllWhereClause($q, $filter, [
|
|
$this->getTableAlias().'.name',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @return array<array{0: string, 1: string}>
|
|
*/
|
|
protected function getDefaultOrder(): array
|
|
{
|
|
return [
|
|
[$this->getTableAlias().'.name', 'ASC'],
|
|
];
|
|
}
|
|
}
|