PMCORE-1138
This commit is contained in:
@@ -546,45 +546,36 @@ class Ajax
|
||||
G::RenderPage('publish', 'extJs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel case from actions menu
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.3/Cases/Actions#Cancel
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cancelCase()
|
||||
{
|
||||
$oCase = new Cases();
|
||||
$multiple = false;
|
||||
|
||||
if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
|
||||
$APP_UID = $_POST['APP_UID'];
|
||||
$DEL_INDEX = $_POST['DEL_INDEX'];
|
||||
|
||||
$appUids = explode(',', $APP_UID);
|
||||
$delIndexes = explode(',', $DEL_INDEX);
|
||||
if (count($appUids) > 1 && count($delIndexes) > 1) {
|
||||
$multiple = true;
|
||||
try {
|
||||
$appUid = !empty($_SESSION['APPLICATION']) ? $_SESSION['APPLICATION'] : '';
|
||||
$index = !empty($_SESSION['INDEX']) ? $_SESSION['INDEX'] : '';
|
||||
$usrUid = !empty($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '';
|
||||
$result = new stdclass();
|
||||
if (!empty($appUid) && !empty($index) && !empty($usrUid)) {
|
||||
$ws = new WsBase();
|
||||
$response = (object)$ws->cancelCase($appUid, $index, $usrUid);
|
||||
// Review if the case was cancelled, true if the case was cancelled
|
||||
$result->status = ($response->status_code == 0) ? true : false;
|
||||
$result->msg = $response->message;
|
||||
} else {
|
||||
$result->status = false;
|
||||
$result->msg = G::LoadTranslation("ID_CASE_USER_INVALID_CANCEL_CASE", [$usrUid]);
|
||||
}
|
||||
} elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
|
||||
$APP_UID = $_POST['sApplicationUID'];
|
||||
$DEL_INDEX = $_POST['iIndex'];
|
||||
} else {
|
||||
$APP_UID = $_SESSION['APPLICATION'];
|
||||
$DEL_INDEX = $_SESSION['INDEX'];
|
||||
} catch (Exception $e) {
|
||||
$result->status = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
// Save the note pause reason
|
||||
if ($_POST['NOTE_REASON'] != '') {
|
||||
require_once("classes/model/AppNotes.php");
|
||||
$appNotes = new AppNotes();
|
||||
$noteContent = addslashes($_POST['NOTE_REASON']);
|
||||
$appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']);
|
||||
}
|
||||
// End save
|
||||
|
||||
|
||||
if ($multiple) {
|
||||
foreach ($appUids as $i => $appUid) {
|
||||
$oCase->cancelCase($appUid, $delIndexes[$i], $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
} else {
|
||||
$oCase->cancelCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
public function getUsersToReassign()
|
||||
|
||||
@@ -311,9 +311,8 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
//close tab only if IE11
|
||||
|
||||
if ($isIE && !isset($_SESSION['__OUTLOOK_CONNECTOR__'])) {
|
||||
//close tab only if IE11 add a validation was added if the current skin is uxs
|
||||
if ($isIE && !isset($_SESSION['__OUTLOOK_CONNECTOR__']) && SYS_SKIN !== "uxs") {
|
||||
$script = "<script type='text/javascript'>
|
||||
try {
|
||||
if(top.opener) {
|
||||
|
||||
@@ -195,7 +195,7 @@ class EmailServer
|
||||
$bodyPre = new TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
|
||||
|
||||
$bodyPre->prepare();
|
||||
$bodyPre->assign("server", $_SERVER["SERVER_NAME"]);
|
||||
$bodyPre->assign("server", System::getServerProtocol() . System::getServerHost());
|
||||
$bodyPre->assign("date", date("H:i:s"));
|
||||
$bodyPre->assign("ver", System::getVersion());
|
||||
$bodyPre->assign("engine", $engine);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use EmailEventPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use Criteria;
|
||||
use ProcessFiles;
|
||||
use ProcessFilesPeer;
|
||||
use ProcessPeer;
|
||||
use ResultSet;
|
||||
use TaskPeer;
|
||||
|
||||
class FilesManager
|
||||
@@ -671,62 +673,60 @@ class FilesManager
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* Deletes the physical file and its corresponding record in the database.
|
||||
* @param string $proUid {@min 32} {@max 32}
|
||||
* @param string $prfUid {@min 32} {@max 32}
|
||||
*
|
||||
*
|
||||
* @param bool $verifyingRelationship
|
||||
* @access public
|
||||
* @throws Exception
|
||||
*/
|
||||
public function deleteProcessFilesManager($sProcessUID, $prfUid, $verifyingRelationship = false)
|
||||
public function deleteProcessFilesManager($proUid, $prfUid, $verifyingRelationship = false)
|
||||
{
|
||||
try {
|
||||
$path = '';
|
||||
$criteriaPf = new \Criteria("workflow");
|
||||
$criteriaPf->addSelectColumn(\ProcessFilesPeer::PRF_PATH);
|
||||
$criteriaPf->add(\ProcessFilesPeer::PRF_UID, $prfUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteriaPf);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$path = $aRow['PRF_PATH'];
|
||||
$rsCriteria->next();
|
||||
$criteriaProcessFiles = new Criteria("workflow");
|
||||
$criteriaProcessFiles->addSelectColumn(ProcessFilesPeer::PRF_PATH);
|
||||
$criteriaProcessFiles->add(ProcessFilesPeer::PRF_UID, $prfUid, Criteria::EQUAL);
|
||||
$resultSet1 = ProcessFilesPeer::doSelectRS($criteriaProcessFiles);
|
||||
$resultSet1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultSet1->next();
|
||||
while ($row = $resultSet1->getRow()) {
|
||||
$path = $row['PRF_PATH'];
|
||||
$resultSet1->next();
|
||||
}
|
||||
if ($path == '') {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
|
||||
throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
|
||||
}
|
||||
|
||||
$relationshipEmailEvent = false;
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\EmailEventPeer::PRF_UID);
|
||||
$criteria->add(\EmailEventPeer::PRF_UID, $prfUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \EmailEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(EmailEventPeer::PRF_UID);
|
||||
$criteria->add(EmailEventPeer::PRF_UID, $prfUid, Criteria::EQUAL);
|
||||
$resultSet2 = EmailEventPeer::doSelectRS($criteria);
|
||||
$resultSet2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultSet2->next();
|
||||
while ($row = $resultSet2->getRow()) {
|
||||
$relationshipEmailEvent = true;
|
||||
$rsCriteria->next();
|
||||
$resultSet2->next();
|
||||
}
|
||||
$explodePath = explode(DIRECTORY_SEPARATOR,$path);
|
||||
|
||||
$path = str_replace("\\", "/", $path);
|
||||
$fileName = basename($path);
|
||||
if ($relationshipEmailEvent && !$verifyingRelationship) {
|
||||
throw new \Exception(\G::LoadTranslation(G::LoadTranslation('ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT',
|
||||
[end($explodePath)])));
|
||||
throw new Exception(G::LoadTranslation(G::LoadTranslation('ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT', [$fileName])));
|
||||
}
|
||||
|
||||
$sFile = end($explodePath);
|
||||
$path = PATH_DATA_MAILTEMPLATES.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
|
||||
|
||||
$path = PATH_DATA_MAILTEMPLATES . $proUid . "/" . $fileName;
|
||||
if (file_exists($path) && !is_dir($path)) {
|
||||
unlink($path);
|
||||
} else {
|
||||
$path = PATH_DATA_PUBLIC.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
|
||||
|
||||
if (file_exists($path) && !is_dir($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
$path = PATH_DATA_PUBLIC . $proUid . "/" . $fileName;
|
||||
if (file_exists($path) && !is_dir($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
$rs = \ProcessFilesPeer::doDelete($criteriaPf);
|
||||
ProcessFilesPeer::doDelete($criteriaProcessFiles);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
13
workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php
Normal file
13
workflow/engine/src/ProcessMaker/Model/BpmnDiagram.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BpmnDiagram extends Model
|
||||
{
|
||||
protected $table = 'BPMN_DIAGRAM';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
13
workflow/engine/src/ProcessMaker/Model/BpmnEvent.php
Normal file
13
workflow/engine/src/ProcessMaker/Model/BpmnEvent.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BpmnEvent extends Model
|
||||
{
|
||||
protected $table = 'BPMN_EVENT';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
13
workflow/engine/src/ProcessMaker/Model/BpmnProcess.php
Normal file
13
workflow/engine/src/ProcessMaker/Model/BpmnProcess.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BpmnProcess extends Model
|
||||
{
|
||||
protected $table = 'BPMN_PROCESS';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ class BpmnProject extends Model
|
||||
// Set our table name
|
||||
protected $table = 'BPMN_PROJECT';
|
||||
protected $primaryKey = 'PRJ_UID';
|
||||
public $incrementing = false;
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
workflow/engine/src/ProcessMaker/Model/EmailEvent.php
Normal file
13
workflow/engine/src/ProcessMaker/Model/EmailEvent.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class EmailEvent extends Model
|
||||
{
|
||||
protected $table = 'EMAIL_EVENT';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ class ProcessFiles extends Model
|
||||
{
|
||||
protected $table = 'PROCESS_FILES';
|
||||
protected $primaryKey = 'PRF_UID';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<img id='logo' src='http://{server}/images/processmaker.logo.jpg' />
|
||||
<img id='logo' src='{server}/images/processmaker.logo.jpg' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1026,81 +1026,86 @@ Ext.onReady(function(){
|
||||
});
|
||||
}
|
||||
|
||||
Actions.cancelCase = function()
|
||||
{
|
||||
var msgCancel = new Ext.Window({
|
||||
width:500,
|
||||
plain: true,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
title: _('ID_CONFIRM'),
|
||||
items: [
|
||||
new Ext.FormPanel({
|
||||
labelAlign: 'top',
|
||||
labelWidth: 75,
|
||||
border: false,
|
||||
frame: true,
|
||||
Actions.cancelCase = function () {
|
||||
var msgCancel = new Ext.Window({
|
||||
width: 500,
|
||||
plain: true,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
title: _('ID_CONFIRM'),
|
||||
items: [
|
||||
{
|
||||
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_CONFIRM_CANCEL_CASE')+'? </div> <br/>'
|
||||
},
|
||||
{
|
||||
xtype: 'textarea',
|
||||
id: 'noteReason',
|
||||
fieldLabel: _('ID_CASE_CANCEL_REASON'),
|
||||
name: 'noteReason',
|
||||
width: 450,
|
||||
height: 50
|
||||
},
|
||||
{
|
||||
id: 'notifyReason',
|
||||
xtype:'checkbox',
|
||||
name: 'notifyReason',
|
||||
hideLabel: true,
|
||||
boxLabel: _('ID_NOTIFY_USERS_CASE')
|
||||
}
|
||||
],
|
||||
|
||||
buttonAlign: 'center',
|
||||
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: function(){
|
||||
if (Ext.getCmp('noteReason').getValue() != '') {
|
||||
var noteReasonTxt = _('ID_CASE_CANCEL_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
|
||||
} else {
|
||||
var noteReasonTxt = '';
|
||||
}
|
||||
var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0;
|
||||
|
||||
Ext.MessageBox.show({ msg: _('ID_PROCESSING'), wait:true,waitConfig: {interval:200} });
|
||||
Ext.Ajax.request({
|
||||
url : 'ajaxListener' ,
|
||||
params : {action : 'cancelCase', NOTE_REASON: noteReasonTxt, NOTIFY_PAUSE: notifyReasonVal},
|
||||
success: function ( result, request ) {
|
||||
try {
|
||||
parent.notify("", _("ID_CASE_CANCELLED", stringReplace("\\: ", "", _APP_NUM)));
|
||||
parent.updateCasesTree();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
location.href = 'casesListExtJs';
|
||||
},
|
||||
failure: function ( result, request) {
|
||||
Ext.MessageBox.alert( _('ID_FAILED'), result.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
},{
|
||||
text: _('ID_CANCEL'),
|
||||
handler: function(){
|
||||
msgCancel.close();
|
||||
}
|
||||
}]
|
||||
})
|
||||
]
|
||||
});
|
||||
msgCancel.show(this);
|
||||
new Ext.FormPanel({
|
||||
labelAlign: 'top',
|
||||
labelWidth: 75,
|
||||
border: false,
|
||||
frame: true,
|
||||
items: [{
|
||||
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_CONFIRM_CANCEL_CASE') + '? </div> <br/>'
|
||||
},
|
||||
{
|
||||
xtype: 'textarea',
|
||||
id: 'noteReason',
|
||||
fieldLabel: _('ID_CASE_CANCEL_REASON'),
|
||||
name: 'noteReason',
|
||||
width: 450,
|
||||
height: 50
|
||||
},
|
||||
{
|
||||
id: 'notifyReason',
|
||||
xtype: 'checkbox',
|
||||
name: 'notifyReason',
|
||||
hideLabel: true,
|
||||
boxLabel: _('ID_NOTIFY_USERS_CASE')
|
||||
}],
|
||||
buttonAlign: 'center',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: function () {
|
||||
if (Ext.getCmp('noteReason').getValue() != '') {
|
||||
var noteReasonTxt = _('ID_CASE_CANCEL_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
|
||||
} else {
|
||||
var noteReasonTxt = '';
|
||||
}
|
||||
var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0;
|
||||
Ext.MessageBox.show({msg: _('ID_PROCESSING'), wait: true, waitConfig: {interval: 200}});
|
||||
Ext.Ajax.request({
|
||||
url: 'ajaxListener',
|
||||
params: {
|
||||
action: 'cancelCase',
|
||||
NOTE_REASON: noteReasonTxt,
|
||||
NOTIFY_PAUSE: notifyReasonVal
|
||||
},
|
||||
success: function (result, request) {
|
||||
try {
|
||||
var data = Ext.util.JSON.decode(result.responseText);
|
||||
if (data.status == true) {
|
||||
// The case was cancelled
|
||||
parent.notify('', _("ID_CASE_CANCELLED", stringReplace("\\: ", "", _APP_NUM)));
|
||||
} else {
|
||||
// The case wasn't cancel
|
||||
parent.notify('', data.msg);
|
||||
}
|
||||
parent.updateCasesTree();
|
||||
} catch (e) {
|
||||
parent.notify('', _('ID_SOMETHING_WRONG'));
|
||||
}
|
||||
location.href = 'casesListExtJs';
|
||||
},
|
||||
failure: function (result, request) {
|
||||
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
text: _('ID_CANCEL'),
|
||||
handler: function () {
|
||||
msgCancel.close();
|
||||
}
|
||||
}]
|
||||
})
|
||||
]
|
||||
});
|
||||
msgCancel.show(this);
|
||||
}
|
||||
|
||||
Actions.getUsersToReassign = function()
|
||||
|
||||
Reference in New Issue
Block a user