Merged in danteloayza/processmaker/BY-237 (pull request #4382)
BY-237, BY-232, BY-169, BY-170
This commit is contained in:
@@ -414,9 +414,23 @@ class AppDocumentDrive
|
||||
}
|
||||
}
|
||||
|
||||
public function addUsersDocumentDrive ($appUid)
|
||||
/**
|
||||
* Add users to documents drive to give permissions
|
||||
*
|
||||
* @param $appUid Id application
|
||||
* @param $emails array with emails which can be null
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addUsersDocumentDrive ($appUid, $emails=null)
|
||||
{
|
||||
$this->getEmailUsersTask($appUid);
|
||||
if (is_array($emails)) {
|
||||
foreach ($emails as $index => $email) {
|
||||
$this->addUserEmail($email);
|
||||
}
|
||||
} else {
|
||||
$this->getEmailUsersTask($appUid);
|
||||
}
|
||||
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->add( AppDocumentPeer::APP_UID, $appUid );
|
||||
|
||||
@@ -235,6 +235,16 @@ class labelsGmail
|
||||
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
|
||||
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
|
||||
|
||||
//if there isn't any message at draft, and lasindex is zero, is a subprocess
|
||||
//and we must search in inbox:
|
||||
if ($actualLastIndex === 0 && count($messageList) ===0) {
|
||||
$labelsToRemove = $labelsIds['Inbox'];
|
||||
$labelsToSearch = "*-inbox";
|
||||
$labelsToAdd = $labelsIds['Participated'];
|
||||
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
|
||||
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
|
||||
}
|
||||
|
||||
foreach ($messageList as $message) {
|
||||
$messageId = $message->getId();
|
||||
|
||||
|
||||
@@ -226,12 +226,28 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton ();
|
||||
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
|
||||
G::LoadClass("pmGoogleApi");
|
||||
try{
|
||||
$pmGoogle = new PMGoogleApi ();
|
||||
if ($pmGoogle->getServiceGmailStatus()) {
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||
$Pmgmail->gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess);
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
error_log($oError->getMessage());
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
if ($flagActionsByEmail) {
|
||||
if ($flagActionsByEmail) {
|
||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $delIndex;
|
||||
|
||||
@@ -261,21 +261,6 @@ function startCase ()
|
||||
|
||||
$_SESSION['CASES_REFRESH'] = true;
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//sending the email for gmail integration if the option is available
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
G::LoadClass( "pmGoogleApi" );
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
|
||||
if($pmGoogle->getServiceGmailStatus()){
|
||||
require_once 'src/ProcessMaker/BusinessModel/Pmgmail.php';
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||
$response = $Pmgmail->sendEmail($aData['APPLICATION'], "", $aData['INDEX'], null, null);
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$oCase = new Cases();
|
||||
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
|
||||
|
||||
@@ -77,6 +77,17 @@ if ($aDelegation['USR_UID'] == "") {
|
||||
$labGmail->addRelabelingToQueue($sAppUid, $iDelIndex, -1, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($licensedFeatures->verifyfeature('AhKNjBEVXZlWUFpWE8wVTREQ0FObmo0aTdhVzhvalFic1M=')) {
|
||||
G::LoadClass("AppDocumentDrive");
|
||||
$drive = new AppDocumentDrive();
|
||||
if ($drive->getStatusDrive()) {
|
||||
//add users email next task
|
||||
$user = new Users();
|
||||
$userInfo = $user->load($_SESSION['USER_LOGGED']);
|
||||
$drive->addUsersDocumentDrive($sAppUid, array($userInfo['USR_EMAIL']));
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//changing email labels if the claim comes from gmail
|
||||
if(array_key_exists('gmail',$_SESSION) && $_SESSION['gmail'] == 1){
|
||||
|
||||
@@ -179,13 +179,9 @@ try {
|
||||
|
||||
$appDelPrev = $appDel->LoadParallel ( $_SESSION ['APPLICATION'] );
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail ();
|
||||
if (! $appDelPrev) {
|
||||
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $_SESSION ['INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
|
||||
} else {
|
||||
foreach ( $appDelPrev as $app ) {
|
||||
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
|
||||
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
|
||||
}
|
||||
foreach ( $appDelPrev as $app ) {
|
||||
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
|
||||
$Pmgmail->gmailsIfSelfServiceValueBased ( $_SESSION ['APPLICATION'], $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,7 +68,7 @@ class GmailIntegration extends Api
|
||||
{
|
||||
try {
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||
$response = $Pmgmail->sendEmail($app_uid, $mail, $index);
|
||||
$response = $Pmgmail->sendGmail($app_uid, $mail, $index);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
|
||||
Reference in New Issue
Block a user