Merge pull request 'refs #6278 fixFilter' (!1774) from 6278-ticketRequestFixFilter into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1774
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Pablo Natek 2023-10-20 10:45:03 +00:00
commit 2a55adb8b8
2 changed files with 21 additions and 10 deletions

View File

@ -26,6 +26,7 @@
<vn-th field="ticketFk" number>Ticket ID</vn-th>
<vn-th field="shipped" expand>Shipped</vn-th>
<vn-th field="description" filter-enabled="false" expand>Description</vn-th>
<vn-th field="requesterFk" >Requester</vn-th>
<vn-th field="quantity" number editable>Requested</vn-th>
<vn-th field="price" number>Price</vn-th>
<vn-th field="attenderName">Atender</vn-th>
@ -51,6 +52,13 @@
</span>
</vn-td>
<vn-td title="{{::request.description}}" expand>{{::request.description}}</vn-td>
<vn-td number>
<span
class="link"
ng-click="workerDescriptor.show($event, request.requesterFk)">
{{::request.requesterName}}
</span>
</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price | currency: 'EUR':2}}</vn-td>
<vn-td>

View File

@ -99,6 +99,8 @@ module.exports = Self => {
switch (value) {
case 'pending':
return {'tr.isOk': null};
case 'accepted':
return {'tr.isOk': 1};
default:
return {'tr.isOk': value};
}
@ -122,8 +124,7 @@ module.exports = Self => {
filter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL(
`SELECT
tr.id,
`SELECT tr.id,
tr.ticketFk,
tr.quantity,
tr.price,
@ -133,18 +134,19 @@ module.exports = Self => {
tr.saleFk,
tr.requesterFk,
tr.isOk,
s.quantity AS saleQuantity,
s.quantity saleQuantity,
s.itemFk,
i.name AS itemDescription,
i.name itemDescription,
t.shipped,
DATE(t.shipped) AS shippedDate,
DATE(t.shipped) shippedDate,
t.nickname,
t.warehouseFk,
t.clientFk,
w.name AS warehouse,
u.nickname AS salesPersonNickname,
ua.name AS attenderName,
c.salesPersonFk
w.name warehouse,
u.nickname salesPersonNickname,
ua.name attenderName,
c.salesPersonFk,
ua2.name requesterName
FROM ticketRequest tr
LEFT JOIN ticketWeekly tw on tw.ticketFk = tr.ticketFk
LEFT JOIN ticket t ON t.id = tr.ticketFk
@ -155,7 +157,8 @@ module.exports = Self => {
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN worker wka ON wka.id = tr.attenderFk
LEFT JOIN account.user ua ON ua.id = wka.id`);
LEFT JOIN account.user ua ON ua.id = wka.id
LEFT JOIN account.user ua2 ON ua2.id = tr.requesterFk`);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt, myOptions);