Author: peter
Date: 2008-10-21 15:37:13 -0700 (Tue, 21 Oct 2008)
New Revision: 1485
Modified:
trunk/qubit/apps/qubit/modules/repository/actions/updateAction.class.php
Log:
when updating a repository record re-index the information objects that are
linked to it so that the revised repository name is searchable. fixes issue#481
Modified:
trunk/qubit/apps/qubit/modules/repository/actions/updateAction.class.php
===================================================================
--- trunk/qubit/apps/qubit/modules/repository/actions/updateAction.class.php
2008-10-21 19:10:37 UTC (rev 1484)
+++ trunk/qubit/apps/qubit/modules/repository/actions/updateAction.class.php
2008-10-21 22:37:13 UTC (rev 1485)
@@ -35,39 +35,47 @@
{
if (!$this->getRequestParameter('id', 0))
{
- $repository = new QubitRepository;
+ $this->repository = new QubitRepository;
//set the user navigation context to 'add'
$this->getUser()->setAttribute('nav_context_module', 'add');
}
else
{
- $repository = QubitRepository::getById($this->getRequestParameter('id'));
- $this->forward404Unless($repository);
+ $this->repository =
QubitRepository::getById($this->getRequestParameter('id'));
+ $this->forward404Unless($this->repository);
}
- $repository->setId($this->getRequestParameter('id'));
+ $this->repository->setId($this->getRequestParameter('id'));
- //save fields by template
- switch ($this->getRequestParameter('template'))
+ $this->updateActorAttributes($this->repository);
+ $this->updateRepositoryAttributes($this->repository);
+ $this->updateOtherNames($this->repository);
+ $this->updateTermOneToManyRelations($this->repository);
+ $this->updateProperties($this->repository);
+ $this->updateContactInformation($this->repository);
+ $this->updateRepositoryNotes($this->repository);
+
+ if (sfContext::getInstance()->getActionName() == 'update')
{
- case 'anotherTemplate' :
- //save stuff
- break;
- //default template is 'ISAAR'
- case 'isaar' :
- default :
- $this->updateActorAttributes($repository);
- $this->updateRepositoryAttributes($repository);
- $this->updateOtherNames($repository);
- $this->updateTermOneToManyRelations($repository);
- $this->updateProperties($repository);
- $this->updateContactInformation($repository);
- $this->updateRepositoryNotes($repository);
-
- break;
+ // update the search index and return user to the default edit template
+ // in case this is a generic 'update' action that is not associated with
+ // a specific template (e.g. updateISDIAH)
+ //
+ // update the search index for those informationObjects that are linked to
this Repository
+ if (count($holdings = $this->repository->getRepositoryHoldings()) > 0)
+ {
+ foreach ($holdings as $informationObject)
+ {
+ SearchIndex::updateTranslatedLanguages($informationObject);
+ }
}
+ // return to default edit template
+ return
$this->redirect('repository/'.sfConfig::get('app_default_template_repository_edit').'?id='.$this->repository->getId());
+ }
+
+
//set view template
switch ($this->getRequestParameter('template'))
{
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---