Yaron Koren has uploaded a new change for review. ( 
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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms 
refs/changes/36/326036/2

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: newchange
Gerrit-Change-Id: I0b0a9ad17ddce99f55647a5afcf1ab8fb15106a6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to