0 Replies Latest reply on Sep 22, 2007 12:33 AM by (Marcell_Branco)

    Multiple delete linked to multiple insert

      Hello folks!

      I'm developing a CMS and using ADDT to build most of the database operations. I'm registering user's activities in a db table. After each insert, update or delete, I link the requested transaction to an insert transaction to register it in my "changes" table. I'm having a little problem with linking multiple transactions. When I link a multiple delete, for example, to a multiple insert transaction in my detail page, they end without registering values in my tables. No errors are shown. I thought maybe an ADDT hero around could give me a hand and also this scenario could bring good ideas to others.

      The dynamic list sends the url variables correctly (detail.php?id=1&id_1=2.. etc). The delete transaction are trigged by the "KT_delete1" form variable. I presume it is been passed as the transaction finish and I'm redirected as I should (the url gets the "transaction=deleteTxt" variable). Here's my code:

      //start Trigger_LinkTransactions trigger
      function Trigger_LinkTransactions_del(&$tNG) {
      global $ins_alteracoesDelete;
      $linkObj = new tNG_LinkedTrans($tNG, $ins_alteracoesDelete);
      $linkObj->setLink("altFKey");
      return $linkObj->Execute();
      }
      //end Trigger_LinkTransactions trigger

      // Make an instance of the transaction object
      $del_textos = new tNG_multipleDelete($conn_equylybraCMS);
      $tNGs->addTransaction($del_textos);
      // Register triggers
      $del_textos->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Delete1");
      $del_textos->registerTrigger("AFTER", "Trigger_LinkTransactions_del", 98);
      $del_textos->registerTrigger("ERROR", "Trigger_LinkTransactions_del", 98);
      $del_textos->registerTrigger("END", "Trigger_Default_Redirect", 99, "listar.php?modulo=Textos&categoria={GET.categoria}&transaction=deleteTxt");
      // Add columns
      $del_textos->setTable("inscricoes_pagamentos");
      $del_textos->setPrimaryKey("pgtNumInscricao", "NUMERIC_TYPE", "GET", "txtID");

      // Make an insert transaction instance
      $ins_alteracoesDelete = new tNG_multipleInsert($conn_equylybraCMS);
      $tNGs->addTransaction($ins_alteracoesDelete);
      // Register triggers
      $ins_alteracoesDelete->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "");
      // Add columns
      $ins_alteracoesDelete->setTable("alteracoes");
      $ins_alteracoesDelete->addColumn("altUsuario", "NUMERIC_TYPE", "POST", "altUsuario");
      $ins_alteracoesDelete->addColumn("altTipo", "NUMERIC_TYPE", "VALUE", "3");
      $ins_alteracoesDelete->addColumn("altDescricao", "STRING_TYPE", "VALUE", "Excluiu texto - {POST.txtTituloDelete}");
      $ins_alteracoesDelete->addColumn("altFKey", "NUMERIC_TYPE", "VALUE", "");
      $ins_alteracoesDelete->setPrimaryKey("altID", "NUMERIC_TYPE");

      * To makes it easier: "alteracoes" means "changes" and "textos" means "text" in my language (portuguese)