Example #1
0
 /**
  * Remind approval table approvers
  *
  * @return Void
  */
 public function remindApprovers()
 {
     $dao = new Docman_ApprovalTableItemDao();
     $dar = $dao->getTablesForReminder();
     $tables = array();
     if ($dar && !$dar->isError()) {
         foreach ($dar as $row) {
             if ($row['item_id']) {
                 $table = new Docman_ApprovalTableItem();
             } else {
                 $table = new Docman_ApprovalTableFile();
             }
             $table->initFromRow($row);
             $distance = DateHelper::dateDiffInDays($table->getDate(), $_SERVER['REQUEST_TIME']);
             if ($distance > 0 && DateHelper::isPeriodicallyDistant($distance, $table->getNotificationOccurence())) {
                 $this->sendNotificationToPendingApprovers($table);
             }
         }
     }
 }
Example #2
0
 function getAllApprovalTableForUser($userId)
 {
     // Item
     $sql_item = 'SELECT t.table_id, i.item_id, i.group_id, t.date, i.title, g.group_name, t.status' . ',' . parent::getTableStatusFields() . ' FROM plugin_docman_approval t' . '  LEFT JOIN ' . parent::getTableStatusJoin('app_u', 't') . '  JOIN plugin_docman_item i ON (i.item_id = t.item_id)' . '  JOIN groups g ON (g.group_id = i.group_id)' . ' WHERE t.table_owner = ' . $this->da->escapeInt($userId) . ' AND t.status IN (' . PLUGIN_DOCMAN_APPROVAL_TABLE_DISABLED . ', ' . PLUGIN_DOCMAN_APPROVAL_TABLE_ENABLED . ')' . ' AND ' . Docman_ItemDao::getCommonExcludeStmt('i') . ' AND g.status = \'A\'' . ' GROUP BY ' . parent::getTableStatusGroupBy('t');
     // Version
     $sql_ver = 'SELECT t.table_id, i.item_id, i.group_id, t.date, i.title, g.group_name, t.status' . ',' . parent::getTableStatusFields() . ' FROM plugin_docman_approval t' . '  LEFT JOIN ' . parent::getTableStatusJoin('app_u', 't') . '   JOIN plugin_docman_version v' . '     ON (v.id = t.version_id)' . '   JOIN plugin_docman_item AS i' . '     ON (i.item_id = v.item_id)' . '   JOIN groups g' . '     ON (g.group_id = i.group_id)' . ' WHERE t.table_owner = ' . $this->da->escapeInt($userId) . ' AND t.status IN (' . PLUGIN_DOCMAN_APPROVAL_TABLE_DISABLED . ', ' . PLUGIN_DOCMAN_APPROVAL_TABLE_ENABLED . ')' . ' AND ' . Docman_ItemDao::getCommonExcludeStmt('i') . ' AND g.status = \'A\'' . ' GROUP BY ' . parent::getTableStatusGroupBy('t');
     $sql = '(' . $sql_item . ') UNION ALL (' . $sql_ver . ') ORDER BY group_name ASC, date ASC';
     //echo $sql;
     return $this->retrieve($sql);
 }
Example #3
0
 function createTable($versionId, $userId, $description, $date, $status, $notification)
 {
     return parent::createTable('version_id', $versionId, $userId, $description, $date, $status, $notification);
 }