Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/LMSManagers/LMSDocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function GetDocumentList(array $params)
$to = $params['to'] ?? 0;
$status = $params['status'] ?? -1;
$archived = $params['archived'] ?? -1;
$attachments = $params['attachments'] ?? -1;
$limit = $params['limit'] ?? null;
$offset = $params['offset'] ?? null;
$count = isset($params['count']) && $params['count'];
Expand Down Expand Up @@ -317,13 +318,19 @@ public function GetDocumentList(array $params)
if (empty($list)) {
$list = array();
} else {
foreach ($list as &$document) {
$document['attachments'] = $this->db->GetAll('SELECT id, filename, md5sum, contenttype, type, type AS main, cdate
foreach ($list as $key => $document) {
$list[$key]['attachments'] = $this->db->GetAll('SELECT id, filename, md5sum, contenttype, type, type AS main, cdate
FROM documentattachments WHERE docid = ? ORDER BY type DESC, filename', array($document['docid']));
if (!empty($document['reference'])) {
$document['reference'] = $this->db->GetRow('SELECT id, type, fullnumber, cdate FROM documents
$list[$key]['reference'] = $this->db->GetRow('SELECT id, type, fullnumber, cdate FROM documents
WHERE id = ?', array($document['reference']));
}
if ($attachments != -1) {
$attachments_count = sizeof($list[$key]['attachments']);
if (($attachments == 1 && $attachments_count < 2) || ($attachments == 0 && $attachments_count > 1)) {
unset($list[$key]);
}
}
}
unset($document);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/locale/pl_PL/strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4761,6 +4761,8 @@
$_LANG['Your browser does not support the video element.'] = 'Twoja przeglądarka nie obsługuje elementu video.';

$_LANG['more document attachments'] = 'więcej załączników dokumentu';
$_LANG['Document attachments'] = 'Załączniki dokumentów';
$_LANG['Condition for the existence of document attachments'] = 'Warunek istnienia załączników dokumentu';
$_LANG['New files:'] = 'Nowe pliki:';
$_LANG['New files'] = 'Nowe pliki';
$_LANG['Attached files:'] = 'Załączone pliki:';
Expand Down
8 changes: 8 additions & 0 deletions modules/documentlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,18 @@
} elseif (!isset($filter['archived'])) {
$filter['archived'] = -1;
}

if (isset($_GET['attachments'])) {
$filter['attachments'] = $_GET['attachments'];
} elseif (!isset($filter['attachments'])) {
$filter['attachments'] = -1;
}

} else {
$filter = array(
'status' => -1,
'archived' => -1,
'attachments' => -1,
);
$SMARTY->clearAssign('persistent_filter');
$SESSION->saveFilter($filter);
Expand Down
8 changes: 8 additions & 0 deletions templates/default/document/documentlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ <H1>{$layout.pagetitle}</H1>
</SELECT>
</label>

{trans("Document attachments")}
<select name="attachments" {tip text="Condition for the existence of document attachments"}>
<option value="-1">{trans("— all —")} </option>
<option value="0"{if !$filter.attachments} selected{/if}>{trans("no")}</option>
<option value="1"{if $filter.attachments} selected{/if}>{trans("yes")}</option>
</select>
</label>

<A href="javascript:applyFilter();">&raquo;&raquo;&raquo;</A>
</form>
</div>
Expand Down