It looks like you're new here. If you want to get involved, click one of these buttons!
document.write("<script type='text/javascript' src='include/js/Merge.js'></"+"script>");
function verify_data(form) {
if(! form.createpotential.checked == true)
{
if (form.potential_name.value == "")
{
alert(alert_arr.OPPORTUNITYNAME_CANNOT_BE_EMPTY);
return false;
}
if (form.closedate.value == "")
{
alert(alert_arr.CLOSEDATE_CANNOT_BE_EMPTY);
return false;
}
return dateValidate('closedate','Potential Close Date','GECD');
}
return true;
}
function togglePotFields(form)
{
if (form.createpotential.checked == true)
{
form.potential_name.disabled = true;
form.closedate.disabled = true;
}
else
{
form.potential_name.disabled = false;
form.closedate.disabled = false;
}
}
function toggleAssignType(currType)
{
if (currType=="U")
{
getObj("assign_user").style.display="block"
getObj("assign_team").style.display="none"
}
else
{
getObj("assign_user").style.display="none"
getObj("assign_team").style.display="block"
}
}
function set_return(product_id, product_name) {
if(document.getElementById('from_link').value != '') {
window.opener.document.QcEditView.parent_name.value = product_name;
window.opener.document.QcEditView.parent_id.value = product_id;
} else {
window.opener.document.EditView.parent_name.value = product_name;
window.opener.document.EditView.parent_id.value = product_id;
}
}
function set_return_todo(product_id, product_name) {
if(document.getElementById('from_link').value != '') {
window.opener.document.QcEditView.task_parent_name.value = product_name;
window.opener.document.QcEditView.task_parent_id.value = product_id;
} else {
window.opener.document.createTodo.task_parent_name.value = product_name;
window.opener.document.createTodo.task_parent_id.value = product_id;
}
}
/** Returns a list of the associated emails
* @param integer $id - leadid
* returns related emails record in array format
*/
function get_emails($id, $cur_tab_id, $rel_tab_id, $actions=false) {
global $log, $singlepane_view,$currentModule,$current_user;
$log->debug("Entering get_emails(".$id.") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once("modules/$related_module/$related_module.php");
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if($singlepane_view == 'true')
$returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
else
$returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
$button = '';
$button .= '<input type="hidden" name="email_directing_module"><input type="hidden" name="record">';
if($actions) {
if(is_string($actions)) $actions = explode(',', strtoupper($actions));
if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
$button .= "<input title='".getTranslatedString('LBL_SELECT')." ". getTranslatedString($related_module). "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id&parenttab=$parenttab','test','width=640,height=602,resizable=0,scrollbars=0');\" value='". getTranslatedString('LBL_SELECT'). " " . getTranslatedString($related_module) ."'>&nbsp;";
}
if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
$button .= "<input title='". getTranslatedString('LBL_ADD_NEW')." ". getTranslatedString($singular_modname)."' accessyKey='F' class='crmbutton small create' onclick='fnvshobj(this,\"sendmail_cont\");sendmail(\"$this_module\",$id);' type='button' name='button' value='". getTranslatedString('LBL_ADD_NEW')." ". getTranslatedString($singular_modname)."'></td>";
}
}
$query ="select case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name," .
" vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.semodule, vtiger_activity.activitytype," .
" vtiger_activity.date_start, vtiger_activity.status, vtiger_activity.priority, vtiger_crmentity.crmid," .
" vtiger_crmentity.smownerid,vtiger_crmentity.modifiedtime, vtiger_users.user_name, vtiger_seactivityrel.crmid as parent_id " .
" from vtiger_activity" .
" inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid" .
" inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid" .
" left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid" .
" inner join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid" .
" where vtiger_activity.activitytype='Emails' and vtiger_crmentity.deleted=0 and vtiger_seactivityrel.crmid=".$id;
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if($return_value == null) $return_value = Array();
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_emails method ...");
return $return_value;
}
'CUSTOM-MODULE'=>'Custom-Module',
'COMBO_CUSTOM-MODULE'=>'Custom-Module',
'LBL_CUSTOM-MODULE_NAME' => 'Custom-Module',
/**
* Function to get the Custom-Module Name when a contact id is given
* Takes the input as $custom-moduleid - Custom-Module id
* returns the Custom-Module Name in string format.
*/
function getCustom-ModuleName($custom-module_id)
{
global $log;
$log->debug("Entering getCustom-ModuleName(".$Custom-Module_id.") method ...");
$log->info("in getCustom-ModuleName ".$custom-module_id);
global $adb, $current_user;
$custom-module_name = '';
if($custom-module_id != '')
{
$sql = "select * from vtiger_custom-module where custom-moduleid=?";
$result = $adb->pquery($sql, array($custom-module_id));
$custom-module_name = $adb->query_result($result,0,"custom-modulename");
}
$log->debug("Exiting getCustom-ModuleName method ...returning $custom-module_name");
return $custom-module_name;
}
Step 6: elseif($parent_module == "Custom-Module")
{
$label_fld[] = $app_strings['LBL_CUSTOM-MODULE_NAME'];
$custom-module_name = getCustom-ModuleName($value);
$label_fld[] = '<a href="index.php?module='.$parent_module.'&action=DetailView&record='.$value.'">'.$custom-module_name.'</a>';
}
elseif($parent_module == "Custom-Module")
{
$parent_name = getCustom-ModuleName($value);
$custom-module_selected = "selected";
}
and around line 830 you should have this
$editview_label[0] = array(
$app_strings['COMBO_CUSTOM-MODULE'],
$app_strings['COMBO_LEADS'],
$app_strings['COMBO_ACCOUNTS'],
$app_strings['COMBO_POTENTIALS'],
);
$editview_label[1] = array(
$custom-module_selected,
$lead_selected,
$account_selected,
$potential_selected
);
$editview_label[2] = array(
"Custom-Module&action=Popup",
"Leads&action=Popup",
"Accounts&action=Popup",
"Potentials&action=Popup"
);
Step 8: if($parent_module == 'Custom-Module')
{
$parent_query = "SELECT custom-modulename FROM vtiger_custom-module WHERE custom-moduleid=?";
$parent_result = $adb->pquery($parent_query, array($parent_id));
$parent_name = textlength_check($adb->query_result($parent_result,0,"custom-modulename"));
}
<option value="Custom-Module"><?php echo $app_strings['LBL_CUSTOM-MODULE_NAME']?></option>
and around line 959
<option value="Custom-Module"><?php echo $app_strings['LBL_CUSTOM-MODULE_NAME']?></option>
Comments
i don't understand step 3 - what is the relevenace of the get_emails function that is added, i would have expeced the get_activities function (or similar) instead.
yes you are right. get_activities function should be copied instead of get_emails.
@hassansr
i have made a custome module. module that has purpose in our company and vtiger installation. we wanted to link that module to activities in calendar. that is not possible using only vtlib. so if someone needs that his or hers module is related to calendar/activities he or her must take these steps.
what is accomplished with this?
1. creating a meeting/call/task could be related to record of a custom module.
2. on custom module detailview you have activities and activity history and you can see what appointments are and were related to this custom module record.
my client is now using this function to allow him to create events from the service contract module. service calls are tracked through trouble tickets, however there are also regular inspection visits built into the contract and this function allows him to keep those separate from the trouble ticketed visits.
i wanted to apply this feature to my project module (vtiger v5.2.1), but i did something wrong, it didn't work out for me.
so, let me show you my steps:
1) i have read the manual
2) i opened project.js (it contained nothing but a comment) in www\vtigercrm\modules\project and pasted the code, given in the manual (2nd step)
3) opened project.php in www\vtigercrm\modules\project and pasted the code, given in the manual (3d step), inserted the code, and changed the get_emails to get_activities (you can find two get_emails in the given code).
but didn't change anything in
4) inserted the following into file include/language/en_us.lang.php
5) inserted the code from step5 in file include/utils/commonutils.php (in the given code nothing was changed)
6) in file include/utils/detailviewutils.php inserted the following around line 923 7) in file include/utils/editviewutils.php around line 758 inserted following
and around line 830 i replaced existing (similar) strings by the following
<!-- s8) --><img src="{smilies_path}/icon_cool.gif" alt="8)" title="cool" /><!-- s8) --> inserted in file include/utils/listviewutils.php arround line 3346 following
9) inserted following in modules/calendar/addeventui.php
around line 645
and around line 959
can somebody kindly point to my mistakes (unfortunately, i am not a programmer, started learning php only yesterday).
i think, every vtigercrm user want to relate their project activities to calendar.
thank you!
i need this as well and also tried the steps listed.
help would be appreciated!
robert
here is what i did with projects - similar but a few changes to the previous try in this post.
error message when i go to projects
i can select projects and relate to projects in the activities mask though.
the error i get is
fatal error: call to undefined method project::get_activities() in /home/ostina5/public_html/db/include/utils/detailviewutils.php on line 1740
any suggestions???
step 1
set relation in vtiger database
vtiger_relatedlist
135 44 9 get_activities 6 activity 0 add,select
(projects is 44 for me and activities is 9)
step 2
added to modules/project/project.js
step 3
added to modules/project/project.php
step 4
added to include/language/en_us.lang.php
step 6
added to include/utils/detailview.php
line 923
step 7
include/utils/editviewutils.php
line 758
line 830
step 8
include/utils/listviewutils.php
step 9
modules/calendar/addeventui.php
line 645
line 959
step 10
error message when i go to projects
i can select projects and relate to projects in the activities mask
any suggestions???
whats on that 1740 line? i checked it in my vtiger and it appears nothing relevant to that error you get. you probably changed something before that line and there is mismatch between our codes.
and important question, what vtiger version are you using? i tried and been using this only on 510.
i tested your guide in <!-- l --><a class="postlink-local" href="http://forums.vtiger.com/viewtopic.php?f=95&t=33599">viewtopic.php?f=95&t=33599</a><!-- l --> with my custom module.
everything was ok, but texbox control can not get value when popup mymodule closed !
what more should i do ?
i have a similar problem (i think so ) <!-- l --><a class="postlink-local" href="http://forums.vtiger.com/viewtopic.php?f=95&t=43380">viewtopic.php?f=95&t=43380</a><!-- l -->
can you help me ?