7525-devToTest #2542
|
@ -26,10 +26,11 @@
|
||||||
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
|
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
|
||||||
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
|
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
|
||||||
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
|
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
|
||||||
|
<mrw:Observaciones><%= expeditionData.deliveryObservation %></mrw:Observaciones>
|
||||||
</mrw:DatosEntrega>
|
</mrw:DatosEntrega>
|
||||||
<mrw:DatosServicio>
|
<mrw:DatosServicio>
|
||||||
<mrw:Fecha><%= expeditionData.created %></mrw:Fecha>
|
<mrw:Fecha><%= expeditionData.created %></mrw:Fecha>
|
||||||
<mrw:Referencia><%= expeditionData.expeditionDataId %></mrw:Referencia>
|
<mrw:Referencia><%= expeditionData.reference %></mrw:Referencia>
|
||||||
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
|
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
|
||||||
<mrw:NumeroBultos>1</mrw:NumeroBultos>
|
<mrw:NumeroBultos>1</mrw:NumeroBultos>
|
||||||
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>
|
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>
|
||||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
||||||
`SELECT
|
`SELECT
|
||||||
CASE co.code
|
CASE co.code
|
||||||
WHEN 'ES' THEN a.postalCode
|
WHEN 'ES' THEN a.postalCode
|
||||||
WHEN 'PT' THEN LEFT(a.postalCode, 4)
|
WHEN 'PT' THEN LEFT(a.postalCode, mc.portugalPostCodeTrim)
|
||||||
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
|
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
|
||||||
END postalCode,
|
END postalCode,
|
||||||
a.city,
|
a.city,
|
||||||
|
@ -56,9 +56,10 @@ module.exports = Self => {
|
||||||
c.phone,
|
c.phone,
|
||||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
e.id expeditionId,
|
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||||
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType,
|
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
|
||||||
IF(mw.weekdays, 'S', 'N') weekDays
|
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||||
|
oa.description deliveryObservation
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN ticket t ON e.ticketFk = t.id
|
JOIN ticket t ON e.ticketFk = t.id
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
@ -66,8 +67,12 @@ module.exports = Self => {
|
||||||
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a')
|
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a')
|
||||||
JOIN client c ON t.clientFk = c.id
|
JOIN client c ON t.clientFk = c.id
|
||||||
JOIN address a ON t.addressFk = a.id
|
JOIN address a ON t.addressFk = a.id
|
||||||
|
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||||
|
LEFT JOIN observationType ot ON ot.id = oa.observationTypeFk
|
||||||
|
AND ot.code = 'delivery'
|
||||||
JOIN province p ON a.provinceFk = p.id
|
JOIN province p ON a.provinceFk = p.id
|
||||||
JOIN country co ON co.id = p.countryFk
|
JOIN country co ON co.id = p.countryFk
|
||||||
|
JOIN mrwConfig mc
|
||||||
WHERE e.id = ?
|
WHERE e.id = ?
|
||||||
LIMIT 1`;
|
LIMIT 1`;
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,7 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vClient INT DEFAULT NULL;
|
DECLARE vClient INT DEFAULT NULL;
|
||||||
|
|
||||||
-- SET vPhone = vPhone COLLATE 'utf8_unicode_ci';
|
CREATE OR REPLACE TEMPORARY TABLE tClient
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tClient;
|
|
||||||
CREATE TEMPORARY TABLE tClient
|
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT id clientFk
|
SELECT id clientFk
|
||||||
FROM `client`
|
FROM `client`
|
||||||
|
@ -27,13 +24,14 @@ BEGIN
|
||||||
OR mobile = vPhone
|
OR mobile = vPhone
|
||||||
UNION
|
UNION
|
||||||
SELECT clientFk
|
SELECT clientFk
|
||||||
FROM vn.clientContact
|
FROM clientContact
|
||||||
WHERE phone = vPhone;
|
WHERE phone = vPhone;
|
||||||
|
|
||||||
SELECT t.clientFk INTO vClient
|
SELECT t.clientFk INTO vClient
|
||||||
FROM tClient t
|
FROM tClient t
|
||||||
JOIN `client` c ON c.id = t.clientFk
|
JOIN `client` c ON c.id = t.clientFk
|
||||||
WHERE c.isActive
|
WHERE c.isActive
|
||||||
|
AND c.salesPersonFk
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tClient;
|
DROP TEMPORARY TABLE tClient;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS expeditionDeadLine TIME NULL
|
||||||
|
COMMENT 'This field stores the latest time by which expeditions can be generated to be sent today';
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS counterWidth INT UNSIGNED NULL
|
||||||
|
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
|
||||||
|
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS serviceTypeWidth INT UNSIGNED NULL
|
||||||
|
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
|
||||||
|
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS portugalPostCodeTrim INT UNSIGNED NULL
|
||||||
|
COMMENT 'It will trim the last characters of the postal code';
|
|
@ -85,8 +85,12 @@ exports.translateValues = async(instance, changes, options = {}) => {
|
||||||
exports.getChanges = (original, changes) => {
|
exports.getChanges = (original, changes) => {
|
||||||
const oldChanges = {};
|
const oldChanges = {};
|
||||||
const newChanges = {};
|
const newChanges = {};
|
||||||
|
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
||||||
|
|
||||||
for (let property in changes) {
|
for (let property in changes) {
|
||||||
|
if (dateRegex.test(original[property]))
|
||||||
|
original[property] = new Date(Date.parse(original[property]));
|
||||||
|
|
||||||
const firstChar = property.substring(0, 1);
|
const firstChar = property.substring(0, 1);
|
||||||
const isPrivate = firstChar == '$';
|
const isPrivate = firstChar == '$';
|
||||||
if (isPrivate) return;
|
if (isPrivate) return;
|
||||||
|
|
|
@ -88,7 +88,8 @@ module.exports = Self => {
|
||||||
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
||||||
|
|
||||||
// When pickup has been changed
|
// When pickup has been changed
|
||||||
if (salesPerson && changedPickup && updatedClaim.pickup)
|
if (salesPerson) {
|
||||||
|
if (changedPickup && updatedClaim.pickup)
|
||||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
await notifyPickUp(ctx, salesPerson.id, claim);
|
||||||
|
|
||||||
// When claimState has been changed
|
// When claimState has been changed
|
||||||
|
@ -98,6 +99,7 @@ module.exports = Self => {
|
||||||
if (newState.code == 'canceled')
|
if (newState.code == 'canceled')
|
||||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
ng-model="$ctrl.worker.originCountryFk"
|
ng-model="$ctrl.worker.originCountryFk"
|
||||||
url="Countries"
|
url="Countries"
|
||||||
fields="['id', 'country', 'code']"
|
fields="['id', 'name', 'code']"
|
||||||
show-field="country"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
label="Origin country">
|
label="Origin country">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
Loading…
Reference in New Issue