Fix bug where enable/disable trigger option would be set incorrectly for multiple...
authorxzilla <rob@xzilla.net>
Sat, 12 Feb 2011 22:47:03 +0000 (17:47 -0500)
committerxzilla <rob@xzilla.net>
Sat, 12 Feb 2011 22:47:03 +0000 (17:47 -0500)
triggers.php

index 9aa8c87c1dbab22179544ea0be60eb160d6f130b..7f586cb2d18bbf0424e7f65bdea8ad9156e034b8 100644 (file)
                global $data, $misc, $database;
                global $lang;
 
-               function tgPre(&$rowdata) {
-                       global $data, $lang;
+               function tgPre(&$rowdata,$actions) {
+                       global $data;
                        // Nasty hack to support pre-7.4 PostgreSQL
                        $rowdata->fields['+tgdef'] = $rowdata->fields['tgdef'] !== null
                                                                        ? $rowdata->fields['tgdef']
                                                                        : $data->getTriggerDef($rowdata->fields);
+
+
+                       // toggle enable/disable trigger per trigger
+                       if( ! $data->phpBool( $rowdata->fields["tgenabled"] ) ) {
+                               unset( $actions['disable'] );
+                       }
+                       else{
+                               unset( $actions['enable'] );
+                       }
+
+                       return $actions;
                }
                
                $misc->printTrail('table');
                        ),
                );
                if($data->hasDisableTriggers()) {
-                       if(!$data->phpBool($triggers->fields["tgenabled"])) {
                                $actions['enable'] = array(
                                        'title' => $lang['strenable'],
                                        'url'   => "triggers.php?action=confirm_enable&amp;{$misc->href}&amp;table=".urlencode($_REQUEST['table'])."&amp;",
                                        'vars'  => array('trigger' => 'tgname'),
                                );
-                       } else {
                                $actions['disable'] = array(
                                        'title' => $lang['strdisable'],
                                        'url'   => "triggers.php?action=confirm_disable&amp;{$misc->href}&amp;table=".urlencode($_REQUEST['table'])."&amp;",
                                        'vars'  => array('trigger' => 'tgname'),
                                );
-                       }
                }
 
                $misc->printTable($triggers, $columns, $actions, $lang['strnotriggers'], 'tgPre');