antes del relleno de site y sectorial como custom attributes estáticos
This commit is contained in:
parent
28f700e64c
commit
b0ba48d111
@ -11708,3 +11708,32 @@ EJECUTANDO PATCH - Se detectaron cambios
|
|||||||
|
|
||||||
Response Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Juan Escutia","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2026-02-01T15:22:57Z","source":"whatsapp","funnelId":null,"href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["s0LOCS","PRUEBAS"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","user name":"Daniel Humberto","Monto Ultimo Pago":"💲 100","Domicilio":"📍 Calle San Antonio 13, Lindavista, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México","Cliente":"135","Site":"El Lindero","URL":"🌐 https://sistema.siip.mx/crm/client/135","Saldo Actual":"💲10375 a favor","Nombre":"👤 Juan Escutia","password-antena":"{\"Servicio 1\":\"Aq{0J8:n<l0&ec-{d[*W\"}","Fecha Ultima Actualizacion":"📆🔄️ 16/02/2026 23:06","Resumen":"{\"Cliente\": \"135\",\"Nombre\": \"Juan Escutia\",\"URL\": \"https://sistema.siip.mx/crm/client/135\",\"Saldo Actual\": \"💲10375 a favor\",\"Monto Ultimo Pago\": \"$ 100\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 12/02/2026 13:36 con Desconocido, revisar metodos de pago no contemplados\",\"Fecha Ultima Actualizacion\": \"16/02/2026 23:06\",\"Clabe Interbancaria\": \"\",\"Site\": \"El Lindero\",\"Antena/Sectorial\": \"San Vicente\",\"Password Antena\": {\"Servicio 1\":\"Aq{0J8:n<l0&ec-{d[*W\"}}","Fecha Ultimo Pago":"📆💸 12/02/2026 13:36 con Desconocido, revisar metodos de pago no contemplados","Antena/Sectorial":"San Vicente"},"team":{"uuid":"5faeed738d6a44ccacf6509762eb288d","name":"General","default":true,"members":5,"createdAt":"2023-11-07T00:37:10Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"discardedAt":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
Response Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Juan Escutia","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2026-02-01T15:22:57Z","source":"whatsapp","funnelId":null,"href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["s0LOCS","PRUEBAS"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","user name":"Daniel Humberto","Monto Ultimo Pago":"💲 100","Domicilio":"📍 Calle San Antonio 13, Lindavista, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México","Cliente":"135","Site":"El Lindero","URL":"🌐 https://sistema.siip.mx/crm/client/135","Saldo Actual":"💲10375 a favor","Nombre":"👤 Juan Escutia","password-antena":"{\"Servicio 1\":\"Aq{0J8:n<l0&ec-{d[*W\"}","Fecha Ultima Actualizacion":"📆🔄️ 16/02/2026 23:06","Resumen":"{\"Cliente\": \"135\",\"Nombre\": \"Juan Escutia\",\"URL\": \"https://sistema.siip.mx/crm/client/135\",\"Saldo Actual\": \"💲10375 a favor\",\"Monto Ultimo Pago\": \"$ 100\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 12/02/2026 13:36 con Desconocido, revisar metodos de pago no contemplados\",\"Fecha Ultima Actualizacion\": \"16/02/2026 23:06\",\"Clabe Interbancaria\": \"\",\"Site\": \"El Lindero\",\"Antena/Sectorial\": \"San Vicente\",\"Password Antena\": {\"Servicio 1\":\"Aq{0J8:n<l0&ec-{d[*W\"}}","Fecha Ultimo Pago":"📆💸 12/02/2026 13:36 con Desconocido, revisar metodos de pago no contemplados","Antena/Sectorial":"San Vicente"},"team":{"uuid":"5faeed738d6a44ccacf6509762eb288d","name":"General","default":true,"members":5,"createdAt":"2023-11-07T00:37:10Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"discardedAt":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||||
|
|
||||||
|
[2026-02-18 23:38:20.448527] [notice] Logging level set to:debug
|
||||||
|
[2026-02-18 23:38:20.448643] [debug] Payload recibido: {"uuid":"75d3692a-dbf2-4ec8-a485-9c1b54425950","changeType":"insert","entity":"service","entityId":"173","eventName":"service.add","extraData":{"entity":{"id":173,"prepaid":false,"clientId":167,"status":1,"name":"PREMIUM","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","note":null,"addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"servicePlanId":4,"servicePlanPeriodId":19,"price":700,"hasIndividualPrice":false,"totalPrice":700,"currencyCode":"MXN","invoiceLabel":null,"contractId":null,"contractLengthType":1,"minimumContractLengthMonths":null,"activeFrom":"2026-02-18T00:00:00-0600","activeTo":null,"contractEndDate":null,"discountType":0,"discountValue":null,"discountInvoiceLabel":"Descuento","discountFrom":null,"discountTo":null,"tax1Id":null,"tax2Id":null,"tax3Id":null,"invoicingStart":"2026-02-18T00:00:00-0600","invoicingPeriodType":1,"invoicingPeriodStartDay":1,"nextInvoicingDayAdjustment":10,"invoicingProratedSeparately":true,"invoicingSeparately":false,"sendEmailsAutomatically":null,"useCreditAutomatically":true,"servicePlanName":"PREMIUM","servicePlanPrice":700,"servicePlanPeriod":1,"servicePlanType":"Internet","downloadSpeed":20,"uploadSpeed":20,"hasOutage":false,"unmsClientSiteStatus":null,"fccBlockId":null,"lastInvoicedDate":null,"unmsClientSiteId":"e90dae2d-be06-42d3-9488-edcb441b2217","attributes":[],"addressData":null,"suspensionReasonId":null,"serviceChangeRequestId":null,"setupFeePrice":null,"earlyTerminationFeePrice":null,"downloadSpeedOverride":null,"uploadSpeedOverride":null,"trafficShapingOverrideEnd":null,"trafficShapingOverrideEnabled":false,"servicePlanGroupId":null,"suspensionPeriods":[],"surcharges":[]},"entityBeforeEdit":null}}
|
||||||
|
|
||||||
|
[2026-02-18 23:38:20.801202] [debug] Evento recibido: service.add
|
||||||
|
[2026-02-18 23:38:26.902650] [notice] Logging level set to:debug
|
||||||
|
[2026-02-18 23:38:26.902714] [debug] Payload recibido: {"uuid":"21a4c963-be21-4796-8078-7a47e9a7e902","changeType":"edit","entity":"service","entityId":"173","eventName":"service.edit","extraData":{"entity":{"id":173,"prepaid":false,"clientId":167,"status":1,"name":"PREMIUM","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","note":null,"addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"servicePlanId":4,"servicePlanPeriodId":19,"price":700,"hasIndividualPrice":false,"totalPrice":700,"currencyCode":"MXN","invoiceLabel":null,"contractId":null,"contractLengthType":1,"minimumContractLengthMonths":null,"activeFrom":"2026-02-18T00:00:00-0600","activeTo":null,"contractEndDate":null,"discountType":0,"discountValue":null,"discountInvoiceLabel":"Descuento","discountFrom":null,"discountTo":null,"tax1Id":null,"tax2Id":null,"tax3Id":null,"invoicingStart":"2026-02-18T00:00:00-0600","invoicingPeriodType":1,"invoicingPeriodStartDay":1,"nextInvoicingDayAdjustment":10,"invoicingProratedSeparately":true,"invoicingSeparately":false,"sendEmailsAutomatically":null,"useCreditAutomatically":true,"servicePlanName":"PREMIUM","servicePlanPrice":700,"servicePlanPeriod":1,"servicePlanType":"Internet","downloadSpeed":20,"uploadSpeed":20,"hasOutage":false,"unmsClientSiteStatus":null,"fccBlockId":null,"lastInvoicedDate":null,"unmsClientSiteId":"e90dae2d-be06-42d3-9488-edcb441b2217","attributes":[],"addressData":null,"suspensionReasonId":null,"serviceChangeRequestId":null,"setupFeePrice":null,"earlyTerminationFeePrice":null,"downloadSpeedOverride":null,"uploadSpeedOverride":null,"trafficShapingOverrideEnd":null,"trafficShapingOverrideEnabled":false,"servicePlanGroupId":null,"suspensionPeriods":[],"surcharges":[]},"entityBeforeEdit":{"id":173,"prepaid":false,"clientId":167,"status":1,"name":"PREMIUM","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","note":null,"addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"servicePlanId":4,"servicePlanPeriodId":19,"price":700,"hasIndividualPrice":false,"totalPrice":700,"currencyCode":"MXN","invoiceLabel":null,"contractId":null,"contractLengthType":1,"minimumContractLengthMonths":null,"activeFrom":"2026-02-18T00:00:00-0600","activeTo":null,"contractEndDate":null,"discountType":0,"discountValue":null,"discountInvoiceLabel":"Descuento","discountFrom":null,"discountTo":null,"tax1Id":null,"tax2Id":null,"tax3Id":null,"invoicingStart":"2026-02-18T00:00:00-0600","invoicingPeriodType":1,"invoicingPeriodStartDay":1,"nextInvoicingDayAdjustment":10,"invoicingProratedSeparately":true,"invoicingSeparately":false,"sendEmailsAutomatically":null,"useCreditAutomatically":true,"servicePlanName":"PREMIUM","servicePlanPrice":700,"servicePlanPeriod":1,"servicePlanType":"Internet","downloadSpeed":20,"uploadSpeed":20,"hasOutage":false,"unmsClientSiteStatus":null,"fccBlockId":null,"lastInvoicedDate":null,"unmsClientSiteId":"e90dae2d-be06-42d3-9488-edcb441b2217","attributes":[],"addressData":null,"suspensionReasonId":null,"serviceChangeRequestId":null,"setupFeePrice":null,"earlyTerminationFeePrice":null,"downloadSpeedOverride":null,"uploadSpeedOverride":null,"trafficShapingOverrideEnd":null,"trafficShapingOverrideEnabled":false,"servicePlanGroupId":null,"suspensionPeriods":[],"surcharges":[]}}}
|
||||||
|
|
||||||
|
[2026-02-18 23:38:27.128709] [debug] Evento recibido: service.edit
|
||||||
|
[2026-02-18 23:38:27.129110] [debug] Se editó el servicio a un cliente
|
||||||
|
|
||||||
|
[2026-02-18 23:38:27.131855] [info] Iniciando verificación/sincronización de contraseña para el cliente ID: 167
|
||||||
|
[2026-02-18 23:40:42.885363] [notice] Logging level set to:debug
|
||||||
|
[2026-02-18 23:40:42.885576] [debug] Payload recibido: {"uuid":"58dcf382-9f24-42b3-9b4d-873af712bbb2","changeType":"edit","entity":"client","entityId":"167","eventName":"client.edit","extraData":{"entity":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":232,"clientId":167,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}}
|
||||||
|
|
||||||
|
[2026-02-18 23:40:43.034780] [debug] Evento recibido: client.edit
|
||||||
|
[2026-02-18 23:40:43.035028] [info] Procesando evento client.edit para entityId: 167
|
||||||
|
[2026-02-18 23:40:43.035130] [debug] Payload completo client.edit: {"uuid":"58dcf382-9f24-42b3-9b4d-873af712bbb2","changeType":"edit","entity":"client","entityId":"167","eventName":"client.edit","extraData":{"entity":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":232,"clientId":167,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}}
|
||||||
|
[2026-02-18 23:40:43.035191] [info] Llamando a updatePasswordAntenaIfNeeded para cliente: 167
|
||||||
|
[2026-02-18 23:40:43.035229] [info] Iniciando verificación/sincronización de contraseña para el cliente ID: 167
|
||||||
|
[2026-02-18 23:40:43.332000] [info] Sincronizando contraseña en CRM para cliente 167. [VACIO] -> [TzP9TC3NS2Rm@Dzy]
|
||||||
|
[2026-02-18 23:40:43.332156] [debug] Intentando PATCH en clients/167 para atributo ID: 17 con valor: TzP9TC3NS2Rm@Dzy
|
||||||
|
[2026-02-18 23:40:43.773077] [notice] Logging level set to:debug
|
||||||
|
[2026-02-18 23:40:43.773202] [debug] Payload recibido: {"uuid":"fa0b2295-c214-411d-8ef7-1bad1919790b","changeType":"edit","entity":"client","entityId":"167","eventName":"client.edit","extraData":{"entity":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true},{"id":413,"clientId":167,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"TzP9TC3NS2Rm@Dzy","clientZoneVisible":false}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}}
|
||||||
|
|
||||||
|
[2026-02-18 23:40:43.890788] [debug] Evento recibido: client.edit
|
||||||
|
[2026-02-18 23:40:43.891062] [info] Procesando evento client.edit para entityId: 167
|
||||||
|
[2026-02-18 23:40:43.891163] [debug] Payload completo client.edit: {"uuid":"fa0b2295-c214-411d-8ef7-1bad1919790b","changeType":"edit","entity":"client","entityId":"167","eventName":"client.edit","extraData":{"entity":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true},{"id":413,"clientId":167,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"TzP9TC3NS2Rm@Dzy","clientZoneVisible":false}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":167,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"34 Avenida Sur","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Avenida Sur 34, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"TV AZTECA","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-02-10T00:00:00-0600","leadConvertedAt":"2025-02-10T23:11:22-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Javier","lastName":"Alatorre","username":null,"contacts":[{"id":173,"clientId":167,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[{"id":174,"clientId":167,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_Rkh9CoRTpjlZUu","clientZoneVisible":true},{"id":175,"clientId":167,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180228993431717","clientZoneVisible":true},{"id":283,"clientId":167,"customAttributeId":21,"name":"RUTA DE COBRANZA","key":"rutaDeCobranza","value":"GUSANO","clientZoneVisible":true}],"accountBalance":750,"accountCredit":750,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#6a1b9a","addressGpsLat":21.1519382,"addressGpsLon":-100.9371879,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}}
|
||||||
|
[2026-02-18 23:40:43.891218] [info] Llamando a updatePasswordAntenaIfNeeded para cliente: 167
|
||||||
|
[2026-02-18 23:40:43.891258] [info] Iniciando verificación/sincronización de contraseña para el cliente ID: 167
|
||||||
|
|||||||
@ -32,11 +32,14 @@ if ($fixOption === 'all') {
|
|||||||
// -- Helpers --
|
// -- Helpers --
|
||||||
function logMessage($message)
|
function logMessage($message)
|
||||||
{
|
{
|
||||||
global $logFile;
|
$logFile = __DIR__ . '/audit_passwords.log';
|
||||||
$timestamp = date('Y-m-d H:i:s');
|
$timestamp = date('Y-m-d H:i:s');
|
||||||
file_put_contents($logFile, "[$timestamp] $message\n", FILE_APPEND);
|
file_put_contents($logFile, "[$timestamp] $message\n", FILE_APPEND);
|
||||||
|
// Only write to STDERR if running in CLI mode, not web server (optional, but good practice)
|
||||||
|
if (php_sapi_name() === 'cli') {
|
||||||
fwrite(STDERR, "[$timestamp] $message\n");
|
fwrite(STDERR, "[$timestamp] $message\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isTestEnvironment($config)
|
function isTestEnvironment($config)
|
||||||
{
|
{
|
||||||
@ -407,10 +410,15 @@ function patchClientAttributes($ucrmApi, $clientId, array $attributeUpdates)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 0. Resolve Attribute IDs
|
/**
|
||||||
|
* Resolves UCRM custom attribute IDs based on keys.
|
||||||
|
*/
|
||||||
|
function resolveAttributeIds($ucrmApi, $customAttributeKey, $siteAttributeKey, $antenaSectorialAttributeKey)
|
||||||
|
{
|
||||||
$customAttributeId = null;
|
$customAttributeId = null;
|
||||||
$siteAttributeId = null;
|
$siteAttributeId = null;
|
||||||
$antenaSectorialAttributeId = null;
|
$antenaSectorialAttributeId = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$attributes = $ucrmApi->get('custom-attributes', ['attributeType' => 'client']);
|
$attributes = $ucrmApi->get('custom-attributes', ['attributeType' => 'client']);
|
||||||
foreach ($attributes as $attr) {
|
foreach ($attributes as $attr) {
|
||||||
@ -423,26 +431,64 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
logMessage("Error fetching attributes: " . $e->getMessage());
|
logMessage("Error fetching attributes: " . $e->getMessage());
|
||||||
exit(1);
|
return null; // Return null on failure
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$customAttributeId) {
|
if (!$customAttributeId) {
|
||||||
logMessage("Error: Custom attribute '$customAttributeKey' not found.");
|
logMessage("Error: Custom attribute '$customAttributeKey' not found.");
|
||||||
exit(1);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log resolved IDs
|
// Log resolved IDs
|
||||||
logMessage("Resolved attribute IDs: password=$customAttributeId, site=" . ($siteAttributeId ?? 'N/A') . ", antenaSectorial=" . ($antenaSectorialAttributeId ?? 'N/A'));
|
logMessage("Resolved attribute IDs: password=$customAttributeId, site=" . ($siteAttributeId ?? 'N/A') . ", antenaSectorial=" . ($antenaSectorialAttributeId ?? 'N/A'));
|
||||||
|
|
||||||
// Build attribute IDs map for fixClientData
|
return [
|
||||||
$attributeIds = [
|
|
||||||
'password' => $customAttributeId,
|
'password' => $customAttributeId,
|
||||||
'site' => $siteAttributeId,
|
'site' => $siteAttributeId,
|
||||||
'antenaSectorial' => $antenaSectorialAttributeId,
|
'antenaSectorial' => $antenaSectorialAttributeId,
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// -- Main Execution --
|
// -- Main Execution --
|
||||||
|
|
||||||
|
if (!defined('INCLUDED_AS_LIBRARY')) {
|
||||||
|
// Initialization
|
||||||
|
$config = PluginConfigManager::create()->loadConfig();
|
||||||
|
$ipServer = $config['ipserver'] ?? 'localhost';
|
||||||
|
$apiUrl = "https://$ipServer/crm/api/v1.0/";
|
||||||
|
$token = $config['apitoken'] ?? '';
|
||||||
|
|
||||||
|
if (empty($token)) {
|
||||||
|
logMessage("Error: API Token is missing in plugin configuration.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize UCRM Client
|
||||||
|
$client = new Client([
|
||||||
|
'base_uri' => $apiUrl,
|
||||||
|
'verify' => false,
|
||||||
|
'headers' => [
|
||||||
|
'X-Auth-App-Key' => $token,
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$ucrmApi = new UcrmApi($client, $token);
|
||||||
|
|
||||||
|
// Initialize UNMS Client
|
||||||
|
$unmsClient = new Client([
|
||||||
|
'base_uri' => "https://{$ipServer}/nms/api/v2.1/",
|
||||||
|
'verify' => false,
|
||||||
|
'headers' => [
|
||||||
|
'X-Auth-Token' => $config['unmsApiToken'] ?? ''
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Resolve IDs
|
||||||
|
$attributeIds = resolveAttributeIds($ucrmApi, $customAttributeKey, $siteAttributeKey, $antenaSectorialAttributeKey);
|
||||||
|
if (!$attributeIds) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($fixOption === null) {
|
if ($fixOption === null) {
|
||||||
// Check for --file argument
|
// Check for --file argument
|
||||||
$fileOption = null;
|
$fileOption = null;
|
||||||
@ -454,7 +500,6 @@ if ($fixOption === null) {
|
|||||||
|
|
||||||
if ($fileOption) {
|
if ($fileOption) {
|
||||||
if ($fileOption[0] !== '/') {
|
if ($fileOption[0] !== '/') {
|
||||||
global $initialDir;
|
|
||||||
$fileOption = $initialDir . '/' . $fileOption;
|
$fileOption = $initialDir . '/' . $fileOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,9 +514,6 @@ if ($fixOption === null) {
|
|||||||
$lines = file($fileOption, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
$lines = file($fileOption, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
|
||||||
// Process lines
|
// Process lines
|
||||||
// We need to loop, process, remove, rewrite.
|
|
||||||
// Ideally, we process the list in memory and rewrite the file after EACH success to satisfy "removing it as we go".
|
|
||||||
|
|
||||||
$originalCount = count($lines);
|
$originalCount = count($lines);
|
||||||
$processedCount = 0;
|
$processedCount = 0;
|
||||||
|
|
||||||
@ -480,12 +522,6 @@ if ($fixOption === null) {
|
|||||||
file_put_contents($fileOption, implode("\n", $remainingLines) . "\n");
|
file_put_contents($fileOption, implode("\n", $remainingLines) . "\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// We allow a header row if it starts with "clientId" or "id"
|
|
||||||
// If we remove the header, we lose it for subsequent runs? No, we should probably keep header if present?
|
|
||||||
// Or just assume data.
|
|
||||||
// Let's assume the user might have a header.
|
|
||||||
// If the first line is non-numeric, treat as header?
|
|
||||||
|
|
||||||
$header = null;
|
$header = null;
|
||||||
if (!empty($lines)) {
|
if (!empty($lines)) {
|
||||||
$firstLine = $lines[0];
|
$firstLine = $lines[0];
|
||||||
@ -508,16 +544,9 @@ if ($fixOption === null) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process Client
|
|
||||||
$clientId = (int)$clientId;
|
$clientId = (int)$clientId;
|
||||||
logMessage("Processing ID from file: $clientId");
|
logMessage("Processing ID from file: $clientId");
|
||||||
|
|
||||||
// Use fetchAllClients filtered by ID? No, too slow.
|
|
||||||
// Directly use fixClientPassword which fetches services inside.
|
|
||||||
// BUT we need the current password to decide if we fix?
|
|
||||||
// `fixClientPassword` takes `$currentPassword`.
|
|
||||||
// We can fetch the specific client first.
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$clientDataResponse = $ucrmApi->get("clients/$clientId");
|
$clientDataResponse = $ucrmApi->get("clients/$clientId");
|
||||||
$currentAttributes = $clientDataResponse['attributes'] ?? [];
|
$currentAttributes = $clientDataResponse['attributes'] ?? [];
|
||||||
@ -529,10 +558,6 @@ if ($fixOption === null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if valid (same logic as audit)
|
|
||||||
// Actually, if it's in the list, we assume it's invalid?
|
|
||||||
// Or should we re-validate? safer to re-validate slightly to get current state.
|
|
||||||
|
|
||||||
$fixResult = fixClientData($clientId, $ucrmApi, $unmsClient, $attributeIds, $config, $currentPass);
|
$fixResult = fixClientData($clientId, $ucrmApi, $unmsClient, $attributeIds, $config, $currentPass);
|
||||||
$newPass = $fixResult['password'];
|
$newPass = $fixResult['password'];
|
||||||
$siteInfo = $fixResult['siteName'] ? " | Site: {$fixResult['siteName']}" : '';
|
$siteInfo = $fixResult['siteName'] ? " | Site: {$fixResult['siteName']}" : '';
|
||||||
@ -540,22 +565,14 @@ if ($fixOption === null) {
|
|||||||
logMessage("Client $clientId result: $newPass$siteInfo$devInfo");
|
logMessage("Client $clientId result: $newPass$siteInfo$devInfo");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
logMessage("Error processing Client $clientId: " . $e->getMessage());
|
logMessage("Error processing Client $clientId: " . $e->getMessage());
|
||||||
// Do we remove it if error?
|
|
||||||
// User said "que cada que procese un id lo quite".
|
|
||||||
// Usually specific errors might warrant keeping, but if we want to "resume", maybe we remove logic?
|
|
||||||
// Let's assuming "Processed" means attempted.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite file
|
// Rewrite file
|
||||||
// Content = Header (if any) + Remaining Queue
|
|
||||||
$validLines = $queue;
|
$validLines = $queue;
|
||||||
if ($header) {
|
if ($header) {
|
||||||
array_unshift($validLines, $header);
|
array_unshift($validLines, $header);
|
||||||
}
|
}
|
||||||
$rewriteFile($validLines);
|
$rewriteFile($validLines);
|
||||||
|
|
||||||
// Sleep slightly to avoid hammering?
|
|
||||||
// usleep(100000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logMessage("File processing complete.");
|
logMessage("File processing complete.");
|
||||||
@ -592,12 +609,6 @@ foreach ($clients as $clientData) {
|
|||||||
$isValid = true;
|
$isValid = true;
|
||||||
$reason = "";
|
$reason = "";
|
||||||
|
|
||||||
// Strict validation for "invalid" detection to trigger fix,
|
|
||||||
// BUT we need to be careful not to flag "valid" generated strings (like "Servicio 1: ...") as invalid if we just want to audit "missing".
|
|
||||||
// Facade generates complex strings. If we flag them all as invalid because of spaces, we will loop forever fixing them (if generating same structure).
|
|
||||||
// Logic: If it contains "Servicio" or "⚠️", it is "Managed".
|
|
||||||
// Only flag if Empty OR (Length check fail AND Not Managed).
|
|
||||||
|
|
||||||
// Detect explicit error states that should be retried (e.g. "⚠️ Error Regenerating...")
|
// Detect explicit error states that should be retried (e.g. "⚠️ Error Regenerating...")
|
||||||
$isError = (stripos((string)$password, 'Error') !== false);
|
$isError = (stripos((string)$password, 'Error') !== false);
|
||||||
|
|
||||||
@ -672,3 +683,4 @@ foreach ($results as $row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logMessage("Done.");
|
logMessage("Done.");
|
||||||
|
}
|
||||||
|
|||||||
@ -16,6 +16,8 @@ use GuzzleHttp\Client as GuzzleClient;
|
|||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
|
||||||
|
|
||||||
|
use Ubnt\UcrmPluginSdk\Service\PluginConfigManager;
|
||||||
|
|
||||||
class PluginNotifierFacade extends AbstractStripeOperationsFacade
|
class PluginNotifierFacade extends AbstractStripeOperationsFacade
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -49,6 +51,83 @@ class PluginNotifierFacade extends AbstractStripeOperationsFacade
|
|||||||
$this->getVaultCredentialsByClientId($clientId);
|
$this->getVaultCredentialsByClientId($clientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesar la lógica de corrección de contraseña cuando se detecta la etiqueta "OBTENER PASSWORD ANTENA".
|
||||||
|
* Reutiliza la lógica del script audit_client_passwords.php.
|
||||||
|
*/
|
||||||
|
public function processClientPasswordAntenna(int $clientId, array $clientEntity): void
|
||||||
|
{
|
||||||
|
$this->logger->info("Procesando etiqueta OBTENER PASSWORD ANTENA para cliente $clientId");
|
||||||
|
|
||||||
|
// 1. Define constant to prevent script execution when including
|
||||||
|
if (!defined('INCLUDED_AS_LIBRARY')) {
|
||||||
|
define('INCLUDED_AS_LIBRARY', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Include the script functions
|
||||||
|
$scriptPath = __DIR__ . '/../../scripts-uisp/audit_client_passwords.php';
|
||||||
|
if (file_exists($scriptPath)) {
|
||||||
|
require_once $scriptPath;
|
||||||
|
} else {
|
||||||
|
$this->logger->error("No se encontró el script de auditoría en: $scriptPath");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Initialize Config & UNMS Client
|
||||||
|
// Note: $this->ucrmApi is already available from parent class.
|
||||||
|
$ucrmConfig = PluginConfigManager::create()->loadConfig();
|
||||||
|
$ipServer = $ucrmConfig['ipserver'] ?? 'localhost';
|
||||||
|
|
||||||
|
$unmsToken = $ucrmConfig['unmsApiToken'] ?? $this->pluginData->unmsAppToken ?? '';
|
||||||
|
|
||||||
|
if (empty($unmsToken)) {
|
||||||
|
$this->logger->error("UNMS API Token is missing. Cannot proceed with password fix.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$unmsClientInstance = new GuzzleClient([
|
||||||
|
'base_uri' => "https://{$ipServer}/nms/api/v2.1/",
|
||||||
|
'verify' => false,
|
||||||
|
'headers' => [
|
||||||
|
'X-Auth-Token' => $unmsToken
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 4. Resolve Attributes
|
||||||
|
// Use global function from script
|
||||||
|
$attributeIds = \resolveAttributeIds($this->ucrmApi, 'passwordAntenaCliente', 'site', 'antenaSectorial');
|
||||||
|
if (!$attributeIds) {
|
||||||
|
$this->logger->error("Could not resolve attributes for password fix.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Get current password
|
||||||
|
$currentPassword = null;
|
||||||
|
foreach ($clientEntity['attributes'] ?? [] as $attr) {
|
||||||
|
if ($attr['key'] === 'passwordAntenaCliente') {
|
||||||
|
$currentPassword = $attr['value'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Fix Data
|
||||||
|
try {
|
||||||
|
$fixResult = \fixClientData($clientId, $this->ucrmApi, $unmsClientInstance, $attributeIds, $ucrmConfig, $currentPassword);
|
||||||
|
$this->logger->info("Password fix result for client $clientId: " . json_encode($fixResult));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->logger->error("Error executing fixClientData: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7. Remove Tag
|
||||||
|
// Reuse parent method
|
||||||
|
$this->removeTagFromClient($clientId, 'OBTENER PASSWORD ANTENA');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of abstract method from AbstractStripeOperationsFacade
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implementation of abstract method from AbstractStripeOperationsFacade
|
* Implementation of abstract method from AbstractStripeOperationsFacade
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -455,17 +455,22 @@ class Plugin
|
|||||||
|
|
||||||
$clabeTagExistsBefore = false;
|
$clabeTagExistsBefore = false;
|
||||||
$stripeTagExistsBefore = false;
|
$stripeTagExistsBefore = false;
|
||||||
|
$passwordAntenaTagExistsBefore = false;
|
||||||
|
|
||||||
$clabeTagExists = false;
|
$clabeTagExists = false;
|
||||||
$stripeTagExists = false;
|
$stripeTagExists = false;
|
||||||
|
$passwordAntenaTagExists = false;
|
||||||
|
|
||||||
foreach ($tagsBefore as $tag) {
|
foreach ($tagsBefore as $tag) {
|
||||||
if ($tag['name'] === 'CREAR CLABE STRIPE') $clabeTagExistsBefore = true;
|
if ($tag['name'] === 'CREAR CLABE STRIPE') $clabeTagExistsBefore = true;
|
||||||
if ($tag['name'] === 'CREAR CLIENTE STRIPE') $stripeTagExistsBefore = true;
|
if ($tag['name'] === 'CREAR CLIENTE STRIPE') $stripeTagExistsBefore = true;
|
||||||
|
if ($tag['name'] === 'OBTENER PASSWORD ANTENA') $passwordAntenaTagExistsBefore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if ($tag['name'] === 'CREAR CLABE STRIPE') $clabeTagExists = true;
|
if ($tag['name'] === 'CREAR CLABE STRIPE') $clabeTagExists = true;
|
||||||
if ($tag['name'] === 'CREAR CLIENTE STRIPE') $stripeTagExists = true;
|
if ($tag['name'] === 'CREAR CLIENTE STRIPE') $stripeTagExists = true;
|
||||||
|
if ($tag['name'] === 'OBTENER PASSWORD ANTENA') $passwordAntenaTagExists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clabeTagExists && !$clabeTagExistsBefore) {
|
if ($clabeTagExists && !$clabeTagExistsBefore) {
|
||||||
@ -477,6 +482,11 @@ class Plugin
|
|||||||
$this->logger->debug('La etiqueta CREAR CLIENTE STRIPE se agregó al cliente');
|
$this->logger->debug('La etiqueta CREAR CLIENTE STRIPE se agregó al cliente');
|
||||||
$this->pluginNotifierFacade->createStripeClient($notification, 'CREAR CLIENTE STRIPE', false);
|
$this->pluginNotifierFacade->createStripeClient($notification, 'CREAR CLIENTE STRIPE', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($passwordAntenaTagExists && !$passwordAntenaTagExistsBefore) {
|
||||||
|
$this->logger->debug('La etiqueta OBTENER PASSWORD ANTENA se agregó al cliente');
|
||||||
|
$this->pluginNotifierFacade->processClientPasswordAntenna($clientID, $entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatización: Sincronizar cambios de Nombre o Email con Stripe
|
// Automatización: Sincronizar cambios de Nombre o Email con Stripe
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user