5843-quitUserFk2 #1758

Merged
carlossa merged 10 commits from 5843-quitUserFk2 into dev 2023-09-22 11:18:18 +00:00
19 changed files with 34 additions and 37 deletions
Showing only changes of commit b1b6bd13ea - Show all commits

View File

@ -45,7 +45,7 @@
<vn-label-value <vn-label-value
label="Attended by"> label="Attended by">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.claim.worker.id)"
class="link"> class="link">
{{$ctrl.claim.worker.user.name}} {{$ctrl.claim.worker.user.name}}
</span> </span>

View File

@ -60,7 +60,7 @@ module.exports = Self => {
at2.id IS NOT NULL as isCompensation at2.id IS NOT NULL as isCompensation
FROM vn.receipt r FROM vn.receipt r
LEFT JOIN vn.worker w ON w.id = r.workerFk LEFT JOIN vn.worker w ON w.id = r.workerFk
LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN account.user u ON u.id = w.id
JOIN vn.company c ON c.id = r.companyFk JOIN vn.company c ON c.id = r.companyFk
LEFT JOIN vn.accounting a ON a.id = r.bankFk LEFT JOIN vn.accounting a ON a.id = r.bankFk
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation' LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'

View File

@ -24,8 +24,8 @@
<vn-tr ng-repeat="credit in credits track by credit.id"> <vn-tr ng-repeat="credit in credits track by credit.id">
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td> <vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td> <vn-td>
<span <span
ng-click="workerDescriptor.show($event, credit.worker.userFk)" ng-click="workerDescriptor.show($event, credit.worker.id)"
class="link"> class="link">
{{::credit.worker.user.name}} {{::credit.worker.user.name}}
</span> </span>
@ -41,10 +41,10 @@
ui-sref="client.card.credit.create" ui-sref="client.card.credit.create"
vn-acl="teamBoss" vn-acl="teamBoss"
vn-acl-action="remove" vn-acl-action="remove"
vn-tooltip="New credit" vn-tooltip="New credit"
vn-bind="+" vn-bind="+"
fixed-bottom-right> fixed-bottom-right>
</vn-float-button> </vn-float-button>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -180,7 +180,7 @@ module.exports = Self => {
LEFT JOIN itemType it ON it.id = i.typeFk LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN worker w ON w.id = it.workerFk LEFT JOIN worker w ON w.id = it.workerFk
LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN account.user u ON u.id = w.id
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN producer pr ON pr.id = i.producerFk
LEFT JOIN origin ori ON ori.id = i.originFk LEFT JOIN origin ori ON ori.id = i.originFk

View File

@ -1,6 +1,6 @@
<vn-crud-model <vn-crud-model
auto-load="true" auto-load="true"
url="Warehouses" url="Warehouses"
data="warehouses"> data="warehouses">
</vn-crud-model> </vn-crud-model>
<vn-descriptor-content <vn-descriptor-content
@ -58,7 +58,7 @@
<vn-label-value <vn-label-value
label="Buyer"> label="Buyer">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.id)"
class="link"> class="link">
{{$ctrl.item.itemType.worker.user.name}} {{$ctrl.item.itemType.worker.user.name}}
</span> </span>

View File

@ -70,7 +70,7 @@
</vn-label-value> </vn-label-value>
<vn-label-value label="Buyer"> <vn-label-value label="Buyer">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.id)"
class="link"> class="link">
{{$ctrl.summary.item.itemType.worker.user.name}} {{$ctrl.summary.item.itemType.worker.user.name}}
</span> </span>

View File

@ -215,7 +215,7 @@ module.exports = Self => {
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`); LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
if (args.orderFk) { if (args.orderFk) {

View File

@ -169,7 +169,7 @@ module.exports = Self => {
LEFT JOIN agencyMode am ON am.id = o.agency_id LEFT JOIN agencyMode am ON am.id = o.agency_id
LEFT JOIN client c ON c.id = o.customer_id LEFT JOIN client c ON c.id = o.customer_id
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN company co ON co.id = o.company_id LEFT JOIN company co ON co.id = o.company_id
LEFT JOIN orderTicket ot ON ot.orderFk = o.id LEFT JOIN orderTicket ot ON ot.orderFk = o.id
LEFT JOIN ticket t ON t.id = ot.ticketFk LEFT JOIN ticket t ON t.id = ot.ticketFk

View File

@ -111,7 +111,7 @@ module.exports = Self => {
let stmt; let stmt;
stmt = new ParameterizedSQL( stmt = new ParameterizedSQL(
`SELECT `SELECT
r.id, r.id,
r.workerFk, r.workerFk,
r.created, r.created,
@ -134,7 +134,7 @@ module.exports = Self => {
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vehicle v ON v.id = r.vehicleFk LEFT JOIN vehicle v ON v.id = r.vehicleFk
LEFT JOIN worker w ON w.id = r.workerFk LEFT JOIN worker w ON w.id = r.workerFk
LEFT JOIN account.user u ON u.id = w.userFk` LEFT JOIN account.user u ON u.id = w.id`
); );
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeSuffix(filter));

View File

@ -41,7 +41,7 @@ module.exports = Self => {
FROM saleTracking st FROM saleTracking st
JOIN sale s ON s.id = st.saleFk JOIN sale s ON s.id = st.saleFk
JOIN worker w ON w.id = st.workerFk JOIN worker w ON w.id = st.workerFk
JOIN account.user u ON u.id = w.userFk JOIN account.user u ON u.id = w.id
JOIN state ste ON ste.id = st.stateFk`); JOIN state ste ON ste.id = st.stateFk`);
stmt.merge(Self.makeSuffix(filter)); stmt.merge(Self.makeSuffix(filter));

View File

@ -153,9 +153,9 @@ module.exports = Self => {
LEFT JOIN item i ON i.id = tr.itemFk LEFT JOIN item i ON i.id = tr.itemFk
LEFT JOIN sale s ON s.id = tr.saleFk LEFT JOIN sale s ON s.id = tr.saleFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN worker wka ON wka.id = tr.attenderFk LEFT JOIN worker wka ON wka.id = tr.attenderFk
LEFT JOIN account.user ua ON ua.id = wka.userFk`); LEFT JOIN account.user ua ON ua.id = wka.id`);
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt, myOptions); return conn.executeStmt(stmt, myOptions);

View File

@ -272,7 +272,7 @@ module.exports = Self => {
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN route r ON r.id = t.routeFk`); LEFT JOIN route r ON r.id = t.routeFk`);
if (args.orderFk) { if (args.orderFk) {

View File

@ -38,12 +38,12 @@ module.exports = Self => {
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
const worker = await models.Worker.findById(id); const worker = await models.Worker.findById(id);
const userId = worker.userFk; const userId = worker.id;
const stmts = []; const stmts = [];
stmts.push(` stmts.push(`
DROP TEMPORARY TABLE IF EXISTS DROP TEMPORARY TABLE IF EXISTS
tmp.timeControlCalculate, tmp.timeControlCalculate,
tmp.timeBusinessCalculate tmp.timeBusinessCalculate
`); `);
@ -54,7 +54,7 @@ module.exports = Self => {
const resultIndex = stmts.push(new ParameterizedSQL(` const resultIndex = stmts.push(new ParameterizedSQL(`
SELECT tcc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours SELECT tcc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
FROM tmp.timeControlCalculate tcc FROM tmp.timeControlCalculate tcc
LEFT JOIN tmp.timeBusinessCalculate tbc ON tcc.dated = tbc.dated LEFT JOIN tmp.timeBusinessCalculate tbc ON tcc.dated = tbc.dated
WHERE tcc.dated BETWEEN DATE(?) AND DATE(?) WHERE tcc.dated BETWEEN DATE(?) AND DATE(?)
`, [started, ended])) - 1; `, [started, ended])) - 1;

View File

@ -24,9 +24,6 @@
"phone": { "phone": {
"type" : "string" "type" : "string"
}, },
"userFk": {
"type" : "number"
},
"bossFk": { "bossFk": {
"type" : "number" "type" : "number"
}, },
@ -66,12 +63,12 @@
"client": { "client": {
"type": "belongsTo", "type": "belongsTo",
"model": "Client", "model": "Client",
"foreignKey": "userFk" "foreignKey": "id"
}, },
"sip": { "sip": {
"type": "belongsTo", "type": "belongsTo",
"model": "Sip", "model": "Sip",
"foreignKey": "userFk" "foreignKey": "id"
}, },
"department": { "department": {
"type": "belongsTo", "type": "belongsTo",

View File

@ -5,7 +5,7 @@ class Controller extends Section {
onSubmit() { onSubmit() {
const sip = this.worker.sip; const sip = this.worker.sip;
const params = { const params = {
userFk: this.worker.userFk, userFk: this.worker.id,
extension: sip.extension extension: sip.extension
}; };
this.$.watcher.check(); this.$.watcher.check();

View File

@ -58,7 +58,7 @@
<vn-one> <vn-one>
<h4 translate>User data</h4> <h4 translate>User data</h4>
<vn-label-value label="User id" <vn-label-value label="User id"
value="{{worker.userFk}}"> value="{{worker.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="User" <vn-label-value label="User"
value="{{worker.user.name}}"> value="{{worker.user.name}}">

View File

@ -7,5 +7,5 @@ SELECT
FROM client c FROM client c
JOIN account.user u ON u.id = c.id JOIN account.user u ON u.id = c.id
LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user wu ON wu.id = w.userFk LEFT JOIN account.user wu ON wu.id = w.id
WHERE c.id = ? WHERE c.id = ?

View File

@ -8,5 +8,5 @@ SELECT
FROM client c FROM client c
JOIN account.user u ON u.id = c.id JOIN account.user u ON u.id = c.id
LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN account.user wu ON wu.id = w.userFk LEFT JOIN account.user wu ON wu.id = w.id
WHERE c.id = ? WHERE c.id = ?

View File

@ -1,4 +1,4 @@
SELECT SELECT
r.id, r.id,
r.m3, r.m3,
r.created, r.created,
@ -11,9 +11,9 @@ SELECT
FROM route r FROM route r
LEFT JOIN vehicle v ON v.id = r.vehicleFk LEFT JOIN vehicle v ON v.id = r.vehicleFk
LEFT JOIN worker w ON w.id = r.workerFk LEFT JOIN worker w ON w.id = r.workerFk
LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN account.user u ON u.id = w.id
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN agency a ON a.id = am.agencyFk LEFT JOIN agency a ON a.id = am.agencyFk
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
LEFT JOIN supplier s ON s.id = sa.supplierFk LEFT JOIN supplier s ON s.id = sa.supplierFk
WHERE r.id IN(?) WHERE r.id IN(?)