Index: /extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php
===================================================================
--- /extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php	(revision 6900)
+++ /extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php	(revision 6901)
@@ -3,5 +3,5 @@
   class name: GCPRequestBuilder
   class version  : 1.1.0
-  plugin version : 3.1.0
+  plugin version : 3.2.0
   date           : 2010-09-08
 
@@ -90,5 +90,5 @@
  *  - getWhere
  *  - getJoin
- *  - getImageId (used for multirecord requests only)
+ *  - getImageId
  *
  * Retrieving the results
@@ -102,25 +102,9 @@
  *               is builded, but it is used only when retrieving the results for
  *               multirecord tables)
+ *  - formatData
  *
  *
- * Example 1 : single record request
- * ---------------------------------
- * Consider the table "tableA" like this
- *
- *  - (*) imageId
- *  -     att1
- *  -     att2
- *  The primary key is the 'imageId' attribute
- *    => for one imageId, you can only have ZERO or ONE record
- *
- *  getSelect returns : "tableA.att1, tableA.att2"
- *  getFrom returns   : "tableA"
- *  getWhere returns  : "tableA.att1 = zzzz"
- *  getJoin returns   : "tableA.imageId = pit.id"
- *  getFilter returns : ""
- *
- *
- * Example 2 : multi records request
- * ---------------------------------
+ * Example
+ * -------
  * Consider the table "tableA" like this
  *
@@ -137,7 +121,7 @@
  *  getSelect returns  : "tableA.att1, tableA.att2"
  *  getFrom returns    : "tableA"
- *  getWhere returns   : "tableA.att1 = zzzz AND tableA.att1 = xxxx"
- *  getJoin returns    : "tableA.id = pit.id"
- *  getFilter returns  : ""
+ *  getWhere returns   : "tableA.localId= xxxx AND tableA.att1 = zzzz"
+ *  getJoin returns    : "tableA.imageId = pit.id"
+ *  getFilter returns  : "tableA.localId= xxxx"
  *
  */
@@ -402,4 +386,37 @@
     $tablef= new GPCTables(self::$tables);
     $tablef->create($tablesDef);
+
+    return(true);
+  }
+
+  /**
+   * update the tables needed by RequestBuilder (used during the gpc process
+   * activation)
+   */
+  static public function updateTables($pluginPreviousRelease)
+  {
+    $tablesCreate=array();
+    $tablesUpdate=array();
+
+    switch($pluginPreviousRelease)
+    {
+      case '03.01.00':
+        $tablesCreate[]=
+"CREATE TABLE `".self::$tables['temp']."` (
+  `requestId` char(30) NOT NULL,
+  `imageId` mediumint(8) unsigned NOT NULL,
+  PRIMARY KEY  (`request`,`id`)
+)
+CHARACTER SET utf8 COLLATE utf8_general_ci";
+
+        $tablesUpdate[self::$tables['request']]['filter']=
+"ADD COLUMN  `filter` text NOT NULL default '' ";
+        break;
+    }
+
+    $tablef=new GPCTables(self::$tables);
+
+    if(count($tablesCreate)>0) $tablef->create($tablesCreate);
+    if(count($tablesUpdate)>0) $tablef->updateTablesFields($tablesUpdate);
 
     return(true);
Index: /extensions/GrumPluginClasses/gpc_install.class.inc.php
===================================================================
--- /extensions/GrumPluginClasses/gpc_install.class.inc.php	(revision 6900)
+++ /extensions/GrumPluginClasses/gpc_install.class.inc.php	(revision 6901)
@@ -46,4 +46,9 @@
     public function install()
     {
+      $this->initConfig();
+      $this->loadConfig();
+      $this->config['installed']=GPC_VERSION2;
+      $this->saveConfig();
+
       $result=GPCRequestBuilder::createTables();
       return($result);
@@ -70,4 +75,28 @@
     public function activate()
     {
+      global $template, $user;
+
+      $this->initConfig();
+      $this->loadConfig();
+
+      /*
+       * if there is no version information available, assume the previous
+       *  installed release of the plugin is 3.1.0
+       */
+      if(!isset($this->config['installed'])) $this->config['installed']='03.01.00';
+
+      /*
+      switch($this->config['installed'])
+      {
+        case '03.01.00':
+          GPCRequestBuilder::updateTables($this->config['installed']);
+          break;
+      }
+      */
+      GPCRequestBuilder::updateTables($this->config['installed']);
+
+
+      $this->config['installed']=GPC_VERSION2; //update the installed release number
+      $this->saveConfig();
     }
 
