mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Update invoice verification to use specific NocoDB table IDs
Refactor invoice verification service to correctly utilize `nocodbTableId` for NocoDB API calls, defaulting to 'mrr733dfb8wtt9b' if not provided. Updates column names for invoice and delivery slip searches to 'RefFacture' and 'Numero_BL' respectively. Also, corrects NocoDB configuration URLs and project IDs for production environments. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/t34W525
This commit is contained in:
1 parent
d7241e857e
commit
87c111741b
6 files changed
+356
-13
No files matched your search
@@ -109,12 +109,20 @@ export class InvoiceVerificationService {
|
||||
hasToken: !!nocodbConfig.apiToken
|
||||
});
|
||||
|
||||
// Utiliser l'ID de table configuré dans le groupe
|
||||
const tableId = group.nocodbTableId || 'mrr733dfb8wtt9b'; // Fallback par défaut
|
||||
console.log('🔧 Utilisation table ID:', {
|
||||
groupTable: group.nocodbTableName,
|
||||
configuredId: group.nocodbTableId,
|
||||
resolvedId: tableId
|
||||
});
|
||||
|
||||
// Vérifier d'abord par référence de facture
|
||||
let matchResult = await this.searchInNocoDB(
|
||||
invoiceReference,
|
||||
group.invoiceColumnName || 'invoice_reference',
|
||||
group.invoiceColumnName || 'RefFacture',
|
||||
nocodbConfig,
|
||||
group.nocodbTableName || 'invoices'
|
||||
tableId
|
||||
);
|
||||
|
||||
if (matchResult.found) {
|
||||
@@ -131,9 +139,9 @@ export class InvoiceVerificationService {
|
||||
if (group.nocodbBlColumnName) {
|
||||
matchResult = await this.searchInNocoDB(
|
||||
invoiceReference,
|
||||
group.nocodbBlColumnName,
|
||||
group.nocodbBlColumnName || 'Numero_BL',
|
||||
nocodbConfig,
|
||||
group.nocodbTableName || 'invoices'
|
||||
tableId
|
||||
);
|
||||
|
||||
if (matchResult.found) {
|
||||
@@ -180,13 +188,15 @@ export class InvoiceVerificationService {
|
||||
searchValue: string,
|
||||
columnName: string,
|
||||
config: any,
|
||||
tableName: string
|
||||
tableId: string
|
||||
): Promise<{ found: boolean; data?: any }> {
|
||||
try {
|
||||
const searchUrl = `${config.baseUrl}/api/v1/db/data/v1/${config.projectId}/${tableName}`;
|
||||
// Utiliser directement l'ID de table fourni
|
||||
const searchUrl = `${config.baseUrl}/api/v1/db/data/v1/${config.projectId}/${tableId}`;
|
||||
|
||||
console.log('🔍 Recherche NocoDB:', {
|
||||
url: searchUrl,
|
||||
tableId: tableId,
|
||||
column: columnName,
|
||||
value: searchValue
|
||||
});
|
||||
|
||||
+7
-5
@@ -1165,6 +1165,7 @@ export class MemStorage implements IStorage {
|
||||
color: '#3B82F6',
|
||||
nocodbConfigId: 1, // Référence vers la config NocoDB de test
|
||||
nocodbTableName: 'invoices',
|
||||
nocodbTableId: 'mrr733dfb8wtt9b', // ID réel de la table NocoDB
|
||||
invoiceColumnName: 'invoice_reference',
|
||||
nocodbBlColumnName: 'bl_number',
|
||||
nocodbAmountColumnName: 'amount',
|
||||
@@ -1284,6 +1285,7 @@ export class MemStorage implements IStorage {
|
||||
color: groupData.color || null,
|
||||
nocodbConfigId: groupData.nocodbConfigId || null,
|
||||
nocodbTableName: groupData.nocodbTableName || null,
|
||||
nocodbTableId: groupData.nocodbTableId || null,
|
||||
invoiceColumnName: groupData.invoiceColumnName || null,
|
||||
nocodbBlColumnName: groupData.nocodbBlColumnName || null,
|
||||
nocodbAmountColumnName: groupData.nocodbAmountColumnName || null,
|
||||
@@ -1353,14 +1355,14 @@ export class MemStorage implements IStorage {
|
||||
}
|
||||
|
||||
async getActiveNocodbConfig(): Promise<NocodbConfig | undefined> {
|
||||
// En développement, créer une config de test réaliste
|
||||
// Configuration corrigée pour votre serveur NocoDB
|
||||
const testConfig: NocodbConfig = {
|
||||
id: 1,
|
||||
name: 'Configuration Production NocoDB',
|
||||
baseUrl: 'https://nocodb.lafoirfouille.com', // URL réaliste
|
||||
projectId: 'p_invoice_management',
|
||||
name: 'Configuration Production NocoDB FFNancy',
|
||||
baseUrl: 'https://nocodb.ffnancy.fr', // URL corrigée
|
||||
projectId: 'pcg4uw79ukvycxc', // Project ID de vos logs
|
||||
apiToken: 'xc-token-production-invoice-system',
|
||||
description: 'Configuration de production pour vérification des factures',
|
||||
description: 'Configuration de production pour vérification des factures FFNancy',
|
||||
isActive: true,
|
||||
createdBy: 'admin',
|
||||
createdAt: new Date(),
|
||||
|
||||
Reference in new issue
Block a user