Yaron Koren has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/326036 )

Change subject: Fix for parsing templates that have an "attached" Cargo table
......................................................................


Fix for parsing templates that have an "attached" Cargo table

Change-Id: I0b0a9ad17ddce99f55647a5afcf1ab8fb15106a6
---
M includes/PF_Template.php
1 file changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/PF_Template.php b/includes/PF_Template.php
index a838ab4..936a30f 100644
--- a/includes/PF_Template.php
+++ b/includes/PF_Template.php
@@ -195,10 +195,18 @@
                // See if there even is DB storage for this template - if not,
                // exit.
                if ( is_null( $tableSchemaString ) ) {
-                       return null;
+                       // There's no declared table - but see if there's an
+                       // attached table.
+                       list( $tableName, $isDeclared ) = 
CargoUtils::getTableNameForTemplate( $templateTitle );
+                       if ( $tableName == null ) {
+                               return null;
+                       }
+                       $mainTemplatePageID = 
CargoUtils::getTemplateIDForDBTable( $tableName );
+                       $tableSchemaString = CargoUtils::getPageProp( 
$mainTemplatePageID, 'CargoFields' );
+               } else {
+                       $tableName = CargoUtils::getPageProp( $templatePageID, 
'CargoTableName' );
                }
                $tableSchema = CargoTableSchema::newFromDBString( 
$tableSchemaString );
-               $tableName = CargoUtils::getPageProp( $templatePageID, 
'CargoTableName' );
 
                // Then, match template params to Cargo table fields, by
                // parsing call(s) to #cargo_store.

-- 
To view, visit https://gerrit.wikimedia.org/r/326036
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b0a9ad17ddce99f55647a5afcf1ab8fb15106a6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to