cc-3936: fixed wrong argument order bug.

This commit is contained in:
Rudi Grinberg 2012-08-24 10:20:23 -04:00
parent 4ad983f63c
commit 19a5a8f992
1 changed files with 6 additions and 7 deletions

View File

@ -97,7 +97,6 @@ class Application_Model_StoredFile
*/ */
public function setMetadata($p_md=null) public function setMetadata($p_md=null)
{ {
Logging::info("entered setMetadata");
if (is_null($p_md)) { if (is_null($p_md)) {
$this->setDbColMetadata(); $this->setDbColMetadata();
} else { } else {
@ -146,13 +145,13 @@ class Application_Model_StoredFile
$this->_file->$method(null); $this->_file->$method(null);
} }
} else { } else {
// if owner_id is already set we don't want to set it again.
$owner = $this->_file->getOwner(); $owner = $this->_file->getOwner();
if($owner) { // if owner_id is already set we don't want to set it again.
if(!$owner) { // no owner detected, we try to assign one.
$owner = null; $owner = null;
// if MDATA_OWNER_ID is not set then we default to the // if MDATA_OWNER_ID is not set then we default to the
// first admin user we find // first admin user we find
if (!array_key_exists($md, 'MDATA_OWNER_ID')) { if (!array_key_exists('MDATA_OWNER_ID', $p_md)) {
$admins = Application_Model_User::getUsers(array('A')); $admins = Application_Model_User::getUsers(array('A'));
if (count($admins) > 0) { // found admin => pick first one if (count($admins) > 0) { // found admin => pick first one
$owner = $admins[0]; $owner = $admins[0];
@ -160,8 +159,8 @@ class Application_Model_StoredFile
} }
// get the user by id and set it like that // get the user by id and set it like that
else { else {
// this is wrong $user = CcSubjsQuery::create()
$user = CcSubjsQuery::create()->findPk($p_md['MDATA_OWNER_ID']); ->findPk($p_md['MDATA_OWNER_ID']);
if ($user) { if ($user) {
$owner = $user; $owner = $user;
} }