Merge remote branch 'upstream/master'
This commit is contained in:
@@ -4366,13 +4366,6 @@ class Cases
|
||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), Criteria::IN);
|
||||
$oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN);
|
||||
$oCriteria->add(AppDocumentPeer::DEL_INDEX, 100000);
|
||||
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(
|
||||
AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN
|
||||
)->
|
||||
addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)));
|
||||
|
||||
$oCriteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX);
|
||||
|
||||
@@ -1057,39 +1057,66 @@ class workspaceTools
|
||||
* @param string $filename the script filename
|
||||
* @param string $database the database to execute this script into
|
||||
*/
|
||||
private function executeSQLScript($database, $filename)
|
||||
private function executeSQLScript($database, $filename, $parameters)
|
||||
{
|
||||
mysql_query("CREATE DATABASE IF NOT EXISTS " . mysql_real_escape_string($database));
|
||||
mysql_select_db($database);
|
||||
$script = file_get_contents($filename);
|
||||
$lines = explode("\n", $script);
|
||||
$previous = null;
|
||||
foreach ($lines as $j => $line) {
|
||||
// Remove comments from the script
|
||||
$line = trim($line);
|
||||
if (strpos($line, "--") === 0) {
|
||||
$line = substr($line, 0, strpos($line, "--"));
|
||||
}
|
||||
if (empty($line)) {
|
||||
continue;
|
||||
}
|
||||
// Concatenate the previous line, if any, with the current
|
||||
if ($previous) {
|
||||
$line = $previous . " " . $line;
|
||||
}
|
||||
$previous = null;
|
||||
// If the current line doesnt end with ; then put this line together
|
||||
// with the next one, thus supporting multi-line statements.
|
||||
if (strrpos($line, ";") != strlen($line) - 1) {
|
||||
$previous = $line;
|
||||
continue;
|
||||
}
|
||||
$line = substr($line, 0, strrpos($line, ";"));
|
||||
$result = mysql_query($line);
|
||||
if ($result === false) {
|
||||
throw new Exception("Error when running script '$filename', line $j, query '$line': " . mysql_error());
|
||||
}
|
||||
|
||||
// Check for safe mode and if mysql exist on server
|
||||
$flagFunction = '';
|
||||
if ( !ini_get('safe_mode') ) {
|
||||
$flagFunction = shell_exec('mysql --version');
|
||||
}
|
||||
|
||||
if ( !ini_get('safe_mode') && !is_null($flagFunction) ) {
|
||||
$command = 'mysql'
|
||||
. ' --host=' . $parameters['dbHost']
|
||||
. ' --user=' . $parameters['dbUser']
|
||||
. ' --password=' . $parameters['dbPass']
|
||||
. ' --database=' . mysql_real_escape_string($database)
|
||||
. ' --execute="SOURCE '.$filename.'"';
|
||||
shell_exec($command);
|
||||
|
||||
} else {
|
||||
//If the safe mode of the server is actived
|
||||
try {
|
||||
mysql_select_db($database);
|
||||
$script = file_get_contents($filename);
|
||||
|
||||
$lines = explode(";\n", $script);
|
||||
$previous = null;
|
||||
foreach ($lines as $j => $line) {
|
||||
// Remove comments from the script
|
||||
$line = trim($line);
|
||||
if (strpos($line, "--") === 0) {
|
||||
$line = substr($line, 0, strpos($line, "--"));
|
||||
}
|
||||
if (empty($line)) {
|
||||
continue;
|
||||
}
|
||||
// Concatenate the previous line, if any, with the current
|
||||
if ($previous) {
|
||||
$line = $previous . " " . $line;
|
||||
}
|
||||
$previous = null;
|
||||
// If the current line doesnt end with ; then put this line together
|
||||
// with the next one, thus supporting multi-line statements.
|
||||
if (strrpos($line, ";") != strlen($line) - 1) {
|
||||
$previous = $line;
|
||||
continue;
|
||||
}
|
||||
$line = substr($line, 0, strrpos($line, ";"));
|
||||
$result = mysql_query($line);
|
||||
if ($result === false) {
|
||||
throw new Exception("Error when running script '$filename', line $j, query '$line': " . mysql_error());
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
CLI::logging(CLI::error("Error:" . "There are problems running script '$filename': " . $e));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static public function restoreLegacy($directory)
|
||||
@@ -1254,7 +1281,7 @@ class workspaceTools
|
||||
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
||||
}
|
||||
list ($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
|
||||
$aParameters = array('dbHost'=>$dbHost,'dbUser'=>$dbUser,'dbPass'=>$dbPass);
|
||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
||||
@mysql_query("SET NAMES 'utf8';");
|
||||
@@ -1268,7 +1295,7 @@ class workspaceTools
|
||||
foreach ($metadata->databases as $db) {
|
||||
$dbName = $newDBNames[$db->name];
|
||||
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql");
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql",$aParameters);
|
||||
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
|
||||
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
try {
|
||||
//save info
|
||||
G::LoadClass( 'case' );
|
||||
|
||||
G::LoadClass( 'tasks' );
|
||||
|
||||
$oAppDocument = new AppDocument();
|
||||
$aFields = array ('APP_UID' => $_GET['APP_UID'],'DEL_INDEX' => 100000,'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $_GET['UID'],'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : ''
|
||||
);
|
||||
@@ -38,6 +39,7 @@ try {
|
||||
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
|
||||
$sPathName = PATH_DOCUMENT . G::getPathFromUID($_GET['APP_UID']) . PATH_SEP;
|
||||
$sFileName = $sAppDocUid . '.' . $ext;
|
||||
$sOriginalName = $_FILES['form']['name']['APP_DOC_FILENAME'];
|
||||
G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
|
||||
|
||||
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
||||
@@ -49,6 +51,66 @@ try {
|
||||
unlink( $sPathName . $sFileName );
|
||||
}
|
||||
//end plugin
|
||||
|
||||
//update AppData with the current file uploaded
|
||||
$oCase = new Cases();
|
||||
$aAppDataFields = $oCase->loadCase( $_GET['APP_UID'] );
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $_GET['APP_UID'], CRITERIA::EQUAL);
|
||||
$oCriteria->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$oDataset->next();
|
||||
$oTask = new Tasks();
|
||||
|
||||
$aDynaforms = array();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aSteps = $oTask->getStepsOfTask($aRow['TAS_UID']);
|
||||
if (is_array($aSteps)) {
|
||||
foreach ($aSteps as $key => $value) {
|
||||
$oCriteriaStep = new Criteria('workflow');
|
||||
$oCriteriaStep->addSelectColumn(StepPeer::STEP_UID_OBJ);
|
||||
$sStepId = (isset($value['STEP_UID'])) ? $value['STEP_UID'] : 0 ;
|
||||
$oCriteriaStep->add(StepPeer::STEP_UID, $sStepId, CRITERIA::EQUAL);
|
||||
$oCriteriaStep->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM', CRITERIA::EQUAL);
|
||||
$oDataSetStep = StepPeer::doSelectRS($oCriteriaStep);
|
||||
$oDataSetStep->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataSetStep->next();
|
||||
$aRows = $oDataSetStep->getRow();
|
||||
|
||||
if (is_array($aRows) && !in_array($aRows['STEP_UID_OBJ'], $aDynaforms)) {
|
||||
$aDynaforms[] = $aRows['STEP_UID_OBJ'];
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
|
||||
if (count($aDynaforms) > 0) {
|
||||
require_once ("classes/model/Dynaform.php");
|
||||
$dynInstance = new Dynaform();
|
||||
foreach ($aDynaforms as $key => $value) {
|
||||
$aAllFields = $dynInstance->getDynaformFields($value);
|
||||
if (is_array($aAllFields)) {
|
||||
foreach ($aAllFields as $kInput => $input) {
|
||||
if (!isset($input->input)) continue;
|
||||
|
||||
if ($input->type == 'file' && $input->input == $_GET['UID'] && !empty($aAppDataFields['APP_DATA'][$kInput])) {
|
||||
$aAppDataFields['APP_DATA'][$kInput] = $sOriginalName;
|
||||
$oCase->updateCase( $_GET['APP_UID'], $aAppDataFields );
|
||||
}
|
||||
}
|
||||
unset($input);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
}
|
||||
//End Update AppData with the current file uploaded
|
||||
}
|
||||
}
|
||||
//go to the next step
|
||||
|
||||
@@ -46,7 +46,8 @@ try {
|
||||
if (isset( $aData['SEND_EMAIL'] )) {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE';
|
||||
} else {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
|
||||
$aTaskInfo = $oTask->load($aData['TAS_UID']);
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = is_null($aTaskInfo['TAS_SEND_LAST_EMAIL']) ? 'FALSE' : $aTaskInfo['TAS_SEND_LAST_EMAIL'];
|
||||
}
|
||||
|
||||
//Additional configuration
|
||||
|
||||
@@ -720,7 +720,8 @@ Ext.app.menuLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, {
|
||||
attr.expanded = true;
|
||||
//}
|
||||
}else if(attr.title){
|
||||
attr.text = attr.title;
|
||||
attr.text = Ext.util.Format.htmlDecode(attr.title);
|
||||
|
||||
if( attr.cases_count )
|
||||
attr.text += ' (<label id="NOTIFIER_'+attr.id+'">' + attr.cases_count + '</label>)';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user