HOR-1312 Agregar el campo GRP_TITLE en la tabla GROUPWF

add method remove in table content
This commit is contained in:
qronald
2016-06-16 16:23:42 -04:00
parent a41785f378
commit b133bd50b2
13 changed files with 150 additions and 226 deletions

View File

@@ -41,36 +41,15 @@ require_once 'classes/model/Content.php';
*/
class Groupwf extends BaseGroupwf
{
/**
* This value goes in the content table
*
* @var string
*/
//protected $grp_title = '';
protected $grp_title = '';
/**
* Get the [grp_title] column value.
*
* @return string
*/
public function getGrpTitle ()
{
if ($this->getGrpUid() == '') {
throw (new Exception( "Error in getGrpTitle, the GRP_UID can't be blank" ));
}
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->grp_title = Content::load( 'GRP_TITLE', '', $this->getGrpUid(), $lang );
return $this->grp_title;
}
protected $grp_title_content = '';
/**
* Set the [grp_title] column value.
*
* @param string $v new value
* @return void
*/
public function setGrpTitle ($v)
public function setGrpTitleContent ($v)
{
if ($this->getGrpUid() == '') {
throw (new Exception( "Error in setGrpTitle, the GRP_UID can't be blank" ));
@@ -81,15 +60,14 @@ class Groupwf extends BaseGroupwf
$v = (string) $v;
}
if ($this->grp_title !== $v || $v === '') {
$this->grp_title = $v;
if ($this->grp_title_content !== $v || $v === '') {
$this->grp_title_content = $v;
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$res = Content::addContent( 'GRP_TITLE', '', $this->getGrpUid(), $lang, $this->grp_title );
$res = Content::addContent( 'GRP_TITLE', '', $this->getGrpUid(), $lang, $this->grp_title_content );
}
} // set()
/**
* Creates the Group
*
@@ -107,6 +85,12 @@ class Groupwf extends BaseGroupwf
$this->setGrpUid( G::generateUniqueID() );
}
if (isset( $aData['GRP_TITLE'] )) {
$this->setGrpTitle( $aData['GRP_TITLE'] );
} else {
$this->setGrpTitle( 'Default Group Title' );
}
if (isset( $aData['GRP_STATUS'] )) {
$this->setGrpStatus( $aData['GRP_STATUS'] );
} else {
@@ -124,9 +108,9 @@ class Groupwf extends BaseGroupwf
$res = $this->save();
if (isset( $aData['GRP_TITLE'] )) {
$this->setGrpTitle( $aData['GRP_TITLE'] );
$this->setGrpTitleContent( $aData['GRP_TITLE'] );
} else {
$this->setGrpTitle( 'Default Group Title' );
$this->setGrpTitleContent( 'Default Group Title' );
}
$con->commit();
@@ -160,8 +144,6 @@ class Groupwf extends BaseGroupwf
if (is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
$aFields = $oPro->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$aFields['GRP_TITLE'] = $oPro->getGrpTitle();
$this->setGrpTitle( $oPro->getGrpTitle() );
return $aFields;
} else {
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
@@ -188,7 +170,7 @@ class Groupwf extends BaseGroupwf
$oPro->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oPro->validate()) {
if (isset( $aData['GRP_TITLE'] )) {
$oPro->setGrpTitle( $aData['GRP_TITLE'] );
$oPro->setGrpTitleContent( $aData['GRP_TITLE'] );
}
$res = $oPro->save();
$con->commit();
@@ -226,7 +208,6 @@ class Groupwf extends BaseGroupwf
$oPro = GroupwfPeer::retrieveByPK( $ProUid );
if (! is_null( $oPro )) {
Content::removeContent( 'GRP_TITLE', '', $oPro->getGrpUid() );
Content::removeContent( 'GRP_DESCRIPTION', '', $oPro->getGrpUid() );
return $oPro->delete();
} else {
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
@@ -263,12 +244,8 @@ class Groupwf extends BaseGroupwf
$del = DBAdapter::getStringDelimiter();
$c->clearSelectColumns();
$c->addSelectColumn( ContentPeer::CON_CATEGORY );
$c->addSelectColumn( ContentPeer::CON_VALUE );
$c->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
$c->add( ContentPeer::CON_VALUE, $Groupname );
$c->add( ContentPeer::CON_LANG, SYS_LANG );
$c->addSelectColumn( GroupwfPeer::GRP_TITLE );
$c->add( GroupwfPeer::GRP_TITLE, $Groupname );
return $c;
}
@@ -297,17 +274,15 @@ class Groupwf extends BaseGroupwf
$totalCount = 0;
$criteria = new Criteria( 'workflow' );
$criteria->addSelectColumn( GroupwfPeer::GRP_UID );
$criteria->addSelectColumn( GroupwfPeer::GRP_TITLE );
$criteria->addSelectColumn( GroupwfPeer::GRP_STATUS );
$criteria->addSelectColumn( GroupwfPeer::GRP_LDAP_DN );
$criteria->addSelectColumn( ContentPeer::CON_VALUE );
$criteria->addJoin( GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN );
$criteria->add( GroupwfPeer::GRP_STATUS, 'ACTIVE' );
$criteria->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG );
$criteria->addAscendingOrderByColumn( ContentPeer::CON_VALUE );
$criteria->addAscendingOrderByColumn( GroupwfPeer::GRP_TITLE );
if ($search) {
$criteria->add( ContentPeer::CON_VALUE, '%' . $search . '%', Criteria::LIKE );
$criteria->add( GroupwfPeer::GRP_TITLE, '%' . $search . '%', Criteria::LIKE );
}
$c = clone $criteria;
@@ -349,33 +324,15 @@ class Groupwf extends BaseGroupwf
require_once 'classes/model/TaskUser.php';
require_once 'classes/model/GroupUser.php';
$sDelimiter = DBAdapter::getStringDelimiter();
$aConditions = [
[GroupwfPeer::GRP_UID, 'C.CON_ID'],
['C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter],
['C.CON_LANG', 'if((SELECT COUNT(S.CON_ID) FROM CONTENT AS S WHERE S.CON_ID=C.CON_ID AND S.CON_CATEGORY=C.CON_CATEGORY AND S.CON_LANG=' . $sDelimiter . SYS_LANG . $sDelimiter . ')>0,' . $sDelimiter . SYS_LANG . $sDelimiter . ',' . $sDelimiter . 'en' . $sDelimiter . ')']
];
$totalCount = 0;
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addAlias('C', 'CONTENT');
$criteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
if ($search) {
$criteria->add('C.CON_VALUE', '%' . $search . '%', Criteria::LIKE);
}
$totalRows = GroupwfPeer::doCount($criteria);
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
$criteria->addSelectColumn(GroupwfPeer::GRP_STATUS);
$criteria->addSelectColumn(GroupwfPeer::GRP_UX);
$criteria->addAlias('C', 'CONTENT');
$criteria->addAsColumn('GRP_TITLE', 'C.CON_VALUE');
$criteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
if (is_null($sortField) || trim($sortField) == "") {
$sortField = 'GRP_TITLE';
$sortField = GroupwfPeer::GRP_TITLE;
}
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
@@ -393,7 +350,7 @@ class Groupwf extends BaseGroupwf
}
if ($search) {
$criteria->add('C.CON_VALUE', '%' . $search . '%', Criteria::LIKE);
$criteria->add(GroupwfPeer::GRP_TITLE, '%' . $search . '%', Criteria::LIKE);
}
$oDataset = GroupwfPeer::doSelectRS($criteria);
@@ -406,7 +363,7 @@ class Groupwf extends BaseGroupwf
$groups[] = $oDataset->getRow();
}
return array('rows' => $groups, 'totalCount' => $totalRows);
return array('rows' => $groups, 'totalCount' => count($groups));
}
public function filterGroup ($filter, $start, $limit)
@@ -426,11 +383,8 @@ class Groupwf extends BaseGroupwf
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( GroupwfPeer::GRP_UID );
$oCriteria->addJoin( GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
if ($filter != '') {
$oCriteria->add( ContentPeer::CON_VALUE, '%' . $filter . '%', Criteria::LIKE );
$oCriteria->add( GroupwfPeer::GRP_TITLE, '%' . $filter . '%', Criteria::LIKE );
}
$totalRows = GroupwfPeer::doCount( $oCriteria );
@@ -438,14 +392,10 @@ class Groupwf extends BaseGroupwf
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn( GroupwfPeer::GRP_UID );
$oCriteria->addSelectColumn( GroupwfPeer::GRP_STATUS );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->addAsColumn( 'GRP_TASKS', 0 );
$oCriteria->addAsColumn( 'GRP_USERS', 0 );
$oCriteria->addJoin( GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
if ($filter != '') {
$oCriteria->add( ContentPeer::CON_VALUE, '%' . $filter . '%', Criteria::LIKE );
$oCriteria->add( GroupwfPeer::GRP_TITLE, '%' . $filter . '%', Criteria::LIKE );
}
$oCriteria->setOffset( $start );
$oCriteria->setLimit( $limit );

View File

@@ -67,6 +67,8 @@ class GroupwfMapBuilder
$tMap->addPrimaryKey('GRP_UID', 'GrpUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('GRP_TITLE', 'GrpTitle', 'string', CreoleTypes::LONGVARCHAR, true, null);
$tMap->addColumn('GRP_STATUS', 'GrpStatus', 'string', CreoleTypes::CHAR, true, 8);
$tMap->addColumn('GRP_LDAP_DN', 'GrpLdapDn', 'string', CreoleTypes::VARCHAR, true, 255);

View File

@@ -31,7 +31,13 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
* The value for the grp_uid field.
* @var string
*/
protected $grp_uid = '';
protected $grp_uid;
/**
* The value for the grp_title field.
* @var string
*/
protected $grp_title;
/**
* The value for the grp_status field.
@@ -76,6 +82,17 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
return $this->grp_uid;
}
/**
* Get the [grp_title] column value.
*
* @return string
*/
public function getGrpTitle()
{
return $this->grp_title;
}
/**
* Get the [grp_status] column value.
*
@@ -124,13 +141,35 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$v = (string) $v;
}
if ($this->grp_uid !== $v || $v === '') {
if ($this->grp_uid !== $v) {
$this->grp_uid = $v;
$this->modifiedColumns[] = GroupwfPeer::GRP_UID;
}
} // setGrpUid()
/**
* Set the value of [grp_title] column.
*
* @param string $v new value
* @return void
*/
public function setGrpTitle($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->grp_title !== $v) {
$this->grp_title = $v;
$this->modifiedColumns[] = GroupwfPeer::GRP_TITLE;
}
} // setGrpTitle()
/**
* Set the value of [grp_status] column.
*
@@ -216,18 +255,20 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$this->grp_uid = $rs->getString($startcol + 0);
$this->grp_status = $rs->getString($startcol + 1);
$this->grp_title = $rs->getString($startcol + 1);
$this->grp_ldap_dn = $rs->getString($startcol + 2);
$this->grp_status = $rs->getString($startcol + 2);
$this->grp_ux = $rs->getString($startcol + 3);
$this->grp_ldap_dn = $rs->getString($startcol + 3);
$this->grp_ux = $rs->getString($startcol + 4);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = GroupwfPeer::NUM_COLUMNS - GroupwfPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = GroupwfPeer::NUM_COLUMNS - GroupwfPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Groupwf object", $e);
@@ -435,12 +476,15 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
return $this->getGrpUid();
break;
case 1:
return $this->getGrpStatus();
return $this->getGrpTitle();
break;
case 2:
return $this->getGrpLdapDn();
return $this->getGrpStatus();
break;
case 3:
return $this->getGrpLdapDn();
break;
case 4:
return $this->getGrpUx();
break;
default:
@@ -464,9 +508,10 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$keys = GroupwfPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getGrpUid(),
$keys[1] => $this->getGrpStatus(),
$keys[2] => $this->getGrpLdapDn(),
$keys[3] => $this->getGrpUx(),
$keys[1] => $this->getGrpTitle(),
$keys[2] => $this->getGrpStatus(),
$keys[3] => $this->getGrpLdapDn(),
$keys[4] => $this->getGrpUx(),
);
return $result;
}
@@ -502,12 +547,15 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$this->setGrpUid($value);
break;
case 1:
$this->setGrpStatus($value);
$this->setGrpTitle($value);
break;
case 2:
$this->setGrpLdapDn($value);
$this->setGrpStatus($value);
break;
case 3:
$this->setGrpLdapDn($value);
break;
case 4:
$this->setGrpUx($value);
break;
} // switch()
@@ -538,15 +586,19 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
}
if (array_key_exists($keys[1], $arr)) {
$this->setGrpStatus($arr[$keys[1]]);
$this->setGrpTitle($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setGrpLdapDn($arr[$keys[2]]);
$this->setGrpStatus($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setGrpUx($arr[$keys[3]]);
$this->setGrpLdapDn($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setGrpUx($arr[$keys[4]]);
}
}
@@ -564,6 +616,10 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$criteria->add(GroupwfPeer::GRP_UID, $this->grp_uid);
}
if ($this->isColumnModified(GroupwfPeer::GRP_TITLE)) {
$criteria->add(GroupwfPeer::GRP_TITLE, $this->grp_title);
}
if ($this->isColumnModified(GroupwfPeer::GRP_STATUS)) {
$criteria->add(GroupwfPeer::GRP_STATUS, $this->grp_status);
}
@@ -630,6 +686,8 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setGrpTitle($this->grp_title);
$copyObj->setGrpStatus($this->grp_status);
$copyObj->setGrpLdapDn($this->grp_ldap_dn);
@@ -639,7 +697,7 @@ abstract class BaseGroupwf extends BaseObject implements Persistent
$copyObj->setNew(true);
$copyObj->setGrpUid(''); // this is a pkey column, so set to default value
$copyObj->setGrpUid(NULL); // this is a pkey column, so set to default value
}

View File

@@ -25,7 +25,7 @@ abstract class BaseGroupwfPeer
const CLASS_DEFAULT = 'classes.model.Groupwf';
/** The total number of columns. */
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -34,6 +34,9 @@ abstract class BaseGroupwfPeer
/** the column name for the GRP_UID field */
const GRP_UID = 'GROUPWF.GRP_UID';
/** the column name for the GRP_TITLE field */
const GRP_TITLE = 'GROUPWF.GRP_TITLE';
/** the column name for the GRP_STATUS field */
const GRP_STATUS = 'GROUPWF.GRP_STATUS';
@@ -54,10 +57,10 @@ abstract class BaseGroupwfPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('GrpUid', 'GrpStatus', 'GrpLdapDn', 'GrpUx', ),
BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID, GroupwfPeer::GRP_STATUS, GroupwfPeer::GRP_LDAP_DN, GroupwfPeer::GRP_UX, ),
BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'GRP_STATUS', 'GRP_LDAP_DN', 'GRP_UX', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('GrpUid', 'GrpTitle', 'GrpStatus', 'GrpLdapDn', 'GrpUx', ),
BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID, GroupwfPeer::GRP_TITLE, GroupwfPeer::GRP_STATUS, GroupwfPeer::GRP_LDAP_DN, GroupwfPeer::GRP_UX, ),
BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'GRP_TITLE', 'GRP_STATUS', 'GRP_LDAP_DN', 'GRP_UX', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -67,10 +70,10 @@ abstract class BaseGroupwfPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'GrpStatus' => 1, 'GrpLdapDn' => 2, 'GrpUx' => 3, ),
BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID => 0, GroupwfPeer::GRP_STATUS => 1, GroupwfPeer::GRP_LDAP_DN => 2, GroupwfPeer::GRP_UX => 3, ),
BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'GRP_STATUS' => 1, 'GRP_LDAP_DN' => 2, 'GRP_UX' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'GrpTitle' => 1, 'GrpStatus' => 2, 'GrpLdapDn' => 3, 'GrpUx' => 4, ),
BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID => 0, GroupwfPeer::GRP_TITLE => 1, GroupwfPeer::GRP_STATUS => 2, GroupwfPeer::GRP_LDAP_DN => 3, GroupwfPeer::GRP_UX => 4, ),
BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'GRP_TITLE' => 1, 'GRP_STATUS' => 2, 'GRP_LDAP_DN' => 3, 'GRP_UX' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -173,6 +176,8 @@ abstract class BaseGroupwfPeer
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
$criteria->addSelectColumn(GroupwfPeer::GRP_STATUS);
$criteria->addSelectColumn(GroupwfPeer::GRP_LDAP_DN);