本文整理汇总了PHP中CRMEntity::save_related_module方法的典型用法代码示例。如果您正苦于以下问题:PHP CRMEntity::save_related_module方法的具体用法?PHP CRMEntity::save_related_module怎么用?PHP CRMEntity::save_related_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRMEntity
的用法示例。
在下文中一共展示了CRMEntity::save_related_module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function save_related_module($module, $crmid, $with_module, $with_crmid)
{
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
if ($with_module == 'ServiceContracts') {
$serviceContract = CRMEntity::getInstance("ServiceContracts");
$serviceContract->updateHelpDeskRelatedTo($with_crmid, $crmid);
$serviceContract->updateServiceContractState($with_crmid);
}
}
示例2: array
/**
* Handle saving related module information.
* NOTE: This function has been added to CRMEntity (base class).
* You can override the behavior by re-defining it here.
*/
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
if ($with_module == 'HelpDesk') {
$this->updateHelpDeskRelatedTo($crmid, $with_crmid);
$this->updateServiceContractState($crmid);
}
}
}
示例3: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Contacts') {
//When we select contact from potential related list
$sql = "insert into vtiger_contpotentialrel values (?,?)";
$adb->pquery($sql, array($with_crmid, $crmid));
} elseif ($with_module == 'Products') {
//when we select product from potential related list
$sql = "insert into vtiger_seproductsrel values (?,?,?)";
$adb->pquery($sql, array($crmid, $with_crmid, 'Potentials'));
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例4: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Products') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_seproductsrel WHERE productid = ? AND crmid = ?', array($with_crmid, $crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$adb->pquery("insert into vtiger_seproductsrel values (?,?,?)", array($crmid, $with_crmid, 'Contacts'));
} elseif ($with_module == 'Campaigns') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_campaigncontrel WHERE campaignid = ? AND contacrid = ?', array($with_crmid, $crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$adb->pquery("insert into vtiger_campaigncontrel values(?,?,1)", array($with_crmid, $crmid));
} elseif ($with_module == 'Potentials') {
$adb->pquery("insert into vtiger_contpotentialrel values(?,?)", array($crmid, $with_crmid));
} elseif ($with_module == 'Vendors') {
$adb->pquery("insert into vtiger_vendorcontactrel values (?,?)", array($with_crmid, $crmid));
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例5: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Products') {
$adb->pquery("insert into vtiger_seproductsrel values (?,?,?)", array($crmid, $with_crmid, $module));
} elseif ($with_module == 'Campaigns') {
$adb->pquery("insert into vtiger_campaignleadrel values(?,?,1)", array($with_crmid, $crmid));
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例6: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Leads' || $with_module == 'Accounts' || $with_module == 'Contacts' || $with_module == 'Potentials' || $with_module == 'Products') {
$query = $adb->pquery("SELECT * from vtiger_seproductsrel WHERE crmid=? and productid=?", array($crmid, $with_crmid));
if ($adb->num_rows($query) == 0) {
$adb->pquery("insert into vtiger_seproductsrel values (?,?,?)", array($with_crmid, $crmid, $with_module));
}
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例7: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = $this->db;
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Products') {
$adb->pquery("insert into vtiger_seproductsrel values(?,?,?)", array($crmid, $with_crmid, $module));
} elseif ($with_module == 'Campaigns') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_campaignaccountrel WHERE campaignid = ? AND accountid = ?', array($with_crmid, $crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$adb->pquery("insert into vtiger_campaignaccountrel values(?,?,1)", array($with_crmid, $crmid));
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例8: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Leads') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_campaignleadrel WHERE campaignid = ? AND leadid = ?', array($crmid, $with_crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$sql = 'INSERT INTO vtiger_campaignleadrel VALUES(?,?,1)';
$adb->pquery($sql, array($crmid, $with_crmid));
} elseif ($with_module == 'Contacts') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_campaigncontrel WHERE campaignid = ? AND contactid = ?', array($crmid, $with_crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$sql = 'INSERT INTO vtiger_campaigncontrel VALUES(?,?,1)';
$adb->pquery($sql, array($crmid, $with_crmid));
if (GlobalVariable::getVariable('Campaign_CreatePotentialOnContactRelation', '0') == '1') {
self::createPotentialRelatedTo($with_crmid, $crmid);
}
} elseif ($with_module == 'Accounts') {
$checkResult = $adb->pquery('SELECT 1 FROM vtiger_campaignaccountrel WHERE campaignid = ? AND accountid = ?', array($crmid, $with_crmid));
if ($checkResult && $adb->num_rows($checkResult) > 0) {
continue;
}
$sql = 'INSERT INTO vtiger_campaignaccountrel VALUES(?,?,1)';
$adb->pquery($sql, array($crmid, $with_crmid));
if (GlobalVariable::getVariable('Campaign_CreatePotentialOnAccountRelation', '0') == '1') {
self::createPotentialRelatedTo($with_crmid, $crmid);
}
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例9: foreach
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!is_array($with_crmids)) {
$with_crmids = [$with_crmids];
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Products') {
$insert = $db->insert('vtiger_seproductsrel', ['crmid' => $crmid, 'productid' => $with_crmid, 'setype' => $module, 'rel_created_user' => $currentUser->getId(), 'rel_created_time' => date('Y-m-d H:i:s')]);
} elseif ($with_module == 'Campaigns') {
$checkResult = $db->pquery('SELECT 1 FROM vtiger_campaignaccountrel WHERE campaignid = ? AND accountid = ?', [$with_crmid, $crmid]);
if ($db->getRowCount($checkResult) > 0) {
continue;
}
$db->insert('vtiger_campaignaccountrel', ['campaignid' => $with_crmid, 'accountid' => $crmid, 'campaignrelstatusid' => 1]);
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例10: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Contacts') {
$adb->pquery("insert into vtiger_vendorcontactrel values (?,?)", array($crmid, $with_crmid));
} elseif ($with_module == 'Products') {
$adb->pquery("update vtiger_products set vendor_id=? where productid=?", array($crmid, $with_crmid));
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例11: array
/**
* Save the related module record information. Triggered from CRMEntity->saveentity method or updateRelations.php
* @param String This module name
* @param Integer This module record number
* @param String Related module name
* @param mixed Integer or Array of related module record number
*/
function save_related_module($module, $crmid, $with_module, $with_crmid)
{
global $adb;
if ($module == 'Documents') {
// in this case we have to turn the parameters around to call the parent method correctly
if (!is_array($with_crmid)) {
$with_crmid = array($with_crmid);
}
foreach ($with_crmid as $relcrmid) {
$checkpresence = $adb->pquery("SELECT crmid FROM vtiger_senotesrel WHERE crmid = ? AND notesid = ?", array($relcrmid, $crmid));
// Relation already exists? No need to add again
if ($checkpresence && $adb->num_rows($checkpresence)) {
continue;
}
$adb->pquery("INSERT INTO vtiger_senotesrel(crmid, notesid) VALUES(?,?)", array($relcrmid, $crmid));
}
} else {
// just call parent method
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
示例12: array
/**
* Here we override the parent's method,
* This is done because the related lists for this module use a custom query
* that queries the child module's table (column of the uitype10 field)
*
* @see data/CRMEntity#save_related_module($module, $crmid, $with_module, $with_crmid)
*/
function save_related_module($module, $crmid, $with_module, $with_crmid)
{
if (!in_array($with_module, array('ProjectMilestone', 'ProjectTask'))) {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
return;
}
/**
* $_REQUEST['action']=='Save' when choosing ADD from Related list.
* Do nothing on the project's entity when creating a related new child using ADD in relatedlist
* by doing nothing we do not insert any line in the crmentity's table when
* we are relating a module to this module
*/
if ($_REQUEST['action'] != 'updateRelations') {
return;
}
$_REQUEST['submode'] = 'no_html_conversion';
//update the child elements' column value for uitype10
$destinationModule = vtlib_purify($_REQUEST['destination_module']);
if (!is_array($with_crmid)) {
$with_crmid = array($with_crmid);
}
foreach ($with_crmid as $relcrmid) {
$child = CRMEntity::getInstance($destinationModule);
$child->retrieve_entity_info($relcrmid, $destinationModule);
$child->mode = 'edit';
$child->column_fields['projectid'] = $crmid;
$child->save($destinationModule, $relcrmid);
}
}
示例13: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Leads' || $with_module == 'Accounts' || $with_module == 'Contacts' || $with_module == 'Products') {
$query = $db->pquery("SELECT * from vtiger_seproductsrel WHERE crmid=? and productid=?", array($crmid, $with_crmid));
if ($db->getRowCount($result) == 0) {
$db->insert('vtiger_seproductsrel', ['crmid' => $with_crmid, 'productid' => $crmid, 'setype' => $with_module, 'rel_created_user' => $currentUser->getId(), 'rel_created_time' => date('Y-m-d H:i:s')]);
}
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}
示例14:
/**
* Handle saving related module information.
* NOTE: This function has been added to CRMEntity (base class).
* You can override the behavior by re-defining it here.
*/
function save_related_module($module, $crmid, $with_module, $with_crmid)
{
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
if ($with_module == 'HelpDesk') {
$this->updateHelpDeskRelatedTo($crmid, $with_crmid);
$this->updateServiceContractState($crmid);
}
}
示例15: array
function save_related_module($module, $crmid, $with_module, $with_crmids)
{
$adb = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!is_array($with_crmids)) {
$with_crmids = array($with_crmids);
}
foreach ($with_crmids as $with_crmid) {
if ($with_module == 'Products') {
$adb->insert('vtiger_seproductsrel', ['crmid' => $crmid, 'productid' => $with_crmid, 'setype' => $module, 'rel_created_user' => $currentUser->getId(), 'rel_created_time' => date('Y-m-d H:i:s')]);
} elseif ($with_module == 'Campaigns') {
$adb->insert('vtiger_campaignleadrel', ['campaignid' => $with_crmid, 'leadid' => $crmid, 'campaignrelstatusid' => 1]);
} else {
parent::save_related_module($module, $crmid, $with_module, $with_crmid);
}
}
}