Author: peter
Date: Fri Sep 25 17:43:02 2009
New Revision: 3540
Log:
move the update of descendant publication status into the action as a temporary
workaround because the new method of saving related objects (in
QubitInformationObject->save()) is currently triggering an automatic save of
status objects regardles of whether a form action triggers it. Fixes issue #1006
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
trunk/lib/model/QubitInformationObject.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Fri Sep 25 16:48:15 2009 (r3539)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Fri Sep 25 17:43:02 2009 (r3540)
@@ -96,7 +96,7 @@
$choices[$this->context->routing->generate(null, array('module' =>
'term', 'action' => 'show', 'id' => $term->id))] = $term;
}
- if (QubitAcl::check($this->informationObject,
QubitAclAction::PUBLISH_ID))
+ if (QubitAcl::check(QubitInformationObject::getRoot(),
QubitAclAction::PUBLISH_ID))
{
$this->form->setWidget('publicationStatus', new
sfWidgetFormSelect(array('choices' => $choices)));
}
@@ -547,6 +547,14 @@
if ($params['id'] !== $this->informationObject->getStatus($options =
array('typeId' => QubitTerm::STATUS_TYPE_PUBLICATION_ID))->statusId)
{
$this->informationObject->setStatus($options = array('typeId' =>
QubitTerm::STATUS_TYPE_PUBLICATION_ID, 'statusId' => $params['id']));
+ // if publication status has changed, set the status of all its
descendants to null
+ // so that they inherit the newly changed status, and update their
search index
+ // document so that the changed status is reflected in search and list
browse results
+ foreach ($this->informationObject->descendants as $descendant)
+ {
+ $descendant->setStatus($options = array('typeId' =>
QubitTerm::STATUS_TYPE_PUBLICATION_ID, 'statusId' => null));
+ $descendant->save();
+ }
}
}
}
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Fri Sep 25 16:48:15 2009
(r3539)
+++ trunk/lib/model/QubitInformationObject.php Fri Sep 25 17:43:02 2009
(r3540)
@@ -185,27 +185,11 @@
}
// Save updated Status
- $publicationStatusUpdate = false;
foreach ($this->statuss as $status)
{
$status->setIndexOnSave(false);
$status->setObject($this);
$status->save();
- if ($status->typeId == QubitTerm::STATUS_TYPE_PUBLICATION_ID)
- {
- $publicationStatusUpdate = true;
- }
- }
- if ($publicationStatusUpdate)
- {
- // if publication status has changed, set the status of all its
descendants to null
- // so that they inherit the newly changed status, and update their
search index
- // document so that the changed status is reflected in search and list
browse results
- foreach ($this->descendants as $descendant)
- {
- $descendant->setStatus($options = array('typeId' =>
QubitTerm::STATUS_TYPE_PUBLICATION_ID, 'statusId' => null));
- $descendant->save();
- }
}
SearchIndex::updateTranslatedLanguages($this);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---