File tree Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -311,26 +311,46 @@ void QgsRelation::updateRelationStatus()
311
311
mValid = true ;
312
312
313
313
if ( mRelationId .isEmpty () )
314
- mValid = false ;
315
-
316
- if ( !mReferencedLayer || !mReferencingLayer )
317
314
{
315
+ QgsDebugMsg ( " Invalid relation: no ID" );
318
316
mValid = false ;
319
- }
317
+ }
320
318
else
321
319
{
322
- if ( mFieldPairs . count () < 1 )
320
+ if ( ! mReferencedLayer )
323
321
{
322
+ QgsDebugMsg ( QString (" Invalid relation: referenced layer does not exist. ID: %1" ).arg (mReferencedLayerId ) );
324
323
mValid = false ;
325
324
}
326
-
327
- Q_FOREACH ( const FieldPair& fieldPair, mFieldPairs )
325
+ else if ( !mReferencingLayer )
328
326
{
329
- if ( -1 == mReferencingLayer ->fieldNameIndex ( fieldPair.first )
330
- || -1 == mReferencedLayer ->fieldNameIndex ( fieldPair.second ) )
327
+ QgsDebugMsg ( QString (" Invalid relation: referencing layer does not exist. ID: %2" ).arg (mReferencingLayerId ) );
328
+ mValid = false ;
329
+ }
330
+ else
331
+ {
332
+ if ( mFieldPairs .count () < 1 )
331
333
{
334
+ QgsDebugMsg ( " Invalid relation: no pair of field is specified." );
332
335
mValid = false ;
333
336
}
337
+
338
+ Q_FOREACH ( const FieldPair& fieldPair, mFieldPairs )
339
+ {
340
+ if ( -1 == mReferencingLayer ->fieldNameIndex ( fieldPair.first ))
341
+ {
342
+ QgsDebugMsg ( QString (" Invalid relation: field %1 does not exist in referencing layer %2" ).arg (fieldPair.first , mReferencingLayer ->name ()) );
343
+ mValid = false ;
344
+ break ;
345
+ }
346
+ else if ( -1 == mReferencedLayer ->fieldNameIndex ( fieldPair.second ) )
347
+ {
348
+ QgsDebugMsg ( QString (" Invalid relation: field %1 does not exist in referencedg layer %2" ).arg (fieldPair.second , mReferencedLayer ->name ()) );
349
+ mValid = false ;
350
+ break ;
351
+ }
352
+ }
334
353
}
354
+
335
355
}
336
356
}
You can’t perform that action at this time.
0 commit comments