Internal overhaul of Cart/Checkout and other minor fixes
This commit is contained in:
@@ -36,15 +36,16 @@ class Model_SSL_CA extends ORM_OSB {
|
||||
}
|
||||
|
||||
public function rules() {
|
||||
return array(
|
||||
return Arr::merge(parent::rules(),array(
|
||||
'sign_cert'=>array(
|
||||
array('not_empty'),
|
||||
array(array($this,'isCert')),
|
||||
array(array($this,'isCA')),
|
||||
),
|
||||
'parent_ssl_ca_id'=>array(
|
||||
array(array($this,'rule_parentExist')),
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
private $_so = NULL;
|
||||
@@ -120,10 +121,30 @@ class Model_SSL_CA extends ORM_OSB {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to find the parent SSL_CA
|
||||
*
|
||||
* @notes This filter only runs when the value passed is -1
|
||||
*/
|
||||
public function filter_getParent() {
|
||||
foreach (ORM::factory($this->_object_name)->find_all() as $sco)
|
||||
if ($sco->aki_keyid() == $this->aki_keyid())
|
||||
// This cannot be an array
|
||||
if (count(func_get_args()) != 1)
|
||||
return NULL;
|
||||
|
||||
$x = func_get_args();
|
||||
$x = array_pop($x);
|
||||
|
||||
// This filter only runs when our value is -1
|
||||
if ($x != -1)
|
||||
return $x;
|
||||
|
||||
foreach (ORM::factory($this->_object_name)->find_all() as $sco) {
|
||||
if ($sco->ski() == $this->aki_keyid())
|
||||
return $sco->id;
|
||||
}
|
||||
|
||||
// If we got here, we couldnt find it
|
||||
return $this->isRoot() ? NULL : $x;
|
||||
}
|
||||
|
||||
public function list_childca() {
|
||||
@@ -136,7 +157,7 @@ class Model_SSL_CA extends ORM_OSB {
|
||||
|
||||
public function rule_parentExist() {
|
||||
// Our parent_ssl_ca_id should have been populated by filter_GetParent().
|
||||
return $this->parent_ssl_ca_id OR $this->isRoot();
|
||||
return ($this->parent_ssl_ca_id > 0) OR $this->isRoot();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user