comanage-dev - [comanage-dev] r412 - in registry/trunk/app: Controller Model
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r412 - in registry/trunk/app: Controller Model
- Date: Fri, 25 Jan 2013 23:40:40 -0500
Author: benno
Date: 2013-01-25 23:40:40 -0500 (Fri, 25 Jan 2013)
New Revision: 412
Modified:
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Model/AppModel.php
Log:
Additional fixes for CO-518
Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2013-01-26 03:13:56
UTC (rev 411)
+++ registry/trunk/app/Controller/AppController.php 2013-01-26 04:40:40
UTC (rev 412)
@@ -1313,7 +1313,10 @@
throw new InvalidArgumentException($e->getMessage());
}
- if($recordCoId != $this->cur_co['Co']['id']) {
+ // $recordCoId could be null if we're looking up an MVPA which is
attached
+ // to an Org Identity. If so, that check passes.
+
+ if($recordCoId && ($recordCoId != $this->cur_co['Co']['id'])) {
throw new InvalidArgumentException(_txt('er.co.mismatch',
array($modelName,
$this->request->params['pass'][0])));
Modified: registry/trunk/app/Model/AppModel.php
===================================================================
--- registry/trunk/app/Model/AppModel.php 2013-01-26 03:13:56 UTC (rev
411)
+++ registry/trunk/app/Model/AppModel.php 2013-01-26 04:40:40 UTC (rev
412)
@@ -113,7 +113,7 @@
*
* @since COmanage Registry v0.8
* @param integer Record to retrieve for
- * @return integer Corresponding CO ID
+ * @return integer Corresponding CO ID, or NULL if record has no
corresponding CO ID
* @throws RunTimeException
*/
@@ -136,6 +136,13 @@
if(!empty($cop['CoPerson']['co_id'])) {
return $cop['CoPerson']['co_id'];
}
+
+ // Is this an MVPA where this is an org identity?
+
+ if(empty($cop[ $this->alias ]['co_person_id'])
+ && !empty($cop[ $this->alias ]['org_identity_id'])) {
+ return null;
+ }
} elseif(isset($this->validate['co_person_role_id'])) {
// Find the CO via the CO Person via the CO Person Role
@@ -149,13 +156,20 @@
$args = array();
$args['conditions']['CoPersonRole.co_person_id'] =
$copr['CoPersonRole']['co_person_id'];
$args['contain'][] = 'CoPerson';
-
+
$cop = $this->CoPersonRole->find('first', $args);
if(!empty($cop['CoPerson']['co_id'])) {
return $cop['CoPerson']['co_id'];
}
}
+
+ // Is this an MVPA where this is an org identity?
+
+ if(empty($copr[ $this->alias ]['co_person_id'])
+ && !empty($copr[ $this->alias ]['org_identity_id'])) {
+ return null;
+ }
} else {
throw new LogicException(_txt('er.co.fail'));
}
- [comanage-dev] r412 - in registry/trunk/app: Controller Model, svnlog, 01/25/2013
Archive powered by MHonArc 2.6.16.