Merged in 3.1 (pull request #4737)

Updating branch HOR-1500 with last changes in 3.1 (2016-08-11)
This commit is contained in:
Julio Cesar Laura Avendaño
2016-08-11 15:42:38 -04:00
6 changed files with 180 additions and 56 deletions

View File

@@ -3129,6 +3129,13 @@ class wsBase
$g->sessionVarRestore();
return $result;
}
$oAppThread = new AppThread();
$cant = $oAppThread->countStatus($caseUid, 'OPEN');
if($cant > 1){
$result = new wsResponse( 100, G::LoadTranslation( "ID_CASE_CANCELLED_PARALLEL" ) );
$g->sessionVarRestore();
return $result;
}
$case = new Cases();
$case->cancelCase( $caseUid, $delIndex, $userUid );

View File

@@ -114,5 +114,15 @@ class AppThread extends BaseAppThread
throw($oError);
}
}
public function countStatus($appUid, $status='OPEN'){
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn( AppThreadPeer::APP_THREAD_PARENT );
$c->add(AppThreadPeer::APP_UID, $appUid );
$c->add(AppThreadPeer::APP_THREAD_STATUS , $status );
$cant = AppThreadPeer::doCount($c);
return $cant;
}
}

View File

@@ -498,7 +498,7 @@ class Translation extends BaseTranslation
}
}
return $environments;
return $this->sortByColumn($environments, 'LANGUAGE');
/*
G::LoadSystem('dbMaintenance');
@@ -520,6 +520,31 @@ class Translation extends BaseTranslation
*/
}
/**
* Sorts an array according to a specified column
* Params : array $table
* string $colname
* bool $numeric
**/
public function sortByColumn($table, $colname) {
$tn = $ts = $temp_num = $temp_str = array();
foreach ($table as $key => $row) {
if(is_numeric(substr($row[$colname], 0, 1))) {
$tn[$key] = $row[$colname];
$temp_num[$key] = $row;
}
else {
$ts[$key] = $row[$colname];
$temp_str[$key] = $row;
}
}
unset($table);
array_multisort($tn, SORT_ASC, SORT_NUMERIC, $temp_num);
array_multisort($ts, SORT_ASC, SORT_STRING, $temp_str);
return array_merge($temp_num, $temp_str);
}
public function getInfoFromPOFile ($file)
{
G::loadClass( 'i18n_po' );