Пример #1
0
 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'samples'
         TTransaction::open('db_crmbf');
         // instantiates object Customer
         $customer = new CRM($key);
         // deletes the object from the database
         $customer->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', "Registro Deletado");
     } catch (Exception $e) {
         // in case of exception
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }