Commit 7301ffd0 authored by Victor Emanouilov's avatar Victor Emanouilov
Browse files

[ENH] add duplicate cascade ItemLink option

parent 479393d2
Pipeline #757037982 passed with stages
in 9 minutes and 41 seconds
......@@ -642,6 +642,13 @@ EXPORT;
$itemObject = Tracker_Item::fromId($id);
foreach (TikiLib::lib('trk')->get_child_items($itemId) as $info) {
$field = TikiLib::lib('trk')->get_tracker_field($info['field']);
$factory = new Tracker_Field_Factory();
$options = Tracker_Options::fromSerialized($field['options'], $factory->getFieldInfo($field['type']));
if (! $options->getParam('duplicateCascade')) {
continue;
}
$childItem = Tracker_Item::fromId($info['itemId']);
if ($childItem->canView()) {
......
......@@ -228,6 +228,20 @@ class Tracker_Field_ItemLink extends Tracker_Field_Abstract implements Tracker_F
],
'legacy_index' => 14,
],
'duplicateCascade' => [
'name' => tr('Duplicate cascade action'),
'description' => tr('Duplicate (Duplicate tracker items feature) an item in the master/parent tracker (Tracker to link to) silently creates a slave/child item in this tracker (yes by default).'),
'filter' => 'int',
'options' => [
0 => tr('No'),
1 => tr('Yes'),
],
'default' => '1',
'depends' => [
'pref' => 'tracker_clone_item',
],
'legacy_index' => 15,
],
],
],
];
......
......@@ -29,7 +29,7 @@ function prefs_tracker_list()
],
'tracker_clone_item' => [
'name' => tr('Duplicate tracker items'),
'description' => tr('Allow copying tracker item information to a new tracker item.'),
'description' => tr('Allow copying tracker item information to a new tracker item. If the item has an item-link linked, it will automatically create new child item. This last can be turned on and off per case on the item-link tracker fields options.'),
'type' => 'flag',
'default' => 'n',
],
......
......@@ -90,7 +90,7 @@
<div class="form-text">{tr}Separate multiple with &quot;{$def.separator}&quot;{/tr}</div>
{/if}
{/if}
{if !empty($def.depends)}
{if !empty($def.depends.field)}
{jq}
$("input[name='option~{{$def.depends.field|escape}}'],textarea[name='option~{{$def.depends.field|escape}}'],select[name='option~{{$def.depends.field|escape}}']")
.change(function(){
......@@ -104,6 +104,11 @@
}).change();
{/jq}
{/if}
{if !empty($def.depends.pref) && (empty($prefs[$def.depends.pref]) || $prefs[$def.depends.pref] == 'n')}
{jq}
$("input[name='option~{{$param|escape}}'],textarea[name='option~{{$param|escape}}'],select[name='option~{{$param|escape}}']").closest('.mb-3').hide();
{/jq}
{/if}
</div>
{/foreach}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment