Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REACH2-1285: Support excluding entries from reach based on entry admin tags #13039

Open
wants to merge 1 commit into
base: Ursa-21.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugins/reach/admin/forms/CatalogItemConfigure.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ public function init()
'filters' => array('StringTrim'),
'placement' => 'prepend',
));

$this->addElement('text', 'adminTagsToExclude', array(
'label' => 'Admin tags to exclude:',
'filters' => array('StringTrim'),
'placement' => 'prepend',
));

$liveCatalogItemTypesArray = array(Kaltura_Client_Reach_Enum_VendorServiceFeature::LIVE_CAPTION, Kaltura_Client_Reach_Enum_VendorServiceFeature::LIVE_TRANSLATION);
if (in_array($this->catalogItemType, $liveCatalogItemTypesArray))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ abstract class KalturaVendorCatalogItem extends KalturaObject implements IRelate
* @var int
*/
public $partnerId;

/**
* @var string
*/
public $adminTagsToExclude;

private static $map_between_objects = array
(
Expand All @@ -149,6 +154,7 @@ abstract class KalturaVendorCatalogItem extends KalturaObject implements IRelate
'contract',
'createdBy',
'notes',
'adminTagsToExclude',
);

abstract protected function getServiceFeature();
Expand Down
8 changes: 8 additions & 0 deletions plugins/reach/lib/kReachManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,12 +738,20 @@ public static function addEntryVendorTaskByObjectIds(entry $entry, VendorCatalog

public static function addEntryVendorTask(entry $entry, ReachProfile $reachProfile, VendorCatalogItem $vendorCatalogItem, $validateModeration = true, $version = 0, $context = null, $creationMode = EntryVendorTaskCreationMode::MANUAL, $taskDuration = null)
{
//Check if the entry is temporary, if so, dont create the task
if($entry->getIsTemporary())
{
KalturaLog::debug("Entry [{$entry->getId()}] is temporary, entry vendor task object wont be created for it");
return null;
}

//Check if static content and the catalog item is excluding static content, if so, dont create the task
if(count($vendorCatalogItem->getAdminTagsToExcludeArray()) && array_intersect($vendorCatalogItem->getAdminTagsToExcludeArray(), $entry->getAdminTagsArr()))
{
KalturaLog::debug("Entry [{$entry->getId()}] has admin tags that are excluded by the catalog item, entry vendor task object wont be created for it");
return null;
}

//Create new entry vendor task object
$entryVendorTask = new EntryVendorTask();

Expand Down
22 changes: 22 additions & 0 deletions plugins/reach/lib/model/VendorCatalogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function applyDefaultValues()
const CUSTOM_DATA_CONTRACT = 'contract';
const CUSTOM_DATA_CREATED_BY = 'createdBy';
const CUSTOM_DATA_NOTES = 'notes';
const CUSTOM_ADMIN_TAGS_TO_EXCLUDE = 'admin_tags_to_exclude';

public function setAllowResubmission($allowResubmission)
{
Expand Down Expand Up @@ -354,6 +355,27 @@ public function getNotes()
{
return $this->getFromCustomData(self::CUSTOM_DATA_NOTES);
}

public function setAdminTagsToExclude($v)
{
$this->putInCustomData(self::CUSTOM_ADMIN_TAGS_TO_EXCLUDE, $v);
}

public function getAdminTagsToExclude()
{
return $this->getFromCustomData(self::CUSTOM_ADMIN_TAGS_TO_EXCLUDE);
}

public function getAdminTagsToExcludeArray()
{
$adminTagsToExclude = $this->getFromCustomData(self::CUSTOM_ADMIN_TAGS_TO_EXCLUDE);
if(!$adminTagsToExclude)
{
return array();
}

return array_map("trim", explode(',', $adminTagsToExclude));
}

public function isEntryDurationExceeding(entry $entry)
{
Expand Down