Arreglo de conflictos

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-03-24 16:40:01 -04:00
parent aa15d5c800
commit f6030e8ac7
2 changed files with 56 additions and 0 deletions

View File

@@ -54,5 +54,11 @@ class ProcessCategory extends BaseProcessCategory
$aRow = $dataset->getRow();
return $aRow;
}
public function exists ($catUid)
{
$oProCat = ProcessCategoryPeer::retrieveByPk( $catUid );
return (is_object( $oProCat ) && get_class( $oProCat ) == 'ProcessCategory');
}
}

View File

@@ -171,6 +171,56 @@ class Validator{
return $tri_uid;
}
/**
* Validate pro_uid
*
* @param string $pro_uid, Uid for process
* @param string $nameField . Name of field for message
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
static public function proUid($pro_uid, $nameField = 'pro_uid')
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The process with $nameField: '' does not exist."));
}
$oProcess = new \Process();
if (!($oProcess->exists($pro_uid))) {
throw (new \Exception("The process with $nameField: '$pro_uid' does not exist."));
}
return $pro_uid;
}
/**
* Validate cat_uid
*
* @param string $cat_uid, Uid for category
* @param string $nameField . Name of field for message
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
static public function catUid($cat_uid, $nameField = 'cat_uid')
{
$cat_uid = trim($cat_uid);
if ($cat_uid == '') {
throw (new \Exception("The category with $nameField: '' does not exist."));
}
$oCategory = new \ProcessCategory();
if (!($oCategory->exists($cat_uid))) {
throw (new \Exception("The category with $nameField: '$cat_uid' does not exist."));
}
return $cat_uid;
}
/**
* Validate date
*