Commit 853bf481716a98638bb6dd348d63b1a979f8cd8a

Authored by Kevin Cyster
1 parent edf54b51

Fix for KTC-642 Added trigger for expunged documents

Committed By: Kevin Cyster

Reviewed By: Megan Watson
plugins/ktcore/admin/deletedDocuments.php
@@ -171,13 +171,26 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; @@ -171,13 +171,26 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html';
171 $oDocumentTransaction->create(); 171 $oDocumentTransaction->create();
172 172
173 // delete this from the db now 173 // delete this from the db now
174 - if (!$oDoc->delete()) { $aErrorDocuments[] = $oDoc->getId(); }  
175 - else { 174 + if (!$oDoc->delete()) {
  175 + $aErrorDocuments[] = $oDoc->getId();
  176 + } else {
176 // removed succesfully 177 // removed succesfully
177 $aSuccessDocuments[] = $oDoc->getDisplayPath(); 178 $aSuccessDocuments[] = $oDoc->getDisplayPath();
178 179
179 // remove any document data 180 // remove any document data
180 $oDoc->cleanupDocumentData($oDoc->getId()); // silly - why the redundancy? 181 $oDoc->cleanupDocumentData($oDoc->getId()); // silly - why the redundancy?
  182 +
  183 + $oKTTriggerRegistry = KTTriggerRegistry::getSingleton();
  184 + $aTriggers = $oKTTriggerRegistry->getTriggers('expunge', 'finalised');
  185 + foreach ($aTriggers as $aTrigger) {
  186 + $sTrigger = $aTrigger[0];
  187 + $oTrigger = new $sTrigger;
  188 + $aInfo = array(
  189 + 'document' => $oDoc,
  190 + );
  191 + $oTrigger->setInfo($aInfo);
  192 + $ret = $oTrigger->finalised();
  193 + }
181 } 194 }
182 } 195 }
183 } 196 }