[Vtigercrm-commits] [Vtiger development] #8084: If it's a vtlib module, then record deletion will not erase data from database

Vtiger development vtiger-tickets at trac.vtiger.com
Sun Jun 29 19:06:18 GMT 2014


#8084: If it's a vtlib module, then record deletion will not erase data from
database
----------------------------+--------------------------
 Reporter:  uma             |       Owner:  developer
     Type:  Need More Info  |      Status:  new
 Priority:  major           |   Milestone:  6.1.0
Component:  vtigercrm       |     Version:  6.1.0 - wip
 Severity:  High            |  Resolution:
 Keywords:                  |
----------------------------+--------------------------

Comment (by holbi):

 I have just created two different custom module using vtlib and entity
 module example:
 http://community.vtiger.com/help/vtigercrm/developers/extensions/examples
 /entity-module.html
 Both of them shows the issue raised in this ticket.
 Delete record from the Custom module -> First the record marked as deleted
 in the vtiger_crmentity table (OK)
 Recycle Bin -> Empty Recycle Bin, or Delete (list view action) -> The
 marked earlier record erased from the vtiger_crmentity table (OK)
 BUT, the record from the vtiger_custom-module table and from the
 vtiger_custom-modulecf table did not remove.

 How to reproduce: Install a custom module with database (e.g. module
 Expenses from the sample site, link above), and create a record and delete
 a record, and erase and/or delete from the Recycle Bin.

 class RecycleBin_Module_Model responsible for the record deleting and
 there is not any command to delete the custom module records from the
 vtiger_custom-module table and from the vtiger_custom-modulecf table.

 Please look at the functions:
         /*/
         /*/ Function to delete the reccords perminently in vitger CRM
 database
         /*/
         public function emptyRecycleBin(){
                 $db = PearDatabase::getInstance();

                 $db->query('DELETE FROM vtiger_crmentity WHERE deleted =
 1');
                 $db->query('DELETE FROM vtiger_relatedlists_rb');

                 return true;
         }

         /*/
         /*/ Function to deleted the records perminently in CRM
         /*/ @param type $reocrdIds
         /*/
         public function deleteRecords($recordIds){
                 $db = PearDatabase::getInstance();
                 //Delete the records in vtiger crmentity and relatedlists.
                 $query = 'DELETE FROM vtiger_crmentity WHERE deleted = ?
 and crmid in('.generateQuestionMarks($recordIds).')';
                 $db->pquery($query, array(1, $recordIds));

                 $query = 'DELETE FROM vtiger_relatedlists_rb WHERE
 entityid in('.generateQuestionMarks($recordIds).')';
                 $db->pquery($query, array($recordIds));

                 // TODO - Remove records from module tables and other
 related stores.
         }

 Only a TODO marks there to write necessary code to remove records from the
 module table.
 It looks like in the old (standard) modules there are rewritten delete()
 methods to extend the basic, and it is the reason why it does not work in
 the custom modules.

--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8084#comment:4>
Vtiger development <http://trac.vtiger.com/>
Vtiger CRM


More information about the vtigercrm-commits mailing list