Example #1
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     global $adb;
     if ($event_type == 'module.postinstall') {
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1');
         $Instance = Vtiger_Module::getInstance($modulename);
         $nModule = Vtiger_Module::getInstance('Accounts');
         if ($nModule) {
             $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list');
         }
         $Instance = Vtiger_Module::getInstance($modulename);
         $nModule = Vtiger_Module::getInstance('Invoice');
         if ($nModule) {
             $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list');
         }
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('Payments'));
             }
         }
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         $tabid = Vtiger_Functions::getModuleId($modulename);
         include_once 'modules/ModTracker/ModTracker.php';
         $moduleModTrackerInstance = new ModTracker();
         if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
             $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         } else {
             $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         }
         if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
             $moduleInstance = Vtiger_Module::getInstance($tabid);
             $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
         }
         $this->addWorkflow($modulename);
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
function modcomms_changeModuleVisibility($mname, $status)
{
    include_once 'modules/ModComments/ModComments.php';
    if ($status == 'module_disable') {
        ModComments::removeWidgetFrom(array($mname));
    } else {
        ModComments::addWidgetTo(array($mname));
    }
}
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type
  */
 function vtlib_handler($moduleName, $eventType)
 {
     $adb = PearDatabase::getInstance();
     if ($eventType == 'module.postinstall') {
         $ModuleInstance = CRMEntity::getInstance('QuotesEnquires');
         $ModuleInstance->setModuleSeqNumber("configure", 'QuotesEnquires', 'ID', '1');
         // co w miejsce id
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('QuotesEnquires'));
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('QuotesEnquires'));
             }
         }
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
         if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
             include_once 'vtlib/Vtiger/Module.php';
             include_once 'modules/ModTracker/ModTracker.php';
             $tabid = Vtiger_Functions::getModuleId('QuotesEnquires');
             $moduleModTrackerInstance = new ModTracker();
             if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
                 $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
                 $moduleModTrackerInstance->updateCache($tabid, 1);
             } else {
                 $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
                 $moduleModTrackerInstance->updateCache($tabid, 1);
             }
             if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
                 $moduleInstance = Vtiger_Module::getInstance($tabid);
                 $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
             }
         }
         // TODO Handle actions after this module is installed.
     } else {
         if ($eventType == 'module.disabled') {
             // TODO Handle actions before this module is being uninstalled.
         } else {
             if ($eventType == 'module.preuninstall') {
                 // TODO Handle actions when this module is about to be deleted.
             } else {
                 if ($eventType == 'module.preupdate') {
                     // TODO Handle actions before this module is updated.
                 } else {
                     if ($eventType == 'module.postupdate') {
                         // TODO Handle actions after this module is updated.
                     }
                 }
             }
         }
     }
 }
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     $registerLink = false;
     $displayLabel = 'Time Control';
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     if ($event_type == 'module.postinstall') {
         $tabid = getTabid($modulename);
         $adb->query("UPDATE `vtiger_field` SET `summaryfield` = '1' WHERE `tabid` = {$tabid} AND `columnname` IN ('name','osstimecontrol_no','osstimecontrol_status','smownerid','date_start','time_start','time_end','due_date','sum_time','platnosc');", true);
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, 'TC', '1');
         include_once 'vtlib/Vtiger/Module.php';
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('OSSTimeControl'));
             }
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
Example #5
0
function vtws_transferComments($sourceRecordId, $destinationRecordId)
{
    if (vtlib_isModuleActive('ModComments')) {
        CRMEntity::getInstance('ModComments');
        ModComments::transferRecords($sourceRecordId, $destinationRecordId);
    }
}
Example #6
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     global $adb;
     if ($event_type == 'module.postinstall') {
         $projectTaskResult = $adb->pquery('SELECT tabid FROM vtiger_tab WHERE name=?', array('ProjectTask'));
         $projecttaskTabid = $adb->query_result($projectTaskResult, 0, 'tabid');
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         if (getTabid('CustomerPortal')) {
             $checkAlreadyExists = $adb->pquery('SELECT 1 FROM vtiger_customerportal_tabs WHERE tabid=?', array($projecttaskTabid));
             if ($checkAlreadyExists && $adb->num_rows($checkAlreadyExists) < 1) {
                 $maxSequenceQuery = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_customerportal_tabs");
                 $maxSequence = $adb->query_result($maxSequenceQuery, 0, 'maxsequence');
                 $nextSequence = $maxSequence + 1;
                 $adb->query("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES ({$projecttaskTabid},1,{$nextSequence})");
                 $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$projecttaskTabid},'showrelatedinfo',1)");
             }
         }
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('ProjectTask'));
             }
         }
         $result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($modulename));
         if (!$adb->num_rows($result)) {
             //Initialize module sequence for the module
             // SalesPlatform.ru begin: Added separate numbering for self organizations
             $adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PT', 1, 1, 1, ''));
             //$adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PT', 1, 1, 1));
             // SalesPlatform.ru end
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
                             if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                                 include_once 'modules/ModComments/ModComments.php';
                                 if (class_exists('ModComments')) {
                                     ModComments::addWidgetTo(array('ProjectTask'));
                                 }
                             }
                             $result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($modulename));
                             if (!$adb->num_rows($result)) {
                                 //Initialize module sequence for the module
                                 // SalesPlatform.ru begin: Added separate numbering for self organizations
                                 $adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PT', 1, 1, 1, ''));
                                 //$adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PT', 1, 1, 1));
                                 // SalesPlatform.ru end
                             }
                         }
                     }
                 }
             }
         }
     }
 }
$task->methodName = "CustomerCommentFromPortal";
$taskManager->saveTask($task);
$task1 = $taskManager->createTask('VTEntityMethodTask', $commentsWorkflow->id);
$task1->active = true;
$task1->summary = 'Notify Customer when commenting on a Ticket';
$task1->methodName = "TicketOwnerComments";
$taskManager->saveTask($task1);
// Ends
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_links MODIFY column linktype VARCHAR(50)', array());
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_links MODIFY column linklabel VARCHAR(50)', array());
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_links MODIFY column handler_class VARCHAR(50)', array());
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_links MODIFY column handler VARCHAR(50)', array());
//--
//Add ModComments to HelpDesk and Faq module
require_once 'modules/ModComments/ModComments.php';
ModComments::addWidgetTo(array("HelpDesk", "Faq"));
global $current_user, $VTIGER_BULK_SAVE_MODE;
$VTIGER_BULK_SAVE_MODE = true;
$stopLoop = false;
$pageCount = 0;
do {
    $ticketComments = Migration_Index_View::ExecuteQuery(sprintf('SELECT * FROM vtiger_ticketcomments ORDER BY commentid ASC LIMIT %s,%s', $pageCount * 1000, 1000), array());
    $rows = $adb->num_rows($ticketComments);
    if (empty($rows)) {
        $stopLoop = true;
        break;
    }
    for ($i = 0; $i < $rows; $i++) {
        $modComments = CRMEntity::getInstance('ModComments');
        $modComments->column_fields['commentcontent'] = decode_html($adb->query_result($ticketComments, $i, 'comments'));
        $ownerId = $adb->query_result($ticketComments, $i, 'ownerid');
Example #8
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     if ($event_type == 'module.postinstall') {
         global $adb;
         $projecttaskTabid = getTabid($modulename);
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         $maxSequenceQuery = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_customerportal_tabs");
         $maxSequence = $adb->query_result($maxSequenceQuery, 0, 'maxsequence');
         $nextSequence = $maxSequence + 1;
         $adb->query("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES ({$projecttaskTabid},1,{$nextSequence})");
         $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$projecttaskTabid},'showrelatedinfo',1)");
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('ProjectTask'));
             }
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             // TODO Handle actions after this module is updated.
                         }
                     }
                 }
             }
         }
     }
 }
Example #9
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     if ($event_type == 'module.postinstall') {
         global $adb;
         include_once 'vtlib/Vtiger/Module.php';
         $moduleInstance = Vtiger_Module::getInstance($modulename);
         $projectTabid = getTabid($modulename);
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         // Add module to Customer portal
         $maxSequenceQuery = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_customerportal_tabs");
         $maxSequence = $adb->query_result($maxSequenceQuery, 0, 'maxsequence');
         $nextSequence = $maxSequence + 1;
         $adb->query("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES ({$projectTabid},1,{$nextSequence})");
         $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$projectTabid},'showrelatedinfo',1)");
         // Add Gnatt chart to the related list of the module
         $relation_id = $adb->getUniqueID('vtiger_relatedlists');
         $max_sequence = 0;
         $result = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_relatedlists WHERE tabid={$projectTabid}");
         if ($adb->num_rows($result)) {
             $max_sequence = $adb->query_result($result, 0, 'maxsequence');
         }
         $sequence = $max_sequence + 1;
         $adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence) VALUES(?,?,?,?,?,?,?)", array($relation_id, $projectTabid, 0, 'get_gantt_chart', $sequence, 'Charts', 0));
         // Add Project module to the related list of Accounts module
         $accountsModuleInstance = Vtiger_Module::getInstance('Accounts');
         $accountsModuleInstance->setRelatedList($moduleInstance, 'Projects', array('ADD', 'SELECT'), 'get_dependents_list');
         // Add Project module to the related list of Accounts module
         $contactsModuleInstance = Vtiger_Module::getInstance('Contacts');
         $contactsModuleInstance->setRelatedList($moduleInstance, 'Projects', array('ADD', 'SELECT'), 'get_dependents_list');
         // Add Project module to the related list of HelpDesk module
         $helpDeskModuleInstance = Vtiger_Module::getInstance('HelpDesk');
         $helpDeskModuleInstance->setRelatedList($moduleInstance, 'Projects', array('SELECT'), 'get_related_list');
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('Project'));
             }
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             // TODO Handle actions after this module is updated.
                         }
                     }
                 }
             }
         }
     }
 }
Example #10
0
 public function updateRecords()
 {
     global $log, $adb, $YetiForce_current_version;
     $log->debug("Entering VT620_to_YT::updateRecords() method ...");
     $changes = array();
     $changes[] = array('where' => array('columnname' => array('calendarsharedtype')), 'setColumn' => array('displaytype'), 'setValue' => array(1));
     $changes[] = array('where' => array('columnname' => array('description'), 'tabid' => array(getTabid('Accounts'), getTabid('Leads'), getTabid('Assets'), getTabid('Vendors'), getTabid('Quotes'), getTabid('Contacts'), getTabid('Potentials'), getTabid('PurchaseOrder'), getTabid('Project'), getTabid('HelpDesk'), getTabid('SalesOrder'), getTabid('Invoice'))), 'setColumn' => array('uitype'), 'setValue' => array(300));
     $changes[] = array('where' => array('columnname' => array('createdtime', 'modifiedtime')), 'setColumn' => array('typeofdata'), 'setValue' => array('DT~O'));
     $changes[] = array('where' => array('columnname' => array('donotcall'), 'tabid' => array(getTabid('Contacts'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Approval for phone calls'));
     $changes[] = array('where' => array('columnname' => array('emailoptout'), 'tabid' => array(getTabid('Contacts'), getTabid('Accounts'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Approval for email'));
     $changes[] = array('where' => array('columnname' => array('end_hour'), 'tabid' => array(getTabid('Users'))), 'setColumn' => array('uitype'), 'setValue' => array(16));
     $changes[] = array('where' => array('columnname' => array('invoiceid'), 'tabid' => array(getTabid('Assets'))), 'setColumn' => array('typeofdata'), 'setValue' => array('V~M'));
     $changes[] = array('where' => array('columnname' => array('lastname'), 'tabid' => array(getTabid('Leads'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Short name'));
     $changes[] = array('where' => array('columnname' => array('notecontent '), 'tabid' => array(getTabid('Documents'))), 'setColumn' => array('uitype'), 'setValue' => array(300));
     $changes[] = array('where' => array('columnname' => array('parent_id'), 'tabid' => array(getTabid('HelpDesk'))), 'setColumn' => array('typeofdata'), 'setValue' => array('I~M'));
     $changes[] = array('where' => array('columnname' => array('priority', 'projectpriority', 'projecttaskpriority')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Low'));
     $changes[] = array('where' => array('columnname' => array('quotestage')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Created'));
     $changes[] = array('where' => array('columnname' => array('sales_stage')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Accepted for processing'));
     $changes[] = array('where' => array('columnname' => array('projecttaskstatus')), 'setColumn' => array('defaultvalue', 'typeofdata'), 'setValue' => array('Open', 'V~M'));
     $changes[] = array('where' => array('columnname' => array('solution')), 'setColumn' => array('uitype'), 'setValue' => array(300));
     $changes[] = array('where' => array('columnname' => array('start_hour')), 'setColumn' => array('defaultvalue'), 'setValue' => array('08:00'));
     $changes[] = array('where' => array('columnname' => array('status'), 'tabid' => array('HelpDesk')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Open'));
     $changes[] = array('where' => array('columnname' => array('status'), 'tabid' => array('Calendar')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Not Started'));
     $changes[] = array('where' => array('columnname' => array('totalduration'), 'tabid' => array('PBXManager')), 'setColumn' => array('uitype'), 'setValue' => array(1));
     $changes[] = array('where' => array('columnname' => array('campaignrelstatus')), 'setColumn' => array('fieldlabel'), 'setValue' => array('Campaign status'));
     $changes[] = array('where' => array('columnname' => array('user_name'), 'tablename' => array('vtiger_users')), 'setColumn' => array('displaytype'), 'setValue' => array(4));
     $changes[] = array('where' => array('columnname' => array('product_id'), 'tablename' => array('vtiger_troubletickets')), 'setColumn' => array('displaytype', 'uitype'), 'setValue' => array(1, 10));
     $changes[] = array('where' => array('columnname' => array('startdate'), 'tablename' => array('vtiger_projecttask')), 'setColumn' => array('typeofdata', 'quickcreate'), 'setValue' => array('D~M', 2));
     $changes[] = array('where' => array('columnname' => array('targetenddate'), 'tablename' => array('vtiger_projecttask')), 'setColumn' => array('typeofdata', 'quickcreate'), 'setValue' => array('D~M', 2));
     $changes[] = array('where' => array('columnname' => array('folderid'), 'tablename' => array('vtiger_notes')), 'setColumn' => array('uitype', 'defaultvalue'), 'setValue' => array(302, 'T1'));
     foreach ($changes as $update) {
         $setColumn = implode(' = ?, ', $update['setColumn']) . ' = ? ';
         $params = $update['setValue'];
         $i = 0;
         $where = '';
         foreach ($update['where'] as $whereColumn => $whereValue) {
             $where .= $whereColumn . ' IN (' . generateQuestionMarks($whereValue) . ') ';
             $i++;
             if ($i != count($update['where'])) {
                 $where .= ' AND ';
             }
             $params = array_merge($params, $whereValue);
         }
         $query = "UPDATE vtiger_field SET " . $setColumn . " WHERE " . $where . " ; ";
         $adb->pquery($query, $params);
     }
     $adb->query("DELETE FROM `vtiger_module_dashboard_widgets` ");
     //delete value?
     $adb->query("UPDATE vtiger_inventory_tandc SET tandc = '';");
     // delete all language
     $adb->query("DELETE FROM `vtiger_language` ");
     // add lang from yeti
     $lang[] = array('English', 'en_us', 'US English', '2014-07-16 11:20:12', NULL, '1', '1');
     $lang[] = array('Język Polski', 'pl_pl', 'Język Polski', '2014-07-16 11:20:40', NULL, '0', '1');
     $lang[] = array('Deutsch', 'de_de', 'DE Deutsch', '2014-11-21 11:20:40', NULL, '0', '1');
     $lang[] = array('Portuguese', 'pt_br', 'Brazilian Portuguese', '2014-12-11 11:12:39', NULL, '0', '1');
     $lang[] = array('Russian', 'ru_ru', 'Russian', '2015-01-13 15:12:39', NULL, '0', '1');
     foreach ($lang as $params) {
         $adb->pquery("insert  into `vtiger_language`(`name`,`prefix`,`label`,`lastupdated`,`sequence`,`isdefault`,`active`) values (?,?,?,?,?,?,?);", $params);
     }
     $adb->query("UPDATE vtiger_language_seq SET `id` = (SELECT count(*) FROM `vtiger_language`);");
     $adb->pquery("UPDATE vtiger_version SET `current_version` = ? ;", [$YetiForce_current_version]);
     //update tax in inventoryproductrel
     $adb->query(" UPDATE `vtiger_inventoryproductrel` SET tax = \n\t\t\t  CASE\n\t\t\t\tWHEN `tax1` IS NOT NULL \n\t\t\t\tOR\n\t\t\t\t`tax2` IS NOT NULL \n\t\t\t\tOR \n\t\t\t\t`tax3` IS NOT NULL \n\t\t\t\tTHEN 'tax1' \n\t\t\t  END,\n\t\t\t  tax1 = IFNULL(tax1, 0) + IFNULL(tax2, 0) + IFNULL(tax3, 0) ;");
     $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET fieldname = ? WHERE `module` = ? AND fieldname = ? ;", array('End of support for contact', 'Contacts', 'support_end_date'));
     $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET fieldname = ? WHERE `module` = ? AND fieldname = ? ;", array('Birthdays of contacts', 'Contacts', 'birthday'));
     $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET `active` = ? ;", array(1));
     // links
     $instanceModule = Vtiger_Module::getInstance('Potentials');
     $instanceModule->addLink('DASHBOARDWIDGET', 'KPI', 'index.php?module=Potentials&view=ShowWidget&name=Kpi');
     $instanceModule = Vtiger_Module::getInstance('Home');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Employees Time Control', 'index.php?module=OSSTimeControl&view=ShowWidget&name=TimeControl');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Delagated Events/To Dos', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingCalendarTasks');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) Events/ToDos', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueCalendarTasks');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueProjectsTasks');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingProjectsTasks');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Calculations', 'index.php?module=Calculations&view=ShowWidget&name=Calculations');
     $instanceModule->addLink('DASHBOARDWIDGET', 'PotentialsList', 'index.php?module=Potentials&view=ShowWidget&name=PotentialsList');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Mails List', 'index.php?module=Home&view=ShowWidget&name=MailsList');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Calendar', 'index.php?module=Home&view=ShowWidget&name=Calendar');
     $instanceModule = Vtiger_Module::getInstance('Leads');
     $instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted');
     $adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-file'  WHERE `linklabel` = ?;", array('Add Note'));
     $adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-tasks' WHERE `linklabel` = ?;", array('Add Project Task'));
     $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('SalesOrder'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
     if ($adb->num_rows($result) == 0) {
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('SalesOrder'));
             }
         }
     }
     $result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Products'");
     if ($adb->num_rows($result) == 0) {
         $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Products',NULL,1);");
     }
     $result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Services'");
     if ($adb->num_rows($result) == 0) {
         $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Services',NULL,2);");
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ?", array('LIST_OF_LAST_UPDATED_RECORD'));
     if ($adb->num_rows($result) == 0) {
         $instanceModule = Vtiger_Module::getInstance('Home');
         $instanceModule->addLink('DASHBOARDWIDGET', 'LIST_OF_LAST_UPDATED_RECORD', 'index.php?module=Home&view=ShowWidget&name=ListUpdatedRecord');
     }
     $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parentid', 'vtiger_contactdetails'));
     $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Vendors'));
     if ($adb->num_rows($result2) == 0) {
         $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Contacts','Vendors');");
     }
     $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ? WHERE `modulename` IN (?,?);", array('subject', 'RequirementCards', 'QuotesEnquires'));
     $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ?, fieldname = ?  WHERE `modulename` = ?;", array('holidaysentitlement_year,ossemployeesid', 'holidaysentitlement_year', 'HolidaysEntitlement'));
     $adb->pquery("UPDATE `vtiger_entityname` SET fieldname = ?  WHERE `modulename` = ?;", array('lastname', 'Leads'));
     $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Quotes'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
     if ($adb->num_rows($result) == 0) {
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('Quotes'));
             }
         }
     }
     $modulename = 'Quotes';
     $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
     if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
         include_once 'vtlib/Vtiger/Module.php';
         include_once 'modules/ModTracker/ModTracker.php';
         $tabid = Vtiger_Functions::getModuleId($modulename);
         $moduleModTrackerInstance = new ModTracker();
         if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
             $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         } else {
             $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         }
         if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
             $moduleInstance = Vtiger_Module::getInstance($tabid);
             $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
         }
     }
     $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
     $adb->pquery($query, array('Potentials', 'Contacts'));
     $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
     $adb->pquery($query, array('Assets', 'Accounts'));
     $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
     $adb->pquery($query, array('PBXManager', 'Leads'));
     $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
     $adb->pquery($query, array(getTabid('Leads'), getTabid('PBXManager'), 'PBXManager'), true);
     $adb->pquery("UPDATE `vtiger_calendar_user_activitytypes` SET `visible` = ? WHERE `id` > ? ;", array(0, 2));
     $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ? AND linkicon = ? ; ", array('LBL_SHOW_ACCOUNT_HIERARCHY', 'icon-align-justify'));
     if ($adb->num_rows($result) == 0) {
         $adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-align-justify', 'LBL_SHOW_ACCOUNT_HIERARCHY'));
         $adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-file', 'LBL_ADD_NOTE'));
     }
     $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parent_id', 'vtiger_assets'));
     $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Accounts'));
     if ($adb->num_rows($result2) == 0) {
         $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Assets','Accounts');");
     }
     $log->debug("Exiting VT620_to_YT::updateRecords() method ...");
 }
Example #11
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     if ($event_type == 'module.postinstall') {
         global $adb;
         $this->setModuleSeqNumber('configure', $modulename, 'prjt-', '0000001');
         $projectTaskResult = $adb->pquery('SELECT tabid FROM vtiger_tab WHERE name=?', array('ProjectTask'));
         $projecttaskTabid = $adb->query_result($projectTaskResult, 0, 'tabid');
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         if (getTabid('CustomerPortal')) {
             $checkAlreadyExists = $adb->pquery('SELECT 1 FROM vtiger_customerportal_tabs WHERE tabid=?', array($projecttaskTabid));
             if ($checkAlreadyExists && $adb->num_rows($checkAlreadyExists) < 1) {
                 $maxSequenceQuery = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_customerportal_tabs");
                 $maxSequence = $adb->query_result($maxSequenceQuery, 0, 'maxsequence');
                 $nextSequence = $maxSequence + 1;
                 $adb->query("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES ({$projecttaskTabid},1,{$nextSequence})");
                 $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$projecttaskTabid},'showrelatedinfo',1)");
             }
         }
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('ProjectTask'));
             }
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
                             if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                                 include_once 'modules/ModComments/ModComments.php';
                                 if (class_exists('ModComments')) {
                                     ModComments::addWidgetTo(array('ProjectTask'));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #12
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     if ($event_type == 'module.postinstall') {
         global $adb;
         include_once 'vtlib/Vtiger/Module.php';
         $moduleInstance = Vtiger_Module::getInstance($modulename);
         $projectsResult = $adb->pquery('SELECT tabid FROM vtiger_tab WHERE name=?', array('Project'));
         $projectTabid = $adb->query_result($projectsResult, 0, 'tabid');
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         // Add module to Customer portal
         if (getTabid('CustomerPortal') && $projectTabid) {
             $checkAlreadyExists = $adb->pquery('SELECT 1 FROM vtiger_customerportal_tabs WHERE tabid=?', array($projectTabid));
             if ($checkAlreadyExists && $adb->num_rows($checkAlreadyExists) < 1) {
                 $maxSequenceQuery = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_customerportal_tabs");
                 $maxSequence = $adb->query_result($maxSequenceQuery, 0, 'maxsequence');
                 $nextSequence = $maxSequence + 1;
                 $adb->query("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES ({$projectTabid},1,{$nextSequence})");
                 $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$projectTabid},'showrelatedinfo',1)");
             }
         }
         // Add Gnatt chart to the related list of the module
         $relation_id = $adb->getUniqueID('vtiger_relatedlists');
         $max_sequence = 0;
         $result = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_relatedlists WHERE tabid={$projectTabid}");
         if ($adb->num_rows($result)) {
             $max_sequence = $adb->query_result($result, 0, 'maxsequence');
         }
         $sequence = $max_sequence + 1;
         $adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence) VALUES(?,?,?,?,?,?,?)", array($relation_id, $projectTabid, 0, 'get_gantt_chart', $sequence, 'Charts', 0));
         // Add Project module to the related list of Accounts module
         $accountsModuleInstance = Vtiger_Module::getInstance('Accounts');
         $accountsModuleInstance->setRelatedList($moduleInstance, 'Projects', array('ADD', 'SELECT'), 'get_dependents_list');
         // Add Project module to the related list of Accounts module
         $contactsModuleInstance = Vtiger_Module::getInstance('Contacts');
         $contactsModuleInstance->setRelatedList($moduleInstance, 'Projects', array('ADD', 'SELECT'), 'get_dependents_list');
         // Add Project module to the related list of HelpDesk module
         $helpDeskModuleInstance = Vtiger_Module::getInstance('HelpDesk');
         $helpDeskModuleInstance->setRelatedList($moduleInstance, 'Projects', array('SELECT'), 'get_related_list');
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('Project'));
             }
         }
         $result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($modulename));
         if (!$adb->num_rows($result)) {
             //Initialize module sequence for the module
             // SalesPlatform.ru begin: Added separate numbering for self organizations
             $adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PROJ', 1, 1, 1, ''));
             //$adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PROJ', 1, 1, 1));
             // SalesPlatform.ru end
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             global $adb;
                             $projectsResult = $adb->pquery('SELECT tabid FROM vtiger_tab WHERE name=?', array('Project'));
                             $projectTabid = $adb->query_result($projectsResult, 0, 'tabid');
                             // Add Gnatt chart to the related list of the module
                             $relation_id = $adb->getUniqueID('vtiger_relatedlists');
                             $max_sequence = 0;
                             $result = $adb->query("SELECT max(sequence) as maxsequence FROM vtiger_relatedlists WHERE tabid={$projectTabid}");
                             if ($adb->num_rows($result)) {
                                 $max_sequence = $adb->query_result($result, 0, 'maxsequence');
                             }
                             $sequence = $max_sequence + 1;
                             $adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence) VALUES(?,?,?,?,?,?,?)", array($relation_id, $projectTabid, 0, 'get_gantt_chart', $sequence, 'Charts', 0));
                             // Add Comments widget to Project module
                             $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
                             if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                                 include_once 'modules/ModComments/ModComments.php';
                                 if (class_exists('ModComments')) {
                                     ModComments::addWidgetTo(array('Project'));
                                 }
                             }
                             $result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($modulename));
                             if (!$adb->num_rows($result)) {
                                 //Initialize module sequence for the module
                                 // SalesPlatform.ru begin: Added separate numbering for self organizations
                                 $adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PROJ', 1, 1, 1, ''));
                                 //$adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $modulename, 'PROJ', 1, 1, 1));
                                 // SalesPlatform.ru end
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #13
0
 /**
  * Update ticket action.
  */
 function __UpdateTicket($mailscanner, $mailrecord, $regexMatchInfo, $mailscannerrule)
 {
     global $adb;
     $returnid = false;
     $usesubject = false;
     if ($this->lookup == 'SUBJECT') {
         // If regex match was performed on subject use the matched group
         // to lookup the ticket record
         if ($regexMatchInfo) {
             $usesubject = $regexMatchInfo['matches'];
         } else {
             $usesubject = $mailrecord->_subject;
         }
         // Get the ticket record that was created by SENDER earlier
         $fromemail = $mailrecord->_from[0];
         $linkfocus = $mailscanner->GetTicketRecord($usesubject, $fromemail);
         $commentedBy = $mailscanner->LookupContact($fromemail);
         if (!$commentedBy) {
             $commentedBy = $mailscanner->LookupAccount($fromemail);
         }
         // If matching ticket is found, update comment, attach email
         if ($linkfocus) {
             $commentFocus = new ModComments();
             $commentFocus->column_fields['commentcontent'] = $mailrecord->getBodyText();
             $commentFocus->column_fields['related_to'] = $linkfocus->id;
             $commentFocus->column_fields['assigned_user_id'] = $mailscannerrule->assigned_to;
             if ($commentedBy) {
                 $commentFocus->column_fields['customer'] = $commentedBy;
                 $commentFocus->column_fields['from_mailconverter'] = 1;
             } else {
                 $commentFocus->column_fields['userid'] = $mailscannerrule->assigned_to;
             }
             $commentFocus->saveentity('ModComments');
             // Set the ticket status to Open if its Closed
             $adb->pquery("UPDATE vtiger_troubletickets set status=? WHERE ticketid=? AND status='Closed'", array('Open', $linkfocus->id));
             $returnid = $this->__CreateNewEmail($mailrecord, $this->module, $linkfocus);
         } else {
             // TODO If matching ticket was not found, create ticket?
             // $returnid = $this->__CreateTicket($mailscanner, $mailrecord);
         }
     }
     return $returnid;
 }
Example #14
0
        /** n:n relations with Documents**/
        $relModule = Vtiger_Module::getInstance('Documents');
        $moduleInstance->unsetRelatedList($relModule, 'Documents', 'get_attachments');
        $moduleInstance->setRelatedList($relModule, 'Documents', array('ADD', 'SELECT'), 'get_attachments');
        /** n:n relations with Calendar**/
        $relModule = Vtiger_Module::getInstance('Calendar');
        $moduleInstance->unsetRelatedList($relModule, 'Activities', 'get_activities');
        $moduleInstance->setRelatedList($relModule, 'Activities', array('ADD'), 'get_activities');
        $moduleInstance->unsetRelatedList($relModule, 'Activity History', 'get_history');
        $moduleInstance->setRelatedList($relModule, 'Activity History', array('ADD'), 'get_history');
        /*Dashboard Widgets*/
        $moduleInstance->addLink('DASHBOARDWIDGET', 'Rumors to be verified', 'index.php?module=' . $MODULENAME . '&view=ShowWidget&name=TbvRumors', '', '1');
        $moduleInstance->addLink('DASHBOARDWIDGET', 'Rumors by status', 'index.php?module=' . $MODULENAME . '&view=ShowWidget&name=RumorsByStatus', '', '2');
        $home = Vtiger_Module::getInstance('Home');
        $home->addLink('DASHBOARDWIDGET', 'Rumors to be verified', 'index.php?module=' . $MODULENAME . '&view=ShowWidget&name=TbvRumors', '', '15');
        $home->addLink('DASHBOARDWIDGET', 'Rumors by status', 'index.php?module=' . $MODULENAME . '&view=ShowWidget&name=RumorsByStatus', '', '16');
        if (file_exists('modules/ModTracker/ModTrackerUtils.php')) {
            require_once 'modules/ModTracker/ModTrackerUtils.php';
            ModTrackerUtils::modTrac_changeModuleVisibility($tabid, 'module_enable');
        }
        if (file_exists('modules/ModComments/ModComments.php')) {
            require_once 'modules/ModComments/ModComments.php';
            ModComments::removeWidgetFrom($MODULENAME);
            ModComments::addWidgetTo($MODULENAME);
        }
    } else {
        echo "Block " . $block_name . " is not present\n";
    }
} else {
    echo "Module " . $MODULENAME . " is not present\n";
}
Example #15
0
    public function databaseData()
    {
        global $log, $adb;
        $log->debug("Entering YetiForceUpdate::databaseData() method ...");
        $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ?", array('LIST_OF_LAST_UPDATED_RECORD'));
        if ($adb->num_rows($result) == 0) {
            $instanceModule = Vtiger_Module::getInstance('Home');
            $instanceModule->addLink('DASHBOARDWIDGET', 'LIST_OF_LAST_UPDATED_RECORD', 'index.php?module=Home&view=ShowWidget&name=ListUpdatedRecord');
        }
        $result = $adb->query("SELECT MAX(blockid) AS id FROM vtiger_settings_blocks");
        $adb->pquery("UPDATE vtiger_settings_blocks_seq SET `id` = ?", array($adb->query_result($result, 0, 'id')));
        $result = $adb->pquery("SELECT * FROM `vtiger_settings_blocks` WHERE `label` = ? ", array('LBL_PROCESSES'));
        if ($adb->num_rows($result) == 0) {
            $blockid = $adb->getUniqueId("vtiger_settings_blocks");
            $adb->pquery("insert  into `vtiger_settings_blocks`(`blockid`,`label`,`sequence`) values (?,?,?);", array($blockid, 'LBL_PROCESSES', 9));
            $result = $adb->query("SELECT MAX(blockid) AS id FROM vtiger_settings_blocks");
            $result = $adb->pquery("UPDATE vtiger_settings_blocks_seq SET `id` = ?", array($adb->query_result($result, 0, 'id')));
        }
        $adb->pquery("UPDATE `vtiger_modentity_num` SET `cur_id` = ? WHERE `semodule` = ? ;", array(1, 'Products'));
        $result = $adb->pquery("SELECT * FROM `vtiger_ossmailtemplates` WHERE name = ? AND oss_module_list = ? ", array('Customer Portal Login Details', 'Contacts'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_ossmailtemplates` SET `content` = ? WHERE name = ? AND oss_module_list = ?  ;", array('<p>#s#LogoImage#sEnd# </p><p>Dear #a#67#aEnd#  #a#70#aEnd#</p><p>Created for your account in the customer portal, below sending data access.</p><p>Login: #a#80#aEnd#<br />Password: #s#ContactsPortalPass#sEnd#</p><p>Regards</p>', 'Customer Portal Login Details', 'Contacts'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_ossmailtemplates` WHERE name = ? AND oss_module_list = ? ", array('Customer Portal - ForgotPassword', 'Contacts'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_ossmailtemplates` SET `content` = ? WHERE name = ? AND oss_module_list = ?  ;", array('Dear #a#67#aEnd# #a#70#aEnd#,<br /><br />
You recently requested a reminder of your access data for the YetiForce Portal.<br /><br />
You can login by entering the following data:<br /><br />
Your username: #a#80#aEnd#<br />
Your password: #s#ContactsPortalPass#sEnd#<br /><br /><br />
Regards,<br />
YetiForce CRM Support Team.', 'Customer Portal - ForgotPassword', 'Contacts'));
        }
        $adb->pquery("UPDATE `vtiger_ossmenumanager` SET `label` = ?, `langfield` = ? WHERE `label` = ? ;", array('Teamwork', 'en_us*Teamwork#pl_pl*Praca grupowa', 'Group Card'));
        $adb->pquery("UPDATE `vtiger_osspdf` SET `footer_content` = ? WHERE `title` = ? AND `moduleid` = ?;", array('<title></title>
<table width="537px">
	<tbody>
		<tr>
			<td colspan="6" rowspan="2"><img src="#special_function#siteUrl#end_special_function#storage/Logo/logo_yetiforce.png" style="width: 200px;" width="200" /></td>
			<td colspan="4"><span style="font-size:6px;">#company_organizationname# #company_address# #company_code# #company_city#. VAT:#company_vatid#</span></td>
		</tr>
		<tr>
			<td colspan="5">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Calculation confirmation: <strong>#calculations_no#</strong></span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Date: #special_function#CreatedDateTime#end_special_function#</span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="7">&nbsp;</td>
			<td colspan="5" rowspan="2">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="5">
							<tbody>
								<tr>
									<td>
									<table cellpadding="0" style="font-size:8px;">
										<tbody>
											<tr>
												<td colspan="2">Issued by:</td>
												<td colspan="3">#Users_first_name# #Users_last_name#</td>
											</tr>
											<tr>
												<td colspan="2">Email:</td>
												<td colspan="3">#Users_email1#</td>
											</tr>
										</tbody>
									</table>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="3">
			<table>
				<tbody>
					<tr>
						<td><span style="font-size:10px;">&nbsp;<span style="font-size:8px;">#Accounts_account_no#</span></span></td>
					</tr>
					<tr>
						<td>
						<table>
							<tbody>
								<tr>
									<td>
									<p><span style="font-size:10px;">#Accounts_accountname#<br />
									<span style="font-size:8px;">#Accounts_addresslevel8b# #Accounts_buildingnumberb# #Accounts_localnumberb#<br />
									#Accounts_addresslevel7b#, #Accounts_addresslevel5b#<br />
									<span style="font-size:10px;">#Accounts_addresslevel1b#</span><br />
									#Accounts_vat_id#<br />
									#Contacts_email#</span></span></p>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
			<td colspan="3">&nbsp;</td>
		</tr>
	</tbody>
</table>
&nbsp;

<table>
	<tbody>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>#special_function#replaceProductTable#end_special_function#</td>
		</tr>
	</tbody>
</table>', 'Calculation PDF', getTabid('Calculations')));
        $this->addWorkflow();
        $this->addRecords();
        $this->settingsReplace();
        $result = $adb->pquery("SELECT * FROM `vtiger_payment_duration` WHERE payment_duration = ?", array('payment:+0 days'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_payment_duration` SET `payment_duration` = ? WHERE `payment_duration` = ? ;", array('payment:+0 day', 'payment:+0 days'));
            $adb->pquery("UPDATE `vtiger_invoice_recurring_info` SET `payment_duration` = ? WHERE `payment_duration` = ? ;", array('payment:+0 day', 'payment:+0 days'));
        }
        $this->picklists();
        $adb->pquery("UPDATE `vtiger_blocks` SET `display_status` = ? WHERE `tabid` = ? AND `blocklabel` = ? ;", array(0, getTabid('OSSTimeControl'), 'LBL_BLOCK'));
        $adb->query("ALTER TABLE `vtiger_notes` CHANGE `title` `title` varchar(200) NOT NULL after `note_no` ;");
        $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(14, 'time_start', 'vtiger_osstimecontrol'));
        $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(14, 'time_end', 'vtiger_osstimecontrol'));
        $result = $adb->pquery("SELECT * FROM `vtiger_salesprocesses_settings`; ");
        if ($adb->num_rows($result) == 0) {
            $adb->pquery('insert  into `vtiger_salesprocesses_settings`(`id`,`products_rel_potentials`) values (1,1);');
        }
        $adb->pquery("UPDATE `vtiger_field` SET `displaytype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(1, 'product_id', 'vtiger_troubletickets'));
        $fieldsToDelete = array('OSSTimeControl' => array('payment', 'contactid'), 'Calculations' => array('parentid'), 'Assets' => array('contact'), 'OutsourcedProducts' => array('contact'), 'OSSOutsourcedServices' => array('contact'), 'OSSSoldServices' => array('contact'), 'Invoice' => array('contact_id'), 'PurchaseOrder' => array('contact_id'), 'SalesOrder' => array('contact_id'), 'Quotes' => array('contact_id'), 'HelpDesk' => array('contact_id'), 'PaymentsIn' => array('parentid'));
        self::deleteFields($fieldsToDelete);
        self::addFields();
        $result = $adb->query("SHOW TABLES LIKE 'vtiger_calendar_config';");
        if ($adb->num_rows($result) == 1) {
            $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` ;");
            if ($adb->num_rows($result) == 0) {
                $adb->query("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values ('colors','break','PLL_BREAK_TIME','#ffd000');");
                $adb->query("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values ('colors','holiday','PLL_HOLIDAY_TIME','#00d4f5');");
            }
        }
        $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ? WHERE `modulename` IN (?,?,?);", array('subject', 'RequirementCards', 'QuotesEnquires', 'Ideas'));
        $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ?, fieldname = ?  WHERE `modulename` = ?;", array('holidaysentitlement_year,ossemployeesid', 'holidaysentitlement_year', 'HolidaysEntitlement'));
        $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parentid', 'vtiger_contactdetails'));
        $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Vendors'));
        if ($adb->num_rows($result2) == 0) {
            $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Contacts','Vendors');");
        }
        $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('potentialid', 'vtiger_quotesenquires'));
        $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Potentials'));
        if ($adb->num_rows($result2) == 0) {
            $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'QuotesEnquires','Potentials');");
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? ;", array('reminder'));
        if ($adb->num_rows($result) == 0) {
            $adb->pquery("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('reminder', 'update_event', 'LBL_UPDATE_EVENT', '0'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'work'));
        if ($adb->num_rows($result) == 0) {
            $adb->pquery("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'work', 'PLL_WORKING_TIME', '#FFD500'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'Task'));
        if ($adb->num_rows($result) == 0) {
            $adb->pquery("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'Task', 'Task', '#00d4f5'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'Meeting'));
        if ($adb->num_rows($result) == 0) {
            $adb->pquery("insert  into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'Meeting', 'Meeting', '#FFD500'));
        }
        // related list
        $adb->pquery("UPDATE `vtiger_relatedlists` SET label = ? WHERE related_tabid = ? AND name = ? AND label = ?;", array('Upcoming Activities', getTabid('Calendar'), 'get_activities', 'Activities'));
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Accounts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView', 7));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(8, getTabid('Accounts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `actions` = ?;", array(getTabid('Accounts'), getTabid('Calendar'), 'get_history', 'Activity History', 'add'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ?, `actions` = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(7, '', getTabid('Accounts'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        //
        $adb->pquery("UPDATE `vtiger_relatedlists` SET actions = ? WHERE related_tabid = ? AND name = ? AND label = ?;", array('', getTabid('Calendar'), 'get_history', 'Activity History'));
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Contacts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView', 3));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(9, getTabid('Contacts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView'));
        }
        //
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Contacts'), getTabid('Calendar'), 'get_history', 'Activity History', 9));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Contacts'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Potentials'), getTabid('Contacts'), 'get_contacts', 'Contacts', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(8, getTabid('Potentials'), getTabid('Contacts'), 'get_contacts', 'Contacts'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Potentials'), getTabid('Calendar'), 'get_history', 'Activity History', 8));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('Potentials'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('HelpDesk'), getTabid('Documents'), 'get_attachments', 'Documents', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('HelpDesk'), getTabid('Documents'), 'get_attachments', 'Documents'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('HelpDesk'), getTabid('Calendar'), 'get_history', 'Activity History', 4));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('HelpDesk'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Quotes'), getTabid('Documents'), 'get_attachments', 'Documents', 3));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('Quotes'), getTabid('Documents'), 'get_attachments', 'Documents'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Quotes'), getTabid('Calendar'), 'get_history', 'Activity History', 4));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Quotes'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('PurchaseOrder'), getTabid('Documents'), 'get_attachments', 'Documents', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('PurchaseOrder'), getTabid('Documents'), 'get_attachments', 'Documents'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('PurchaseOrder'), getTabid('Calendar'), 'get_history', 'Activity History', 3));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('PurchaseOrder'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('SalesOrder'), getTabid('Documents'), 'get_attachments', 'Documents', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('SalesOrder'), getTabid('Documents'), 'get_attachments', 'Documents'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('SalesOrder'), getTabid('Calendar'), 'get_history', 'Activity History', 4));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('SalesOrder'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Invoice'), getTabid('Documents'), 'get_attachments', 'Documents', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Invoice'), getTabid('Documents'), 'get_attachments', 'Documents'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Invoice'), getTabid('Calendar'), 'get_history', 'Activity History', 3));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('Invoice'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Campaigns'), getTabid('Accounts'), 'get_accounts', 'Accounts', 5));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(6, getTabid('Campaigns'), getTabid('Accounts'), 'get_accounts', 'Accounts'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('ServiceContracts'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk', 2));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('ServiceContracts'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk', 6));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(5, getTabid('Project'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), 0, 'get_gantt_chart', 'Charts', 5));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(1, getTabid('Project'), 0, 'get_gantt_chart', 'Charts'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), getTabid('Calendar'), 'get_activities', 'Upcoming Activities', 1));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(6, getTabid('Project'), getTabid('Calendar'), 'get_activities', 'Upcoming Activities'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Campaigns'), getTabid('Calendar'), 'get_history', 'Activity History'));
        if ($adb->num_rows($result) == 0) {
            $targetModule = Vtiger_Module::getInstance('Campaigns');
            $moduleInstance = Vtiger_Module::getInstance('Calendar');
            $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history');
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(5, getTabid('Campaigns'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Project'), getTabid('Calendar'), 'get_history', 'Activity History'));
        if ($adb->num_rows($result) == 0) {
            $targetModule = Vtiger_Module::getInstance('Project');
            $moduleInstance = Vtiger_Module::getInstance('Calendar');
            $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history');
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(7, getTabid('Project'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('ServiceContracts'), getTabid('Calendar'), 'get_history', 'Activity History'));
        if ($adb->num_rows($result) == 0) {
            $targetModule = Vtiger_Module::getInstance('ServiceContracts');
            $moduleInstance = Vtiger_Module::getInstance('Calendar');
            $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history');
            $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND `name` = ? AND label = ?;", array(2, getTabid('ServiceContracts'), getTabid('Calendar'), 'get_history', 'Activity History'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('RequirementCards', 'Quotes'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("DELETE FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('RequirementCards', 'Quotes'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('Calculations', 'Quotes'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("DELETE FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('Calculations', 'Quotes'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND `name` = ?", array(getTabid('Quotes'), getTabid('Calculations'), 'get_dependents_list'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_relatedlists` SET `name` = ? WHERE `tabid` = ? AND `related_tabid` = ? AND `name` = ?;", array('get_related_list', getTabid('Quotes'), getTabid('Calculations'), 'get_dependents_list'));
        }
        /*$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('OSSEmployees'),getTabid('HolidaysEntitlement'),'get_dependents_list','HolidaysEntitlement'));
        		if($adb->num_rows($result) == 0){
        			$targetModule = Vtiger_Module::getInstance('OSSEmployees');
        			$moduleInstance = Vtiger_Module::getInstance('HolidaysEntitlement');
        			$targetModule->setRelatedList($moduleInstance, 'HolidaysEntitlement', array('ADD'),'get_dependents_list');
        		}*/
        /*$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Accounts'),getTabid('RequirementCards'),'get_dependents_list','RequirementCards'));
        		if($adb->num_rows($result) == 0){
        			$targetModule = Vtiger_Module::getInstance('Accounts');
        			$moduleInstance = Vtiger_Module::getInstance('RequirementCards');
        			$targetModule->setRelatedList($moduleInstance, 'RequirementCards', array('ADD'),'get_dependents_list');
        		}*/
        $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Calculations'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
        if ($adb->num_rows($result) == 0) {
            $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
            if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                include_once 'modules/ModComments/ModComments.php';
                if (class_exists('ModComments')) {
                    ModComments::addWidgetTo(array('Calculations'));
                }
            }
        }
        $modulename = 'Calculations';
        $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
        if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
            include_once 'vtlib/Vtiger/Module.php';
            include_once 'modules/ModTracker/ModTracker.php';
            $tabid = Vtiger_Functions::getModuleId($modulename);
            $moduleModTrackerInstance = new ModTracker();
            if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
                $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            } else {
                $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            }
            if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
                $moduleInstance = Vtiger_Module::getInstance($tabid);
                $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
            }
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Quotes'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
        if ($adb->num_rows($result) == 0) {
            $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
            if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                include_once 'modules/ModComments/ModComments.php';
                if (class_exists('ModComments')) {
                    ModComments::addWidgetTo(array('Quotes'));
                }
            }
        }
        $modulename = 'Quotes';
        $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
        if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
            include_once 'vtlib/Vtiger/Module.php';
            include_once 'modules/ModTracker/ModTracker.php';
            $tabid = Vtiger_Functions::getModuleId($modulename);
            $moduleModTrackerInstance = new ModTracker();
            if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
                $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            } else {
                $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            }
            if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
                $moduleInstance = Vtiger_Module::getInstance($tabid);
                $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
            }
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('SalesOrder'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
        if ($adb->num_rows($result) == 0) {
            $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
            if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
                include_once 'modules/ModComments/ModComments.php';
                if (class_exists('ModComments')) {
                    ModComments::addWidgetTo(array('SalesOrder'));
                }
            }
        }
        $modulename = 'SalesOrder';
        $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
        if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
            include_once 'vtlib/Vtiger/Module.php';
            include_once 'modules/ModTracker/ModTracker.php';
            $tabid = Vtiger_Functions::getModuleId($modulename);
            $moduleModTrackerInstance = new ModTracker();
            if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
                $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            } else {
                $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
                $moduleModTrackerInstance->updateCache($tabid, 1);
            }
            /*if(!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)){
            			$moduleInstance=Vtiger_Module::getInstance($tabid);
            			$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')",'','',
            			array('path'=>'modules/ModTracker/ModTracker.php','class'=>'ModTracker','method'=>'isViewPermitted'));
            		}*/
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_cron_task` WHERE name = ? ;", array('CardDav'));
        if ($adb->num_rows($result) == 0) {
            $addCrons = array();
            $addCrons[] = array('CardDav', 'modules/API/cron/CardDav.php', 300, NULL, NULL, 1, 'Contacts', 12, NULL);
            foreach ($addCrons as $cron) {
                Vtiger_Cron::register($cron[0], $cron[1], $cron[2], $cron[6], $cron[5], 0, $cron[8]);
            }
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;", array('vtiger.entity.aftersave.final', 'API_CardDAV_Handler'));
        if ($adb->num_rows($result) == 0) {
            $addHandler[] = array('vtiger.entity.aftersave.final', 'modules/API/handlers/CardDAV.php', 'API_CardDAV_Handler', '', 1, '[]');
            $em = new VTEventsManager($adb);
            foreach ($addHandler as $handler) {
                $em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]);
            }
        }
        /*$modules = array('RequirementCards','QuotesEnquires');
        		foreach($modules as $module){
        			$moduleInstance = Vtiger_Module::getInstance($module);
        			$refInstance = Vtiger_Module::getInstance('OSSMailView');
        			if($moduleInstance && $refInstance){
        				$moduleInstance->unsetRelatedList($refInstance,"OSSMailView",'get_related_list');
        			}
        		}*/
        $result = $adb->pquery("SELECT * FROM `vtiger_dataaccess` WHERE summary = ?;", array('Date vatidation'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_dataaccess` SET `summary` = ? WHERE `summary` = ? ;", array('Date validation', 'Date vatidation'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_dataaccess` WHERE summary = ?;", array('Checking whether all mandatory fields in quick edit are filled in'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_dataaccess` SET `summary` = ? WHERE `summary` = ? ;", array('Check whether all mandatory fields in quick edit are filled in', 'Checking whether all mandatory fields in quick edit are filled in'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_cron_task` WHERE name = ? ;", array('CalDav'));
        if ($adb->num_rows($result) == 0) {
            $addCrons = array();
            $addCrons[] = array('CalDav', 'modules/API/cron/CalDav.php', 300, NULL, NULL, 1, 'Calendar', 13, NULL);
            foreach ($addCrons as $cron) {
                Vtiger_Cron::register($cron[0], $cron[1], $cron[2], $cron[6], $cron[5], 0, $cron[8]);
            }
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;", array('vtiger.entity.aftersave.final', 'API_CalDAV_Handler'));
        if ($adb->num_rows($result) == 0) {
            $addHandler[] = array('vtiger.entity.aftersave.final', 'modules/API/handlers/CalDAV.php', 'API_CalDAV_Handler', NULL, 1, '[]');
            $em = new VTEventsManager($adb);
            foreach ($addHandler as $handler) {
                $em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]);
            }
        }
        $adb->pquery("UPDATE `vtiger_field` SET `defaultvalue` = '' WHERE `columnname` = ? AND `defaultvalue` = ?;", array('eventstatus', 'Planned'));
        $result = $adb->pquery("SELECT * FROM `vtiger_taskstatus` WHERE taskstatus = ?;", array('Planned'));
        if ($adb->num_rows($result) == 1) {
            $adb->pquery("UPDATE `vtiger_taskstatus` SET `taskstatus` = ? WHERE `taskstatus` = ?;", array('Cancelled', 'Planned'));
            //$adb->pquery("UPDATE `vtiger_activity` SET `status` = ? WHERE `status` = ?;", array('Cancelled', 'Planned'));
        }
        $adb->pquery("UPDATE `vtiger_users` SET `defaulteventstatus` = ? WHERE `defaulteventstatus` = ?;", array('Not Held', 'Planned'));
        // change relations
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSPasswords', 'Leads'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Leads'), getTabid('OSSPasswords'), 'OSSPasswords'), true);
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('PBXManager', 'Leads'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Leads'), getTabid('PBXManager'), 'PBXManager'), true);
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('PaymentsIn', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('PaymentsIn'), 'PaymentsIn'), true);
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('PaymentsOut', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('PaymentsOut'), 'PaymentsOut'), true);
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSCosts', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSCosts'), 'OSSCosts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Calculations'), 'Calculations'), true);
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSPasswords', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSPasswords'), 'OSSPasswords'), true);
        // Related Products of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Products'), 'Products'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Products'), getTabid('Contacts'), 'Contacts'), true);
        ////// Related Assets of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('Assets', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Assets'), 'Assets'), true);
        ////// Related OutsourcedProducts of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OutsourcedProducts', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OutsourcedProducts'), 'OutsourcedProducts'), true);
        ////// Related Services of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Services'), 'Services'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Services'), getTabid('Contacts'), 'Contacts'), true);
        ////// Related OSSOutsourcedServices of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSOutsourcedServices', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSOutsourcedServices'), 'OSSOutsourcedServices'), true);
        ////// Related OSSSoldServices of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSSoldServices', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSSoldServices'), 'OSSSoldServices'), true);
        ////// Related Vendors of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Vendors'), 'Vendors'), true);
        ////// Related OSSTimeControl of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('OSSSoldServices', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSTimeControl'), 'OSSTimeControl'), true);
        ////// Related Projects of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('Project', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Project'), 'Projects'), true);
        ////// Related ServiceContracts of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('ServiceContracts', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('ServiceContracts'), 'Service Contracts'), true);
        ////// Related PBXManager of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('PBXManager', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('PBXManager'), 'PBXManager'), true);
        ////// Related Invoices of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Invoice'), 'Invoice'), true);
        ////// Related Contacts of Campaigns ect.
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Campaigns'), 'Campaigns'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Campaigns'), getTabid('Contacts'), 'Contacts'), true);
        ////// Related PurchaseOrder of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('PurchaseOrder'), 'Purchase Order'), true);
        ////// Related SalesOrder of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('SalesOrder'), 'Sales Order'), true);
        ////// Related  Quotes of contact
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('Quotes'), 'Quotes'), true);
        ////// Related HelpDesk of contact
        $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
        $adb->pquery($query, array('HelpDesk', 'Contacts'), true);
        $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
        $adb->pquery($query, array(getTabid('Contacts'), getTabid('HelpDesk'), 'HelpDesk'), true);
        $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `uitype` = ? AND columnname = ? AND tablename = ?;", array(1, '16', 'name', 'vtiger_osstimecontrol'));
        $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('ModComments', 'Reservations'));
        if ($adb->num_rows($result) == 0) {
            $result = $adb->pquery("SELECT * FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('related_to', 'vtiger_modcomments'));
            $fieldId = $adb->query_result($result, 0, 'fieldid');
            $adb->pquery("INSERT INTO vtiger_fieldmodulerel(fieldid, module, relmodule) VALUES(?,?,?)", array($fieldId, 'ModComments', 'Reservations'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('ModComments', 'SalesOrder'));
        if ($adb->num_rows($result) == 0) {
            $result = $adb->pquery("SELECT * FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('related_to', 'vtiger_modcomments'));
            $fieldId = $adb->query_result($result, 0, 'fieldid');
            $adb->pquery("INSERT INTO vtiger_fieldmodulerel(fieldid, module, relmodule) VALUES(?,?,?)", array($fieldId, 'ModComments', 'SalesOrder'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_trees_templates` WHERE name = ?;", array('Reservations'));
        if ($adb->num_rows($result) == 0) {
            $sql = 'INSERT INTO vtiger_trees_templates(`name`, `module`, `access`) VALUES (?,?,?)';
            $params = array('Reservations', getTabid('Reservations'), 0);
            $adb->pquery($sql, $params);
            $templateId = $adb->getLastInsertID();
            $recordModel = new Settings_TreesManager_Record_Model();
            $recordModel->set('name', 'Reservations');
            $recordModel->set('module', getTabid('Reservations'));
            $recordModel->set('templateid', $templateId);
            $recordModel->set('tree', array(array('data' => 'LBL_MEETING_ROOMS', 'attr' => array('id' => 3), 'state' => NULL), array('data' => 'LBL_EQUIPMENT', 'attr' => array('id' => 2), 'state' => NULL), array('data' => 'LBL_CARS', 'attr' => array('id' => 1), 'state' => NULL)));
            $recordModel->save();
            $adb->pquery("UPDATE `vtiger_field` SET `fieldparams` = ? WHERE `columnname` = ? AND `tablename` = ?;", array($templateId, 'type', 'vtiger_reservations'));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_widgets` WHERE tabid = ? AND `type` = ? ;", array(getTabid('Reservations'), 'Summary'));
        if ($adb->num_rows($result) == 0) {
            $widget = array('Reservations', 'Summary', NULL, '1', '0', NULL, '[]');
            $sql = "INSERT INTO vtiger_widgets (tabid, type, label, wcol, sequence, nomargin, data) VALUES (?, ?, ?, ?, ?, ?, ?);";
            $adb->pquery($sql, array(getTabid($widget[0]), $widget[1], $widget[2], $widget[3], $widget[4], $widget[5], $widget[6]));
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_widgets` WHERE tabid = ? AND `type` = ? ;", array(getTabid('Reservations'), 'Comments'));
        if ($adb->num_rows($result) == 0) {
            $widget = array('Reservations', 'Comments', '', '2', '1', NULL, '{"relatedmodule":"ModComments","limit":"10"}');
            $sql = "INSERT INTO vtiger_widgets (tabid, type, label, wcol, sequence, nomargin, data) VALUES (?, ?, ?, ?, ?, ?, ?);";
            $adb->pquery($sql, array(getTabid($widget[0]), $widget[1], $widget[2], $widget[3], $widget[4], $widget[5], $widget[6]));
        }
        $picklist_names = array('servicecategory', 'pscategory');
        foreach ($picklist_names as $picklist_name) {
            $select = $adb->query("select picklistid from vtiger_picklist where name = '{$picklist_name}'");
            if ($adb->num_rows($select) == 1) {
                $picklistid = $adb->query_result($select, 0, "picklistid");
                $delete_from = $adb->query("delete from vtiger_role2picklist where picklistid = '{$picklistid}'");
                $delete_from = $adb->query("delete from vtiger_picklist where name = '{$picklist_name}'");
            }
        }
        $result = $adb->query("SELECT vtiger_def_org_field.tabid,vtiger_def_org_field.fieldid FROM `vtiger_def_org_field` WHERE fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)");
        $num = $adb->num_rows($result);
        $deleteField = array();
        for ($i = 0; $i < $num; $i++) {
            $deleteField[] = $adb->query_result($result, $i, "fieldid");
        }
        $adb->pquery("delete from vtiger_def_org_field where fieldid in (" . generateQuestionMarks($deleteField) . ")", array($deleteField));
        $result = $adb->query("SELECT vtiger_profile2field.tabid,vtiger_profile2field.fieldid FROM `vtiger_profile2field` WHERE fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)");
        $num = $adb->num_rows($result);
        $deleteField = array();
        for ($i = 0; $i < $num; $i++) {
            $deleteField[] = $adb->query_result($result, $i, "fieldid");
        }
        $adb->pquery("delete from vtiger_profile2field where fieldid in (" . generateQuestionMarks($deleteField) . ")", array($deleteField));
        $result = $adb->query("SELECT vtiger_fieldmodulerel.fieldid FROM `vtiger_fieldmodulerel` WHERE vtiger_fieldmodulerel.fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)");
        $num = $adb->num_rows($result);
        $deleteField = array();
        for ($i = 0; $i < $num; $i++) {
            $deleteField[] = $adb->query_result($result, $i, "fieldid");
        }
        $adb->pquery("delete from vtiger_fieldmodulerel where fieldid in (" . generateQuestionMarks($deleteField) . ")", $deleteField);
        $adb->query("UPDATE vtiger_field set helpinfo = '' ");
        $result = $adb->pquery("SELECT vtiger_field.fieldid FROM `vtiger_field` WHERE tabid = ? AND columnname = ? ", array(getTabid('OSSMailTemplates'), 'oss_module_list'));
        $num = $adb->num_rows($result);
        if ($num == 1) {
            $fieldId = $adb->query_result($result, 0, "fieldid");
            $result = $adb->pquery("SELECT * FROM `vtiger_def_org_field` WHERE fieldid = ? ", array($fieldId));
            $num = $adb->num_rows($result);
            if ($num == 0) {
                $insertQuery = 'INSERT INTO vtiger_def_org_field VALUES(?,?,?,?)';
                $adb->pquery($insertQuery, array(getTabid('OSSMailTemplates'), $fieldId, 0, 0));
            }
            $result = $adb->pquery("SELECT * FROM `vtiger_profile2field` WHERE fieldid = ? ", array($fieldId));
            $num = $adb->num_rows($result);
            if ($num == 0) {
                $result = $adb->pquery("SELECT profileid FROM `vtiger_profile` ");
                $num = $adb->num_rows($result);
                for ($i = 0; $i < $num; $i++) {
                    $profileId = $adb->query_result($result, $i, "profileid");
                    $sql = 'INSERT INTO vtiger_profile2field(profileid, tabid, fieldid, visible, readonly) VALUES (?,?,?,?,?)';
                    $params = array($profileId, getTabid('OSSMailTemplates'), $fieldId, 0, 0);
                    $adb->pquery($sql, $params);
                }
            }
        }
        $adb->query("delete from vtiger_role2picklist where roleid = 'H1'");
        $adb->pquery("UPDATE vtiger_profile2utility set permission = ? WHERE tabid = ? ", array(1, getTabid('PaymentsOut')));
        // menu
        $result = $adb->pquery("SELECT * FROM `vtiger_ossmenumanager` WHERE label = ? ", array('AddressLevel1'));
        $num = $adb->num_rows($result);
        if ($num == 1) {
            $id = $adb->query_result($result, 0, "id");
            $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMenuManager');
            $recordModel->deleteMenu($id);
        }
        $modules = array(getTabid('QuotesEnquires'), getTabid('LettersOut'), getTabid('LettersIn'), getTabid('PaymentsOut'), getTabid('OSSPasswords'), getTabid('RequirementCards'), getTabid('Quotes'), getTabid('OSSMailView'));
        $adb->pquery("UPDATE `vtiger_links` set handler_path = 'modules/ModTracker/ModTracker.php', handler_class = 'ModTracker', handler = 'isViewPermitted' WHERE linklabel = 'View History' AND tabid IN (" . generateQuestionMarks($modules) . ") ", $modules);
        $log->debug("Exiting YetiForceUpdate::databaseData() method ...");
        $adb->query('ALTER TABLE roundcube_identities CHANGE `signature` `signature` LONGTEXT NULL;');
        $adb->pquery("INSERT INTO roundcube_system (name, value) VALUES ('roundcube-version', '2014042900');");
    }
Example #16
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     $adb = PearDatabase::getInstance();
     if ($event_type == 'module.postinstall') {
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1');
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('Payments'));
             }
         }
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         $tabid = Vtiger_Functions::getModuleId($modulename);
         include_once 'modules/ModTracker/ModTracker.php';
         $moduleModTrackerInstance = new ModTracker();
         if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
             $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         } else {
             $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
             $moduleModTrackerInstance->updateCache($tabid, 1);
         }
         if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
             $moduleInstance = Vtiger_Module::getInstance($tabid);
             $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
         }
         vimport('~~vtlib/Vtiger/Module.php');
         $moduleInstance = Vtiger_Module::getInstance('Invoice');
         $blockInstance = Vtiger_Block::getInstance('LBL_INVOICE_INFORMATION', $moduleInstance);
         $fieldInstance = new Vtiger_Field();
         $fieldInstance->name = 'payment_balance';
         $fieldInstance->table = 'vtiger_invoice';
         $fieldInstance->label = 'Payment balance';
         $fieldInstance->column = 'payment_balance';
         $fieldInstance->columntype = 'decimal(25,8)';
         $fieldInstance->uitype = 7;
         $fieldInstance->typeofdata = 'NN~O';
         $fieldInstance->displaytype = 2;
         $blockInstance->addField($fieldInstance);
         $moduleInstance = Vtiger_Module::getInstance('Accounts');
         $blockInstance = Vtiger_Block::getInstance('LBL_ACCOUNT_INFORMATION', $moduleInstance);
         $fieldInstance = new Vtiger_Field();
         $fieldInstance->name = 'payment_balance';
         $fieldInstance->table = 'vtiger_account';
         $fieldInstance->label = 'Payment balance';
         $fieldInstance->column = 'payment_balance';
         $fieldInstance->columntype = 'decimal(25,8)';
         $fieldInstance->uitype = 7;
         $fieldInstance->typeofdata = 'NN~O';
         $fieldInstance->displaytype = 2;
         $blockInstance->addField($fieldInstance);
         $moduleInstance = Vtiger_Module::getInstance('Potentials');
         $blockInstance = Vtiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $moduleInstance);
         $fieldInstance = new Vtiger_Field();
         $fieldInstance->name = 'payment_balance';
         $fieldInstance->table = 'vtiger_potential';
         $fieldInstance->label = 'Payment balance';
         $fieldInstance->column = 'payment_balance';
         $fieldInstance->columntype = 'decimal(25,8)';
         $fieldInstance->uitype = 7;
         $fieldInstance->typeofdata = 'NN~O';
         $fieldInstance->displaytype = 2;
         $blockInstance->addField($fieldInstance);
         $this->addWorkflow($modulename);
         $this->addWorkflow('Invoice');
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
Example #17
0
 function vtlib_handler($modulename, $event_type)
 {
     global $adb;
     if ($event_type == 'module.postinstall') {
         //blok z polami w podsumowaniu
         $tabid = getTabid($modulename);
         $adb->query("UPDATE `vtiger_field` SET `summaryfield` = '1' WHERE `tabid` = {$tabid} AND `columnname` IN ('ossemployees_no','employee_status','name','last_name','pesel','id_card','employee_education','parentid','business_mail');", true);
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, 'P', '1');
         // blok z komentarzami
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('OSSEmployees'));
             }
         }
         // blok EH
         //$this->addWidgetTo(array('OSSEmployees'));
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
Example #18
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     $adb = PearDatabase::getInstance();
     if ($event_type == 'module.postinstall') {
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, 'LI', '1');
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('LettersIn'));
             }
         }
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
         if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
             include_once 'vtlib/Vtiger/Module.php';
             include_once 'modules/ModTracker/ModTracker.php';
             $tabid = Vtiger_Functions::getModuleId($modulename);
             $moduleModTrackerInstance = new ModTracker();
             if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
                 $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
                 $moduleModTrackerInstance->updateCache($tabid, 1);
             } else {
                 $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
                 $moduleModTrackerInstance->updateCache($tabid, 1);
             }
             if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
                 $moduleInstance = Vtiger_Module::getInstance($tabid);
                 $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
             }
         }
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'title'));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'smownerid'));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'lin_type_ship'));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'lin_type_doc'));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'date_adoption'));
         $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersin', 'relatedid'));
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
Example #19
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     $registerLink = false;
     $displayLabel = 'Time Control';
     global $adb, $log;
     if ($event_type == 'module.postinstall') {
         $tabid = getTabid($modulename);
         $adb->query("UPDATE `vtiger_field` SET `summaryfield` = '1' WHERE `tabid` = {$tabid} AND `columnname` IN ('name','osstimecontrol_no','osstimecontrol_status','smownerid','date_start','time_start','time_end','due_date','sum_time','platnosc');", true);
         $ModuleInstance = CRMEntity::getInstance($modulename);
         $ModuleInstance->setModuleSeqNumber("configure", $modulename, 'TC', '1');
         include_once 'vtlib/Vtiger/Module.php';
         $moduleInstance = Vtiger_Module::getInstance($modulename);
         $docelowy_Module = Vtiger_Module::getInstance('Accounts');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('HelpDesk');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Project');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('ProjectTask');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('ServiceContracts');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Assets');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('SalesOrder');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Potentials');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Quotes');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Leads');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
         $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
         if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
             include_once 'modules/ModComments/ModComments.php';
             if (class_exists('ModComments')) {
                 ModComments::addWidgetTo(array('OSSTimeControl'));
             }
         }
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px; background-color:#f7fff3; ">
<table width="100%" border=0><tr><td><span style='color:red;float:right;margin-right:30px;'><h2>Proud member of the <a href='http://corebos.org'>coreBOS</a> family!</h2></span></td></tr></table>
<hr style="height: 1px">
<?php 
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Module.php';
if (empty($_REQUEST['modulename'])) {
    echo "<br/><H2>'modulename' parameter is mandatory</H2>";
    echo "<br/><H2>Es obligatorio introducir el parámetro 'modulename'</H2>";
    die;
}
$module = Vtiger_Module::getInstance($_REQUEST['modulename']);
if ($module) {
    include_once 'modules/ModComments/ModComments.php';
    if (class_exists('ModComments')) {
        ModComments::addWidgetTo(array($_REQUEST['modulename']));
        echo '<br/><H2>ModComments added to ' . $_REQUEST['modulename'] . ' module.</H2><br>';
        echo '<br/><H2>ModComments añadido al módulo ' . $_REQUEST['modulename'] . '.</H2><br>';
    } else {
        echo '<br/><H2>Failed to find ModComments module.</h2><br>';
        echo '<br/><H2>No se ha podido encontrar el módulo ModComments.</h2><br>';
    }
} else {
    echo '<br/><H2>Failed to find ' . $_REQUEST['modulename'] . ' module.</h2><br>';
    echo '<br/><H2>No se ha podido encontrar el módulo ' . $_REQUEST['modulename'] . '.</h2><br>';
}
?>
</body>
</html>