Merge remote branch 'upstream/master'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* CalendarDefinition.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
@@ -20,9 +21,12 @@ require_once 'classes/model/CalendarAssignments.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class CalendarDefinition extends BaseCalendarDefinition {
|
||||
class CalendarDefinition extends BaseCalendarDefinition
|
||||
{
|
||||
public $calendarLog = '';
|
||||
function getCalendarList($onlyActive = false, $arrayMode = false) {
|
||||
|
||||
public function getCalendarList ($onlyActive = false, $arrayMode = false)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria->clearSelectColumns();
|
||||
|
||||
@@ -35,9 +39,11 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
// $Criteria->addAsColumn('DELETABLE', "IF (CALENDAR_UID <> '00000000000000000000000000000001', '".G::LoadTranslation('ID_DELETE')."','') ");
|
||||
$Criteria->addAsColumn( 'DELETABLE', "CASE WHEN CALENDAR_UID <> '00000000000000000000000000000001' THEN '" . G::LoadTranslation( 'ID_DELETE' ) . "' ELSE '' END " );
|
||||
// Note: This list doesn't show deleted items (STATUS = DELETED)
|
||||
if ($onlyActive) { // Show only active. Used on assignment lists
|
||||
if ($onlyActive) {
|
||||
// Show only active. Used on assignment lists
|
||||
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, "ACTIVE", CRITERIA::EQUAL );
|
||||
} else { // Show Active and Inactive calendars. USed in main list
|
||||
} else {
|
||||
// Show Active and Inactive calendars. USed in main list
|
||||
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, array ("ACTIVE","INACTIVE"), CRITERIA::IN );
|
||||
}
|
||||
|
||||
@@ -63,14 +69,13 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
}
|
||||
//Added by qennix
|
||||
//Gets criteria for listing
|
||||
function getCalendarCriterias($filter, $start, $limit){
|
||||
public function getCalendarCriterias ($filter, $start, $limit)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria->clearSelectColumns();
|
||||
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
|
||||
if ($filter != '') {
|
||||
$Criteria->add(
|
||||
$Criteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_NAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$Criteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_DESCRIPTION,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$Criteria->add( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) );
|
||||
}
|
||||
$Criteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL );
|
||||
|
||||
@@ -82,9 +87,7 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION );
|
||||
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS );
|
||||
if ($filter != '') {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_NAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_DESCRIPTION,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) );
|
||||
}
|
||||
$oCriteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL );
|
||||
$oCriteria->setLimit( $limit );
|
||||
@@ -95,7 +98,9 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$criterias['LIST'] = $oCriteria;
|
||||
return $criterias;
|
||||
}
|
||||
function getCalendarInfo($CalendarUid) {
|
||||
|
||||
public function getCalendarInfo ($CalendarUid)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
|
||||
|
||||
@@ -131,20 +136,18 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$CalendarBusinessHoursObj = new CalendarBusinessHours();
|
||||
$CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid );
|
||||
$fields['BUSINESS_DAY'] = $CalendarBusinessHours;
|
||||
|
||||
$CalendarHolidaysObj = new CalendarHolidays();
|
||||
$CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid );
|
||||
$fields['HOLIDAY'] = $CalendarHolidays;
|
||||
$fields=$this->validateCalendarInfo($fields, $defaultCalendar); //********************
|
||||
|
||||
$fields = $this->validateCalendarInfo( $fields, $defaultCalendar );
|
||||
//********************
|
||||
return $fields;
|
||||
|
||||
}
|
||||
//for edit
|
||||
function getCalendarInfoE($CalendarUid) {
|
||||
public function getCalendarInfoE ($CalendarUid)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
|
||||
|
||||
$defaultCalendar['CALENDAR_UID'] = "00000000000000000000000000000001";
|
||||
$defaultCalendar['CALENDAR_NAME'] = "Default";
|
||||
$defaultCalendar['CALENDAR_CREATE_DATE'] = date( "Y-m-d" );
|
||||
@@ -177,18 +180,16 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$CalendarBusinessHoursObj = new CalendarBusinessHours();
|
||||
$CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid );
|
||||
$fields['BUSINESS_DAY'] = $CalendarBusinessHours;
|
||||
|
||||
$CalendarHolidaysObj = new CalendarHolidays();
|
||||
$CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid );
|
||||
$fields['HOLIDAY'] = $CalendarHolidays;
|
||||
// $fields=$this->validateCalendarInfo($fields, $defaultCalendar); //********************
|
||||
|
||||
return $fields;
|
||||
|
||||
}
|
||||
//end for edit
|
||||
|
||||
function validateCalendarInfo($fields,$defaultCalendar){
|
||||
public function validateCalendarInfo ($fields, $defaultCalendar)
|
||||
{
|
||||
try {
|
||||
//Validate if Working days are Correct
|
||||
//Minimun 3 ?
|
||||
@@ -221,7 +222,6 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
throw (new Exception( "Not all working days have their correspondent business day" ));
|
||||
}
|
||||
//Validate Holidays
|
||||
|
||||
return $fields;
|
||||
} catch (Exception $e) {
|
||||
//print $e->getMessage();
|
||||
@@ -231,9 +231,10 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
return $defaultCalendar;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function saveCalendarInfo($aData) {
|
||||
|
||||
public function saveCalendarInfo ($aData)
|
||||
{
|
||||
$CalendarUid = $aData['CALENDAR_UID'];
|
||||
$CalendarName = $aData['CALENDAR_NAME'];
|
||||
$CalendarDescription = $aData['CALENDAR_DESCRIPTION'];
|
||||
@@ -253,7 +254,6 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
}
|
||||
$tr->setCalendarUid( $CalendarUid );
|
||||
$tr->setCalendarName( $CalendarName );
|
||||
|
||||
$tr->setCalendarUpdateDate( 'now' );
|
||||
$tr->setCalendarDescription( $CalendarDescription );
|
||||
$tr->setCalendarStatus( $CalendarStatus );
|
||||
@@ -271,7 +271,6 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$objData['CALENDAR_UID'] = $CalendarUid;
|
||||
$CalendarBusinessHoursObj->saveCalendarBusinessHours( $objData );
|
||||
}
|
||||
|
||||
//Holiday Save code.
|
||||
//First Delete all current records
|
||||
$CalendarHolidayObj = new CalendarHolidays();
|
||||
@@ -293,18 +292,14 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
||||
}
|
||||
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
|
||||
|
||||
|
||||
//to do: uniform coderror structures for all classes
|
||||
|
||||
|
||||
//if ( $res['codError'] < 0 ) {
|
||||
// G::SendMessageText ( $res['message'] , 'error' );
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
function deleteCalendar($CalendarUid) {
|
||||
|
||||
public function deleteCalendar ($CalendarUid)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
|
||||
|
||||
@@ -323,7 +318,6 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
@@ -335,24 +329,18 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
||||
}
|
||||
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
|
||||
|
||||
|
||||
//to do: uniform coderror structures for all classes
|
||||
|
||||
|
||||
//if ( $res['codError'] < 0 ) {
|
||||
// G::SendMessageText ( $res['message'] , 'error' );
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
function getCalendarFor($userUid, $proUid, $tasUid, $sw_validate=true) {
|
||||
$Criteria = new Criteria ( 'workflow' );
|
||||
|
||||
public function getCalendarFor ($userUid, $proUid, $tasUid, $sw_validate = true)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
//Default Calendar
|
||||
$calendarUid = "00000000000000000000000000000001";
|
||||
$calendarOwner = "DEFAULT";
|
||||
|
||||
//Load User,Task and Process calendars (if exist)
|
||||
$Criteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID );
|
||||
$Criteria->addSelectColumn( CalendarAssignmentsPeer::OBJECT_UID );
|
||||
@@ -374,6 +362,7 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
if (isset( $calendarArray['USER'] )) {
|
||||
$calendarUid = $calendarArray['USER'];
|
||||
$calendarOwner = "USER";
|
||||
@@ -396,13 +385,13 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
return $calendarDefinition;
|
||||
}
|
||||
|
||||
function assignCalendarTo($objectUid, $calendarUid, $objectType) {
|
||||
public function assignCalendarTo ($objectUid, $calendarUid, $objectType)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = CalendarAssignmentsPeer::retrieveByPK( $objectUid );
|
||||
if ($calendarUid != "") {
|
||||
if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) {
|
||||
$tr = new CalendarAssignments();
|
||||
|
||||
}
|
||||
$tr->setObjectUid( $objectUid );
|
||||
$tr->setCalendarUid( $calendarUid );
|
||||
@@ -411,7 +400,6 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
@@ -421,16 +409,17 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
}
|
||||
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
||||
}
|
||||
} else { //Delete record
|
||||
} else {
|
||||
//Delete record
|
||||
if ((is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) {
|
||||
$tr->delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Added by Qennix
|
||||
//Counts all users,task,process by calendar
|
||||
function getAllCounterByCalendar($type){
|
||||
public function getAllCounterByCalendar ($type)
|
||||
{
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||
@@ -446,7 +435,7 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
return $aCounter;
|
||||
}
|
||||
|
||||
function loadByCalendarName($calendarName)
|
||||
public function loadByCalendarName ($calendarName)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
|
||||
@@ -459,9 +448,8 @@ class CalendarDefinition extends BaseCalendarDefinition {
|
||||
$oDataset = calendarDefinitionPeer::doSelectRS( $Criteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
|
||||
return $oDataset->getRow();
|
||||
}
|
||||
} // CalendarDefinition
|
||||
|
||||
}
|
||||
// CalendarDefinition
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Content.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -37,8 +38,8 @@ require_once 'classes/model/om/BaseContent.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Content extends BaseContent {
|
||||
|
||||
class Content extends BaseContent
|
||||
{
|
||||
public $langs;
|
||||
public $rowsProcessed;
|
||||
public $rowsInserted;
|
||||
@@ -50,15 +51,17 @@ class Content extends BaseContent {
|
||||
* @param string $sUID
|
||||
* @return variant
|
||||
*/
|
||||
function load($ConCategory, $ConParent, $ConId, $ConLang) {
|
||||
public function load ($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
{
|
||||
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
if (is_null( $content )) {
|
||||
//we dont find any value for this field and language in CONTENT table
|
||||
//we dont find any value for this field and language in CONTENT table;
|
||||
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
} else {
|
||||
//krumo($content);
|
||||
$ConValue = $content->getConValue();
|
||||
if ($ConValue == "") { //try to find a valid translation
|
||||
if ($ConValue == "") {
|
||||
//try to find a valid translation
|
||||
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
}
|
||||
}
|
||||
@@ -72,7 +75,8 @@ class Content extends BaseContent {
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
function getDefaultContentLang($ConCategory, $ConParent, $ConId, $destConLang) {
|
||||
public function getDefaultContentLang ($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
|
||||
@@ -85,7 +89,6 @@ class Content extends BaseContent {
|
||||
$Criteria->add( ContentPeer::CON_CATEGORY, $ConCategory, CRITERIA::EQUAL );
|
||||
$Criteria->add( ContentPeer::CON_PARENT, $ConParent, CRITERIA::EQUAL );
|
||||
$Criteria->add( ContentPeer::CON_ID, $ConId, CRITERIA::EQUAL );
|
||||
|
||||
$Criteria->add( ContentPeer::CON_LANG, $destConLang, CRITERIA::NOT_EQUAL );
|
||||
|
||||
$rs = ContentPeer::doSelectRS( $Criteria );
|
||||
@@ -94,7 +97,6 @@ class Content extends BaseContent {
|
||||
|
||||
if (is_array( $row = $rs->getRow() )) {
|
||||
$defaultLang = $row['CON_LANG'];
|
||||
|
||||
} else {
|
||||
$defaultLang = "";
|
||||
}
|
||||
@@ -109,7 +111,8 @@ class Content extends BaseContent {
|
||||
* @return string
|
||||
* if the row doesn't exist, it will be created automatically, even the default 'en' language
|
||||
*/
|
||||
function autoLoadSave($ConCategory, $ConParent, $ConId, $destConLang) {
|
||||
public function autoLoadSave ($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
{
|
||||
//search in 'en' language, the default language
|
||||
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, 'en' );
|
||||
|
||||
@@ -119,10 +122,12 @@ class Content extends BaseContent {
|
||||
}
|
||||
|
||||
//to do: review if the $destConLang is a valid language/
|
||||
if (is_null ( $content ))
|
||||
$ConValue = ''; //we dont find any value for this field and language in CONTENT table
|
||||
else
|
||||
if (is_null( $content )) {
|
||||
$ConValue = '';
|
||||
//we dont find any value for this field and language in CONTENT table
|
||||
} else {
|
||||
$ConValue = $content->getConValue();
|
||||
}
|
||||
|
||||
try {
|
||||
$con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $destConLang );
|
||||
@@ -153,7 +158,8 @@ class Content extends BaseContent {
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
function addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) {
|
||||
public function addContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
try {
|
||||
if ($ConLang != 'en') {
|
||||
$baseLangContent = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, 'en' );
|
||||
@@ -167,12 +173,14 @@ class Content extends BaseContent {
|
||||
if (is_null( $con )) {
|
||||
$con = new Content();
|
||||
} else {
|
||||
if ($con->getConParent () == $ConParent && $con->getConCategory () == $ConCategory && $con->getConValue () == $ConValue && $con->getConLang () == $ConLang && $con->getConId () == $ConId)
|
||||
if ($con->getConParent() == $ConParent && $con->getConCategory() == $ConCategory && $con->getConValue() == $ConValue && $con->getConLang() == $ConLang && $con->getConId() == $ConId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$con->setConCategory( $ConCategory );
|
||||
if ($con->getConParent () != $ConParent)
|
||||
if ($con->getConParent() != $ConParent) {
|
||||
$con->setConParent( $ConParent );
|
||||
}
|
||||
$con->setConId( $ConId );
|
||||
$con->setConLang( $ConLang );
|
||||
$con->setConValue( $ConValue );
|
||||
@@ -197,7 +205,8 @@ class Content extends BaseContent {
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
function insertContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) {
|
||||
public function insertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
try {
|
||||
$con = new Content();
|
||||
$con->setConCategory( $ConCategory );
|
||||
@@ -226,7 +235,8 @@ class Content extends BaseContent {
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
function removeContent($ConCategory, $ConParent, $ConId) {
|
||||
public function removeContent ($ConCategory, $ConParent, $ConId)
|
||||
{
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->add( ContentPeer::CON_CATEGORY, $ConCategory );
|
||||
@@ -256,7 +266,7 @@ class Content extends BaseContent {
|
||||
* @param string $ConValue
|
||||
* @return boolean true or false
|
||||
*/
|
||||
function Exists ($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
public function Exists ($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
{
|
||||
try {
|
||||
$oPro = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
@@ -265,8 +275,7 @@ class Content extends BaseContent {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +285,7 @@ class Content extends BaseContent {
|
||||
*
|
||||
* @param array $langs
|
||||
*/
|
||||
function regenerateContent($langs, $workSpace=SYS_SYS)
|
||||
public function regenerateContent ($langs, $workSpace = SYS_SYS)
|
||||
{
|
||||
//Search the language
|
||||
$key = array_search( 'en', $langs );
|
||||
@@ -330,8 +339,7 @@ class Content extends BaseContent {
|
||||
$workSpace = new workspaceTools( $workSpace );
|
||||
$workSpace->getDBInfo();
|
||||
|
||||
$link = mysql_pconnect($workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass)
|
||||
or die ("Could not connect");
|
||||
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass ) or die( "Could not connect" );
|
||||
|
||||
mysql_select_db( $workSpace->dbName, $link );
|
||||
mysql_query( "SET NAMES 'utf8';" );
|
||||
@@ -339,11 +347,10 @@ class Content extends BaseContent {
|
||||
$result = mysql_unbuffered_query( $sql, $link );
|
||||
$list = array ();
|
||||
$default = array ();
|
||||
$sw = array('CON_ID'=>'','CON_CATEGORY'=>'','CON_PARENT'=>'');
|
||||
$sw = array ('CON_ID' => '','CON_CATEGORY' => '','CON_PARENT' => ''
|
||||
);
|
||||
while ($row = mysql_fetch_assoc( $result )) {
|
||||
if ($sw['CON_ID'] == $row['CON_ID'] &&
|
||||
$sw['CON_CATEGORY'] == $row['CON_CATEGORY'] &&
|
||||
$sw['CON_PARENT'] == $row['CON_PARENT']) {
|
||||
if ($sw['CON_ID'] == $row['CON_ID'] && $sw['CON_CATEGORY'] == $row['CON_CATEGORY'] && $sw['CON_PARENT'] == $row['CON_PARENT']) {
|
||||
$list[] = $row;
|
||||
} else {
|
||||
$this->rowsClustered ++;
|
||||
@@ -375,7 +382,6 @@ class Content extends BaseContent {
|
||||
}
|
||||
mysql_free_result( $result );
|
||||
$total = $this->rowsProcessed + $this->rowsInserted;
|
||||
|
||||
$connection = Propel::getConnection( 'workflow' );
|
||||
$statement = $connection->prepareStatement( "INSERT INTO CONTENT
|
||||
SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE
|
||||
@@ -394,7 +400,7 @@ class Content extends BaseContent {
|
||||
}
|
||||
}
|
||||
|
||||
function checkLanguage($content, $default)
|
||||
public function checkLanguage ($content, $default)
|
||||
{
|
||||
if (count( $content ) > 0) {
|
||||
$langs = $this->langs;
|
||||
@@ -406,18 +412,13 @@ class Content extends BaseContent {
|
||||
}
|
||||
foreach ($langsAsoc as $key => $value) {
|
||||
$this->rowsInserted ++;
|
||||
$this->fastInsertContent(
|
||||
$default['CON_CATEGORY'],
|
||||
$default['CON_PARENT'],
|
||||
$default['CON_ID'],
|
||||
$value,
|
||||
$default['CON_VALUE']
|
||||
);
|
||||
$this->fastInsertContent( $default['CON_CATEGORY'], $default['CON_PARENT'], $default['CON_ID'], $value, $default['CON_VALUE'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) {
|
||||
public function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
$ConValue = mysql_real_escape_string( $ConValue );
|
||||
$connection = Propel::getConnection( 'workflow' );
|
||||
$statement = $connection->prepareStatement( "INSERT INTO CONTENT_BACKUP (
|
||||
@@ -426,7 +427,8 @@ class Content extends BaseContent {
|
||||
$statement->executeQuery();
|
||||
}
|
||||
|
||||
function removeLanguageContent($lanId) {
|
||||
public function removeLanguageContent ($lanId)
|
||||
{
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->addSelectColumn( ContentPeer::CON_CATEGORY );
|
||||
@@ -444,9 +446,9 @@ class Content extends BaseContent {
|
||||
while (is_array( $row )) {
|
||||
$content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId );
|
||||
|
||||
if( $content !== null )
|
||||
if ($content !== null) {
|
||||
$content->delete();
|
||||
|
||||
}
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
}
|
||||
@@ -457,8 +459,11 @@ class Content extends BaseContent {
|
||||
}
|
||||
//Added by Enrique at Feb 9th,2011
|
||||
//Gets all Role Names by Role
|
||||
function getAllContentsByRole($sys_lang=SYS_LANG){
|
||||
if (!isset($sys_lang)) $sys_lang = 'en';
|
||||
public function getAllContentsByRole ($sys_lang = SYS_LANG)
|
||||
{
|
||||
if (! isset( $sys_lang )) {
|
||||
$sys_lang = 'en';
|
||||
}
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn( ContentPeer::CON_ID );
|
||||
@@ -475,5 +480,6 @@ class Content extends BaseContent {
|
||||
}
|
||||
return $aRoles;
|
||||
}
|
||||
}
|
||||
// Content
|
||||
|
||||
} // Content
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* ReportTable.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -27,7 +28,6 @@
|
||||
require_once 'classes/model/Content.php';
|
||||
require_once 'classes/model/om/BaseReportTable.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'REPORT_TABLE' table.
|
||||
*
|
||||
@@ -39,18 +39,22 @@ require_once 'classes/model/om/BaseReportTable.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class ReportTable extends BaseReportTable {
|
||||
class ReportTable extends BaseReportTable
|
||||
{
|
||||
/**
|
||||
* This value goes in the content table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $rep_tab_title = '';
|
||||
|
||||
/**
|
||||
* Get the rep_tab_title column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRepTabTitle() {
|
||||
public function getRepTabTitle ()
|
||||
{
|
||||
if ($this->getRepTabUid() == "") {
|
||||
throw (new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank" ));
|
||||
}
|
||||
@@ -84,78 +88,74 @@ class ReportTable extends BaseReportTable {
|
||||
{
|
||||
try {
|
||||
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
|
||||
if (!is_null($oRow))
|
||||
{
|
||||
if (! is_null( $oRow )) {
|
||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
$this->setNew( false );
|
||||
$this->setRepTabTitle( $aFields['REP_TAB_TITLE'] = $this->getRepTabTitle() );
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
|
||||
return array ();
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function create ($aData)
|
||||
{
|
||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
if ( isset ( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID']== '' )
|
||||
if (isset( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID'] == '') {
|
||||
unset( $aData['REP_TAB_UID'] );
|
||||
if ( !isset ( $aData['REP_TAB_UID'] ) )
|
||||
}
|
||||
if (! isset( $aData['REP_TAB_UID'] )) {
|
||||
$this->setRepTabUid( G::generateUniqueID() );
|
||||
else
|
||||
} else {
|
||||
$this->setRepTabUid( $aData['REP_TAB_UID'] );
|
||||
}
|
||||
|
||||
$this->setProUid( $aData['PRO_UID'] );
|
||||
$this->setRepTabName( $aData['REP_TAB_NAME'] );
|
||||
$this->setRepTabType( $aData['REP_TAB_TYPE'] );
|
||||
if ( !isset ( $aData['REP_TAB_GRID'] ) )
|
||||
if (! isset( $aData['REP_TAB_GRID'] )) {
|
||||
$this->setRepTabGrid( "" );
|
||||
else
|
||||
} else {
|
||||
$this->setRepTabGrid( $aData['REP_TAB_GRID'] );
|
||||
if ( !isset ( $aData['REP_TAB_CONNECTION'] ) )
|
||||
}
|
||||
if (! isset( $aData['REP_TAB_CONNECTION'] )) {
|
||||
$this->setRepTabConnection( "report" );
|
||||
else
|
||||
} else {
|
||||
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
|
||||
}
|
||||
$this->setRepTabCreateDate( date( 'Y-m-d H:i:s' ) );
|
||||
$this->setRepTabStatus( 'ACTIVE' );
|
||||
|
||||
if($this->validate())
|
||||
{
|
||||
if ( !isset ( $aData['REP_TAB_TITLE'] ) )
|
||||
if ($this->validate()) {
|
||||
if (! isset( $aData['REP_TAB_TITLE'] )) {
|
||||
$this->setRepTabTitle( "" );
|
||||
else
|
||||
} else {
|
||||
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
|
||||
|
||||
}
|
||||
$result = $this->save();
|
||||
$con->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function update ($fields)
|
||||
{
|
||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
$this->load( $fields['REP_TAB_UID'] );
|
||||
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||
@@ -169,34 +169,31 @@ class ReportTable extends BaseReportTable {
|
||||
$oValidate = $this->validate();
|
||||
}
|
||||
// if($this->validate())
|
||||
if($oValidate)
|
||||
{
|
||||
if ($oValidate) {
|
||||
$contentResult = 0;
|
||||
if (array_key_exists("REP_TAB_TITLE", $fields)) $contentResult+=$this->setRepTabTitle($fields["REP_TAB_TITLE"]);
|
||||
if (array_key_exists( "REP_TAB_TITLE", $fields )) {
|
||||
$contentResult += $this->setRepTabTitle( $fields["REP_TAB_TITLE"] );
|
||||
}
|
||||
$result = $this->save();
|
||||
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
||||
$con->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$con->rollback();
|
||||
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||
$validationE->aValidationFailures = $this->getValidationFailures();
|
||||
throw ($validationE);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function remove ($RepTabUid)
|
||||
{
|
||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
|
||||
if (! is_null( $oRepTab )) {
|
||||
@@ -205,27 +202,26 @@ class ReportTable extends BaseReportTable {
|
||||
$con->commit();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
function reportTableExists ( $RepTabUid ) {
|
||||
public function reportTableExists ($RepTabUid)
|
||||
{
|
||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||
try {
|
||||
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
|
||||
if (is_object( $oRepTabUid ) && get_class( $oRepTabUid ) == 'ReportTable') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
} // ReportTable
|
||||
}
|
||||
// ReportTable
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Route.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -38,7 +39,8 @@ require_once 'classes/model/Content.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Route extends BaseRoute {
|
||||
class Route extends BaseRoute
|
||||
{
|
||||
|
||||
/*
|
||||
* Load the application document registry
|
||||
@@ -49,26 +51,25 @@ class Route extends BaseRoute {
|
||||
{
|
||||
try {
|
||||
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
|
||||
if (!is_null($oRoute))
|
||||
{
|
||||
if (! is_null( $oRoute )) {
|
||||
$aFields = $oRoute->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the application document registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return string
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||
@@ -78,9 +79,12 @@ class Route extends BaseRoute {
|
||||
$oRoute = new Route();
|
||||
|
||||
// validating default values
|
||||
$aData['ROU_TO_LAST_USER'] = $this->validateValue(isset($aData['ROU_TO_LAST_USER']) ? $aData['ROU_TO_LAST_USER'] : '', array('TRUE', 'FALSE'), 'FALSE');
|
||||
$aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE');
|
||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL']: '', array('TRUE', 'FALSE'), 'TRUE');
|
||||
$aData['ROU_TO_LAST_USER'] = $this->validateValue( isset( $aData['ROU_TO_LAST_USER'] ) ? $aData['ROU_TO_LAST_USER'] : '', array ('TRUE','FALSE'
|
||||
), 'FALSE' );
|
||||
$aData['ROU_OPTIONAL'] = $this->validateValue( isset( $aData['ROU_OPTIONAL'] ) ? $aData['ROU_OPTIONAL'] : '', array ('TRUE','FALSE'
|
||||
), 'FALSE' );
|
||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue( isset( $aData['ROU_SEND_EMAIL'] ) ? $aData['ROU_SEND_EMAIL'] : '', array ('TRUE','FALSE'
|
||||
), 'TRUE' );
|
||||
|
||||
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
|
||||
@@ -89,8 +93,7 @@ class Route extends BaseRoute {
|
||||
$iResult = $oRoute->save();
|
||||
$oConnection->commit();
|
||||
return $sRouteUID;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oRoute->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
@@ -98,34 +101,36 @@ class Route extends BaseRoute {
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the application document registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return string
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function update ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||
try {
|
||||
$oRoute = RoutePeer::retrieveByPK( $aData['ROU_UID'] );
|
||||
if (!is_null($oRoute))
|
||||
{
|
||||
if (! is_null( $oRoute )) {
|
||||
// validating default values
|
||||
if (isset( $aData['ROU_TO_LAST_USER'] )) {
|
||||
$aData['ROU_TO_LAST_USER'] = $this->validateValue($aData['ROU_TO_LAST_USER'], array('TRUE', 'FALSE'), 'FALSE');
|
||||
$aData['ROU_TO_LAST_USER'] = $this->validateValue( $aData['ROU_TO_LAST_USER'], array ('TRUE','FALSE'
|
||||
), 'FALSE' );
|
||||
}
|
||||
if (isset( $aData['ROU_OPTIONAL'] )) {
|
||||
$aData['ROU_OPTIONAL'] = $this->validateValue($aData['ROU_OPTIONAL'], array('TRUE', 'FALSE'), 'FALSE');
|
||||
$aData['ROU_OPTIONAL'] = $this->validateValue( $aData['ROU_OPTIONAL'], array ('TRUE','FALSE'
|
||||
), 'FALSE' );
|
||||
}
|
||||
if (isset( $aData['ROU_SEND_EMAIL'] )) {
|
||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue($aData['ROU_SEND_EMAIL'], array('TRUE', 'FALSE'), 'TRUE');
|
||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue( $aData['ROU_SEND_EMAIL'], array ('TRUE','FALSE'
|
||||
), 'TRUE' );
|
||||
}
|
||||
|
||||
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
@@ -134,8 +139,7 @@ class Route extends BaseRoute {
|
||||
$iResult = $oRoute->save();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oRoute->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
@@ -143,12 +147,10 @@ class Route extends BaseRoute {
|
||||
}
|
||||
throw (new Exception( 'The ROUTE tables cannot be updated!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
@@ -156,43 +158,41 @@ class Route extends BaseRoute {
|
||||
|
||||
/**
|
||||
* Remove the application document registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return string
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function remove ($sRouUid)
|
||||
{
|
||||
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||
try {
|
||||
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
|
||||
if (!is_null($oRoute))
|
||||
{
|
||||
if (! is_null( $oRoute )) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oRoute->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function routeExists ( $sRouUid ) {
|
||||
public function routeExists ($sRouUid)
|
||||
{
|
||||
$con = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||
try {
|
||||
$oRouUid = RoutePeer::retrieveByPk( $sRouUid );
|
||||
if (is_object( $oRouUid ) && get_class( $oRouUid ) == 'Route') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -205,12 +205,13 @@ class Route extends BaseRoute {
|
||||
* @param $default string default value, if the tested value is not valid the default value is returned
|
||||
* @return the tested and accepted value
|
||||
*/
|
||||
function validateValue($value, $validValues, $default)
|
||||
public function validateValue ($value, $validValues, $default)
|
||||
{
|
||||
if (! in_array( $value, $validValues )) {
|
||||
$value = $default;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
} // Route
|
||||
}
|
||||
// Route
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Stage.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
require_once 'classes/model/Content.php';
|
||||
require_once 'classes/model/om/BaseStage.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'STAGE' table.
|
||||
*
|
||||
@@ -19,19 +19,22 @@ require_once 'classes/model/om/BaseStage.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Stage extends BaseStage {
|
||||
|
||||
class Stage extends BaseStage
|
||||
{
|
||||
/**
|
||||
* This value goes in the content table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $stg_title = '';
|
||||
|
||||
/**
|
||||
* Get the stg_title column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStgTitle() {
|
||||
public function getStgTitle ()
|
||||
{
|
||||
if ($this->getStgUid() == "") {
|
||||
throw (new Exception( "Error in getStgTitle, the getStgUid() can't be blank" ));
|
||||
}
|
||||
@@ -65,30 +68,30 @@ class Stage extends BaseStage {
|
||||
{
|
||||
try {
|
||||
$oRow = StagePeer::retrieveByPK( $StgUid );
|
||||
if (!is_null($oRow))
|
||||
{
|
||||
if (! is_null( $oRow )) {
|
||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
$this->setNew( false );
|
||||
$this->setStgTitle( $aFields['STG_TITLE'] = $this->getStgTitle() );
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( "The row '$StgUid' in table Stage doesn't exist!" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function create($aData) {
|
||||
public function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||
try {
|
||||
if ( isset ( $aData['STG_UID'] ) && $aData['STG_UID']== '' )
|
||||
if (isset( $aData['STG_UID'] ) && $aData['STG_UID'] == '') {
|
||||
unset( $aData['STG_UID'] );
|
||||
if ( !isset ( $aData['STG_UID'] ) )
|
||||
}
|
||||
if (! isset( $aData['STG_UID'] )) {
|
||||
$aData['STG_UID'] = G::generateUniqueID();
|
||||
}
|
||||
$oStage = new Stage();
|
||||
$oStage->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
$oStage->setStgTitle( $aData['STG_TITLE'] );
|
||||
@@ -97,8 +100,7 @@ class Stage extends BaseStage {
|
||||
$iResult = $oStage->save();
|
||||
$oConnection->commit();
|
||||
return $aData['STG_UID'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oStage->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
@@ -106,8 +108,7 @@ class Stage extends BaseStage {
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
@@ -116,30 +117,26 @@ class Stage extends BaseStage {
|
||||
public function update ($fields)
|
||||
{
|
||||
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
$this->load( $fields['STG_UID'] );
|
||||
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||
if($this->validate())
|
||||
{
|
||||
if ($this->validate()) {
|
||||
$contentResult = 0;
|
||||
if (array_key_exists("STG_TITLE", $fields)) $contentResult+=$this->setStgTitle($fields["STG_TITLE"]);
|
||||
if (array_key_exists( "STG_TITLE", $fields )) {
|
||||
$contentResult += $this->setStgTitle( $fields["STG_TITLE"] );
|
||||
}
|
||||
$result = $this->save();
|
||||
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
||||
$con->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$con->rollback();
|
||||
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||
$validationE->aValidationFailures = $this->getValidationFailures();
|
||||
throw ($validationE);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
@@ -148,8 +145,7 @@ class Stage extends BaseStage {
|
||||
public function remove ($StgUid)
|
||||
{
|
||||
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
$oStage = StagePeer::retrieveByPK( $StgUid );
|
||||
if (! is_null( $oStage )) {
|
||||
@@ -158,15 +154,14 @@ class Stage extends BaseStage {
|
||||
$con->commit();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
function reorderPositions($sProcessUID, $iIndex) {
|
||||
public function reorderPositions ($sProcessUID, $iIndex)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( StagePeer::PRO_UID, $sProcessUID );
|
||||
@@ -175,26 +170,24 @@ class Stage extends BaseStage {
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$this->update(array('STG_UID' => $aRow['STG_UID'],
|
||||
'PRO_UID' => $aRow['PRO_UID'],
|
||||
'STG_POSX' => $aRow['STG_POSX'],
|
||||
'STG_POSY' => $aRow['STG_POSY'],
|
||||
'STG_INDEX' => $aRow['STG_INDEX'] - 1));
|
||||
$this->update( array ('STG_UID' => $aRow['STG_UID'],'PRO_UID' => $aRow['PRO_UID'],'STG_POSX' => $aRow['STG_POSX'],'STG_POSY' => $aRow['STG_POSY'],'STG_INDEX' => $aRow['STG_INDEX'] - 1
|
||||
) );
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $Exception;
|
||||
}
|
||||
}
|
||||
|
||||
function Exists ( $sUid ) {
|
||||
public function Exists ($sUid)
|
||||
{
|
||||
try {
|
||||
$oObj = StagePeer::retrieveByPk( $sUid );
|
||||
return (is_object( $oObj ) && get_class( $oObj ) == 'Stage');
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
} // Stage
|
||||
}
|
||||
// Stage
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* StepSupervisor.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
require_once 'classes/model/om/BaseStepSupervisor.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'STEP_SUPERVISOR' table.
|
||||
*
|
||||
@@ -18,56 +18,56 @@ require_once 'classes/model/om/BaseStepSupervisor.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class StepSupervisor extends BaseStepSupervisor {
|
||||
|
||||
class StepSupervisor extends BaseStepSupervisor
|
||||
{
|
||||
public function load ($Uid)
|
||||
{
|
||||
try {
|
||||
$oRow = StepSupervisorPeer::retrieveByPK( $Uid );
|
||||
if (!is_null($oRow))
|
||||
{
|
||||
if (! is_null( $oRow )) {
|
||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
$this->setNew( false );
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( "The row '$Uid' in table StepSupervisor doesn't exist!" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function Exists ( $Uid ) {
|
||||
public function Exists ($Uid)
|
||||
{
|
||||
try {
|
||||
$oPro = StepSupervisorPeer::retrieveByPk( $Uid );
|
||||
if (is_object( $oPro ) && get_class( $oPro ) == 'StepSupervisor') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the step supervisor registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return boolean
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
||||
try {
|
||||
if ( isset ( $aData['STEP_UID'] ) && $aData['STEP_UID']== '' )
|
||||
if (isset( $aData['STEP_UID'] ) && $aData['STEP_UID'] == '') {
|
||||
unset( $aData['STEP_UID'] );
|
||||
if ( !isset ( $aData['STEP_UID'] ) )
|
||||
}
|
||||
if (! isset( $aData['STEP_UID'] )) {
|
||||
$aData['STEP_UID'] = G::generateUniqueID();
|
||||
}
|
||||
$oStepSupervisor = new StepSupervisor();
|
||||
$oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oStepSupervisor->validate()) {
|
||||
@@ -75,8 +75,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
$iResult = $oStepSupervisor->save();
|
||||
$oConnection->commit();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oStepSupervisor->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
@@ -84,8 +83,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
@@ -93,24 +91,24 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
|
||||
/**
|
||||
* Update the step supervisor registry
|
||||
*
|
||||
* @param array $aData
|
||||
* @return integer
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function update ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oStepSupervisor = StepSupervisorPeer::retrieveByPK( $aData['STEP_UID'] );
|
||||
if (!is_null($oStepSupervisor))
|
||||
{
|
||||
if (! is_null( $oStepSupervisor )) {
|
||||
$oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oStepSupervisor->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oStepSupervisor->save();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oStepSupervisor->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
@@ -118,12 +116,10 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
@@ -131,9 +127,11 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
|
||||
/**
|
||||
* Remove the step supervisor registry
|
||||
*
|
||||
* @param string $sStepUID
|
||||
* @return integer
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public function remove ($sStepUID)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
||||
@@ -143,8 +141,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
$iResult = $this->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
@@ -152,10 +149,13 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
|
||||
/**
|
||||
* Get the next position for a atep
|
||||
*
|
||||
* @param string $sProcessUID
|
||||
* @return integer
|
||||
**/
|
||||
function getNextPosition($sProcessUID, $sType) {
|
||||
*
|
||||
*/
|
||||
public function getNextPosition ($sProcessUID, $sType)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( '(COUNT(*) + 1) AS POSITION' );
|
||||
@@ -166,18 +166,20 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
return (int) $aRow['POSITION'];
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $Exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorder the steps positions
|
||||
*
|
||||
* @param string $sProcessUID
|
||||
* @param string $iPosition
|
||||
**/
|
||||
function reorderPositions($sProcessUID, $iPosition, $sType) {
|
||||
*
|
||||
*/
|
||||
public function reorderPositions ($sProcessUID, $iPosition, $sType)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
|
||||
@@ -185,35 +187,34 @@ class StepSupervisor extends BaseStepSupervisor {
|
||||
$oCriteria->add( StepSupervisorPeer::STEP_POSITION, $iPosition, '>' );
|
||||
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();var_dump(StepSupervisorPeer::doCount($oCriteria));
|
||||
while ($aRow = $oDataset->getRow()) {var_dump($aRow);echo "\n";
|
||||
$this->update(array('STEP_UID' => $aRow['STEP_UID'],
|
||||
'PRO_UID' => $aRow['PRO_UID'],
|
||||
'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],
|
||||
'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],
|
||||
'STEP_POSITION' => $aRow['STEP_POSITION'] - 1));
|
||||
$oDataset->next();
|
||||
var_dump( StepSupervisorPeer::doCount( $oCriteria ) );
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
var_dump( $aRow );
|
||||
echo "\n";
|
||||
$this->update( array ('STEP_UID' => $aRow['STEP_UID'],'PRO_UID' => $aRow['PRO_UID'],'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],'STEP_POSITION' => $aRow['STEP_POSITION'] - 1
|
||||
) );
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function removeByObject($sType, $sObjUid) {
|
||||
public function removeByObject ($sType, $sObjUid)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
|
||||
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUid );
|
||||
StepSupervisorPeer::doDelete( $oCriteria );
|
||||
}
|
||||
catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
function loadInfo($sObjUID){
|
||||
public function loadInfo ($sObjUID)
|
||||
{
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUID );
|
||||
@@ -222,9 +223,7 @@ function loadInfo($sObjUID){
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
return ($aRow);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// StepSupervisor
|
||||
|
||||
|
||||
} // StepSupervisor
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Translation.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -26,7 +27,6 @@
|
||||
|
||||
require_once 'classes/model/om/BaseTranslation.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'TRANSLATION' table.
|
||||
*
|
||||
@@ -38,18 +38,21 @@ require_once 'classes/model/om/BaseTranslation.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Translation extends BaseTranslation {
|
||||
class Translation extends BaseTranslation
|
||||
{
|
||||
|
||||
public static $meta;
|
||||
public static $localeSeparator = '-';
|
||||
|
||||
private $envFilePath;
|
||||
|
||||
function __construct(){
|
||||
public function __construct ()
|
||||
{
|
||||
$this->envFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env";
|
||||
}
|
||||
|
||||
function getAllCriteria(){
|
||||
public function getAllCriteria ()
|
||||
{
|
||||
|
||||
//SELECT * from TRANSLATION WHERE TRN_LANG = 'en' order by TRN_CATEGORY, TRN_ID
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
@@ -59,10 +62,12 @@ class Translation extends BaseTranslation {
|
||||
$oCriteria->addSelectColumn( TranslationPeer::TRN_VALUE );
|
||||
//$c->add(TranslationPeer::TRN_LANG, 'en');
|
||||
|
||||
|
||||
return $oCriteria;
|
||||
}
|
||||
|
||||
function getAll($lang='en', $start=null, $limit=null, $search=null, $dateFrom=null, $dateTo=null){
|
||||
public function getAll ($lang = 'en', $start = null, $limit = null, $search = null, $dateFrom = null, $dateTo = null)
|
||||
{
|
||||
$totalCount = 0;
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
@@ -76,29 +81,14 @@ class Translation extends BaseTranslation {
|
||||
//$oCriteria->addAscendingOrderByColumn ( 'TRN_CATEGORY' );
|
||||
$oCriteria->addAscendingOrderByColumn( 'TRN_ID' );
|
||||
|
||||
|
||||
if ($search) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_ID,
|
||||
"%$search%", Criteria::LIKE
|
||||
)->addOr($oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_VALUE,
|
||||
"%$search%", Criteria::LIKE
|
||||
))
|
||||
);
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( TranslationPeer::TRN_ID, "%$search%", Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( TranslationPeer::TRN_VALUE, "%$search%", Criteria::LIKE ) ) );
|
||||
}
|
||||
// for date filter
|
||||
if (($dateFrom) && ($dateTo)) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_UPDATE_DATE,
|
||||
"$dateFrom", Criteria::GREATER_EQUAL//LESS_EQUAL
|
||||
)->addAnd($oCriteria->getNewCriterion(
|
||||
TranslationPeer::TRN_UPDATE_DATE,
|
||||
"$dateTo", Criteria::LESS_EQUAL//GREATER_EQUAL
|
||||
))
|
||||
);
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( TranslationPeer::TRN_UPDATE_DATE, "$dateFrom", Criteria::GREATER_EQUAL ) //LESS_EQUAL
|
||||
->addAnd( $oCriteria->getNewCriterion( TranslationPeer::TRN_UPDATE_DATE, "$dateTo", Criteria::LESS_EQUAL ) //GREATER_EQUAL
|
||||
) );
|
||||
}
|
||||
// end filter
|
||||
$c = clone $oCriteria;
|
||||
@@ -108,14 +98,16 @@ class Translation extends BaseTranslation {
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if( is_array($aRow) )
|
||||
if (is_array( $aRow )) {
|
||||
$totalCount = $aRow[0];
|
||||
|
||||
if($start)
|
||||
}
|
||||
if ($start) {
|
||||
$oCriteria->setOffset( $start );
|
||||
if($limit) //&& !isset($seach) && !isset($search))
|
||||
}
|
||||
if ($limit) {
|
||||
//&& !isset($seach) && !isset($search))
|
||||
$oCriteria->setLimit( $limit );
|
||||
|
||||
}
|
||||
$rs = TranslationPeer::doSelectRS( $oCriteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rows = Array ();
|
||||
@@ -129,19 +121,19 @@ class Translation extends BaseTranslation {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Load strings from a Database .
|
||||
* @author Fernando Ontiveros <fernando@colosa.com>
|
||||
* @parameter $languageId (es|en|...).
|
||||
*/
|
||||
|
||||
function generateFileTranslation ($languageId = '') {
|
||||
public function generateFileTranslation ($languageId = '')
|
||||
{
|
||||
$translation = Array ();
|
||||
$translationJS = Array ();
|
||||
|
||||
if ($languageId === '')
|
||||
if ($languageId === '') {
|
||||
$languageId = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
||||
|
||||
}
|
||||
$c = new Criteria();
|
||||
$c->add( TranslationPeer::TRN_LANG, $languageId );
|
||||
$c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
|
||||
@@ -162,12 +154,12 @@ class Translation extends BaseTranslation {
|
||||
|
||||
try {
|
||||
|
||||
if( ! is_dir(dirname($cacheFile)) )
|
||||
if (! is_dir( dirname( $cacheFile ) )) {
|
||||
G::mk_dir( dirname( $cacheFile ) );
|
||||
|
||||
if( ! is_dir(dirname($cacheFileJS)) )
|
||||
}
|
||||
if (! is_dir( dirname( $cacheFileJS ) )) {
|
||||
G::mk_dir( dirname( $cacheFileJS ) );
|
||||
|
||||
}
|
||||
$f = fopen( $cacheFile, 'w+' );
|
||||
fwrite( $f, "<?php\n" );
|
||||
fwrite( $f, '$translation =' . 'unserialize(\'' . addcslashes( serialize( $translation ), '\\\'' ) . "');\n" );
|
||||
@@ -196,7 +188,8 @@ class Translation extends BaseTranslation {
|
||||
* rowsAffected 0,1 the number of rows affected
|
||||
* message message error.
|
||||
*/
|
||||
function addTranslation ( $category, $id, $languageId, $value ) {
|
||||
public function addTranslation ($category, $id, $languageId, $value)
|
||||
{
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = TranslationPeer::retrieveByPK( $category, $id, $languageId );
|
||||
if (! (is_object( $tr ) && get_class( $tr ) == 'Translation')) {
|
||||
@@ -211,8 +204,7 @@ class Translation extends BaseTranslation {
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
$validationFailuresArray = $tr->getValidationFailures();
|
||||
@@ -225,14 +217,15 @@ class Translation extends BaseTranslation {
|
||||
//to do: uniform coderror structures for all classes
|
||||
}
|
||||
|
||||
function remove($sCategory, $sId, $sLang) {
|
||||
public function remove ($sCategory, $sId, $sLang)
|
||||
{
|
||||
$oTranslation = TranslationPeer::retrieveByPK( $sCategory, $sId, $sLang );
|
||||
if ((is_object( $oTranslation ) && get_class( $oTranslation ) == 'Translation')) {
|
||||
$oTranslation->delete();
|
||||
}
|
||||
}
|
||||
|
||||
function addTranslationEnvironment($locale, $headers, $numRecords)
|
||||
public function addTranslationEnvironment ($locale, $headers, $numRecords)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
@@ -257,11 +250,10 @@ class Translation extends BaseTranslation {
|
||||
$environments[$locale]['__INTERNATIONAL__'] = $environment;
|
||||
}
|
||||
|
||||
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
function removeTranslationEnvironment($locale)
|
||||
public function removeTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
if (strpos( $locale, self::$localeSeparator ) !== false) {
|
||||
@@ -274,7 +266,7 @@ class Translation extends BaseTranslation {
|
||||
if (file_exists( $filePath )) {
|
||||
$environments = unserialize( file_get_contents( $filePath ) );
|
||||
if (! isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return NULL;
|
||||
return null;
|
||||
}
|
||||
|
||||
unset( $environments[$LAN_ID][$IC_UID] );
|
||||
@@ -289,22 +281,23 @@ class Translation extends BaseTranslation {
|
||||
}
|
||||
}
|
||||
|
||||
function getTranslationEnvironments(){
|
||||
public function getTranslationEnvironments ()
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$envs = Array ();
|
||||
|
||||
if (! file_exists( $filePath )) {
|
||||
//the transaltions table file doesn't exist, then build it
|
||||
|
||||
if( ! is_dir(dirname($this->envFilePath)) )
|
||||
G::mk_dir(dirname($this->envFilePath));
|
||||
|
||||
if (! is_dir( dirname( $this->envFilePath ) )) {
|
||||
G::mk_dir( dirname( $this->envFilePath ) );
|
||||
}
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$basePOFile = $translationsPath . 'english' . PATH_SEP . 'processmaker.en.po';
|
||||
|
||||
$params = self::getInfoFromPOFile( $basePOFile );
|
||||
$this->addTranslationEnvironment( $params['LOCALE'], $params['HEADERS'], $params['COUNT'] );
|
||||
|
||||
//getting more lanuguage translations
|
||||
$files = glob( $translationsPath . "*.po" );
|
||||
foreach ($files as $file) {
|
||||
@@ -323,7 +316,8 @@ class Translation extends BaseTranslation {
|
||||
|
||||
return $environments;
|
||||
|
||||
/*G::LoadSystem('dbMaintenance');
|
||||
/*
|
||||
G::LoadSystem('dbMaintenance');
|
||||
$o = new DataBaseMaintenance('localhost', 'root', 'atopml2005');
|
||||
$o->connect('wf_os');
|
||||
$r = $o->query('select * from ISO_COUNTRY');
|
||||
@@ -342,7 +336,8 @@ class Translation extends BaseTranslation {
|
||||
*/
|
||||
}
|
||||
|
||||
function getInfoFromPOFile($file){
|
||||
public function getInfoFromPOFile ($file)
|
||||
{
|
||||
G::loadClass( 'i18n_po' );
|
||||
$POFile = new i18n_PO( $file );
|
||||
$POFile->readInit();
|
||||
@@ -377,11 +372,11 @@ class Translation extends BaseTranslation {
|
||||
} catch (Exception $e) {
|
||||
$countItems = '-';
|
||||
}
|
||||
|
||||
return Array ('LOCALE' => $LOCALE,'HEADERS' => $POHeaders,'COUNT' => $countItems);
|
||||
}
|
||||
|
||||
function getTranslationEnvironment($locale){
|
||||
public function getTranslationEnvironment ($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
@@ -397,13 +392,15 @@ class Translation extends BaseTranslation {
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if( isset($environments[$LAN_ID][$IC_UID]) )
|
||||
if (isset( $environments[$LAN_ID][$IC_UID] )) {
|
||||
return $environments[$LAN_ID][$IC_UID];
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function saveTranslationEnvironment($locale, $data){
|
||||
public function saveTranslationEnvironment ($locale, $data)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array ();
|
||||
|
||||
@@ -423,39 +420,36 @@ class Translation extends BaseTranslation {
|
||||
file_put_contents( $filePath, serialize( $environments ) );
|
||||
}
|
||||
|
||||
function getTranslationMeta(){
|
||||
public function getTranslationMeta ()
|
||||
{
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$translationsTable = unserialize( file_get_contents( $translationsPath . 'pmos-translations.meta' ) );
|
||||
return $translationsTable;
|
||||
}
|
||||
|
||||
function getTranslationMetaByCountryName($IC_NAME){
|
||||
public function getTranslationMetaByCountryName ($IC_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['ISO_COUNTRY'] as $row) {
|
||||
if( $row['IC_NAME'] == $IC_NAME )
|
||||
if ($row['IC_NAME'] == $IC_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTranslationMetaByLanguageName($LAN_NAME){
|
||||
public function getTranslationMetaByLanguageName ($LAN_NAME)
|
||||
{
|
||||
$translationsTable = self::getTranslationMeta();
|
||||
|
||||
foreach ($translationsTable['LANGUAGE'] as $row) {
|
||||
if( $row['LAN_NAME'] == $LAN_NAME )
|
||||
if ($row['LAN_NAME'] == $LAN_NAME) {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // Translation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
// Translation
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pmSugar.pmFunctions.php
|
||||
*
|
||||
@@ -16,7 +17,8 @@
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
||||
function getSoapClientOptions() {
|
||||
function getSoapClientOptions ()
|
||||
{
|
||||
$options = array ('trace' => 1);
|
||||
|
||||
//Apply proxy settings
|
||||
@@ -40,22 +42,24 @@ function getSoapClientOptions() {
|
||||
/**
|
||||
* This collection of triggers allows to interact by getting and sending information to SugarCRM
|
||||
* @class pmSugar
|
||||
*
|
||||
* @name Sugar CRM Triggers
|
||||
* @icon /images/triggers/icon_SugarCRM.gif
|
||||
* @className class.pmSugar.pmFunctions.php
|
||||
*/
|
||||
|
||||
function sugarLogin($sugarSoap, $user, $password) {
|
||||
function sugarLogin ($sugarSoap, $user, $password)
|
||||
{
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
$auth_array = array ('user_auth' => array ('user_name' => $user,'password' => md5( $password ),'version' => '1.0') );
|
||||
$login_results = $client->__SoapCall( 'login', $auth_array );
|
||||
|
||||
$session_id = $login_results->id;
|
||||
$user_guid = $client->__SoapCall( 'get_user_id', array ($session_id) );
|
||||
return $session_id;
|
||||
}
|
||||
|
||||
function objectToArray($object) {
|
||||
function objectToArray ($object)
|
||||
{
|
||||
if (! is_object( $object ) && ! is_array( $object )) {
|
||||
return $object;
|
||||
}
|
||||
@@ -66,9 +70,8 @@ function objectToArray($object) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entry using get_entry web service.
|
||||
* @method Gets SugarCRM entry using get_entry web service.
|
||||
*
|
||||
* @name GetSugarEntry
|
||||
* @label Get SugarCRM Entry
|
||||
@@ -86,11 +89,11 @@ function objectToArray($object) {
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array') {
|
||||
function GetSugarEntry ($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array')
|
||||
{
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'id' => $id,
|
||||
'select_fields' => $select_fields, 'link_name_to_fields_array' => $linkNameToFieldsArray);
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,'id' => $id,'select_fields' => $select_fields,'link_name_to_fields_array' => $linkNameToFieldsArray);
|
||||
$sugarEntry = $client->__SoapCall( 'get_entry', $request_array );
|
||||
|
||||
if ($resultType == 'array') {
|
||||
@@ -101,9 +104,8 @@ function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the indicated module.
|
||||
* @method Gets SugarCRM entries from the indicated module.
|
||||
*
|
||||
* @name GetSugarEntries
|
||||
* @label Get SugarCRM Entries
|
||||
@@ -122,25 +124,31 @@ function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarEntries ($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,'query' => $query,'order_by' => $orderBy,'offset' => "",'select_fields' => "",'max_result' => $maxResults);
|
||||
$sugarEntriesO = $client->__SoapCall( 'get_entry_list', $request_array );
|
||||
|
||||
switch ($resultType) {
|
||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
|
||||
case 'object':$sugarEntries = $sugarEntriesO; break;
|
||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
||||
case 'array':
|
||||
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||
break;
|
||||
case 'object':
|
||||
$sugarEntries = $sugarEntriesO;
|
||||
break;
|
||||
default:
|
||||
$sugarEntries = objectToArray( $sugarEntries );
|
||||
}
|
||||
|
||||
return $sugarEntries;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the Calls module
|
||||
* @method Gets SugarCRM entries from the Calls module
|
||||
*
|
||||
* @name GetSugarCalls
|
||||
* @label Gets SugarCRM entries from the Calls module
|
||||
@@ -158,14 +166,15 @@ function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarCalls($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarCalls ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$module = "Calls";
|
||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the Leads module.
|
||||
* @method Gets SugarCRM entries from the Leads module.
|
||||
*
|
||||
* @name GetSugarLeads
|
||||
* @label Gets SugarCRM entries from the Leads module.
|
||||
@@ -183,14 +192,15 @@ function GetSugarCalls($sugarSoap, $user, $password, $query, $orderBy, $selected
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarLeads($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarLeads ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$module = "Leads";
|
||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the Contacts module.
|
||||
* @method Gets SugarCRM entries from the Contacts module.
|
||||
*
|
||||
* @name GetSugarContacts
|
||||
* @label Gets SugarCRM entries from the Contacts module.
|
||||
@@ -208,14 +218,15 @@ function GetSugarLeads($sugarSoap, $user, $password, $query, $orderBy, $selected
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarContacts($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarContacts ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$module = "Contacts";
|
||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the Opportunities module.
|
||||
* @method Gets SugarCRM entries from the Opportunities module.
|
||||
*
|
||||
* @name GetSugarOpportunities
|
||||
* @label Gets SugarCRM entries from the Opportunities module.
|
||||
@@ -233,15 +244,15 @@ function GetSugarContacts($sugarSoap, $user, $password, $query, $orderBy, $selec
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarOpportunities($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarOpportunities ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$module = "Opportunities";
|
||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Gets SugarCRM entries from the Account module.
|
||||
* @method Gets SugarCRM entries from the Account module.
|
||||
*
|
||||
* @name GetSugarAccount
|
||||
* @label Gets SugarCRM entries from the Account module.
|
||||
@@ -259,16 +270,15 @@ function GetSugarOpportunities($sugarSoap, $user, $password, $query, $orderBy, $
|
||||
*
|
||||
*/
|
||||
|
||||
function GetSugarAccount($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
||||
function GetSugarAccount ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||
{
|
||||
$module = "Accounts";
|
||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Creates SugarCRM entries from the Account module.
|
||||
* @method Creates SugarCRM entries from the Account module.
|
||||
*
|
||||
* @name CreateSugarAccount
|
||||
*
|
||||
@@ -283,30 +293,33 @@ function GetSugarAccount($sugarSoap, $user, $password, $query, $orderBy, $select
|
||||
* @return array/object | $sugarAccount | Sugar Opportunities (array or object)
|
||||
*
|
||||
*/
|
||||
function CreateSugarAccount($sugarSoap, $user, $password, $name, $resultType="array") {
|
||||
function CreateSugarAccount ($sugarSoap, $user, $password, $name, $resultType = "array")
|
||||
{
|
||||
|
||||
$module = "Accounts";
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' => array(
|
||||
array("name" => 'name', "value" => $name )
|
||||
) );
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,'name_value_list' => array (array ("name" => 'name',"value" => $name)));
|
||||
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
||||
$account_id = $sugarEntriesO->id;
|
||||
|
||||
switch ($resultType) {
|
||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO );break;
|
||||
case 'object':$sugarEntries = $sugarEntries ;break;
|
||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
||||
case 'array':
|
||||
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||
break;
|
||||
case 'object':
|
||||
$sugarEntries = $sugarEntries;
|
||||
break;
|
||||
default:
|
||||
$sugarEntries = objectToArray( $sugarEntries );
|
||||
}
|
||||
//return $sugarEntries;
|
||||
return $account_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Creates SugarCRM entries from the Account module
|
||||
* @method Creates SugarCRM entries from the Account module
|
||||
*
|
||||
* @name CreateSugarContact
|
||||
*
|
||||
@@ -326,8 +339,8 @@ function CreateSugarAccount($sugarSoap, $user, $password, $name, $resultType="a
|
||||
* @return array/object | $sugarContact | Sugar Opportunities (array or object)
|
||||
*
|
||||
*/
|
||||
function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType="array") {
|
||||
|
||||
function CreateSugarContact ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
|
||||
{
|
||||
$module = "Contacts";
|
||||
/* $aValue = array(
|
||||
array("name" => 'id', "value" => G::generateUniqueID()),
|
||||
@@ -338,34 +351,37 @@ function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_nam
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
|
||||
$request_array = array ('session' => $sessionId, 'module_name' => $module, array(
|
||||
array("name" => 'first_name',"value" => $first_name),
|
||||
array("name" => 'last_name',"value" => $last_name),
|
||||
array("name" => 'email1',"value" => $email),
|
||||
array("name" => 'title',"value" => $title),
|
||||
array("name" => 'phone_work',"value" => $phone),
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,array (array ("name" => 'first_name',"value" => $first_name
|
||||
),array ("name" => 'last_name',"value" => $last_name
|
||||
),array ("name" => 'email1',"value" => $email
|
||||
),array ("name" => 'title',"value" => $title
|
||||
),array ("name" => 'phone_work',"value" => $phone
|
||||
),
|
||||
// array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e')
|
||||
array("name" => 'account_id',"value" => $account_id)
|
||||
));
|
||||
array ("name" => 'account_id',"value" => $account_id
|
||||
)));
|
||||
|
||||
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
||||
|
||||
switch ($resultType) {
|
||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
|
||||
case 'object':$sugarEntries = $sugarEntries; break;
|
||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
||||
case 'array':
|
||||
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||
break;
|
||||
case 'object':
|
||||
$sugarEntries = $sugarEntries;
|
||||
break;
|
||||
default:
|
||||
$sugarEntries = objectToArray( $sugarEntries );
|
||||
}
|
||||
return $sugarEntries;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Creates SugarCRM entries from the Opportunities module.
|
||||
* @method Creates SugarCRM entries from the Opportunities module.
|
||||
*
|
||||
* @name CreateSugarOpportunity
|
||||
|
||||
*
|
||||
* @label Creates SugarCRM entries from the Opportunities module.
|
||||
*
|
||||
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
|
||||
@@ -381,7 +397,8 @@ function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_nam
|
||||
* @return array/object | $sugarOpportunity | Sugar Opportunities (array or object)
|
||||
*
|
||||
*/
|
||||
function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,$amount, $date_closed, $sales_stage,$resultType="array") {
|
||||
function CreateSugarOpportunity ($sugarSoap, $user, $password, $name, $account_id, $amount, $date_closed, $sales_stage, $resultType = "array")
|
||||
{
|
||||
// * @param string | $account_id | Account Id
|
||||
$module = "Opportunities";
|
||||
|
||||
@@ -397,30 +414,33 @@ function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
|
||||
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' =>array(
|
||||
array('name' => 'name','value' => $name),
|
||||
array("name" => 'account_id',"value" => $account_id),
|
||||
array('name' => 'amount','value' => $amount),
|
||||
array('name' => 'date_closed','value' => $date_closed),
|
||||
array('name' => 'sales_stage','value' => $sales_stage),
|
||||
));
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,'name_value_list' => array (array ('name' => 'name','value' => $name
|
||||
),array ("name" => 'account_id',"value" => $account_id
|
||||
),array ('name' => 'amount','value' => $amount
|
||||
),array ('name' => 'date_closed','value' => $date_closed
|
||||
),array ('name' => 'sales_stage','value' => $sales_stage
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
||||
|
||||
switch ($resultType) {
|
||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
|
||||
case 'object':$sugarEntries = $sugarEntries; break;
|
||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
||||
case 'array':
|
||||
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||
break;
|
||||
case 'object':
|
||||
$sugarEntries = $sugarEntries;
|
||||
break;
|
||||
default:
|
||||
$sugarEntries = objectToArray( $sugarEntries );
|
||||
}
|
||||
return $sugarEntries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Creates SugarCRM entries from the Account module
|
||||
* @method Creates SugarCRM entries from the Account module
|
||||
*
|
||||
* @name CreateSugarLeads
|
||||
*
|
||||
@@ -440,28 +460,37 @@ function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,
|
||||
* @return array/object | $sugarContact | Sugar Opportunities (array or object)
|
||||
*
|
||||
*/
|
||||
function CreateSugarLeads($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType="array") {
|
||||
function CreateSugarLeads ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
|
||||
{
|
||||
|
||||
$module = "Leads";
|
||||
$sessionId = sugarLogin( $sugarSoap, $user, $password );
|
||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||
|
||||
$request_array = array ('session' => $sessionId, 'module_name' => $module, array(
|
||||
array("name" => 'first_name',"value" => $first_name),
|
||||
array("name" => 'last_name',"value" => $last_name),
|
||||
array("name" => 'email1',"value" => $email),
|
||||
array("name" => 'title',"value" => $title),
|
||||
array("name" => 'phone_work',"value" => $phone),
|
||||
$request_array = array ('session' => $sessionId,'module_name' => $module,array (array ("name" => 'first_name',"value" => $first_name
|
||||
),array ("name" => 'last_name',"value" => $last_name
|
||||
),array ("name" => 'email1',"value" => $email
|
||||
),array ("name" => 'title',"value" => $title
|
||||
),array ("name" => 'phone_work',"value" => $phone
|
||||
),
|
||||
// array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e')
|
||||
array("name" => 'account_id',"value" => $account_id)
|
||||
));
|
||||
array ("name" => 'account_id',"value" => $account_id
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
||||
|
||||
switch ($resultType) {
|
||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
|
||||
case 'object':$sugarEntries = $sugarEntries; break;
|
||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
||||
case 'array':
|
||||
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||
break;
|
||||
case 'object':
|
||||
$sugarEntries = $sugarEntries;
|
||||
break;
|
||||
default:
|
||||
$sugarEntries = objectToArray( $sugarEntries );
|
||||
}
|
||||
return $sugarEntries;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,14 +43,16 @@ try {
|
||||
$oCase = new Cases();
|
||||
if (isset( $_POST['APP_UIDS'] )) {
|
||||
$ids = explode( ',', $_POST['APP_UIDS'] );
|
||||
foreach ($ids as $id)
|
||||
foreach ($ids as $id) {
|
||||
$oCase->removeCase( $id );
|
||||
}
|
||||
|
||||
if (count( $_POST['APP_UIDS'] ) > 1)
|
||||
if (count( $_POST['APP_UIDS'] ) > 1) {
|
||||
echo 'The Case was deleted successfully';
|
||||
else
|
||||
} else {
|
||||
echo 'All Cases were deleted successfully';
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,9 @@
|
||||
*/
|
||||
|
||||
/* Permissions */
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1)
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass( 'case' );
|
||||
@@ -99,8 +100,9 @@ switch ($sTypeList) {
|
||||
if (defined( 'ENABLE_CASE_LIST_OPTIMIZATION' )) {
|
||||
$aCriteria = $oCases->prepareCriteriaForToDo( $sUIDUserLogged );
|
||||
$xmlfile = 'cases/cases_ListTodoNew';
|
||||
} else
|
||||
} else {
|
||||
list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
list ($aCriteria, $xmlfile) = $oCases->getConditionCasesList( $sTypeList, $sUIDUserLogged, true, $aAdditionalFilter );
|
||||
@@ -156,14 +158,14 @@ G::RenderPage( 'publish', 'blank' );
|
||||
function InAssocArray ($a, $k, $v)
|
||||
{
|
||||
foreach ($a as $item) {
|
||||
if (isset( $item[$k] ) && $v == $item[$k])
|
||||
if (isset( $item[$k] ) && $v == $item[$k]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
try{
|
||||
oPropelTable = document.getElementById('publisherContent[0]');
|
||||
@@ -176,4 +178,5 @@ function InAssocArray ($a, $k, $v)
|
||||
if(parent.refreshCountFolders) parent.refreshCountFolders();
|
||||
}catch(e){}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
|
||||
G::header( 'location: ../login/login' );
|
||||
die();
|
||||
break;
|
||||
|
||||
case - 1:
|
||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||
G::header( 'location: ../login/login' );
|
||||
@@ -137,18 +136,21 @@ $aFields['CHANGE_LINK'] = G::LoadTranslation( 'ID_CHANGE_VIEW' );
|
||||
if (isset( $aMessage )) {
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
}
|
||||
if ($listType == 'dropdown')
|
||||
if ($listType == 'dropdown') {
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' );
|
||||
}
|
||||
|
||||
if ($listType == 'link') {
|
||||
if ($bCanStart)
|
||||
if ($bCanStart) {
|
||||
$sXmlForm = 'cases/cases_NewRadioGroup.xml';
|
||||
}
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', $aFields, 'cases_Save' );
|
||||
}
|
||||
|
||||
if ($listType == 'category') {
|
||||
if ($bCanStart)
|
||||
if ($bCanStart) {
|
||||
$sXmlForm = 'cases/cases_NewCategory.xml';
|
||||
}
|
||||
$G_PUBLISH->AddContent( 'view', 'cases/cases_NewCategory' );
|
||||
}
|
||||
|
||||
@@ -160,3 +162,5 @@ G::RenderPage( 'publish', 'blank' );
|
||||
parent.PANEL_EAST_OPEN = false;
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1)
|
||||
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
//go to the next step
|
||||
G::LoadClass( 'case' );
|
||||
$oCase = new Cases();
|
||||
|
||||
@@ -108,8 +108,8 @@ try {
|
||||
$oDataset->next();
|
||||
$aData = $oDataset->getRow();
|
||||
|
||||
if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") //distinct "" for selfservice
|
||||
{
|
||||
if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") {
|
||||
//distinct "" for selfservice
|
||||
//so we show just the resume
|
||||
$_SESSION['alreadyDerivated'] = true;
|
||||
//the case is paused show only the resume
|
||||
@@ -183,7 +183,6 @@ try {
|
||||
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
}
|
||||
break;
|
||||
|
||||
default: //APP_STATUS <> DRAFT and TO_DO
|
||||
$_SESSION['APPLICATION'] = $sAppUid;
|
||||
$_SESSION['INDEX'] = $iDelIndex != "" ? $iDelIndex : $oCase->getCurrentDelegationCase( $_GET['APP_UID'] );
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
/* Permissions */
|
||||
|
||||
if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1)
|
||||
if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1) {
|
||||
switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) {
|
||||
case - 2:
|
||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||
@@ -36,6 +36,7 @@ if ($RBAC->userCanAccess( 'PM_SUPERVISOR' ) != 1)
|
||||
die();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass( 'case' );
|
||||
|
||||
@@ -123,3 +123,5 @@ try {
|
||||
} catch(e){}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -42,11 +42,9 @@ foreach ($pmTableFields as $iRow => $aRow) {
|
||||
|
||||
foreach ($pmTableFields as $iRow => $aRow) {
|
||||
|
||||
$oFields->create( array ('FLD_INDEX' => $iRow + 1,'ADD_TAB_UID' => $sAddTabUid,'FLD_NAME' => $aRow['FLD_NAME'],'FLD_DESCRIPTION' => isset( $aRow['FLD_DESCRIPTION'] ) ? $aRow['FLD_DESCRIPTION'] : '','FLD_TYPE' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','FLD_SIZE' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','FLD_NULL' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'FLD_AUTO_INCREMENT' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'FLD_KEY' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY' => ($aRow['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY_TABLE' => isset( $aRow['FLD_FOREIGN_KEY_TABLE'] ) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : ''
|
||||
) );
|
||||
$oFields->create( array ('FLD_INDEX' => $iRow + 1,'ADD_TAB_UID' => $sAddTabUid,'FLD_NAME' => $aRow['FLD_NAME'],'FLD_DESCRIPTION' => isset( $aRow['FLD_DESCRIPTION'] ) ? $aRow['FLD_DESCRIPTION'] : '','FLD_TYPE' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','FLD_SIZE' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','FLD_NULL' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'FLD_AUTO_INCREMENT' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'FLD_KEY' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY' => ($aRow['FLD_FOREIGN_KEY'] == 'on' ? 1 : 0),'FLD_FOREIGN_KEY_TABLE' => isset( $aRow['FLD_FOREIGN_KEY_TABLE'] ) ? $aRow['FLD_FOREIGN_KEY_TABLE'] : '') );
|
||||
|
||||
$aFields[] = array ('sType' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','iSize' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','sFieldName' => $aRow['FLD_NAME'],'bNull' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'bAI' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'bPrimaryKey' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0)
|
||||
);
|
||||
$aFields[] = array ('sType' => isset( $aRow['FLD_TYPE'] ) ? $aRow['FLD_TYPE'] : 'VARCHAR','iSize' => isset( $aRow['FLD_SIZE'] ) ? $aRow['FLD_SIZE'] : '32','sFieldName' => $aRow['FLD_NAME'],'bNull' => ($aRow['FLD_NULL'] == 'on' ? 1 : 0),'bAI' => ($aRow['FLD_AUTO_INCREMENT'] == 'on' ? 1 : 0),'bPrimaryKey' => ($aRow['FLD_KEY'] == 'on' ? 1 : 0));
|
||||
}
|
||||
|
||||
$oAdditionalTables->createTable( strtoupper( $pmTableName ), 'wf', $aFields );
|
||||
|
||||
@@ -1,675 +0,0 @@
|
||||
var installer=function()
|
||||
{
|
||||
this.make=function(options)
|
||||
{
|
||||
this.options={
|
||||
target:inst.elements.content,
|
||||
vdef:{
|
||||
wf:'wf_workflow',
|
||||
rb:'rb_workflow',
|
||||
rp:'rp_workflow'
|
||||
}
|
||||
}.concat(options || {});
|
||||
this.html();
|
||||
this.check();
|
||||
};
|
||||
this.html=function()
|
||||
{
|
||||
this.titleBar = document.createElement("div");
|
||||
this.titleBar.className="app_grid_headerBar___gray";
|
||||
leimnud.dom.setStyle(this.titleBar,{
|
||||
height:"auto",
|
||||
textAlign:"right"
|
||||
});
|
||||
this.options.target.appendChild(this.titleBar);
|
||||
|
||||
this.options.button0 = document.createElement("input");
|
||||
this.options.button0.type="button";
|
||||
this.options.button0.value="Test";
|
||||
this.titleBar.appendChild(this.options.button0);
|
||||
|
||||
this.options.button1 = document.createElement("input");
|
||||
this.options.button1.type="button";
|
||||
this.options.button1.value="Install";
|
||||
this.titleBar.appendChild(this.options.button1);
|
||||
|
||||
this.options.button2 = document.createElement("input");
|
||||
this.options.button2.type="button";
|
||||
this.options.button2.value="Reset";
|
||||
this.titleBar.appendChild(this.options.button2);
|
||||
|
||||
this.options.phpinfo = document.createElement("input");
|
||||
this.options.phpinfo.type="button";
|
||||
this.options.phpinfo.style.fontWeight="bold";
|
||||
this.options.phpinfo.value="phpinfo()";
|
||||
this.titleBar.appendChild(this.options.phpinfo);
|
||||
this.options.phpinfo.onmouseup=this.showPhpinfo;
|
||||
|
||||
|
||||
this.options.button1.disabled=true;
|
||||
this.options.button0.onmouseup=this.check;
|
||||
this.options.button1.onmouseup=function(){inst.selectTab(1);}.extend(this);
|
||||
this.options.button2.onmouseup=this.reset;
|
||||
|
||||
this.buttonFun(this.options.button0);
|
||||
this.buttonFun(this.options.button1);
|
||||
this.buttonFun(this.options.button2);
|
||||
this.buttonFun(this.options.phpinfo);
|
||||
|
||||
|
||||
|
||||
//this.phpVersion =
|
||||
this.table = $(document.createElement("table"));
|
||||
/* this.table.setStyle({
|
||||
cellpadding:23
|
||||
});*/
|
||||
this.table.className="inst_table";
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>Requirements</b>",className:"app_grid_title___gray title",colSpan:4})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"PHP Version > 5.1.0",className:"inst_td0",colSpan:2}),
|
||||
this.phpVersion = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"MySQL",className:"inst_td0",colSpan:2}),
|
||||
this.mysqlVersion = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Maximum amount of memory a script may consume (memory_limit) >= 40M",className:"inst_td0",colSpan:2}),
|
||||
this.checkMemory = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Directory "+this.options.path_trunk+"config/<br> permissions: <b>writable</b>",className:"inst_td0",colSpan:2}),
|
||||
this.checkPI = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Directory "+this.options.path_trunk+"content/languages/<br> permissions: <b>writable</b>",className:"inst_td0",colSpan:2}),
|
||||
this.checkDL = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"File "+this.options.path_trunk+"js/labels/<br> permissions: <b>writable</b>",className:"inst_td0",colSpan:2}),
|
||||
this.checkDLJ = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"File "+this.options.path_trunk+"plugins/<br> permissions: <b>writable</b>",className:"inst_td0",colSpan:2}),
|
||||
this.checkPL = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"File "+this.options.path_trunk+"xmlform/<br> permissions: <b>writable</b>",className:"inst_td0",colSpan:2}),
|
||||
this.checkXF = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
|
||||
/* Database */
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>Database</b>",className:"app_grid_title___gray title",colSpan:2}),
|
||||
new DOM('td',{className:"app_grid_title___gray title",colSpan:2}).append(
|
||||
this.select_ao_db = new select({data:[
|
||||
{value:1,text:"Advanced options by default"},
|
||||
{value:2,text:"Change Advanced options"}
|
||||
],
|
||||
style:{width:"100%",border:"1px solid #919B9C"},
|
||||
properties:{onchange:function(){
|
||||
if(this.select_ao_db.selected().value==1)
|
||||
{
|
||||
this.ed_advanced_options({
|
||||
sta:"disabled",
|
||||
act:'usr',
|
||||
def:true
|
||||
});
|
||||
this.ao_db_wf.passed().value=this.options.vdef.wf;
|
||||
this.ao_db_rb.passed().value=this.options.vdef.rb;
|
||||
this.ao_db_rp.passed().value=this.options.vdef.rp;
|
||||
this.ao_db_drop.checked=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ed_advanced_options({
|
||||
act:'usr',
|
||||
sta:"enabled"
|
||||
});
|
||||
this.ao_db_wf.focus();
|
||||
}
|
||||
}.extend(this)}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Database server Hostname",className:"inst_td0"},{width:"30%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"30%"}).append(
|
||||
// this.databaseHostname =new DOM("input",{value:'localhost',type:"text",onkeyup:this.submit,className:"inputNormal"})
|
||||
this.databaseHostname = new input({label:'localhost',properties:{onkeyup:this.submit},style:{width:"100%"}})
|
||||
),
|
||||
new DOM('td',{innerHTML:"Workflow Database:",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_db_wf = new input({label:this.options.vdef.wf,properties:{onkeyup:this.submit},style:{width:"100%"},maxlength:16}).passed().disable()
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Username",className:"inst_td0"},{width:"30%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"30%"}).append(
|
||||
// this.databaseUsername =new DOM("input",{value:'root',type:"text",onkeyup:this.submit,className:"inputNormal"})
|
||||
this.databaseUsername = new input({label:'root',properties:{onkeyup:this.submit},style:{width:"100%"}})
|
||||
),
|
||||
new DOM('td',{innerHTML:"Rbac Database:",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_db_rb = new input({label:this.options.vdef.rb,properties:{onkeyup:this.submit},style:{width:"100%"},maxlength:16}).passed().disable()
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Password",className:"inst_td0"},{width:"30%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"30%"}).append(
|
||||
// this.databasePassword =new DOM("input",{type:"text",onkeyup:this.submit,className:"inputNormal"})
|
||||
this.databasePassword = new input({properties:{type:'password',onkeyup:this.submit},style:{width:"100%"}})
|
||||
),
|
||||
new DOM('td',{innerHTML:"Report Database:",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_db_rp = new input({label:this.options.vdef.rp,properties:{onkeyup:this.submit},style:{width:"100%"},maxlength:16}).passed().disable()
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Database Access",className:"inst_td0"},{width:"30%"}),
|
||||
this.databaseGrant = new DOM('td',{className:"inst_td1"},{width:"30%"}),
|
||||
|
||||
new DOM('td',{innerHTML:"DROP DATABASE IF EXISTS",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td0"},{width:"20%",textAlign:'left'}).append(
|
||||
this.ao_db_drop = new input({
|
||||
properties:{type:'checkbox',disabled:true,className:''},style:{border:"1px solid #666"}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
this.databaseStatus = new DOM('td',{innerHTML:"<br>",className:"tdNormal",colSpan:4},{height:50})
|
||||
);
|
||||
|
||||
/* Database End */
|
||||
|
||||
|
||||
|
||||
/* Directories Begin */
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>Processmaker Configuration</b>",className:"app_grid_title___gray title",colSpan:2}),
|
||||
new DOM('td',{className:"app_grid_title___gray title",colSpan:2}).append(
|
||||
|
||||
this.select_ao_pm = new select({data:[
|
||||
{value:1,text:"Advanced options by default"},
|
||||
{value:2,text:"Change Advanced options"}
|
||||
],
|
||||
style:{width:"100%",border:"1px solid #919B9C"},
|
||||
properties:{onchange:function(){
|
||||
if(this.select_ao_pm.selected().value==1)
|
||||
{
|
||||
this.ed_advanced_options({
|
||||
act:'pm',
|
||||
sta:"disabled",
|
||||
def:true
|
||||
});
|
||||
this.ao_admin.passed().value="admin";
|
||||
this.ao_admin_pass1.passed().value="admin";
|
||||
this.ao_admin_pass2.passed().value="admin";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ed_advanced_options({
|
||||
act:'pm',
|
||||
sta:"enabled"
|
||||
});
|
||||
this.ao_admin.focus();
|
||||
}
|
||||
}.extend(this)}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"Workflow Data Directory (permissions: <b>writable</b>): ",className:"inst_td0"},{width:"30%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"30%"}).append(
|
||||
this.workflowData = new input({label:this.options.path_data,properties:{onkeyup:this.submit},style:{width:"100%"},maxlength:200})
|
||||
),
|
||||
new DOM('td',{innerHTML:"Username (Default: admin):",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_admin = new input({label:'admin',properties:{onkeyup:this.submit},style:{width:"100%"}}).passed().disable()
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"",className:"inst_td0"},{width:"30%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"30%"}).append(
|
||||
this.compiled = new input({label:this.options.path_compiled,properties:{onkeyup:this.submit},style:{width:"100%", display:'none'},maxlength:200})
|
||||
),
|
||||
new DOM('td',{innerHTML:"Username (Default: admin):",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_admin_pass1 = new input({label:'admin',properties:{onkeyup:this.submit,type:'password'},style:{width:"100%"}}).passed().disable()
|
||||
)
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{className:"inst_td0",colSpan:2}),
|
||||
new DOM('td',{innerHTML:"Re-type Password:",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td1"},{width:"20%"}).append(
|
||||
this.ao_admin_pass2 = new input({label:'admin',properties:{onkeyup:this.submit,type:'password'},style:{width:"100%"}}).passed().disable()
|
||||
)
|
||||
);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>HeartBeat Configuration</b><br><i>Heartbeat is an anonymous statistics collector for ProcessMaker. It runs in the background and if you have internet enabled, it will periodically send anonymous information to ProcessMaker servers.<br />No sensitive or private information is collected.<br /><br /> The information collected will allow us to keep improving our software to offer everyone a better user experience</i>",className:"app_grid_title___gray title",colSpan:4})
|
||||
);
|
||||
this.heartBeatTitle=tr;
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
|
||||
this.heartBeat =
|
||||
|
||||
new DOM('td',{innerHTML:"Enable HeartBeat",className:"inst_td0"},{width:"20%"}),
|
||||
new DOM('td',{className:"inst_td0",colSpan:2},{textAlign:'left'}).append(
|
||||
this.ao_hb_status = new input({
|
||||
properties:{type:'checkbox',disabled:false,checked:true,className:''},style:{border:"1px solid #666"}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
this.heartBeatRow=tr;
|
||||
|
||||
|
||||
//alert(this.options.availableProcess);
|
||||
//alert(this.options.availableProcess.length);
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>Available Processes (auto install)</b>",className:"app_grid_title___gray title",colSpan:4})
|
||||
);
|
||||
this.availableProcessTitle=tr;
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
this.availableProcess = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
this.availableProcessRow=tr;
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
new DOM('td',{innerHTML:"<b>Available Plugins (auto install)</b>",className:"app_grid_title___gray title",colSpan:4})
|
||||
);
|
||||
this.availablePluginsTitle=tr;
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
$(tr).append(
|
||||
this.availablePlugins = new DOM('td',{innerHTML:'Loading...',className:"inst_td1",colSpan:2})
|
||||
);
|
||||
this.availablePluginsRow=tr;
|
||||
|
||||
|
||||
leimnud.dom.setStyle([this.workflowData,this.compiled],{
|
||||
textAlign:"left"
|
||||
});
|
||||
this.options.target.appendChild(this.table);
|
||||
};
|
||||
this.formData=function()
|
||||
{
|
||||
//alert(this.databaseExe.value.eplace("\\","/"))
|
||||
return {
|
||||
mysqlH :escape(this.databaseHostname.value),
|
||||
mysqlU :escape(this.databaseUsername.value),
|
||||
mysqlP :escape(this.databasePassword.value),
|
||||
// port :this.port.value,
|
||||
path_data:this.workflowData.value,
|
||||
path_compiled:this.compiled.value,
|
||||
ao_admin :escape(this.ao_admin.value),
|
||||
ao_admin_pass1 :escape(this.ao_admin_pass1.value),
|
||||
ao_admin_pass2 :escape(this.ao_admin_pass2.value),
|
||||
ao_db_wf :this.ao_db_wf.value,
|
||||
ao_db_rb :this.ao_db_rb.value,
|
||||
ao_db_rp :this.ao_db_rp.value,
|
||||
ao_db :parseInt(this.select_ao_db.selected().value),
|
||||
ao_pm :parseInt(this.select_ao_pm.selected().value),
|
||||
ao_db_drop :this.ao_db_drop.checked,
|
||||
heartbeatEnabled :this.ao_hb_status.checked
|
||||
};
|
||||
};
|
||||
this.check=function()
|
||||
{
|
||||
inst.loader.show();
|
||||
this.disabled(true);
|
||||
this.ed_advanced_options({sta:'disabled',act:'all'});
|
||||
var r = new leimnud.module.rpc.xmlhttp({
|
||||
url :this.options.server,
|
||||
method :"POST",
|
||||
args :"action=check&data="+this.formData().toJSONString()
|
||||
});
|
||||
r.callback=function(rpc)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.cstatus = rpc.xmlhttp.responseText.parseJSON();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
this.cstatus={
|
||||
ao_db_wf:false,
|
||||
ao_db_rb:false,
|
||||
ao_db_rp:false
|
||||
};
|
||||
}
|
||||
this.phpVersion.className = (!this.cstatus.phpVersion)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.phpVersion.innerHTML = (!this.cstatus.phpVersion)?"FAILED":"PASSED";
|
||||
|
||||
this.mysqlVersion.className = (!this.cstatus.mysqlVersion)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.mysqlVersion.innerHTML = (!this.cstatus.mysqlVersion)?"FAILED":"PASSED";
|
||||
|
||||
this.checkMemory.className = (!this.cstatus.checkMemory)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkMemory.innerHTML = (!this.cstatus.checkMemory)?"FAILED":"PASSED";
|
||||
|
||||
// this.checkmqgpc.className = (!this.cstatus.checkmqgpc)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
// this.checkmqgpc.innerHTML = (!this.cstatus.checkmqgpc)?"FAILED":"PASSED";
|
||||
|
||||
this.checkPI.className = (!this.cstatus.checkPI)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkPI.innerHTML = (!this.cstatus.checkPI)?"FAILED":"PASSED";
|
||||
|
||||
this.checkDL.className = (!this.cstatus.checkDL)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkDL.innerHTML = (!this.cstatus.checkDL)?"FAILED":"PASSED";
|
||||
|
||||
this.checkDLJ.className = (!this.cstatus.checkDLJ)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkDLJ.innerHTML = (!this.cstatus.checkDLJ)?"FAILED":"PASSED";
|
||||
|
||||
this.checkPL.className = (!this.cstatus.checkPL)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkPL.innerHTML = (!this.cstatus.checkPL)?"FAILED":"PASSED";
|
||||
|
||||
this.checkXF.className = (!this.cstatus.checkXF)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.checkXF.innerHTML = (!this.cstatus.checkXF)?"FAILED":"PASSED";
|
||||
|
||||
this.databaseHostname[(!this.cstatus.mysqlConnection)?"failed":"passed"]();
|
||||
this.databaseUsername[(!this.cstatus.mysqlConnection)?"failed":"passed"]();
|
||||
this.databasePassword[(!this.cstatus.mysqlConnection)?"failed":"passed"]();
|
||||
|
||||
this.databaseGrant.className = (!this.cstatus.grantPriv && this.select_ao_db.selected().value==1)?"inst_td1 tdFailed":"inst_td1 tdOk";
|
||||
this.databaseGrant.innerHTML = (!this.cstatus.grantPriv)?"FAILED":((this.cstatus.grantPriv==1)?'ALL PRIVILEGES':'USAGE');
|
||||
|
||||
this.databaseStatus.className = (!this.cstatus.grantPriv || !this.cstatus.mysqlConnection)?"tdFailed":"tdOk";
|
||||
this.databaseStatus.innerHTML = this.cstatus.databaseMessage;
|
||||
|
||||
this.workflowData[(!this.cstatus.path_data)?"failed":"passed"]();
|
||||
this.compiled[(!this.cstatus.path_compiled)?"failed":"passed"]();
|
||||
|
||||
|
||||
this.ao_db_wf[((!this.cstatus.ao_db_wf['status'])?"failed":"passed")]();
|
||||
this.ao_db_rb[((!this.cstatus.ao_db_rb['status'])?"failed":"passed")]();
|
||||
this.ao_db_rp[((!this.cstatus.ao_db_rp['status'])?"failed":"passed")]();
|
||||
|
||||
this.ao_admin[(!this.cstatus.ao_admin && this.select_ao_pm.selected().value==2)?"failed":"passed"]();
|
||||
this.ao_admin_pass1[(!this.cstatus.ao_admin_pass && this.select_ao_pm.selected().value==2)?"failed":"passed"]();
|
||||
this.ao_admin_pass2[(!this.cstatus.ao_admin_pass && this.select_ao_pm.selected().value==2)?"failed":"passed"]();
|
||||
|
||||
if(this.cstatus.ao_db_wf['status'] && this.cstatus.ao_db_rb['status'] && this.cstatus.ao_db_rp['status'] && this.cstatus.ao_admin && this.cstatus.ao_admin_pass && this.cstatus.checkMemory && this.cstatus.checkPI && this.cstatus.checkDL && this.cstatus.checkDLJ && this.cstatus.checkPL && this.cstatus.checkXF && this.cstatus.phpVersion && this.cstatus.mysqlVersion && this.cstatus.mysqlConnection && this.cstatus.grantPriv && this.cstatus.path_data && this.cstatus.path_compiled)
|
||||
{
|
||||
this.options.button0.disabled=true;
|
||||
this.options.button1.disabled=false;
|
||||
this.disabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.options.button0.disabled=false;
|
||||
this.options.button1.disabled=true;
|
||||
this.disabled(false);
|
||||
try {
|
||||
this.compiled.focus();
|
||||
} catch(err) {}
|
||||
this.ed_advanced_options({sta:((this.select_ao_db.selected().value==2)?'enabled':'disabled'),act:'usr'});
|
||||
this.ed_advanced_options({sta:((this.select_ao_pm.selected().value==2)?'enabled':'disabled'),act:'pm'});
|
||||
}
|
||||
this.buttonFun(this.options.button0);
|
||||
this.buttonFun(this.options.button1);
|
||||
|
||||
this.ao_db_wf.title=this.cstatus.ao_db_wf.message;
|
||||
this.ao_db_rb.title=this.cstatus.ao_db_rb.message;
|
||||
this.ao_db_rp.title=this.cstatus.ao_db_rp.message;
|
||||
|
||||
this.ao_admin.title=(this.cstatus.ao_admin)?'Username invalid':'PASSED';
|
||||
|
||||
|
||||
//*Autoinstall Process and Plugins. By JHL
|
||||
// March 11th. 2009
|
||||
// To enable the way of aoutoinstall process and/or plugins
|
||||
// at same time of initial PM setup
|
||||
if(this.cstatus.availableProcess.length>0){
|
||||
this.availableProcess.className = "inst_td1 tdOk";
|
||||
this.availableProcess.innerHTML="";
|
||||
for(i_process=0;i_process<this.cstatus.availableProcess.length;i_process++){
|
||||
this.availableProcess.innerHTML+=this.cstatus.availableProcess[i_process]+"<br />";
|
||||
}
|
||||
}else{
|
||||
//Hide entire Group
|
||||
this.availableProcessTitle.style.display="none";
|
||||
this.availableProcessRow.style.display="none";
|
||||
}
|
||||
|
||||
if(this.cstatus.availablePlugins.length>0){
|
||||
this.availablePlugins.className = "inst_td1 tdOk";
|
||||
this.availablePlugins.innerHTML="";
|
||||
for(i_plugin=0;i_plugin<this.cstatus.availablePlugins.length;i_plugin++){
|
||||
this.availablePlugins.innerHTML+=this.cstatus.availablePlugins[i_plugin]+"<br />";
|
||||
}
|
||||
}else{
|
||||
//Hide entire Group
|
||||
this.availablePluginsTitle.style.display="none";
|
||||
this.availablePluginsRow.style.display="none";
|
||||
}
|
||||
//End Autoinstall
|
||||
|
||||
inst.loader.hide();
|
||||
}.extend(this);
|
||||
r.make();
|
||||
};
|
||||
this.reset=function()
|
||||
{
|
||||
this.options.button1.disabled=true;
|
||||
this.buttonFun(this.options.button1);
|
||||
this.disabled(false);
|
||||
};
|
||||
this.disabled=function(dis)
|
||||
{
|
||||
this.databaseHostname[(dis===true)?'disable':'enable']();
|
||||
this.databaseUsername[(dis===true)?'disable':'enable']();
|
||||
this.databasePassword[(dis===true)?'disable':'enable']();
|
||||
this.workflowData[(dis===true)?'disable':'enable']();
|
||||
this.compiled[(dis===true)?'disable':'enable']();
|
||||
if(this.compiled.disabled===false)
|
||||
{
|
||||
try {
|
||||
this.compiled.focus();
|
||||
} catch(err) {}
|
||||
}
|
||||
this.options.button0.disabled=dis;
|
||||
this.buttonFun(this.options.button0);
|
||||
};
|
||||
this.ed_advanced_options=function(options)
|
||||
{
|
||||
options = {
|
||||
sta:"disabled",
|
||||
act:"all",
|
||||
def:false
|
||||
}.concat(options || {});
|
||||
|
||||
if(options.act=='pm' || options.act=="all")
|
||||
{
|
||||
this.ao_admin[(options.sta=="disabled")?'disable':'enable']();
|
||||
this.ao_admin_pass1[(options.sta=="disabled")?'disable':'enable']();
|
||||
this.ao_admin_pass2[(options.sta=="disabled")?'disable':'enable']();
|
||||
}
|
||||
if(options.act=='usr' || options.act=="all")
|
||||
{
|
||||
this.ao_db_wf[(options.sta=="disabled")?'disable':'enable']();
|
||||
this.ao_db_rb[(options.sta=="disabled")?'disable':'enable']();
|
||||
this.ao_db_rp[(options.sta=="disabled")?'disable':'enable']();
|
||||
this.ao_db_drop.disabled=(options.sta=="disabled")?true:false;
|
||||
}
|
||||
};
|
||||
this.submit=function(evt)
|
||||
{
|
||||
var evt = (window.event)?window.event:evt;
|
||||
var key = (evt.which)?evt.which:evt.keyCode;
|
||||
if(key==13)
|
||||
{
|
||||
this.check();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
this.install=function()
|
||||
{
|
||||
this.values = this.formData();
|
||||
inst.clearContent();
|
||||
inst.loader.show();
|
||||
this.options.button2.disabled=true;
|
||||
this.options.button1.disabled=true;
|
||||
var r = new leimnud.module.rpc.xmlhttp({
|
||||
url :this.options.server,
|
||||
method :"POST",
|
||||
args :"action=install&data="+this.values.toJSONString()
|
||||
});
|
||||
r.callback=this.installation;
|
||||
r.make();
|
||||
};
|
||||
this.installation=function(rpc)
|
||||
{
|
||||
/* var r = new leimnud.module.rpc.xmlhttp({
|
||||
url :"/sysworkflow/en/classic/tools/updateTranslation",
|
||||
method :"GET"
|
||||
});
|
||||
r.callback=function(rpc)
|
||||
{*/
|
||||
inst.loader.hide();
|
||||
this.table = document.createElement("table");
|
||||
this.table.className="inst_table";
|
||||
|
||||
var success = (rpc.xmlhttp.status == 200);
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
var tdtitle = tr.insertCell(0);
|
||||
tdtitle.innerHTML="Status";
|
||||
tdtitle.className="app_grid_title___gray title";
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
var td0 = tr.insertCell(0);
|
||||
td0.innerHTML=(success) ? "Success" : "Failed (Check log below)";
|
||||
td0.className=(success) ? "tdOk" : "tdFailed";
|
||||
this.options.target.appendChild(this.table);
|
||||
|
||||
if (success) {
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
var tdS = tr.insertCell(0);
|
||||
tdS.colSpan = 2;
|
||||
tdS.innerHTML="<br><br>";
|
||||
tdS.className="tdNormal";
|
||||
|
||||
|
||||
this.options.buttong = document.createElement("input");
|
||||
this.options.buttong.type="button";
|
||||
this.options.buttong.value="Finish Installation";
|
||||
this.options.buttong.onmouseup=function()
|
||||
{
|
||||
window.location = "/sysworkflow/en/classic/login/login";
|
||||
}.extend(this);
|
||||
tdS.appendChild(this.options.buttong);
|
||||
this.buttonFun(this.options.buttong);
|
||||
tdS.appendChild(document.createElement("br"));
|
||||
tdS.appendChild(document.createElement("br"));
|
||||
|
||||
}
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
var tdtitle = tr.insertCell(0);
|
||||
tdtitle.innerHTML="Installation Log";
|
||||
tdtitle.className="app_grid_title___gray title";
|
||||
|
||||
var tr = this.table.insertRow(-1);
|
||||
var td0 = tr.insertCell(0);
|
||||
var pre = document.createElement('pre');
|
||||
pre.style.overflow='scroll';
|
||||
pre.style.width=(this.options.target.clientWidth-10)+"px";
|
||||
pre.style.height=((this.options.target.clientHeight-this.table.clientHeight)-15)+'px';
|
||||
pre.innerHTML=rpc.xmlhttp.responseText;
|
||||
td0.appendChild(pre);
|
||||
// }.extend(this);
|
||||
// r.make();
|
||||
};
|
||||
this.buttonFun=function(but)
|
||||
{
|
||||
if(but.disabled==true)
|
||||
{
|
||||
but.className="app_grid_title___gray button buttonDisabled";
|
||||
but.onmouseover=function(){ this.className="app_grid_title___gray button buttonDisabled"};
|
||||
but.onmouseout=function(){ this.className="app_grid_title___gray button buttonDisabled"};
|
||||
but.onblur=function(){ this.className="app_grid_title___gray button buttonDisabled"};
|
||||
}
|
||||
else
|
||||
{
|
||||
but.className="app_grid_title___gray button";
|
||||
but.onmouseover=function(){ this.className="app_grid_title___gray button buttonHover"};
|
||||
but.onmouseout=function(){ this.className="app_grid_title___gray button"};
|
||||
but.onblur=function(){ this.className="app_grid_title___gray button"};
|
||||
}
|
||||
};
|
||||
this.showPhpinfo=function()
|
||||
{
|
||||
var panel = new leimnud.module.panel();
|
||||
panel.options={
|
||||
title:"PHP info",
|
||||
position:{center:true},
|
||||
size:{w:700,h:document.body.clientHeight-50},
|
||||
fx:{modal:true}
|
||||
};
|
||||
panel.make();
|
||||
var r = new leimnud.module.rpc.xmlhttp({
|
||||
url :"install.php",
|
||||
method :"POST",
|
||||
args :"phpinfo=true"
|
||||
});
|
||||
r.callback=function(rpc)
|
||||
{
|
||||
panel.addContent(rpc.xmlhttp.responseText);
|
||||
};
|
||||
r.make();
|
||||
};
|
||||
this.expand(this);
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* install.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default home page view
|
||||
*
|
||||
* @author MaBoRaK
|
||||
* @version 0.1
|
||||
*/
|
||||
if ($_POST && isset( $_POST['phpinfo'] )) {
|
||||
phpinfo();
|
||||
die();
|
||||
}
|
||||
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Processmaker Installer</title>
|
||||
<script type='text/javascript' src='/js/maborak/core/maborak.js'></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="/js/maborak/samples/style.css" />
|
||||
|
||||
<script type='text/javascript' src='/sys/en/classic/install/install.js'></script>
|
||||
<script type='text/javascript'>
|
||||
var ifr;
|
||||
var forceCssLoad = true;
|
||||
var grid,winGrill, leimnud = new maborak(forceCssLoad);
|
||||
var inWIN = false;
|
||||
leimnud.make();
|
||||
leimnud.Package.Load("dom,validator,app,rpc,fx,drag,drop,panel,grid,abbr",{Instance:leimnud,Type:"module"});
|
||||
leimnud.Package.Load("json",{Type:"file"});
|
||||
leimnud.exec(leimnud.fix.memoryLeak);
|
||||
var inst;
|
||||
leimnud.event.add(window,'load',function(){myload();});
|
||||
var myload = function() {
|
||||
if (typeof(DOM) === 'undefined') {
|
||||
setTimeout("myload();", 1000);
|
||||
return;
|
||||
}
|
||||
inst = new leimnud.module.panel();
|
||||
inst.options={
|
||||
size:{w:document.body.offsetWidth-50,h:825},
|
||||
title :"",
|
||||
position:{x:2,y:2,center:true},
|
||||
statusBar:false,
|
||||
control:{
|
||||
roll :false,
|
||||
close :false
|
||||
},
|
||||
fx:{
|
||||
shadow:false,
|
||||
fadeIn:false
|
||||
}
|
||||
};
|
||||
inst.setStyle={
|
||||
content:{padding:2}
|
||||
};
|
||||
var classInstaller = new installer();
|
||||
inst.tab={
|
||||
optWidth:190,
|
||||
manualDisabled:true,
|
||||
step :(leimnud.browser.isIE?-1:5),
|
||||
options:[{
|
||||
title :"Configuration",
|
||||
content :function()
|
||||
{
|
||||
classInstaller.make({
|
||||
server :"installServer.php",
|
||||
path_data:"<?php echo defined('PATH_DATA')?PATH_DATA:PATH_TRUNK.'shared';?>",
|
||||
path_compiled:"<?php echo defined('PATH_C')?PATH_C:PATH_TRUNK.'compiled';?>",
|
||||
path_trunk:"<?php echo PATH_CORE;?>"
|
||||
});
|
||||
},
|
||||
selected:true
|
||||
},
|
||||
{
|
||||
title :"Installation",
|
||||
noClear : true,
|
||||
content :classInstaller.install
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
inst.make();
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
input {
|
||||
font: normal 8pt sans-serif, Tahoma, MiscFixed;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
font: normal 8pt sans-serif, Tahoma;
|
||||
}
|
||||
|
||||
.inst_table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font: normal 8pt Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
.inst_td0 {
|
||||
width: 60%;
|
||||
text-align: right;
|
||||
border: 1px solid #CCC;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.inst_td1 {
|
||||
font-weight: bold;
|
||||
width: 40%;
|
||||
padding: 5px;
|
||||
border: 1px solid #CCC;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tdNormal,.tdOk,.tdFailed {
|
||||
font-weight: bold;
|
||||
border: 1px solid #CCC;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tdOk {
|
||||
font-weight: bold;
|
||||
color: green;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.tdFailed {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: left;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.inputNormal,.inputOk,.inputFailed {
|
||||
width: 100%;
|
||||
border: 1px solid #666;
|
||||
border-left: 3px solid #666;
|
||||
font: normal 8pt Tahoma, sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.inputOk {
|
||||
border: 1px solid green;
|
||||
border-left: 3px solid green;
|
||||
}
|
||||
|
||||
.inputFailed {
|
||||
border: 1px solid red;
|
||||
border-left: 3px solid red;
|
||||
}
|
||||
|
||||
.button {
|
||||
font: normal 8pt Tahoma, MiscFixed, sans-serif;
|
||||
border: 1px solid #afafaf;
|
||||
margin-left: 2px;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.buttonHover {
|
||||
border: 1px solid #666;
|
||||
background-position: 0 -8;
|
||||
}
|
||||
|
||||
.buttonDisabled {
|
||||
border: 1px solid #9f9f9f;
|
||||
background-position: 0 -10;
|
||||
color: #9f9f9f;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
//exec("mkdir /var/www/html/asas",$console);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,380 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* installServer.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
$isWindows = PHP_OS == 'WINNT' ? true : false;
|
||||
|
||||
$oJSON = new Services_JSON();
|
||||
$action = $_POST['action'];
|
||||
$dataClient = $oJSON->decode( stripslashes( $_POST['data'] ) );
|
||||
function find_SQL_Version ($my = 'mysql', $infExe = null)
|
||||
{
|
||||
if (PHP_OS == "WINNT" && ! $infExe) {
|
||||
return false;
|
||||
}
|
||||
$output = shell_exec( $my . ' -V' );
|
||||
preg_match( '@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version );
|
||||
return $version[0];
|
||||
}
|
||||
|
||||
if ($action === "check") {
|
||||
/* TODO: Check if this space is required */
|
||||
print " ";
|
||||
G::LoadClass( 'Installer' );
|
||||
$inst = new Installer();
|
||||
$siteName = "workflow";
|
||||
$p1 = (isset( $dataClient->ao_admin_pass1 )) ? $dataClient->ao_admin_pass1 : 'admin';
|
||||
$p2 = (isset( $dataClient->ao_admin_pass2 )) ? $dataClient->ao_admin_pass2 : 'admin';
|
||||
$s = $inst->create_site( Array ('name' => 'workflow','path_data' => $dataClient->path_data,'path_compiled' => $dataClient->path_compiled,'admin' => Array ('username' => (isset( $dataClient->ao_admin )) ? $dataClient->ao_admin : 'admin','password' => $p1
|
||||
),'advanced' => Array ('ao_db' => (isset( $dataClient->ao_db ) && $dataClient->ao_db === 2) ? false : true,'ao_db_drop' => (isset( $dataClient->ao_db_drop ) && $dataClient->ao_db_drop === true) ? true : false,'ao_db_wf' => (isset( $dataClient->ao_db_wf )) ? $dataClient->ao_db_wf : 'wf_' . $siteName,'ao_db_rb' => (isset( $dataClient->ao_db_rb )) ? $dataClient->ao_db_rb : 'rb_' . $siteName,'ao_db_rp' => (isset( $dataClient->ao_db_rp )) ? $dataClient->ao_db_rp : 'rp_' . $siteName
|
||||
),'database' => Array ('hostname' => $dataClient->mysqlH,'username' => $dataClient->mysqlU,'password' => $dataClient->mysqlP
|
||||
)
|
||||
) );
|
||||
$data = null;
|
||||
$data->phpVersion = (version_compare( PHP_VERSION, "5.1.0", ">" )) ? true : false;
|
||||
if (trim( $dataClient->mysqlH ) == '' || trim( $dataClient->mysqlU ) == '') {
|
||||
$con = array ('connection' => false,'grant' => false,'message' => 'Please complete the input fields (Hostname/Username)'
|
||||
);
|
||||
}
|
||||
$data->mysqlConnection = $s['result']['database']['connection'];
|
||||
$data->grantPriv = $s['result']['database']['grant'];
|
||||
$data->databaseMessage = $s['result']['database']['message'];
|
||||
$data->mysqlVersion = $s['result']['database']['version'];
|
||||
$data->path_data = $s['result']['path_data'];
|
||||
$data->path_compiled = true;
|
||||
$data->checkMemory = (((int) ini_get( "memory_limit" )) >= 40) ? true : false;
|
||||
#$data->checkmqgpc =(get_magic_quotes_gpc())?false:true;
|
||||
$data->checkPI = $inst->is_dir_writable( PATH_CORE . "config/" );
|
||||
$data->checkDL = $inst->is_dir_writable( PATH_CORE . "content/languages/" );
|
||||
$data->checkDLJ = $inst->is_dir_writable( PATH_CORE . "js/labels/" );
|
||||
$data->checkPL = $inst->is_dir_writable( PATH_CORE . "plugins/" );
|
||||
$data->checkXF = $inst->is_dir_writable( PATH_CORE . "xmlform/" );
|
||||
$data->ao_db_wf = $s['result']['database']['ao']['ao_db_wf'];
|
||||
$data->ao_db_rb = $s['result']['database']['ao']['ao_db_rb'];
|
||||
$data->ao_db_rp = $s['result']['database']['ao']['ao_db_rp'];
|
||||
|
||||
$data->ao_admin = $s['result']['admin']['username'];
|
||||
$data->ao_admin_pass = ($p1 !== $p2) ? false : true;
|
||||
|
||||
//*Autoinstall Process and Plugins. By JHL
|
||||
// March 11th. 2009
|
||||
// To enable the way of aoutoinstall process and/or plugins
|
||||
// at same time of initial PM setup
|
||||
|
||||
|
||||
//Get Available autoinstall process
|
||||
$data->availableProcess = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "pm" );
|
||||
|
||||
//Get Available autoinstall plugins
|
||||
$data->availablePlugins = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "tar" );
|
||||
|
||||
//End autoinstall
|
||||
|
||||
|
||||
$data->microtime = microtime( true );
|
||||
echo $oJSON->encode( $data );
|
||||
} elseif ($action === "install") {
|
||||
/*
|
||||
* Installation with SIMPLE POST
|
||||
*
|
||||
* Data necessary for the POST:
|
||||
*
|
||||
*
|
||||
* action=install
|
||||
* data= {"mysqlE":"Path/to/mysql.exe",
|
||||
* "mysqlH":"Mysqlhostname",
|
||||
* "mysqlU":"mysqlUsername",
|
||||
* "mysqlP":"mysqlPassword",
|
||||
* "path_data":"/path/to/workflow_data/",
|
||||
* "path_compiled":"/path/to/compiled/",
|
||||
* "heartbeatEnabled":"1"}
|
||||
*
|
||||
*--------------------------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Steps to install.
|
||||
* 1) This data is required:
|
||||
* $HOSTNAME
|
||||
* $USERNAME
|
||||
* $PASSWORD
|
||||
* $PATH_TO_WORKFLOW_DATA
|
||||
* $PATH_TO_COMPILED DATA
|
||||
* 2) create $PATH_TO_WORKFLOW_DATA
|
||||
* 3) create $PATH_TO_COMPILED_DATA
|
||||
* 4) Create the site workflow
|
||||
*
|
||||
* 4.1 Create user (mysql) wf_workflow , password: sample
|
||||
* 4.1.1 Create database wf_workflow with user wf_workflow
|
||||
* 4.1.2 Give all priviledges to database wf_workflow for user wf_workflow
|
||||
* 4.1.3 Dump file processmaker/workflow/engine/data/mysql/schema.sql
|
||||
* 4.1.4 Dump file processmaker/workflow/engine/data/mysql/insert.sql
|
||||
*
|
||||
* 4.2 Create user (mysql) wf_rbac, password: sample
|
||||
* 4.2.1 Create database wf_rbac with user wf_rbac
|
||||
* 4.2.2 Give all priviledges to databse wf_rbac for user wf_rbac
|
||||
* 4.2.3 Dump file processmaker/rbac/engine/data/mysql/schema.sql
|
||||
* 4.2.4 Dump file processmaker/rbac/engine/data/mysql/insert.sql
|
||||
*
|
||||
* 4.3 Create configuratoin file and directories to site workflow
|
||||
*
|
||||
* 4.3.1 Create directories:
|
||||
*
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/cutomFunctions/
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/rtfs/
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/xmlforms/
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/processesImages/
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/files/
|
||||
* 4.3.2 Create file.
|
||||
*
|
||||
* $PATH_TO_WORKFLOW_DATA./sites/workflow/db.php
|
||||
*
|
||||
* with these contents replacing $HOSTNAME.
|
||||
*
|
||||
<?php
|
||||
// Processmaker configuration
|
||||
define ('DB_ADAPTER', 'mysql' );
|
||||
define ('DB_HOST', $HOSTNAME );
|
||||
define ('DB_NAME', 'wf_workflow' );
|
||||
define ('DB_USER', 'wf_workflow' );
|
||||
define ('DB_PASS', 'sample' );
|
||||
define ('DB_RBAC_HOST', $HOSTNAME );
|
||||
define ('DB_RBAC_NAME', 'rbac_workflow' );
|
||||
define ('DB_RBAC_USER', 'rbac_workflow' );
|
||||
define ('DB_RBAC_PASS', 'sample' );
|
||||
?>
|
||||
|
||||
* 4.4 Create file workflow/engine/config/paths_installed.php with these contents.
|
||||
*
|
||||
* <?php
|
||||
define( 'PATH_DATA', '$PATH_TO_WORKFLOW_DATA' );
|
||||
define( 'PATH_C', '$PATH_TO_COMPILED_DATA' );
|
||||
?>
|
||||
|
||||
* Restarting:
|
||||
* $PATH_TO_WORKFLOW_DATA
|
||||
* $PATH_TO_COMPILED DATA
|
||||
*
|
||||
* 4.2 Update translation from this url (background)
|
||||
*
|
||||
* http://ProcessmakerHostname/sysworkflow/en/classic/tools/updateTranslation
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*5) Auto install processes and plugins
|
||||
*5.1 Install processes
|
||||
*5.2 Install plugins
|
||||
* */
|
||||
|
||||
$report = null;
|
||||
|
||||
try {
|
||||
|
||||
require_once 'Log.php';
|
||||
|
||||
$sp = "/";
|
||||
$dir_data = $dataClient->path_data;
|
||||
|
||||
$dir_data = (substr( $dir_data, - 1 ) == $sp) ? $dir_data : $dir_data . "/";
|
||||
$dir_compiled = $dir_data . "compiled/";
|
||||
$dir_log = "{$dir_data}log/";
|
||||
global $isWindows;
|
||||
|
||||
@mkdir( $dir_data . "sites", 0777, true );
|
||||
@mkdir( $dir_compiled, 0777, true );
|
||||
@mkdir( $dir_log, 0777, true );
|
||||
|
||||
$logFilename = "{$dir_log}install.log";
|
||||
$displayLog = Log::singleton( 'display', '', 'INSTALLER', array ('lineFormat' => "%{message}"
|
||||
) );
|
||||
$fileLog = Log::singleton( 'file', $logFilename, 'INSTALLER' );
|
||||
|
||||
global $logger;
|
||||
$logger = Log::singleton( 'composite' );
|
||||
$logger->addChild( $displayLog );
|
||||
|
||||
$create_db = "create-db.sql";
|
||||
$schema = "schema.sql";
|
||||
|
||||
G::LoadClass( 'Installer' );
|
||||
|
||||
/* Create default workspace called workflow */
|
||||
$inst = new Installer();
|
||||
$siteName = "workflow";
|
||||
$p1 = (isset( $dataClient->ao_admin_pass1 )) ? $dataClient->ao_admin_pass1 : 'admin';
|
||||
$p2 = (isset( $dataClient->ao_admin_pass2 )) ? $dataClient->ao_admin_pass2 : 'admin';
|
||||
|
||||
$s = $inst->create_site( Array ('name' => 'workflow','path_data' => $dataClient->path_data,'path_compiled' => $dataClient->path_compiled,'admin' => Array ('username' => (isset( $dataClient->ao_admin )) ? $dataClient->ao_admin : 'admin','password' => $p1
|
||||
),'advanced' => Array ('ao_db' => (isset( $dataClient->ao_db ) && $dataClient->ao_db === 2) ? false : true,'ao_db_drop' => (isset( $dataClient->ao_db_drop ) && $dataClient->ao_db_drop === true) ? true : false,'ao_db_wf' => (isset( $dataClient->ao_db_wf )) ? $dataClient->ao_db_wf : 'wf_' . $siteName,'ao_db_rb' => (isset( $dataClient->ao_db_rb )) ? $dataClient->ao_db_rb : 'rb_' . $siteName,'ao_db_rp' => (isset( $dataClient->ao_db_rp )) ? $dataClient->ao_db_rp : 'rp_' . $siteName
|
||||
),'database' => Array ('hostname' => $dataClient->mysqlH,'username' => $dataClient->mysqlU,'password' => $dataClient->mysqlP
|
||||
)
|
||||
), true );
|
||||
if ($s['created']) {
|
||||
$report = $inst->report;
|
||||
} else {
|
||||
/* On a failed install, $inst->report is blank because the
|
||||
* installation didnt occured at all. So we use the test report
|
||||
* instead.
|
||||
*/
|
||||
$report = $s['result'];
|
||||
}
|
||||
$installError = (! $s['created']);
|
||||
} catch (Exception $e) {
|
||||
$installError = ($e->getMessage() ? $e->getMessage() : true);
|
||||
}
|
||||
|
||||
if ($installError) {
|
||||
header( 'HTTP', true, 500 );
|
||||
}
|
||||
|
||||
/* Status is used in the Windows installer, do not change this */
|
||||
print_r( "Status: " . (($installError) ? 'FAILED' : 'SUCCESS') . "\n\n" );
|
||||
|
||||
/* Try to open the file log, if it fails, set it to NULL, so we don't try to
|
||||
* write to it again afterwards. If it succeeds, add to the logger.
|
||||
* Only open the log after writing status, otherwise a warning can be issued
|
||||
* which will affect the Windows installer.
|
||||
*/
|
||||
if (! $fileLog->open()) {
|
||||
$fileLog = null;
|
||||
$displayLog->log( "Failed to create file log in $logFilename" );
|
||||
} else {
|
||||
$logger->addChild( $fileLog );
|
||||
$fileLog->log( " ** Starting installation ** " );
|
||||
$fileLog->log( "Status: " . (($installError) ? 'FAILED' : 'SUCCESS') );
|
||||
$displayLog->log( "This log is also available in $logFilename" );
|
||||
}
|
||||
|
||||
$installArgs = (array) $dataClient;
|
||||
$hiddenFields = array ('mysqlP','ao_admin_pass1','ao_admin_pass2');
|
||||
foreach ($installArgs as $arg => $param) {
|
||||
if (in_array( $arg, $hiddenFields )) {
|
||||
$installArgs[$arg] = "********";
|
||||
}
|
||||
}
|
||||
|
||||
$logger->log( "Installation arguments\n" . neat_r( array ($installArgs) ) );
|
||||
|
||||
if (isset( $report )) {
|
||||
$logger->log( "Installation report\n" . neat_r( array ($report ) ) );
|
||||
} else {
|
||||
$logger->log( "** Installation crashed **" );
|
||||
}
|
||||
|
||||
if (is_string( $installError )) {
|
||||
$logger->log( "Error message: $installError" );
|
||||
}
|
||||
|
||||
if ($installError) {
|
||||
$logger->log( "Installation ending with errors" );
|
||||
die();
|
||||
}
|
||||
|
||||
$sh = md5( filemtime( PATH_GULLIVER . "/class.g.php" ) );
|
||||
$h = G::encrypt( $dataClient->mysqlH . $sh . $dataClient->mysqlU . $sh . $dataClient->mysqlP . $sh . $inst->cc_status, $sh );
|
||||
$db_text = "<?php\n" . "define( 'PATH_DATA', '" . $dir_data . "' );\n" . "define( 'PATH_C', '" . $dir_compiled . "' );\n" . "define( 'HASH_INSTALLATION','" . $h . "' );\n" . "define( 'SYSTEM_HASH','" . $sh . "' );\n" . "?>";
|
||||
$fp = fopen( FILE_PATHS_INSTALLED, "w" );
|
||||
fputs( $fp, $db_text, strlen( $db_text ) );
|
||||
fclose( $fp );
|
||||
|
||||
/* Update languages */
|
||||
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/tools/updateTranslation" );
|
||||
$logger->log( "Update language => " . ((! $update) ? $update : "OK") );
|
||||
|
||||
/* Heartbeat Enable/Disable */
|
||||
if (! isset( $dataClient->heartbeatEnabled )) {
|
||||
$dataClient->heartbeatEnabled = true;
|
||||
}
|
||||
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/heartbeatStatus?status=" . $dataClient->heartbeatEnabled );
|
||||
$logger->log( "Heartbeat Status => " . str_replace( "<br>", "\n", $update ) );
|
||||
|
||||
/* Autoinstall Process */
|
||||
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/autoinstallProcesses" );
|
||||
if (trim( str_replace( "<br>", "", $update ) ) == "") {
|
||||
$update = "Nothing to do.";
|
||||
}
|
||||
$logger->log( "Process AutoInstall => " . str_replace( "<br>", "\n", $update ) );
|
||||
|
||||
/* Autoinstall Plugins */
|
||||
$update = file_get_contents( "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/sysworkflow/en/classic/install/autoinstallPlugins" );
|
||||
if (trim( str_replace( "<br>", "", $update ) ) == "") {
|
||||
$update = "Nothing to do.";
|
||||
}
|
||||
$logger->log( "Plugin AutoInstall => " . str_replace( "<br>", "\n", $update ) );
|
||||
$logger->log( "Installation finished successfuly" );
|
||||
}
|
||||
|
||||
/*
|
||||
neat_r works like print_r but with much less visual clutter.
|
||||
By Jake Lodwick. Copy freely.
|
||||
*/
|
||||
function neat_r ($arr, $return = false)
|
||||
{
|
||||
$out = array ();
|
||||
$oldtab = " ";
|
||||
$newtab = " ";
|
||||
|
||||
$lines = explode( "\n", print_r( $arr, true ) );
|
||||
|
||||
foreach ($lines as $line) {
|
||||
|
||||
//remove numeric indexes like "[0] =>" unless the value is an array
|
||||
//if (substr($line, -5) != "Array") {
|
||||
$line = preg_replace( "/^(\s*)\[[0-9]+\] => /", "$1", $line, 1 );
|
||||
//}
|
||||
|
||||
|
||||
//garbage symbols
|
||||
foreach (array ("Array" => "","[" => "","]" => ""
|
||||
) as
|
||||
//" =>" => ":",
|
||||
$old => $new) {
|
||||
$out = str_replace( $old, $new, $out );
|
||||
}
|
||||
|
||||
//garbage lines
|
||||
if (in_array( trim( $line ), array ("Array","(",")",""
|
||||
) )) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//indents
|
||||
$indent = "";
|
||||
$indents = floor( (substr_count( $line, $oldtab ) - 1) / 2 );
|
||||
if ($indents > 0) {
|
||||
for ($i = 0; $i < $indents; $i ++) {
|
||||
$indent .= $newtab;
|
||||
}
|
||||
}
|
||||
|
||||
$out[] = $indent . trim( $line );
|
||||
}
|
||||
|
||||
$out = implode( "\n", $out );
|
||||
if ($return == true) {
|
||||
return $out;
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user