Commit add091c619af69c32ef36836c80594b0b9beb923
1 parent
9e571191
catered for the case where there are no archiving settings
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2766 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
30 additions
and
22 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| @@ -144,32 +144,40 @@ function renderDocumentArchiveSettingsDetails($oDocument, $bEditable) { | @@ -144,32 +144,40 @@ function renderDocumentArchiveSettingsDetails($oDocument, $bEditable) { | ||
| 144 | 144 | ||
| 145 | // retrieve the appropriate settings given the document id | 145 | // retrieve the appropriate settings given the document id |
| 146 | $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); | 146 | $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); |
| 147 | - // retrieve the settings | ||
| 148 | - $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | ||
| 149 | - // switch on archiving type | ||
| 150 | - $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); | ||
| 151 | - $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); | ||
| 152 | - | ||
| 153 | - switch ($sArchivingType) { | ||
| 154 | - case "Date" : | ||
| 155 | - $sDisplayText = "Expiration Date: " . $oArchiveSettings->getExpirationDate(); | ||
| 156 | - if ($oTimePeriod) { | ||
| 157 | - $sDisplayText .= "<br/>Expires after " . $oTimePeriod->getUnits() . " "; | ||
| 158 | - $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()) . " from document creation date"; | ||
| 159 | - } | ||
| 160 | - break; | ||
| 161 | - case "Utilisation" : | ||
| 162 | - $sDisplayText .= "Archive document " . $oTimePeriod->getUnits() . " "; | ||
| 163 | - $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()); | ||
| 164 | - $sDisplayText .= " after the last " . lookupName($default->transaction_types_table, $oArchiveSettings->getDocumentTransactionID()) . " transaction"; | ||
| 165 | - break; | ||
| 166 | - } | 147 | + if ($oDocumentArchiving) { |
| 148 | + // retrieve the settings | ||
| 149 | + $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | ||
| 150 | + // switch on archiving type | ||
| 151 | + $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); | ||
| 152 | + $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); | ||
| 153 | + | ||
| 154 | + $sDisplayText = "<td>"; | ||
| 155 | + switch ($sArchivingType) { | ||
| 156 | + case "Date" : | ||
| 157 | + $sDisplayText .= "Expiration Date: " . $oArchiveSettings->getExpirationDate(); | ||
| 158 | + if ($oTimePeriod) { | ||
| 159 | + $sDisplayText .= "<br/>Expires after " . $oTimePeriod->getUnits() . " "; | ||
| 160 | + $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()) . " from document creation date"; | ||
| 161 | + } | ||
| 162 | + break; | ||
| 163 | + case "Utilisation" : | ||
| 164 | + $sDisplayText .= "Archive document " . $oTimePeriod->getUnits() . " "; | ||
| 165 | + $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()); | ||
| 166 | + $sDisplayText .= " after the last " . lookupName($default->transaction_types_table, $oArchiveSettings->getDocumentTransactionID()) . " transaction"; | ||
| 167 | + break; | ||
| 168 | + } | ||
| 169 | + $sDisplayText .= "</td>" . ($bEditable ? "<td>" . generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "Edit") . "</td>" : ""); | ||
| 170 | + $sArchivingType = "Archiving Type: " . $sArchivingType; | ||
| 171 | + } else { | ||
| 172 | + $sArchivingType = ""; | ||
| 173 | + $sDisplayText = "No archiving settings"; | ||
| 174 | + } | ||
| 167 | 175 | ||
| 168 | $sToRender = "<table cellpadding=\"5\" border=\"0\" width=\"500\">"; | 176 | $sToRender = "<table cellpadding=\"5\" border=\"0\" width=\"500\">"; |
| 169 | $sToRender .= "<caption align=\"top\" colspan=\"2\" align=\"left\"><b>Archiving Settings</b></caption>"; | 177 | $sToRender .= "<caption align=\"top\" colspan=\"2\" align=\"left\"><b>Archiving Settings</b></caption>"; |
| 170 | - $sToRender .= "<th align=\"left\">Archiving Type: $sArchivingType</th>"; | 178 | + $sToRender .= "<th align=\"left\">" . $sArchivingType . "</th>"; |
| 171 | $sToRender .= "<tr bgcolor=\"F5F6EE\">"; | 179 | $sToRender .= "<tr bgcolor=\"F5F6EE\">"; |
| 172 | - $sToRender .= "<td>$sDisplayText</td>" . ($bEditable ? "<td>" . generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "Edit") . "</td>" : ""); | 180 | + $sToRender .= "<td>$sDisplayText</td>"; |
| 173 | $sToRender .= "</tr>"; | 181 | $sToRender .= "</tr>"; |
| 174 | $sToRender .= "</table>"; | 182 | $sToRender .= "</table>"; |
| 175 | return $sToRender; | 183 | return $sToRender; |