mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-10-17 05:22:23 +00:00
send list of expired docs to configured email address
This commit is contained in:
parent
5ac51f3c89
commit
16c8102392
|
@ -22,8 +22,18 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
|
||||||
$dms = $this->dms;
|
$dms = $this->dms;
|
||||||
$taskparams = $task->getParameter();
|
$taskparams = $task->getParameter();
|
||||||
$docs = $dms->getDocumentsExpired(intval($taskparams['days']));
|
$docs = $dms->getDocumentsExpired(intval($taskparams['days']));
|
||||||
foreach($docs as $doc) {
|
$tableformat = " %-10s %5d %-60s";
|
||||||
echo $doc->getName().PHP_EOL;
|
$tableformathead = " %-10s %5s %-60s";
|
||||||
|
$body = '';
|
||||||
|
if (count($docs)>0) {
|
||||||
|
$body .= sprintf($tableformathead."\n", getMLText("expiration_date", array(), ""), "ID", getMLText("name", array(), ""));
|
||||||
|
$body .= "---------------------------------------------------------------------------------\n";
|
||||||
|
foreach($docs as $doc) {
|
||||||
|
$body .= sprintf($tableformat."\n", getReadableDate($doc->getExpires()), $doc->getId(), $doc->getName());
|
||||||
|
// echo $doc->getName().PHP_EOL;
|
||||||
|
}
|
||||||
|
if($taskparams['email'])
|
||||||
|
mail($taskparams['email'], getMLText('expired_docs_mail_subject',array('sitename'=>$settings->_siteName, 'count'=>count($docs))), $body);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +44,11 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
|
||||||
|
|
||||||
public function getAdditionalParams() {
|
public function getAdditionalParams() {
|
||||||
return array(
|
return array(
|
||||||
|
array(
|
||||||
|
'name'=>'email',
|
||||||
|
'type'=>'string',
|
||||||
|
'description'=> '',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'name'=>'days',
|
'name'=>'days',
|
||||||
'type'=>'integer',
|
'type'=>'integer',
|
||||||
|
@ -86,7 +101,7 @@ class SeedDMS_Task_Indexer_Process_Folder { /* {{{ */
|
||||||
/* Check if the attribute created is set or has a value older
|
/* Check if the attribute created is set or has a value older
|
||||||
* than the lastet content. Documents without such an attribute
|
* than the lastet content. Documents without such an attribute
|
||||||
* where added when a new document was added to the dms. In such
|
* where added when a new document was added to the dms. In such
|
||||||
* a case the document content wasn't indexed.
|
* a case the document content wasn't indexed.
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
$created = (int) $hit->getDocument()->getFieldValue('created');
|
$created = (int) $hit->getDocument()->getFieldValue('created');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user