CODE STYLE changes...
FILES: gulliver/system/class.table.php workflow/engine/classes/class.propelTable.php workflow/engine/classes/entities/Base.php workflow/engine/classes/model/AppEvent.php
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.table.php
|
||||
*
|
||||
@@ -29,6 +30,8 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Table class definition
|
||||
* Render table
|
||||
*
|
||||
@@ -151,8 +154,9 @@ class Table
|
||||
global $HTTP_GET_VARS;
|
||||
global $HTTP_SESSION_VARS;
|
||||
$stOrderByDir = $this->DefaultOrderDir;
|
||||
if (isset( $HTTP_SESSION_VARS['OrderDir'] ) && ($HTTP_SESSION_VARS['OrderDir'] == 'DESC' || $HTTP_SESSION_VARS['OrderDir'] == 'ASC'))
|
||||
if (isset( $HTTP_SESSION_VARS['OrderDir'] ) && ($HTTP_SESSION_VARS['OrderDir'] == 'DESC' || $HTTP_SESSION_VARS['OrderDir'] == 'ASC')) {
|
||||
$stOrderByDir = $HTTP_SESSION_VARS['OrderDir'];
|
||||
}
|
||||
|
||||
$stQry = $this->_source;
|
||||
if ($this->WhereClause != "") {
|
||||
@@ -688,7 +692,6 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "currency2":
|
||||
if ($val != "") {
|
||||
$res .= G::NumberToCurrency( $val );
|
||||
@@ -696,7 +699,6 @@ class Table
|
||||
$res .= "$ 0.00";
|
||||
}
|
||||
break;
|
||||
|
||||
case "percentage2":
|
||||
if ($val != "") {
|
||||
$res .= G::NumberToPercentage( $val );
|
||||
@@ -704,7 +706,6 @@ class Table
|
||||
$res .= "0.00 %";
|
||||
}
|
||||
break;
|
||||
|
||||
case "percentage":
|
||||
if ($val != "") {
|
||||
$res .= htmlentities( number_format( (float) $val, 2, ".", "," ) . " %", ENT_QUOTES, 'utf-8' );
|
||||
@@ -712,7 +713,6 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "date":
|
||||
if ($val != "" && $val != '0000-00-00 00:00:00') {
|
||||
$part = explode( ' ', $val );
|
||||
@@ -732,12 +732,10 @@ class Table
|
||||
$res .= formatDate( '$M $d $Y', $val );
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "email":
|
||||
if ($val != "") {
|
||||
$res .= "<a href=\"mailto:" . $val . "\">";
|
||||
@@ -747,7 +745,6 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "ifpdf":
|
||||
if ($val == '1') {
|
||||
$image = "<img border=0 src='/images/pdf.gif'>";
|
||||
@@ -761,7 +758,6 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "ifimg":
|
||||
$image = "<img border=0 src='" . $col['Extra'] . "' >";
|
||||
if ($val == '1') {
|
||||
@@ -774,7 +770,6 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "ifrtf":
|
||||
if ($val == '1') {
|
||||
$image = "<img border=0 src='/images/word.gif'>";
|
||||
@@ -788,11 +783,9 @@ class Table
|
||||
$res .= " ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "image":
|
||||
|
||||
if (is_array( $col["Condition"] )) //By JHL to enable Condition to display a image -- New parameter Condition in Addrawcolumn
|
||||
{
|
||||
if (is_array( $col["Condition"] )) {
|
||||
//By JHL to enable Condition to display a image -- New parameter Condition in Addrawcolumn
|
||||
$field_compare = $col["Condition"]['field'];
|
||||
$tlabel = substr( $field_compare, 0, 1 );
|
||||
switch ($tlabel) {
|
||||
@@ -806,8 +799,6 @@ class Table
|
||||
$val = "<img border=0 src='$fieldname'>";
|
||||
}
|
||||
// break;
|
||||
|
||||
|
||||
case "textimage":
|
||||
$AAS = $col['Extra'];
|
||||
$val1 = " <img border=0 src='$AAS' align='middle'>";
|
||||
@@ -834,14 +825,14 @@ class Table
|
||||
}
|
||||
}
|
||||
$res .= "\"><span class='txtin3'>" . strtoupper( $fieldname ) . "$val</span></a>";
|
||||
} else
|
||||
} else {
|
||||
$val2 = "<span class='txtin3'>" . strtoupper( $fieldname ) . "</span>";
|
||||
}
|
||||
// break;
|
||||
|
||||
|
||||
case "link":
|
||||
if ($val == "")
|
||||
if ($val == "") {
|
||||
$res .= " ";
|
||||
}
|
||||
$title = '';
|
||||
if ($col["Type"] == 'link' && trim( isset( $this->_row_values['TOOLTIP'] ) ? $this->_row_values['TOOLTIP'] : '' ))
|
||||
;
|
||||
@@ -921,10 +912,10 @@ class Table
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
}
|
||||
break;
|
||||
|
||||
case "linknew":
|
||||
if ($val == "")
|
||||
if ($val == "") {
|
||||
$res .= " ";
|
||||
}
|
||||
if ($col["Content"] != "") {
|
||||
$tlabel = substr( $col["Content"], 0, 1 );
|
||||
switch ($tlabel) {
|
||||
@@ -964,7 +955,6 @@ class Table
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
}
|
||||
break;
|
||||
|
||||
case "iflink":
|
||||
if ($col["Content"] != "") {
|
||||
$tlabel = substr( $col["Content"], 0, 1 );
|
||||
@@ -999,10 +989,8 @@ class Table
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
}
|
||||
break;
|
||||
|
||||
case "jsimglink":
|
||||
$val = "<img border=0 src='$fieldname'>";
|
||||
|
||||
case "jslink":
|
||||
if ($val == "") {
|
||||
$val .= "<span class='txtin3'> " . $col['Name'] . '<span>';
|
||||
@@ -1020,7 +1008,6 @@ class Table
|
||||
$res .= $val;
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
break;
|
||||
|
||||
case "$":
|
||||
$vname = substr( $col["Content"], 1, (strlen( $col["Content"] ) - 1) );
|
||||
$lval = $HTTP_SESSION_VARS[$vname];
|
||||
@@ -1028,7 +1015,6 @@ class Table
|
||||
$res .= $val;
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
break;
|
||||
|
||||
case '_':
|
||||
$Values = explode( ',', substr( $col['Content'], 1, strlen( $col['Content'] ) ) );
|
||||
$res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "(";
|
||||
@@ -1048,7 +1034,6 @@ class Table
|
||||
$res .= $val;
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
break;
|
||||
|
||||
default:
|
||||
$res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "('" . $val . "')\"" . $col['Extra'] . ">";
|
||||
$res .= $col["Content"];
|
||||
@@ -1061,7 +1046,6 @@ class Table
|
||||
$res .= "</a" . $col['Extra'] . ">";
|
||||
}
|
||||
break;
|
||||
|
||||
case "checkbox":
|
||||
$res .= "<input type='checkbox' name=\"form[" . $fieldname . "][" . $val . "]\" ";
|
||||
if ($val == '1' || $val == 'TRUE' || $val == 'yes') {
|
||||
@@ -1107,7 +1091,6 @@ class Table
|
||||
if (is_array( $this->contexto )) {
|
||||
$this->contexto[0][] = $contexto;
|
||||
$this->contexto[1][] = $nombre;
|
||||
|
||||
} else {
|
||||
$this->contexto = array ();
|
||||
$this->contexto[0][] = $contexto;
|
||||
@@ -1183,7 +1166,7 @@ class Table
|
||||
$token = '';
|
||||
$i = 0;
|
||||
|
||||
While ($i <= $len and $i <= $number) {
|
||||
while ($i <= $len and $i <= $number) {
|
||||
$car = substr( $value, $i, 1 );
|
||||
$br = strtoupper( substr( $value, $i, 4 ) );
|
||||
if ($car == '<') {
|
||||
@@ -1192,16 +1175,19 @@ class Table
|
||||
if ($car == '>') {
|
||||
$Flag = 1;
|
||||
}
|
||||
if ($br == '<BR>' || $br == '</P>')
|
||||
if ($br == '<BR>' || $br == '</P>') {
|
||||
$token .= "<BR>";
|
||||
}
|
||||
|
||||
if (($Flag == 1) && ($car != '>')) {
|
||||
$token .= $car;
|
||||
if ($i == $number)
|
||||
if ($i == $number) {
|
||||
$token .= "... ";
|
||||
}
|
||||
}
|
||||
$i = $i + 1;
|
||||
}
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,15 +150,18 @@ class propelTable
|
||||
foreach ($orderFields as $field => $fieldOrder) {
|
||||
$field = G::getUIDName( $field, '' );
|
||||
$fieldOrder = strtoupper( $fieldOrder );
|
||||
if ($fieldOrder === 'A')
|
||||
if ($fieldOrder === 'A') {
|
||||
$fieldOrder = 'ASC';
|
||||
if ($fieldOrder === 'D')
|
||||
}
|
||||
if ($fieldOrder === 'D') {
|
||||
$fieldOrder = 'DESC';
|
||||
}
|
||||
switch ($fieldOrder) {
|
||||
case 'ASC':
|
||||
case 'DESC':
|
||||
if ($order !== '')
|
||||
if ($order !== '') {
|
||||
$order .= ', ';
|
||||
}
|
||||
$order .= $field . ' ' . $fieldOrder;
|
||||
$this->aOrder[$field] = $fieldOrder;
|
||||
}
|
||||
@@ -175,12 +178,13 @@ class propelTable
|
||||
$this->criteria->clearOrderByColumns();
|
||||
}
|
||||
foreach ($this->aOrder as $field => $ascending) {
|
||||
if ($ascending == 'ASC')
|
||||
if ($ascending == 'ASC') {
|
||||
$this->criteria->addAscendingOrderByColumn( $field );
|
||||
else
|
||||
} else {
|
||||
$this->criteria->addDescendingOrderByColumn( $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add limits
|
||||
*/
|
||||
@@ -215,18 +219,21 @@ class propelTable
|
||||
$this->name = $xmlForm->name;
|
||||
$this->id = $xmlForm->id;
|
||||
//$this->sqlConnection=((isset($this->xmlForm->sqlConnection))?$this->xmlForm->sqlConnection:'');
|
||||
if (isset( $_GET['page'] ))
|
||||
if (isset( $_GET['page'] )) {
|
||||
$this->currentPage = $_GET['page'];
|
||||
else
|
||||
} else {
|
||||
$this->currentPage = 1;
|
||||
if (isset( $_GET['order'] ))
|
||||
}
|
||||
if (isset( $_GET['order'] )) {
|
||||
$this->orderBy = urldecode( $_GET['order'] );
|
||||
else
|
||||
} else {
|
||||
$this->orderBy = "";
|
||||
if (isset( $_GET['filter'] ))
|
||||
}
|
||||
if (isset( $_GET['filter'] )) {
|
||||
$this->filter = urldecode( $_GET['filter'] );
|
||||
else
|
||||
} else {
|
||||
$this->filter = "";
|
||||
}
|
||||
if ($xmlForm->ajaxServer != '') {
|
||||
$this->ajaxServer = G::encryptLink( $xmlForm->ajaxServer );
|
||||
} else {
|
||||
@@ -235,12 +242,14 @@ class propelTable
|
||||
$this->ownerPage = G::encryptLink( SYS_CURRENT_URI );
|
||||
// Config attributes from XMLFORM file
|
||||
$myAttributes = get_class_vars( get_class( $this ) );
|
||||
foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value)
|
||||
foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value) {
|
||||
if (array_key_exists( $atrib, $myAttributes )) {
|
||||
eval( 'settype($value, gettype($this->' . $atrib . '));' );
|
||||
if ($value !== '')
|
||||
if ($value !== '') {
|
||||
eval( '$this->' . $atrib . '=$value;' );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->masterdetail != "") {
|
||||
$this->masterdetail = explode( ",", $this->masterdetail );
|
||||
foreach ($this->masterdetail as $keyMasterDetail => $valueMasterDetail) {
|
||||
@@ -258,8 +267,9 @@ class propelTable
|
||||
$r = $f;
|
||||
$this->fields[$r]['Name'] = $this->xmlForm->fields[$f]->name;
|
||||
$this->fields[$r]['Type'] = $this->xmlForm->fields[$f]->type;
|
||||
if (isset( $this->xmlForm->fields[$f]->size ))
|
||||
if (isset( $this->xmlForm->fields[$f]->size )) {
|
||||
$this->fields[$r]['Size'] = $this->xmlForm->fields[$f]->size;
|
||||
}
|
||||
$this->fields[$r]['Label'] = $this->xmlForm->fields[$f]->label;
|
||||
}
|
||||
//Set the default settings
|
||||
@@ -283,9 +293,11 @@ class propelTable
|
||||
}
|
||||
}
|
||||
$totalWidth = 0;
|
||||
foreach ($this->fields as $r => $rval)
|
||||
if ($this->style[$r]['showInTable'] != '0')
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if ($this->style[$r]['showInTable'] != '0') {
|
||||
$totalWidth += $this->style[$r]['colWidth'];
|
||||
}
|
||||
}
|
||||
$this->totalWidth = $totalWidth;
|
||||
}
|
||||
|
||||
@@ -313,13 +325,14 @@ class propelTable
|
||||
{
|
||||
//fix the bug about showing hidden fields in propel table.
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if ($this->style[$r]['type'] == 'hidden')
|
||||
if ($this->style[$r]['type'] == 'hidden') {
|
||||
$this->style[$r]['showInTable'] = '0';
|
||||
}
|
||||
}
|
||||
//Render headers
|
||||
$this->colCount = 0;
|
||||
$this->shownFields = '[';
|
||||
foreach ($this->fields as $r => $rval)
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
|
||||
//if (($this->style[$r]['showInTable'] != '0' ))
|
||||
$this->tpl->newBlock( "headers" );
|
||||
@@ -327,26 +340,31 @@ class propelTable
|
||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder);
|
||||
$this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? (G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage;
|
||||
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '");return false;';
|
||||
if (isset( $this->style[$r]['href'] ))
|
||||
if (isset( $this->style[$r]['href'] )) {
|
||||
$this->tpl->assign( "href", $this->style[$r]['href'] );
|
||||
if (isset( $this->style[$r]['onsort'] ))
|
||||
}
|
||||
if (isset( $this->style[$r]['onsort'] )) {
|
||||
$this->tpl->assign( "onsort", htmlentities( $this->style[$r]['onsort'], ENT_QUOTES, 'UTF-8' ) );
|
||||
}
|
||||
|
||||
/* BUG 8080 - erik: don't setup onclick on page table header, doesn't have sense and causing problems
|
||||
if (isset($this->style[$r]['onclick']))
|
||||
$this->tpl->assign( "onclick" , htmlentities( $this->style[$r]['onclick'] , ENT_QUOTES, 'UTF-8' ) );
|
||||
*/
|
||||
|
||||
if (isset( $this->style[$r]['colWidth'] ))
|
||||
if (isset( $this->style[$r]['colWidth'] )) {
|
||||
$this->tpl->assign( "width", $this->style[$r]['colWidth'] );
|
||||
if (isset( $this->style[$r]['colWidth'] ))
|
||||
}
|
||||
if (isset( $this->style[$r]['colWidth'] )) {
|
||||
$this->tpl->assign( "widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%" );
|
||||
//Hook for special skin with RTL languajes
|
||||
}
|
||||
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') {
|
||||
$this->style[$r]['titleAlign'] = 'right';
|
||||
}
|
||||
if (isset( $this->style[$r]['titleAlign'] ))
|
||||
if (isset( $this->style[$r]['titleAlign'] )) {
|
||||
$this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
|
||||
}
|
||||
if ($this->style[$r]['titleVisibility'] != '0') {
|
||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? '<img src="/images/arrow-up.gif">' : '');
|
||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '<img src="/images/arrow-down.gif">' : $sortOrder);
|
||||
@@ -359,6 +377,7 @@ class propelTable
|
||||
$this->shownFields .= ($this->shownFields !== '[') ? ',' : '';
|
||||
$this->shownFields .= '"' . $r . '"';
|
||||
}
|
||||
}
|
||||
$this->shownFields .= ']';
|
||||
}
|
||||
|
||||
@@ -380,10 +399,11 @@ class propelTable
|
||||
$styleData = $this->style[$r];
|
||||
$fielDataName = $styleData['data'];
|
||||
$fieldClassName = isset( $styleData['colClassName'] ) && ($styleData['colClassName']) ? $styleData['colClassName'] : $this->tdClass;
|
||||
if ($fielDataName != '')
|
||||
if ($fielDataName != '') {
|
||||
$value = ((isset( $result[$fielDataName] )) ? $result[$fielDataName] : '');
|
||||
else
|
||||
} else {
|
||||
$value = $this->fields[$r]['Label'];
|
||||
}
|
||||
$this->tpl->newBlock( "field" );
|
||||
$this->tpl->assign( 'width', $this->style[$r]['colWidth'] );
|
||||
$classAttr = (trim( $fieldClassName ) != '') ? " class=\"$fieldClassName\"" : '';
|
||||
@@ -414,7 +434,7 @@ class propelTable
|
||||
$this->xmlForm->setDefaultValues();
|
||||
$this->xmlForm->setValues( $result );
|
||||
//var_dump($fieldName, $fieldClass );echo '<br /><br />';
|
||||
if (array_search( 'renderTable', get_class_methods( $fieldClass ) ) !== FALSE) {
|
||||
if (array_search( 'renderTable', get_class_methods( $fieldClass ) ) !== false) {
|
||||
$htmlField = $this->xmlForm->fields[$fieldName]->renderTable( $value, $this->xmlForm, true );
|
||||
if (is_object( $value )) {
|
||||
$value = '';
|
||||
@@ -423,8 +443,9 @@ class propelTable
|
||||
$testValue = preg_match( "/<a ?.*>(.*)<\/a>/i", $htmlField, $value );
|
||||
$this->tpl->assign( "value", $htmlField );
|
||||
if ($testValue > 0 && (isset( $value[1] ) && strlen( trim( $value[1] ) ) == 0)) {
|
||||
if ((trim( $value[0] )) == '')
|
||||
if ((trim( $value[0] )) == '') {
|
||||
$this->tpl->assign( "value", " " );
|
||||
}
|
||||
// $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" "," ",$htmlField):$htmlField );
|
||||
} else {
|
||||
$this->tpl->assign( "value", $htmlField );
|
||||
@@ -453,52 +474,61 @@ class propelTable
|
||||
$this->style[$r] = array ('showInTable' => '1','titleVisibility' => '1','colWidth' => '150','onclick' => '','event' => ''
|
||||
);
|
||||
//Some widths
|
||||
if (! (strpos( ' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE))
|
||||
if (! (strpos( ' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
|
||||
$this->style[$r]['colWidth'] = '70';
|
||||
}
|
||||
//Data source:
|
||||
if (! (strpos( ' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE))
|
||||
if (! (strpos( ' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
|
||||
$this->style[$r]['data'] = ''; //If the control is a link it shows the label
|
||||
else
|
||||
} else {
|
||||
$this->style[$r]['data'] = $this->fields[$r]['Name']; //ELSE: The data value for that field
|
||||
//Hidden fields
|
||||
}
|
||||
if (! isset( $this->style[$r]['showInTable'] )) {
|
||||
if (! (strpos( ' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
|
||||
if (! (strpos( ' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
|
||||
$this->style[$r]['showInTable'] = '0';
|
||||
} else {
|
||||
$this->style[$r]['showInTable'] = '1';
|
||||
}
|
||||
}
|
||||
//Hidden titles
|
||||
if (! (strpos( ' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
|
||||
if (! (strpos( ' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
|
||||
$this->style[$r]['titleVisibility'] = '0';
|
||||
}
|
||||
//Align titles
|
||||
$this->style[$r]['titleAlign'] = 'center';
|
||||
//Align fields
|
||||
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R')
|
||||
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') {
|
||||
$this->style[$r]['align'] = 'right';
|
||||
else
|
||||
} else {
|
||||
$this->style[$r]['align'] = 'left';
|
||||
if (! (strpos( ' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
|
||||
}
|
||||
if (! (strpos( ' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
|
||||
$this->style[$r]['align'] = 'center';
|
||||
}
|
||||
}
|
||||
// Adjust the columns width to prevent overflow the page width
|
||||
//Render headers
|
||||
$totalWidth = 0;
|
||||
foreach ($this->fields as $r => $rval)
|
||||
if ($this->style[$r]['showInTable'] != '0')
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if ($this->style[$r]['showInTable'] != '0') {
|
||||
$totalWidth += $this->style[$r]['colWidth'];
|
||||
}
|
||||
}
|
||||
$this->totalWidth = $totalWidth;
|
||||
$maxWidth = 1800;
|
||||
$proportion = $totalWidth / $maxWidth;
|
||||
if ($proportion > 1)
|
||||
if ($proportion > 1) {
|
||||
$this->totalWidth = 1800;
|
||||
if ($proportion > 1)
|
||||
foreach ($this->fields as $r => $rval)
|
||||
if ($this->style[$r]['showInTable'] != '0')
|
||||
}
|
||||
if ($proportion > 1) {
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if ($this->style[$r]['showInTable'] != '0') {
|
||||
$this->style[$r]['colWidth'] = $this->style[$r]['colWidth'] / $proportion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function renderTable
|
||||
@@ -512,12 +542,13 @@ class propelTable
|
||||
{
|
||||
//Render Title
|
||||
$thereisnotitle = true;
|
||||
foreach ($this->fields as $r => $rval)
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if ($this->fields[$r]['Type'] === 'title') {
|
||||
$this->title = $this->fields[$r]['Label'];
|
||||
unset( $this->fields[$r] );
|
||||
$thereisnotitle = false;
|
||||
}
|
||||
}
|
||||
if ($thereisnotitle) {
|
||||
$this->title = '';
|
||||
}
|
||||
@@ -530,11 +561,12 @@ class propelTable
|
||||
// verify if there are templates folders registered, template and method folders are the same
|
||||
$folderTemplate = explode( '/', $this->template );
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] ))
|
||||
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
|
||||
$templateFile = PATH_PLUGINS . $this->template . '.html';
|
||||
else
|
||||
} else {
|
||||
$templateFile = PATH_TPL . $this->template . '.html';
|
||||
// Prepare the template
|
||||
}
|
||||
$this->tpl = new TemplatePower( $templateFile );
|
||||
$this->tpl->prepare();
|
||||
if (is_array( $fields )) {
|
||||
@@ -553,9 +585,10 @@ class propelTable
|
||||
$this->tpl->assign( "title", $this->title );
|
||||
if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) {
|
||||
$filterForm = new filterForm( $this->filterForm, $this->xmlForm->home );
|
||||
if ($this->menu === '')
|
||||
if ($this->menu === '') {
|
||||
$this->menu = 'gulliver/pagedTable_Options';
|
||||
}
|
||||
}
|
||||
if (file_exists( $this->xmlForm->home . $this->menu . '.xml' )) {
|
||||
$menu = new xmlMenu( $this->menu, $this->xmlForm->home );
|
||||
$this->tpl->newBlock( 'headerBlock' );
|
||||
@@ -585,9 +618,10 @@ class propelTable
|
||||
$this->tpl->assign( 'content', $filterForm->render( $template, $scriptCode ) );
|
||||
$oHeadPublisher->addScriptFile( $filterForm->scriptURL );
|
||||
$oHeadPublisher->addScriptCode( $scriptCode );
|
||||
if (isset( $_SESSION ))
|
||||
if (isset( $_SESSION )) {
|
||||
$_SESSION[$filterForm->id] = $filterForm->values;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -677,14 +711,16 @@ class propelTable
|
||||
}
|
||||
}
|
||||
$this->tpl->gotoblock( "row" );
|
||||
if (! isset( $rowName ))
|
||||
if (! isset( $rowName )) {
|
||||
$rowName = array ();
|
||||
}
|
||||
$this->tpl->assign( "rowName", implode( ",", $rowName ) );
|
||||
}
|
||||
//End Master Detail: This enable the MasterDEtail view
|
||||
//Merge $result with $xmlForm values (for default valuesSettings)
|
||||
if (is_array( $this->xmlForm->values ))
|
||||
if (is_array( $this->xmlForm->values )) {
|
||||
$result = array_merge( $this->xmlForm->values, $result );
|
||||
}
|
||||
foreach ($this->fields as $r => $rval) {
|
||||
if (strcasecmp( $this->fields[$r]['Type'], 'cellMark' ) == 0) {
|
||||
$result1 = $result;
|
||||
@@ -695,11 +731,12 @@ class propelTable
|
||||
$this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle( $result1, $this->xmlForm );
|
||||
$this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass( $result1, $this->xmlForm );
|
||||
} elseif ($this->style[$r]['showInTable'] != '0') {
|
||||
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail ))))
|
||||
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
|
||||
$this->renderField( $j + 1, $r, $result );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page
|
||||
$this->tpl->newBlock( 'rowTag' );
|
||||
$this->tpl->assign( 'rowId', 'insertAtLast' );
|
||||
@@ -728,20 +765,23 @@ class propelTable
|
||||
$last = "<a class='noLastPage'> </a>";
|
||||
}
|
||||
$pagesEnum = '';
|
||||
for ($r = 1; $r <= $this->totPages; $r ++)
|
||||
for ($r = 1; $r <= $this->totPages; $r ++) {
|
||||
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
|
||||
$pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
|
||||
if ($r != $this->currentPage)
|
||||
if ($r != $this->currentPage) {
|
||||
$pagesEnum .= " <a href=\"" . htmlentities( $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
|
||||
else
|
||||
} else {
|
||||
$pagesEnum .= " <a>" . $r . "</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->totRows === 0) {
|
||||
$this->tpl->newBlock( 'norecords' );
|
||||
$this->tpl->assign( "columnCount", $this->colCount );
|
||||
$noRecordsFound = 'ID_NO_RECORDS_FOUND';
|
||||
if (G::LoadTranslation( $noRecordsFound ))
|
||||
if (G::LoadTranslation( $noRecordsFound )) {
|
||||
$noRecordsFound = G::LoadTranslation( $noRecordsFound );
|
||||
}
|
||||
$this->tpl->assign( "noRecordsFound", $noRecordsFound );
|
||||
}
|
||||
if (! $this->disableFooter) {
|
||||
@@ -770,32 +810,34 @@ class propelTable
|
||||
} else {
|
||||
$this->tpl->assign( "fastSearchStyle", 'visibility:hidden;' );
|
||||
}
|
||||
if ($this->addRow)
|
||||
if ($this->sqlInsert != '')
|
||||
if ($this->addRow) {
|
||||
if ($this->sqlInsert != '') {
|
||||
$this->tpl->assign( "insert", '<a href="#" onclick="pagedTable.event=\'Insert\';popup(\'' . $this->popupPage . '\');return false;">'./*G::LoadXml('labels','ID_ADD_NEW')*/ 'ID_ADD_NEW' . '</a>' );
|
||||
}
|
||||
}
|
||||
$this->tpl->assign( "pagesEnum", $pagesEnum );
|
||||
}
|
||||
?>
|
||||
|
||||
<script language='JavaScript'>
|
||||
var <?php echo $this->id?><?php echo ($this->name != '' ? '='.$this->name : '')?>=new G_PagedTable();
|
||||
<?php echo $this->id?>.id<?php echo '="'. addslashes($this->id) . '"'?>;
|
||||
<?php echo $this->id?>.name<?php echo '="'. addslashes($this->name) . '"'?>;
|
||||
<?php echo $this->id?>.ajaxUri<?php echo '="'. addslashes($this->ajaxServer) . '?ptID='.$this->id.'"'?>;
|
||||
<?php echo $this->id?>.currentOrder<?php echo '="'. addslashes($this->orderBy) . '"'?>;
|
||||
<?php echo $this->id?>.currentFilter;
|
||||
<?php echo $this->id?>.currentPage<?php echo '='. $this->currentPage?>;
|
||||
<?php echo $this->id?>.totalRows<?php echo '='.$this->totRows ?>;
|
||||
<?php echo $this->id?>.rowsPerPage<?php echo '='.$this->rowsPerPage?>;
|
||||
<?php echo $this->id?>.popupPage<?php echo '="'. addslashes($this->popupPage) . '?ptID='.$this->id.'"'?>;
|
||||
<?php echo $this->id?>.onUpdateField<?php echo '="'. addslashes($this->onUpdateField) . '"'?>;
|
||||
<?php echo $this->id?>.shownFields<?php echo '='.$this->shownFields ?>;
|
||||
<script language='JavaScript'>
|
||||
var <?php echo $this->id?><?php echo ($this->name != '' ? '='.$this->name : '')?>=new G_PagedTable();
|
||||
<?php echo $this->id?>.id<?php echo '="'. addslashes($this->id) . '"'?>;
|
||||
<?php echo $this->id?>.name<?php echo '="'. addslashes($this->name) . '"'?>;
|
||||
<?php echo $this->id?>.ajaxUri<?php echo '="'. addslashes($this->ajaxServer) . '?ptID='.$this->id.'"'?>;
|
||||
<?php echo $this->id?>.currentOrder<?php echo '="'. addslashes($this->orderBy) . '"'?>;
|
||||
<?php echo $this->id?>.currentFilter;
|
||||
<?php echo $this->id?>.currentPage<?php echo '='. $this->currentPage?>;
|
||||
<?php echo $this->id?>.totalRows<?php echo '='.$this->totRows ?>;
|
||||
<?php echo $this->id?>.rowsPerPage<?php echo '='.$this->rowsPerPage?>;
|
||||
<?php echo $this->id?>.popupPage<?php echo '="'. addslashes($this->popupPage) . '?ptID='.$this->id.'"'?>;
|
||||
<?php echo $this->id?>.onUpdateField<?php echo '="'. addslashes($this->onUpdateField) . '"'?>;
|
||||
<?php echo $this->id?>.shownFields<?php echo '='.$this->shownFields ?>;
|
||||
|
||||
var panelPopup;
|
||||
var popupWidth<?php echo '='.$this->popupWidth?>;
|
||||
var popupHeight<?php echo '='.$this->popupHeight?>;
|
||||
</script>
|
||||
<?php
|
||||
var panelPopup;
|
||||
var popupWidth<?php echo '='.$this->popupWidth?>;
|
||||
var popupHeight<?php echo '='.$this->popupHeight?>;
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
/**
|
||||
* ******** CLOSE BLOCK **************
|
||||
@@ -832,3 +874,4 @@ var popupHeight<?php echo '='.$this->popupHeight?>;
|
||||
G::RenderPage( "publish", "blank" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,26 +7,25 @@ class Entity_Base
|
||||
* this function check if a field is in the data sent in the constructor
|
||||
* you can specify an array, and this function will use like alias
|
||||
*/
|
||||
protected function validateField($field, $default = false)
|
||||
protected function validateField ($field, $default = false)
|
||||
{
|
||||
$fieldIsEmpty = true;
|
||||
|
||||
// this is a trick, if $fields is a string, $fields will be an array with
|
||||
// one element
|
||||
if (is_array ($field)) {
|
||||
if (is_array( $field )) {
|
||||
$fields = $field;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$fields = array ();
|
||||
$fields [] = $field;
|
||||
$fields[] = $field;
|
||||
}
|
||||
|
||||
// if there are aliases for this field, evaluate all aliases and take the
|
||||
// first occurence
|
||||
foreach ($fields as $k => $f) {
|
||||
if (isset ($this->temp [$f])) {
|
||||
if (isset( $this->temp[$f] )) {
|
||||
$fieldIsEmpty = false;
|
||||
return $this->temp [$f];
|
||||
return $this->temp[$f];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,12 +38,12 @@ class Entity_Base
|
||||
}
|
||||
}
|
||||
|
||||
protected function validateRequiredFields($requiredFields = array())
|
||||
protected function validateRequiredFields ($requiredFields = array())
|
||||
{
|
||||
foreach ($requiredFields as $k => $field) {
|
||||
if ($this->{$field} === NULL) {
|
||||
throw (new Exception ("Field $field is required in " . get_class ($this)));
|
||||
die ();
|
||||
if ($this->{$field} === null) {
|
||||
throw (new Exception( "Field $field is required in " . get_class( $this ) ));
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,28 +52,28 @@ class Entity_Base
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Copy the values of the Entity to the array of aliases
|
||||
* The array of aliases must be defined.
|
||||
*
|
||||
* @return Array of alias with the Entity values
|
||||
*/
|
||||
public function getAliasDataArray()
|
||||
public function getAliasDataArray ()
|
||||
{
|
||||
$aAlias = array ();
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
$className = get_class( $this );
|
||||
if (method_exists( $className, 'GetAliases' )) {
|
||||
$aliases = call_user_func( array ($className,'GetAliases'
|
||||
) );
|
||||
// $aliases = $className::GetAliases ();
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($aliases [$field])) {
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset( $aliases[$field] )) {
|
||||
// echo "Field exists in Aliases: " . $field . "\n";
|
||||
// echo "Alias Name:" . $aliases[$field] . "\n";
|
||||
// echo "Alias value:" . $value . "\n";
|
||||
$aAlias [$aliases [$field]] = $value;
|
||||
$aAlias[$aliases[$field]] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,24 +84,24 @@ class Entity_Base
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Set the data from array of alias to Entity
|
||||
*
|
||||
* @param $aAliasData array
|
||||
* of data of aliases
|
||||
* @param $aAliasData array of data of aliases
|
||||
*/
|
||||
public function setAliasDataArray($aAliasData)
|
||||
public function setAliasDataArray ($aAliasData)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
$className = get_class( $this );
|
||||
if (method_exists( $className, 'GetAliases' )) {
|
||||
$aliases = call_user_func( array ($className,'GetAliases'
|
||||
) );
|
||||
// $aliases = $className::GetAliases ();
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($aliases [$field]))
|
||||
$this->{$field} = $aAliasData [$aliases [$field]];
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset( $aliases[$field] )) {
|
||||
$this->{$field} = $aAliasData[$aliases[$field]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,48 +109,47 @@ class Entity_Base
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Initialize object with values from $data.
|
||||
* The values from data use properties or alias array.
|
||||
*
|
||||
* @param
|
||||
* $data
|
||||
* @param $data
|
||||
*/
|
||||
protected function initializeObject($data)
|
||||
protected function initializeObject ($data)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
$className = get_class( $this );
|
||||
$aliases = array ();
|
||||
$swAliases = false;
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
if (method_exists( $className, 'GetAliases' )) {
|
||||
$aliases = call_user_func( array ($className,'GetAliases'
|
||||
) );
|
||||
// $aliases = $className::GetAliases ();
|
||||
$swAliases = true;
|
||||
}
|
||||
// use object properties or aliases to initialize
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($data [$field])) {
|
||||
$this->$field = $data [$field];
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset( $data[$field] )) {
|
||||
$this->$field = $data[$field];
|
||||
} elseif ($swAliases && isset( $aliases[$field] ) && isset( $data[$aliases[$field]] )) {
|
||||
$this->$field = $data[$aliases[$field]];
|
||||
}
|
||||
elseif ($swAliases && isset ($aliases [$field]) && isset ($data [$aliases [$field]])) {
|
||||
$this->$field = $data [$aliases [$field]];
|
||||
}
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
public function serialize ()
|
||||
{
|
||||
if (isset ($this->temp))
|
||||
unset ($this->temp);
|
||||
return serialize ($this);
|
||||
if (isset( $this->temp )) {
|
||||
unset( $this->temp );
|
||||
}
|
||||
return serialize( $this );
|
||||
}
|
||||
|
||||
public function unserialize($str)
|
||||
public function unserialize ($str)
|
||||
{
|
||||
$className = get_class ($this);
|
||||
$data = unserialize ($str);
|
||||
return new $className ($data);
|
||||
$className = get_class( $this );
|
||||
$data = unserialize( $str );
|
||||
return new $className( $data );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* AppEvent.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
require_once 'classes/model/om/BaseAppEvent.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'APP_EVENT' table.
|
||||
*
|
||||
@@ -18,267 +18,285 @@ require_once 'classes/model/om/BaseAppEvent.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class AppEvent extends BaseAppEvent {
|
||||
public function load($sApplicationUID, $iDelegation) {
|
||||
class AppEvent extends BaseAppEvent
|
||||
{
|
||||
|
||||
public function load ($sApplicationUID, $iDelegation)
|
||||
{
|
||||
try {
|
||||
$oAppEvent = AppEventPeer::retrieveByPK($sApplicationUID, $iDelegation);
|
||||
if (!is_null($oAppEvent)) {
|
||||
$aFields = $oAppEvent->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation );
|
||||
if (! is_null( $oAppEvent )) {
|
||||
$aFields = $oAppEvent->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
return $aFields;
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
else {
|
||||
throw(new Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function create($aData) {
|
||||
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
|
||||
function create ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oAppEvent = new AppEvent();
|
||||
$oAppEvent->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
$oAppEvent->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oAppEvent->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oAppEvent->save();
|
||||
$oConnection->commit();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oAppEvent->getValidationFailures();
|
||||
foreach($aValidationFailures as $oValidationFailure) {
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||
}
|
||||
throw(new Exception('The registry cannot be created!<br />' . $sMessage));
|
||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw($oError);
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function update($aData) {
|
||||
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
|
||||
function update ($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oAppEvent = AppEventPeer::retrieveByPK($aData['APP_UID'], $aData['DEL_INDEX']);
|
||||
if (!is_null($oAppEvent)) {
|
||||
$oAppEvent->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
$oAppEvent = AppEventPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] );
|
||||
if (! is_null( $oAppEvent )) {
|
||||
$oAppEvent->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
if ($oAppEvent->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oAppEvent->save();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oAppEvent->getValidationFailures();
|
||||
foreach($aValidationFailures as $oValidationFailure) {
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||
}
|
||||
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
|
||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||
}
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
else {
|
||||
throw(new Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw($oError);
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function remove($sApplicationUID, $iDelegation, $sEvnUid) {
|
||||
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
|
||||
function remove ($sApplicationUID, $iDelegation, $sEvnUid)
|
||||
{
|
||||
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oAppEvent = AppEventPeer::retrieveByPK($sApplicationUID, $iDelegation, $sEvnUid);
|
||||
if (!is_null($oAppEvent)) {
|
||||
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation, $sEvnUid );
|
||||
if (! is_null( $oAppEvent )) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oAppEvent->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
else {
|
||||
throw(new Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw($oError);
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function getAppEventsCriteria($sProcessUid='', $sStatus = '', $EVN_ACTION='') {
|
||||
function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/Event.php';
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_UID);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::DEL_INDEX);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::EVN_UID);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS);
|
||||
$oCriteria->addSelectColumn(EventPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_WHEN_OCCURS);
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION);
|
||||
$oCriteria->addAsColumn('EVN_DESCRIPTION', 'C1.CON_VALUE');
|
||||
$oCriteria->addAsColumn('TAS_TITLE', 'C2.CON_VALUE');
|
||||
$oCriteria->addAsColumn('APP_TITLE', 'C3.CON_VALUE');
|
||||
$oCriteria->addAsColumn('PRO_TITLE', 'C4.CON_VALUE');
|
||||
$oCriteria->addAlias('C1', 'CONTENT');
|
||||
$oCriteria->addAlias('C2', 'CONTENT');
|
||||
$oCriteria->addAlias('C3', 'CONTENT');
|
||||
$oCriteria->addAlias('C4', 'CONTENT');
|
||||
$oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN);
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_UID );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::DEL_INDEX );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::EVN_UID );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ACTION_DATE );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ATTEMPTS );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_LAST_EXECUTION_DATE );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_STATUS );
|
||||
$oCriteria->addSelectColumn( EventPeer::PRO_UID );
|
||||
$oCriteria->addSelectColumn( EventPeer::EVN_WHEN_OCCURS );
|
||||
$oCriteria->addSelectColumn( EventPeer::EVN_ACTION );
|
||||
$oCriteria->addAsColumn( 'EVN_DESCRIPTION', 'C1.CON_VALUE' );
|
||||
$oCriteria->addAsColumn( 'TAS_TITLE', 'C2.CON_VALUE' );
|
||||
$oCriteria->addAsColumn( 'APP_TITLE', 'C3.CON_VALUE' );
|
||||
$oCriteria->addAsColumn( 'PRO_TITLE', 'C4.CON_VALUE' );
|
||||
$oCriteria->addAlias( 'C1', 'CONTENT' );
|
||||
$oCriteria->addAlias( 'C2', 'CONTENT' );
|
||||
$oCriteria->addAlias( 'C3', 'CONTENT' );
|
||||
$oCriteria->addAlias( 'C4', 'CONTENT' );
|
||||
$oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN );
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(EventPeer::EVN_UID, 'C1.CON_ID');
|
||||
$aConditions[] = array('C1.CON_CATEGORY', $del . 'EVN_DESCRIPTION' . $del);
|
||||
$aConditions[] = array('C1.CON_LANG', $del . SYS_LANG . $del);
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID);
|
||||
$aConditions[] = array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX);
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(AppDelegationPeer::TAS_UID, 'C2.CON_ID');
|
||||
$aConditions[] = array('C2.CON_CATEGORY', $del . 'TAS_TITLE' . $del);
|
||||
$aConditions[] = array('C2.CON_LANG', $del . SYS_LANG . $del);
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(AppDelegationPeer::APP_UID, 'C3.CON_ID');
|
||||
$aConditions[] = array('C3.CON_CATEGORY', $del . 'APP_TITLE' . $del);
|
||||
$aConditions[] = array('C3.CON_LANG', $del . SYS_LANG . $del);
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(AppDelegationPeer::PRO_UID, 'C4.CON_ID');
|
||||
$aConditions[] = array('C4.CON_CATEGORY', $del . 'PRO_TITLE' . $del);
|
||||
$aConditions[] = array('C4.CON_LANG', $del . SYS_LANG . $del);
|
||||
$aConditions = array ();
|
||||
$aConditions[] = array (EventPeer::EVN_UID,'C1.CON_ID'
|
||||
);
|
||||
$aConditions[] = array ('C1.CON_CATEGORY',$del . 'EVN_DESCRIPTION' . $del
|
||||
);
|
||||
$aConditions[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
|
||||
);
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$aConditions = array ();
|
||||
$aConditions[] = array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID
|
||||
);
|
||||
$aConditions[] = array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX
|
||||
);
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$aConditions = array ();
|
||||
$aConditions[] = array (AppDelegationPeer::TAS_UID,'C2.CON_ID'
|
||||
);
|
||||
$aConditions[] = array ('C2.CON_CATEGORY',$del . 'TAS_TITLE' . $del
|
||||
);
|
||||
$aConditions[] = array ('C2.CON_LANG',$del . SYS_LANG . $del
|
||||
);
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$aConditions = array ();
|
||||
$aConditions[] = array (AppDelegationPeer::APP_UID,'C3.CON_ID'
|
||||
);
|
||||
$aConditions[] = array ('C3.CON_CATEGORY',$del . 'APP_TITLE' . $del
|
||||
);
|
||||
$aConditions[] = array ('C3.CON_LANG',$del . SYS_LANG . $del
|
||||
);
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$aConditions = array ();
|
||||
$aConditions[] = array (AppDelegationPeer::PRO_UID,'C4.CON_ID'
|
||||
);
|
||||
$aConditions[] = array ('C4.CON_CATEGORY',$del . 'PRO_TITLE' . $del
|
||||
);
|
||||
$aConditions[] = array ('C4.CON_LANG',$del . SYS_LANG . $del
|
||||
);
|
||||
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL);
|
||||
if($sProcessUid != ''){
|
||||
$oCriteria->add(EventPeer::PRO_UID, $sProcessUid);
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
$oCriteria->add( AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL );
|
||||
if ($sProcessUid != '') {
|
||||
$oCriteria->add( EventPeer::PRO_UID, $sProcessUid );
|
||||
}
|
||||
if($EVN_ACTION != ''){
|
||||
$oCriteria->add(EventPeer::EVN_ACTION, $EVN_ACTION);
|
||||
if ($EVN_ACTION != '') {
|
||||
$oCriteria->add( EventPeer::EVN_ACTION, $EVN_ACTION );
|
||||
}
|
||||
switch ($sStatus) {
|
||||
case '':
|
||||
//Nothing
|
||||
break;
|
||||
case 'PENDING':
|
||||
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN');
|
||||
$oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'OPEN' );
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'CLOSE');
|
||||
$oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'CLOSE' );
|
||||
break;
|
||||
}
|
||||
//$oCriteria->addDescendingOrderByColumn(AppEventPeer::APP_EVN_ACTION_DATE);
|
||||
return $oCriteria;
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function executeEvents($sNow, $debug=false, &$log=array(), $cron=0) {
|
||||
public function executeEvents ($sNow, $debug = false, &$log = array(), $cron = 0)
|
||||
{
|
||||
|
||||
require_once 'classes/model/Configuration.php';
|
||||
require_once 'classes/model/Triggers.php';
|
||||
G::LoadClass('case');
|
||||
G::LoadClass( 'case' );
|
||||
|
||||
$debug = 1;
|
||||
$oCase = new Cases();
|
||||
|
||||
try {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_UID);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::DEL_INDEX);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::EVN_UID);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE);
|
||||
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS);
|
||||
$oCriteria->addSelectColumn(EventPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION);
|
||||
$oCriteria->addSelectColumn(EventPeer::TRI_UID);
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION_PARAMETERS);
|
||||
$oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_UID );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::DEL_INDEX );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::EVN_UID );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ACTION_DATE );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ATTEMPTS );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_LAST_EXECUTION_DATE );
|
||||
$oCriteria->addSelectColumn( AppEventPeer::APP_EVN_STATUS );
|
||||
$oCriteria->addSelectColumn( EventPeer::PRO_UID );
|
||||
$oCriteria->addSelectColumn( EventPeer::EVN_ACTION );
|
||||
$oCriteria->addSelectColumn( EventPeer::TRI_UID );
|
||||
$oCriteria->addSelectColumn( EventPeer::EVN_ACTION_PARAMETERS );
|
||||
$oCriteria->addSelectColumn( EventPeer::EVN_RELATED_TO );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
|
||||
$oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN );
|
||||
|
||||
$oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN);
|
||||
$aConditions = array ();
|
||||
array_push( $aConditions, Array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID
|
||||
) );
|
||||
array_push( $aConditions, Array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX
|
||||
) );
|
||||
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||
|
||||
$aConditions = array();
|
||||
array_push($aConditions, Array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID));
|
||||
array_push($aConditions, Array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX));
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->addJoin( ApplicationPeer::APP_UID, AppEventPeer::APP_UID );
|
||||
|
||||
$oCriteria->addJoin(ApplicationPeer::APP_UID, AppEventPeer::APP_UID);
|
||||
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); //by me
|
||||
$oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'OPEN' );
|
||||
$oCriteria->add( AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL );
|
||||
|
||||
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); //by me
|
||||
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN');
|
||||
$oCriteria->add(AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL);
|
||||
|
||||
$oDataset = AppEventPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset = AppEventPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$c = 0;
|
||||
while ($oDataset->next()){
|
||||
while ($oDataset->next()) {
|
||||
if ($cron == 1) {
|
||||
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
||||
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
|
||||
$arrayCron["processcTimeStart"] = time();
|
||||
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
|
||||
@file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
|
||||
}
|
||||
|
||||
$c++;
|
||||
$c ++;
|
||||
$aRow = $oDataset->getRow();
|
||||
$oTrigger = new Triggers();
|
||||
$aFields = $oCase->loadCase($aRow['APP_UID']);
|
||||
$oAppEvent = AppEventPeer::retrieveByPK($aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID']);
|
||||
$aFields = $oCase->loadCase( $aRow['APP_UID'] );
|
||||
$oAppEvent = AppEventPeer::retrieveByPK( $aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID'] );
|
||||
|
||||
//g::pr($aRow); //die;
|
||||
|
||||
if($debug){
|
||||
|
||||
if ($debug) {
|
||||
require_once 'classes/model/Application.php';
|
||||
$oApp = ApplicationPeer::retrieveByPk($aRow['APP_UID']);
|
||||
$oEv = EventPeer::retrieveByPk($aRow['EVN_UID']);
|
||||
$oApp = ApplicationPeer::retrieveByPk( $aRow['APP_UID'] );
|
||||
$oEv = EventPeer::retrieveByPk( $aRow['EVN_UID'] );
|
||||
$log[] = 'Event ' . $oEv->getEvnDescription() . ' with ID ' . $aRow['EVN_UID'];
|
||||
|
||||
println("\nOK+ event \"".$oEv->getEvnDescription()."\" with ID {} was found");
|
||||
println(" - PROCESS................".$aRow['PRO_UID']);
|
||||
println(" - APPLICATION............".$aRow['APP_UID']." CASE #".$oApp->getAppNumber());
|
||||
println(" - ACTION DATE............".$aRow['APP_EVN_ACTION_DATE']);
|
||||
println(" - ATTEMPTS...............".$aRow['APP_EVN_ATTEMPTS']);
|
||||
println(" - INTERVAL WITH TASKS....".$aRow['EVN_RELATED_TO']);
|
||||
println( "\nOK+ event \"" . $oEv->getEvnDescription() . "\" with ID {} was found" );
|
||||
println( " - PROCESS................" . $aRow['PRO_UID'] );
|
||||
println( " - APPLICATION............" . $aRow['APP_UID'] . " CASE #" . $oApp->getAppNumber() );
|
||||
println( " - ACTION DATE............" . $aRow['APP_EVN_ACTION_DATE'] );
|
||||
println( " - ATTEMPTS..............." . $aRow['APP_EVN_ATTEMPTS'] );
|
||||
println( " - INTERVAL WITH TASKS...." . $aRow['EVN_RELATED_TO'] );
|
||||
}
|
||||
|
||||
if ($aRow['TRI_UID'] == '') {
|
||||
//a rare case when the tri_uid is not set.
|
||||
$log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED";
|
||||
if($debug) println(" (!) Any trigger was set................................SKIPPED and will be CLOSED");
|
||||
$oAppEvent->setAppEvnStatus('CLOSE');
|
||||
if ($debug) {
|
||||
println( " (!) Any trigger was set................................SKIPPED and will be CLOSED" );
|
||||
}
|
||||
$oAppEvent->setAppEvnStatus( 'CLOSE' );
|
||||
$oAppEvent->save();
|
||||
continue;
|
||||
}
|
||||
|
||||
$oTrigger = TriggersPeer::retrieveByPk($aRow['TRI_UID']);
|
||||
if( !is_object($oTrigger) ){
|
||||
$oTrigger = TriggersPeer::retrieveByPk( $aRow['TRI_UID'] );
|
||||
if (! is_object( $oTrigger )) {
|
||||
//the trigger record doesn't exist..
|
||||
$log[] = ' (!) The trigger ' . $aRow['TRI_UID'] . ' ' . $oTrigger->getTriTitle() . " doesn't exist.......SKIPPED and will be CLOSED";
|
||||
if($debug) println(" (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED");
|
||||
$oAppEvent->setAppEvnStatus('CLOSE');
|
||||
if ($debug) {
|
||||
println( " (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED" );
|
||||
}
|
||||
$oAppEvent->setAppEvnStatus( 'CLOSE' );
|
||||
$oAppEvent->save();
|
||||
continue;
|
||||
}
|
||||
@@ -287,51 +305,54 @@ class AppEvent extends BaseAppEvent {
|
||||
$oPMScript = new PMScript();
|
||||
|
||||
$task = new Task();
|
||||
$taskFields = $task->Load($aRow['TAS_UID']);
|
||||
$taskFields = $task->Load( $aRow['TAS_UID'] );
|
||||
$aFields['APP_DATA']['APP_NUMBER'] = $aFields['APP_NUMBER'];
|
||||
$aFields['APP_DATA']['TAS_TITLE'] = $taskFields['TAS_TITLE'];
|
||||
$aFields['APP_DATA']['DEL_TASK_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE'];
|
||||
$oPMScript->setFields($aFields['APP_DATA']);
|
||||
$oPMScript->setScript($oTrigger->getTriWebbot());
|
||||
$oPMScript->setFields( $aFields['APP_DATA'] );
|
||||
$oPMScript->setScript( $oTrigger->getTriWebbot() );
|
||||
|
||||
$oPMScript->execute();
|
||||
|
||||
$oAppEvent->setAppEvnLastExecutionDate(date('Y-m-d H:i:s'));
|
||||
$oAppEvent->setAppEvnLastExecutionDate( date( 'Y-m-d H:i:s' ) );
|
||||
|
||||
if( sizeof($_SESSION['TRIGGER_DEBUG']['ERRORS']) == 0 ){
|
||||
if (sizeof( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ) == 0) {
|
||||
$log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!';
|
||||
if($debug) println(" - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!");
|
||||
if ($debug) {
|
||||
println( " - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!" );
|
||||
//g::pr($aFields);
|
||||
$aFields['APP_DATA'] = $oPMScript->aFields;
|
||||
$oCase->updateCase($aRow['APP_UID'], $aFields);
|
||||
$oAppEvent->setAppEvnStatus('CLOSE');
|
||||
} else {
|
||||
if($debug) {
|
||||
$log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!';
|
||||
println(" - The trigger {$aRow['TRI_UID']} throw some errors!");
|
||||
print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']);
|
||||
}
|
||||
if ( $oAppEvent->getAppEvnAttempts() > 0 ){
|
||||
$oAppEvent->setAppEvnAttempts($oAppEvent->getAppEvnAttempts() - 1);
|
||||
$aFields['APP_DATA'] = $oPMScript->aFields;
|
||||
$oCase->updateCase( $aRow['APP_UID'], $aFields );
|
||||
$oAppEvent->setAppEvnStatus( 'CLOSE' );
|
||||
} else {
|
||||
$oAppEvent->setAppEvnStatus('CLOSE');
|
||||
if ($debug) {
|
||||
$log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!';
|
||||
println( " - The trigger {$aRow['TRI_UID']} throw some errors!" );
|
||||
print_r( $_SESSION['TRIGGER_DEBUG']['ERRORS'] );
|
||||
}
|
||||
if ($oAppEvent->getAppEvnAttempts() > 0) {
|
||||
$oAppEvent->setAppEvnAttempts( $oAppEvent->getAppEvnAttempts() - 1 );
|
||||
} else {
|
||||
$oAppEvent->setAppEvnStatus( 'CLOSE' );
|
||||
}
|
||||
}
|
||||
$oAppEvent->save();
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$log[] = ' Error execute event : ' . $oError->getMessage();
|
||||
die($oError->getMessage());
|
||||
die( $oError->getMessage() );
|
||||
return $oError->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
function close($APP_UID, $DEL_INDEX){
|
||||
$aRow = $this->load($APP_UID, $DEL_INDEX);
|
||||
function close ($APP_UID, $DEL_INDEX)
|
||||
{
|
||||
$aRow = $this->load( $APP_UID, $DEL_INDEX );
|
||||
$aRow['APP_EVN_STATUS'] = 'CLOSE';
|
||||
$this->update($aRow);
|
||||
$this->update( $aRow );
|
||||
}
|
||||
}
|
||||
// AppEvent
|
||||
|
||||
} // AppEvent
|
||||
|
||||
Reference in New Issue
Block a user