2
2
/*
3
3
-------------------------------------------------------------------------
4
4
ProcessMaker plugin for GLPI
5
- Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
5
+ Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
6
6
7
7
https://www.araymond.com/
8
8
-------------------------------------------------------------------------
97
97
]);
98
98
99
99
// there is only one row
100
- $ taskCat = $ res ->next ();
100
+ $ taskCat = $ res ->current ();
101
101
$ ask_for_reason = PluginProcessmakerTaskCategory::inheritedReAssignReason ($ taskCat ['pm_is_reassignreason_mandatory ' ], $ taskCat ['gppp_is_reassignreason_mandatory ' ]);
102
102
103
103
PluginProcessmakerUser::dropdown ( ['name ' => 'users_id_recipient ' ,
121
121
// Dialog helpers
122
122
// Create the dialog with \"Re-assign \" button
123
123
function showCommentDlg(title, content, alttext) {
124
-
125
- var dlgContents = {
126
- title: title,
127
- modal: true,
128
- width: 'auto',
129
- height: 'auto',
130
- resizable: false,
131
- close: function (event, ui) {
132
- $(this).dialog('destroy').remove();
133
- },
134
- buttons: [{
135
- text: alttext,
136
- id: 'submit $ rand',
137
- disabled: 'disabled',
138
- click: function() {
139
- $('#comment $ rand').val($('#commenttxtarea $ rand').val());
140
- $('#reassign $ rand').click();
141
- $('#submit $ rand').button('disable');
142
- }
143
- }],
144
- show: true,
145
- hide: true
124
+ modalId = title.replaceAll(' ', '_')
125
+ var modal = $('#'+title);
126
+ if (modal && modal.length == 0) {
127
+ var modal = '<div class= \"modal fade testmodalprocess \" id= \"'+ modalId +' \" tabindex= \"-1 \" role= \"dialog \" aria-labelledby= \"exampleModalCenterTitle \" aria-hidden= \"true \">'
128
+ + '<div class= \"modal-dialog modal-dialog-centered \"role= \"document \">'
129
+ + '<div class= \"modal-content \">'
130
+ + '<div class= \"modal-header \">'
131
+ + '<h5 class= \"modal-modalId \" id= \"changeChoiceTitle \">'+ title +'</h5>'
132
+ + '<button type= \"button \" class= \"btn-close \" data-bs-dismiss= \"modal \" aria-label= \"Close \"></button>'
133
+ + '</div >'
134
+ + '<div class= \"modal-body \">'
135
+ + '</div>'
136
+ + '<div class= \"modal-footer \">'
137
+ + '<button type= \"button \" class= \"btn btn-primary \" id= \"submit $ rand \" disabled>'+alttext+'</button>'
138
+ + '</div>'
139
+ + '</div>'
140
+ + '</div>';
141
+ $('body').append(modal);
146
142
}
147
- $('<div id=divreassign $ rand ></div>').appendTo($('#processmaker_form_task $ rand - " . $ _REQUEST [ ' delIndex ' ]. " ') );
148
- var locDlg = $('#divreassign $ rand ').html(content + '<p ><textarea id=commenttxtarea$ rand rows=6 cols=60 ></textarea></p><font color=red> " .addslashes (__ ('Input at least 10 words to justify. ' ,'processmaker ' ))."</font>').dialog(dlgContents );
143
+ $('#'+modalId).modal('show' );
144
+ $('#'+modalId+' .modal-body').append('<label for= \" message-text \" class= \" col-form-label \" >'+content+'</label ><textarea class= \" form-control \" id=\" commenttxtarea $ rand\" style= \" height: 100px \" ></textarea></p><font color=red> " .addslashes (__ ('Input at least 10 words to justify. ' ,'processmaker ' ))."</font>');
149
145
$('#commenttxtarea $ rand').focus();
150
146
$('#commenttxtarea $ rand').on('keydown keyup', function(e) {
151
147
if ($('#commenttxtarea $ rand').val().split(/\W+/).length > 10) {
152
- $('#submit $ rand').button('enable' );
148
+ $('#submit $ rand').prop('disabled', false );
153
149
} else {
154
- $('#submit $ rand').button('disable' );
150
+ $('#submit $ rand').prop('disabled', true );
155
151
}
156
152
});
157
-
158
- return locDlg;
153
+ $('#'+modalId).on('hide.bs.modal', function () {
154
+ $('#'+modalId).remove();
155
+ })
156
+ $('#submit $ rand').click(() => {
157
+ $('#comment $ rand').val($('#commenttxtarea $ rand').val());
158
+ $('#reassign $ rand').click();
159
+ $('#submit $ rand').button('disable');
160
+ $('#'+modalId).modal('hide').remove();
161
+ });
159
162
};
160
163
164
+
161
165
$('input[name=reassign $ rand]').click(function (e) {
162
166
//debugger;
163
167
let post = true;
@@ -176,7 +180,6 @@ function showCommentDlg(title, content, alttext) {
176
180
// un-claim
177
181
if ( " .($ can_unclaim ? 1 : 0 )." && users_id_val != 0) {
178
182
if ( " . ($ ask_for_reason ? 1 : 0 ) . ") {
179
- //e.preventDefault();
180
183
showCommentDlg(' " .addslashes (__ ('Un-claim task ' , 'processmaker ' ))."',
181
184
' " .addslashes (__ ('Please input reason to un-claim<br/>(task will be re-assigned to former group): ' , 'processmaker ' ))."',
182
185
' " .addslashes (__ ('Un-claim ' , 'processmaker ' ))."');
0 commit comments