8000 bugfix: repair broken status filter by interduo · Pull Request #2483 · chilek/lms · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bugfix: repair broken status filter #2483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
40 changes: 20 additions & 20 deletions lib/LMSManagers/LMSDocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,17 @@ public function GetDocumentList(array $params)
FROM documentcontents
JOIN documents d ON (d.id = documentcontents.docid)
JOIN docrights r ON (d.type = r.doctype AND r.userid = ? AND (r.rights & ?) > 0)
LEFT JOIN vusers u ON u.id = d.userid
LEFT JOIN vusers u2 ON u2.id = d.cuserid
LEFT JOIN vusers u ON (u.id = d.userid)
LEFT JOIN vusers u2 ON (u2.id = d.cuserid)
LEFT JOIN numberplans ON (d.numberplanid = numberplans.id)
LEFT JOIN (
SELECT DISTINCT c.id AS customerid, 1 AS senddocuments FROM customers c
JOIN customercontacts cc ON cc.customerid = c.id
JOIN customercontacts cc ON (cc.customerid = c.id)
WHERE cc.type & ' . (CONTACT_EMAIL | CONTACT_DOCUMENTS | CONTACT_DISABLED) . ' = ' . (CONTACT_EMAIL | CONTACT_DOCUMENTS) . '
) i ON i.custom 8000 erid = d.customerid
' . ($service ? 'JOIN (
SELECT DISTINCT a.docid FROM assignments a
JOIN tariffs t ON t.id = a.tariffid
JOIN tariffs t ON (t.id = a.tariffid)
WHERE t.type IN (' . implode(',', $service) . ')
) s ON s.docid = d.id' : '') . '
LEFT JOIN (
Expand All @@ -252,12 +252,12 @@ public function GetDocumentList(array $params)
WHERE e.userid = lms_current_user()
) e ON (e.customerid = d.customerid)
WHERE e.customerid IS NULL '
.($customer ? 'AND d.customerid = '.intval($customer) : '')
.($type ? (is_array($type) ? ' AND d.type IN (' . implode(',', $type) . ')' : ' AND d.type = '.intval($type)) : '')
. ($customer ? 'AND d.customerid = ' . intval($customer) : '')
. ($type ? (is_array($type) ? ' AND d.type IN (' . implode(',', $type) . ')' : ' AND d.type = '.intval($type)) : '')
. ($userid ? ' AND ' . $userfield . (is_array($userid) ? ' IN (' . implode(',', $userid) . ')' : ' = ' . intval($userid)) : '')
. ($numberplan ? ' AND d.numberplanid = ' . intval($numberplan) : '')
.($from ? ' AND ' . $datefield . ' >= '.intval($from) : '')
.($to ? ' AND ' . $datefield . ' <= '.intval($to) : '')
. ($from ? ' AND ' . $datefield . ' >= ' . intval($from) : '')
. ($to ? ' AND ' . $datefield . ' <= ' . intval($to) : '')
. $status_sql
. ($archived == -1 ? '' : ' AND d.archived = ' . intval($archived)),
array(
Expand All @@ -277,35 +277,35 @@ public function GetDocumentList(array $params)
FROM documentcontents
JOIN documents d ON (d.id = documentcontents.docid)
JOIN docrights r ON (d.type = r.doctype AND r.userid = ? AND (r.rights & ?) > 0)
LEFT JOIN vusers u ON u.id = d.userid
LEFT JOIN vusers u2 ON u2.id = d.cuserid
LEFT JOIN vusers u3 ON u3.id = d.auserid
LEFT JOIN vusers u ON (u.id = d.userid)
LEFT JOIN vusers u2 ON (u2.id = d.cuserid)
LEFT JOIN vusers u3 ON (u3.id = d.auserid)
LEFT JOIN numberplans ON (d.numberplanid = numberplans.id)
LEFT JOIN (
SELECT DISTINCT c.id AS customerid, 1 AS senddocuments FROM customers c
JOIN customercontacts cc ON cc.customerid = c.id
JOIN customercontacts cc ON (cc.customerid = c.id)
WHERE cc.type & ' . (CONTACT_EMAIL | CONTACT_DOCUMENTS | CONTACT_DISABLED) . ' = ' . (CONTACT_EMAIL | CONTACT_DOCUMENTS) . '
) i ON i.customerid = d.customerid
) i ON (i.customerid = d.customerid)
' . ($service ? 'JOIN (
SELECT DISTINCT a.docid FROM assignments a
JOIN tariffs t ON t.id = a.tariffid
JOIN tariffs t ON (t.id = a.tariffid)
WHERE t.type IN (' . implode(',', $service) . ')
) s ON s.docid = d.id' : '') . '
) s ON (s.docid = d.id)' : '') . '
LEFT JOIN (
SELECT DISTINCT a.customerid FROM vcustomerassignments a
JOIN excludedgroups e ON (a.customergroupid = e.customergroupid)
WHERE e.userid = lms_current_user()
) e ON (e.customerid = d.customerid)
WHERE e.customerid IS NULL '
.($customer ? 'AND d.customerid = '.intval($customer) : '')
.($type ? (is_array($type) ? ' AND d.type IN (' . implode(',', $type) . ')' : ' AND d.type = '.intval($type)) : '')
. ($customer ? 'AND d.customerid = ' . intval($customer) : '')
. ($type ? (is_array($type) ? ' AND d.type IN (' . implode(',', $type) . ')' : ' AND d.type = '.intval($type)) : '')
. ($userid ? ' AND ' . $userfield . (is_array($userid) ? ' IN (' . implode(',', $userid) . ')' : ' = ' . intval($userid)) : '')
. ($numberplan ? ' AND d.numberplanid = ' . intval($numberplan) : '')
.($from ? ' AND ' . $datefield . ' >= '.intval($from) : '')
.($to ? ' AND ' . $datefield . ' <= '.intval($to) : '')
. ($from ? ' AND ' . $datefield . ' >= ' . intval($from) : '')
. ($to ? ' AND ' . $datefield . ' <= ' . intval($to) : '')
. $status_sql
. ($archived == -1 ? '' : ' AND d.archived = ' . intval($archived))
.$sqlord
. $sqlord
. (isset($limit) ? ' LIMIT ' . $limit : '')
. (isset($offset) ? ' OFFSET ' . $offset : ''),
array(
Expand Down
4 changes: 2 additions & 2 deletions templates/default/document/documentlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ <H1>{$layout.pagetitle}</H1>
<OPTION value="-1">{trans("— all —")} </OPTION>
<OPTION value="0"{if $filter.status == 0} selected{/if}>{trans("unconfirmed")}</OPTION>
<OPTION value="1"{if $filter.status == 1} selected{/if}>{trans("confirmed")}</OPTION>
<OPTION value="4"{if $filter.status == 5} selected{/if}>{trans("confirmed (signed document scan)")}</OPTION>
<OPTION value="5"{if $filter.status == 4} selected{/if}>{trans("confirmed (sms authorization)")}</OPTION>
<OPTION value="5"{if $filter.status == 5} selected{/if}>{trans("confirmed (signed document scan)")}</OPTION>
<OPTION value="4"{if $filter.status == 4} selected{/if}>{trans("confirmed (sms authorization)")}</OPTION>
<OPTION value="2"{if $filter.status == 2} selected{/if}>{trans("review (signed document scan)")}</OPTION>
<OPTION value="3"{if $filter.status == 3} selected{/if}>{trans("waiting for signed document scan")}</OPTION>
<option value="6"{if $filter.status == 6} selected{/if}>{trans("waiting for customer action (expired)")}</option>
Expand Down
0