YetiForceCompany / YetiForceCRM

Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!
https://yetiforce.com
Other
1.74k stars 750 forks source link

Question: Is it possible to bind a custom module to email scanner? #3940

Closed PercyP closed 7 years ago

PercyP commented 7 years ago

Hi,

I have created a simple custom module (just a few fields) and want to add a link in the email to allow me to bind an incoming email to this module. I cannot see any way to do this via the admin area. I can see in OSSMailScanner/scanneractions/ there are bind files created. Is it as simple as adding a new one (based on an existing php file in that folder) or is it more complicated than this?

Is there anything currently within yetiforce to create a new bind (sorry if that is the wrong terminology)

mariuszkrzaczkowski commented 7 years ago

Add a module to the hierarchy of modules https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/user_privileges/moduleHierarchy.php Create action in the scanner e-mail adress: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/modules/OSSMailScanner/scanneractions/BindAccounts.php prefix in the subject: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/modules/OSSMailScanner/scanneractions/BindProject.php

PercyP commented 7 years ago

@mariuszkrzaczkowski

Thank you for reply. So far I have managed to get it to work up to the point where I save the record. This is what I did:

Opened file /user_privileges/moduleHierarchy.php Added a new line here: ?php return [ 'modulesHierarchy' => [ 'Accounts' => ['level' => 0], 'Leads' => ['level' => 0], 'Vendors' => ['level' => 0], 'Partners' => ['level' => 0], 'Competition' => ['level' => 0], 'OSSEmployees' => ['level' => 0], 'Contacts' => ['level' => 1], 'SSalesProcesses' => ['level' => 1], 'Project' => ['level' => 1], 'ServiceContracts' => ['level' => 1], 'Campaigns' => ['level' => 1], 'FBookkeeping' => ['level' => 1], 'NewModule' => ['level' => 1],

Then copied /modules/OSSMailScanner/scanneractions/BindAccounts.php

and renamed the file to NewModule.php and changed the body text as follows:

<?php

/**

After saving, I went to email, selected an incoming message. The NewModule appears under the Processes, so I select NewModule and create the new record. Then click Save and the following error appears:

Error!!! Access denied

Go back Home page

0 /home/mysite/public_html/crm/include/main/WebUI.php(200): Vtiger_WebUI->triggerCheckPermission(Object(OSSMailView_Detail_View), Object(Vtiger_Request))

1 /home/mysite/public_html/crm/index.php(26): Vtiger_WebUI->process(Object(Vtiger_Request))

2 {main}

Am I correct in thinking that I was meant to use either BindAccounts or BindProject as a template for my new module?

I have changed the file/folder permissions via ssh so it can't be that. Am I missing a step?

Kind regards

nic86 commented 7 years ago

Try this:

class OSSMailScanner_BindNEWMODULE_ScannerAction extends OSSMailScanner_EmailScannerAction_Model { public function process(OSSMail_Mail_Model $mail) { return parent::process($mail,'NEWMODULE'); } }

and try:

'NewModule' => ['level' => 0],

PercyP commented 7 years ago

@nic86

Thanks for response.

I realised I hadn't changed this bit to my new module name:

class OSSMailScanner_BindNEWMODULE_ScannerAction extends

I have done this now, however, I still get the error. I notice too that for custom modules I cannot select the Quick Create for new custom fields. I can click on the check box but it will not add the tick. If I add a custom field to the built in modules I can edit the quick create check box in a custom field. Could this have something to do with why it won't save? There are no fields in the Quick Create box that pops up when selecting NewModule in the email binding, only the option to go to full form

nic86 commented 7 years ago

Could this have something to do with why it won't save

I do not think, however, to understand what can be, active debugging from config/debug.php (v3.4):

'LOG_TO_FILE' => true, // Enable displaying logs in debug console. Values: false/true 'LOG_TO_CONSOLE' => false, // Enable saving logs profiling. Values: false/true 'LOG_TO_PROFILE' => false, // Level of saved/displayed logs // Values: false = All / 3 = error and warning / ['error', 'warning', 'info', 'trace', 'profile'], 'LOG_LEVELS' => ['error'], // Level of saved/displayed tracerts. // Values: int 'LOG_TRACE_LEVEL' => 10,

Repeat this step:

The NewModule appears under the Processes, so I select NewModule and create the new record. Then click Save and the following error appears

and then, watch in file cache/logs/system.log

PercyP commented 7 years ago

@nic86

I have followed your instructions and tested. This is the output in the debug file:

`2017-01-26 16:17:54.17 [error] - Error in Mail Sending: Message body empty

$_COOKIE = [ 'PHPSESSID' => '19e8f8ea5889f527531d2' 'timezone' => 'Europe/London' 'cpsession' => 'mysite:HdRBJpZiS5dkp1Vi,813b2f76cdda4093ee13a521eff4c63d' 'cd1e449df1367a619a07127624f41252' => 'c76545d05d3a30940e4bce6a91ca8cca' '562250beba1650efcd6e53c7104315c8' => 'ab13552ef91fc332c7f7b02e90b389d4' 'jpanesliders_slide_pane1' => '0' 'jpanesliders_menu-pane3' => '0' 'jpanesliders_menu-pane2' => '0' 'roundcube_sessid' => '9b18f3a36dbb5820ab6f4a998a94926d' 'chat_settings' => 'bbCode=true&bbCodeImages=true&bbCodeColors=true&hyperLinks=true&lineBreaks=true&emoticons=true&autoFocus=false&autoScroll=true&maxMessages=0&wordWrap=true&maxWordLength=32&dateFormat=(%25H%3A%25i%3A%25s)&persistFontColor=false&fontColor=null&audio=true&audioVolume=0.5&soundReceive=sound_1&soundSend=sound_2&soundEnter=sound_3&soundLeave=sound_4&soundChatBot=sound_5&soundError=sound_6&blink=true&blinkInterval=500&blinkIntervalNumber=10' 'chat_style' => 'MyBB' 'roundcube_sessauth' => 'Se68bba300fa6b3c169700a2802352815aa725b4f' 'chat_lang' => 'en' ]

$_SESSION = [ '__HTTP_Session_Info' => 2 'language' => '' 'layout' => '' 'AUTHUSERID' => 10 'authenticated_user_id' => 10 'app_unique_key' => '9322f55d1f1fd21d4127742be4582791' 'authenticated_user_language' => 'en_gb' 'user_name' => 'Jane' 'full_user_name' => 'Doe Jane' 'chatUserID' => 10 'chatUserName' => 'Jane' 'chatLoginUserName' => 'Jane' 'chatUserRole' => 1 'chatLoggedIn' => true 'chatLoginTimeStamp' => 1485436222 'chatIP' => '86.155.188.240' 'chatChannel' => 0 'chatChannelEnterTimeStamp' => 1485436222 'chatStatusUpdateTimeStamp' => 1485447466 'chatInactiveCheckTimeStamp' => 1485447201 'lvs' => [ 'Newmodule' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 111 111 => [ 'start' => '1' ] ] 'Contacts' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 7 7 => [ 'start' => '1' ] ] 'Leads' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 1 1 => [ 'start' => '1' ] ] 'Accounts' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 4 4 => [ 'start' => '1' ] ] 'Project' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 45 45 => [ 'start' => '1' ] ] ] 'Newmodule_listquery' => 'SELECT vtiger_newmodule.newmodule, vtiger_newmodule.number, vtiger_crmentity.createdtime, vtiger_crmentity.smownerid, vtiger_newmodule.newmoduleid FROM vtiger_newmodule INNER JOIN vtiger_crmentity ON vtiger_newmodule.newmoduleid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Contacts_listquery' => 'SELECT vtiger_contactdetails.firstname, vtiger_contactdetails.lastname, vtiger_contactdetails.parentid, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.smownerid, vtiger_contactdetails.contactid FROM vtiger_contactdetails INNER JOIN vtiger_crmentity ON vtiger_contactdetails.contactid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Leads_listquery' => 'SELECT vtiger_leaddetails.lastname, vtiger_leaddetails.company, vtiger_leadaddress.phone, vtiger_leadsubdetails.website, vtiger_leaddetails.email, vtiger_crmentity.smownerid, vtiger_leaddetails.leadid FROM vtiger_leaddetails INNER JOIN vtiger_crmentity ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid INNER JOIN vtiger_leadaddress ON vtiger_leaddetails.leadid = vtiger_leadaddress.leadaddressid INNER JOIN vtiger_leadsubdetails ON vtiger_leaddetails.leadid = vtiger_leadsubdetails.leadsubscriptionid WHERE vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0' 'Accounts_listquery' => 'SELECT vtiger_account.accountname, vtiger_account.website, vtiger_account.phone, vtiger_crmentity.smownerid, vtiger_account.accountid FROM vtiger_account INNER JOIN vtiger_crmentity ON vtiger_account.accountid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Project_listquery' => 'SELECT vtiger_project.projectname, vtiger_project.linktoaccountscontacts, vtiger_project.startdate, vtiger_project.targetenddate, vtiger_project.actualenddate, vtiger_project.targetbudget, vtiger_project.progress, vtiger_project.projectstatus, vtiger_crmentity.smownerid, vtiger_project.projectid FROM vtiger_project INNER JOIN vtiger_crmentity ON vtiger_project.projectid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' ]2017-01-26 16:19:25.32 [error] - Error Vtiger_Loader::getComponentClassName(View, InProjectRelation, OSSMailView): Handler not found

$_COOKIE = [ 'PHPSESSID' => '19e8f8ea5889f527531d2' 'timezone' => 'Europe/London' 'cpsession' => 'mysite:HdRBJpZiS5dkp1Vi,813b2f76cdda4093ee13a521eff4c63d' 'cd1e449df1367a619a07127624f41252' => 'c76545d05d3a30940e4bce6a91ca8cca' '562250beba1650efcd6e53c7104315c8' => 'ab13552ef91fc332c7f7b02e90b389d4' 'jpanesliders_slide_pane1' => '0' 'jpanesliders_menu-pane3' => '0' 'jpanesliders_menu-pane2' => '0' 'roundcube_sessid' => '9b18f3a36dbb5820ab6f4a998a94926d' 'roundcube_sessauth' => 'Se68bba300fa6b3c169700a2802352815aa725b4f' 'chat_settings' => 'bbCode=true&bbCodeImages=true&bbCodeColors=true&hyperLinks=true&lineBreaks=true&emoticons=true&autoFocus=false&autoScroll=true&maxMessages=0&wordWrap=true&maxWordLength=32&dateFormat=(%25H%3A%25i%3A%25s)&persistFontColor=false&fontColor=null&audio=true&audioVolume=0.5&soundReceive=sound_1&soundSend=sound_2&soundEnter=sound_3&soundLeave=sound_4&soundChatBot=sound_5&soundError=sound_6&blink=true&blinkInterval=500&blinkIntervalNumber=10' 'chat_style' => 'MyBB' 'chat_lang' => 'en' ]

$_SESSION = [ '__HTTP_Session_Info' => 2 'language' => '' 'layout' => '' 'AUTHUSERID' => 10 'authenticated_user_id' => 10 'app_unique_key' => '9322f55d1f1fd21d4127742be4582791' 'authenticated_user_language' => 'en_gb' 'user_name' => 'Jane' 'full_user_name' => 'Doe Jane' 'chatUserID' => 10 'chatUserName' => 'Jane' 'chatLoginUserName' => 'Jane' 'chatUserRole' => 1 'chatLoggedIn' => true 'chatLoginTimeStamp' => 1485436222 'chatIP' => '86.155.188.240' 'chatChannel' => 0 'chatChannelEnterTimeStamp' => 1485436222 'chatStatusUpdateTimeStamp' => 1485447517 'chatInactiveCheckTimeStamp' => 1485447502 'lvs' => [ 'Newmodule' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 111 111 => [ 'start' => '1' ] ] 'Contacts' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 7 7 => [ 'start' => '1' ] ] 'Leads' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 1 1 => [ 'start' => '1' ] ] 'Accounts' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 4 4 => [ 'start' => '1' ] ] 'Project' => [ 'sortby' => '' 'sorder' => '' 'viewname' => 45 45 => [ 'start' => '1' ] ] ] 'Newmodule_listquery' => 'SELECT vtiger_newmodule.newmodule, vtiger_newmodule.number, vtiger_crmentity.createdtime, vtiger_crmentity.smownerid, vtiger_newmodule.newmoduleid FROM vtiger_newmodule INNER JOIN vtiger_crmentity ON vtiger_newmodule.newmoduleid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Contacts_listquery' => 'SELECT vtiger_contactdetails.firstname, vtiger_contactdetails.lastname, vtiger_contactdetails.parentid, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.smownerid, vtiger_contactdetails.contactid FROM vtiger_contactdetails INNER JOIN vtiger_crmentity ON vtiger_contactdetails.contactid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Leads_listquery' => 'SELECT vtiger_leaddetails.lastname, vtiger_leaddetails.company, vtiger_leadaddress.phone, vtiger_leadsubdetails.website, vtiger_leaddetails.email, vtiger_crmentity.smownerid, vtiger_leaddetails.leadid FROM vtiger_leaddetails INNER JOIN vtiger_crmentity ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid INNER JOIN vtiger_leadaddress ON vtiger_leaddetails.leadid = vtiger_leadaddress.leadaddressid INNER JOIN vtiger_leadsubdetails ON vtiger_leaddetails.leadid = vtiger_leadsubdetails.leadsubscriptionid WHERE vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0' 'Accounts_listquery' => 'SELECT vtiger_account.accountname, vtiger_account.website, vtiger_account.phone, vtiger_crmentity.smownerid, vtiger_account.accountid FROM vtiger_account INNER JOIN vtiger_crmentity ON vtiger_account.accountid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' 'Project_listquery' => 'SELECT vtiger_project.projectname, vtiger_project.linktoaccountscontacts, vtiger_project.startdate, vtiger_project.targetenddate, vtiger_project.actualenddate, vtiger_project.targetbudget, vtiger_project.progress, vtiger_project.projectstatus, vtiger_crmentity.smownerid, vtiger_project.projectid FROM vtiger_project INNER JOIN vtiger_crmentity ON vtiger_project.projectid = vtiger_crmentity.crmid WHERE vtiger_crmentity.deleted=0' ]`

I tested adding to Projects which works correctly, then tested adding to Accounts and my NewModule (both Accounts and NewModule have problems in that the Quick Create has no fields in it and nor can they be selected, and if I go to full form it produces the same error.

Does this make any sense to you seeing the log? I am not sure what I am looking for.

nic86 commented 7 years ago

in this log output there are not errors related to your problem.

try to change the log level 'LOG_LEVELS' => ['info'],

and filter the output for keyword related to your error: eg 'permission' from linux command line: grep -i --color 'permission' cache/logs/system.log

your problem appears to be related to permissions, checks the profiles and module access. you could do a test on a clean install.

nic86 commented 7 years ago

you may also activate the browser debug console from config/debug.php (v3.4):

'LOG_TO_CONSOLE' => true,

PercyP commented 7 years ago

@nic86

thanks so much for your help.

I finally found the error. In Configuration/Standard Modules/Edit Fields The Basic/Advanced button needed to be switched so that Basic is blue - this then finally displays the Quick Create and allows for changing the state of Quick Create in the field editor.