Actualizar robot.js
This commit is contained in:
5
robot.js
5
robot.js
@@ -70,17 +70,18 @@ async function runMultiasistencia(ownerId, user, pass) {
|
|||||||
if (descHeader && descHeader.nextElementSibling) rawDesc = clean(descHeader.nextElementSibling.innerText);
|
if (descHeader && descHeader.nextElementSibling) rawDesc = clean(descHeader.nextElementSibling.innerText);
|
||||||
const idxDate = rawDesc.search(/\b\d{2}\/\d{2}\/\d{4}\b/);
|
const idxDate = rawDesc.search(/\b\d{2}\/\d{2}\/\d{4}\b/);
|
||||||
const cleanDesc = idxDate !== -1 ? rawDesc.substring(0, idxDate).trim() : rawDesc;
|
const cleanDesc = idxDate !== -1 ? rawDesc.substring(0, idxDate).trim() : rawDesc;
|
||||||
|
// ... (dentro de runMultiasistencia - evaluate)
|
||||||
const rawCPField = findByCab("Distrito Postal") || "";
|
const rawCPField = findByCab("Distrito Postal") || "";
|
||||||
const cpMatch = rawCPField.match(/\b\d{5}\b/);
|
const cpMatch = rawCPField.match(/\b\d{5}\b/);
|
||||||
const cpOnly = cpMatch ? cpMatch[0] : "";
|
const cpOnly = cpMatch ? cpMatch[0] : "";
|
||||||
const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim();
|
const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim();
|
||||||
const phoneMatch = body.match(/[6789]\d{8}/);
|
|
||||||
return {
|
return {
|
||||||
"Expediente": findByCab("Número Reparación") || "",
|
"Expediente": findByCab("Número Reparación") || "",
|
||||||
"Nombre Cliente": findByCab("Nombre Cliente") || "",
|
"Nombre Cliente": findByCab("Nombre Cliente") || "",
|
||||||
"Dirección": findByCab("Dirección") || "",
|
"Dirección": findByCab("Dirección") || "",
|
||||||
"Población": popOnly,
|
"Población": popOnly,
|
||||||
"Código Postal": cpOnly,
|
"Código Postal": cpOnly, // CAMPO RECUPERADO
|
||||||
"Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"),
|
"Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"),
|
||||||
"Descripción": cleanDesc,
|
"Descripción": cleanDesc,
|
||||||
"Teléfono": phoneMatch ? phoneMatch[0] : "",
|
"Teléfono": phoneMatch ? phoneMatch[0] : "",
|
||||||
|
|||||||
Reference in New Issue
Block a user