". "". "". "". "". "". "". "". ""; $PM_SOAP = new PluginProcessmakerProcessmaker; // not used in this context, just here to define the type of $PM_SOAP $PM_DB = new PluginProcessmakerDB; $rand = rand(); echo "
"; echo __('Re-assign task to', 'processmaker')." "; echo ""; echo ""; echo $commoninputs; $can_unclaim = false; // by default $query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';"; $res = $PM_DB->query($query); if ($PM_DB->numrows($res) > 0) { $can_unclaim = true; } PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient', 'value' => $_REQUEST['users_id'], 'used' => $_REQUEST['used'], 'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks 'entity_sons' => false, // not used, as any user can be assigned to any tasks 'right' => 'all', 'rand' => $rand, 'width' => '', 'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']] ]); echo "  "; echo ""; echo ""; echo HTML::scriptBlock(" $(function () { // Dialog helpers // Create the dialog with \"Re-assign\" button function showCommentDlg(title, content, alttext) { var dlgContents = { title: title, modal: true, width: 'auto', height: 'auto', resizable: false, close: function (event, ui) { $(this).dialog('destroy').remove(); }, buttons: [{ text: alttext, id: 'submit$rand', disabled: 'disabled', click: function() { $('#processmaker_form_task$rand-".$_REQUEST['delIndex']." input[name=comment]').val($('#comment$rand').val()); //$('#processmaker_form_task$rand-".$_REQUEST['delIndex']."').submit(); $('input[name=reassign').click(); $('#submit$rand').button('disable'); } }], show: true, hide: true } $('
').appendTo($('#processmaker_form_task$rand-".$_REQUEST['delIndex']."')); var locDlg = $('#reassign$rand').html(content + '

Input at least 10 words in English to justify.').dialog(dlgContents); $('#comment$rand').focus(); $('#comment$rand').on('keydown keyup', function(e) { if ($('#comment$rand').val().split(/\W+/).length > 10) { $('#submit$rand').button('enable'); } else { $('#submit$rand').button('disable'); } }); return locDlg; }; $('input[name=reassign$rand]').click(function (e) { e.preventDefault(); if ($('input[name=users_id]').val() == $('input[name=users_id_recipient]').val()) { // task is already assigned to this user alert('".__('Task is already assigned to this user or group!', 'processmaker')."', '".__('Re-assign task', 'processmaker')."'); } else if ($('input[name=users_id_recipient]').val() == 0) { // un-claim if (".($can_unclaim ? 1 : 0)." && $('input[name=users_id]').val() != 0) { showCommentDlg('".__('Un-claim task', 'processmaker')."', '".__('Please input reason to un-claim
(task will be re-assigned to former group):', 'processmaker')."', '".__('Un-claim', 'processmaker')."'); } else { // task can't be unclaim because it isn't SELF_SERVICE alert('".__('Can\\\'t un-assign Task!', 'processmaker')."', '".__('Un-claim task', 'processmaker')."'); } } else { showCommentDlg('".__('Re-assign task', 'processmaker')."', '".__('Please input reason to re-assign:', 'processmaker')."', '".__('Re-assign', 'processmaker')."'); } return false; }); }) "); if (Session::getLoginUserID() != $_REQUEST['users_id']) { echo "  "; echo ""; } Html::closeForm(true);