Saturday, May 7, 2016

SugarCRM CE | SuiteCRM-Add any field to Mass Update

If its a custom field that you added through studio then simply go into your sugar database and then the fields_meta_data table and find the row entry for your custom field.
Change the massupdate field from 0 to 1.

If its not a custom field added through studio then create a custom php file in this location:

/custom/Extention/modules//Ext/Vardefs/any_name.php

and then add the following code for your specific field.

$dictionary['']['fields']['']['massupdate'] = 1;
Finally run a repair/rebuild and your field should be available on mass update panel.

SugarCRM and Suitecrm – Remove Mass Update From A Built In Module

This quick post will show you how to remove the mass update field from a built in module in SugarCRM or Suitecrm. This will also work for a module that has been deployed but it will not work properly for a module built using module builder. Well, it will work but as soon as you re-deploy the module the changes will be over-written.

For the purpose of this we will use the Account module and assume that it is this that we wish to remove the Mass Update panel from.

The first thing to do is create the file ‘view.list.php’ in /custom/modules/Account/views/ – If this path does not exist, simply create it and place the file in there.

Once that is done add the following code to the file.

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.list.php');

class AccountViewList extends ViewList
{
function listViewProcess()
{
$this->lv->showMassupdateFields = false;
parent::listViewProcess();
}
}
This will remove the Mass update panel from the module. To adapt the above code for other modules simply change the name of the class from AccountViewList to ViewList and place it in the appropriate directory.

Tuesday, January 19, 2016

[sugarcrm] Resolved SugarCRM “You have been logged out because your session has expired”

Upon trying to login to SugarCRM ealier today I kept getting an error stating “You have been logged out because your session has expired”. I knew the details were correct but no matter how many times I tried the same message kept coming up and I could not login. Upon fumbling around for a while I came across a couple of solutions, one of which resolved the problem. I explain these in more detail below:
Solution One – Session Directory Not Writable
This first solution wasn’t relevant in my case but I did see it mentioned a few times on my travels as a very likely resolution to the problem mentioned above and thought it worth a mention it here.
When you’re logged into SugarCRM it uses PHP sessions to store information about your current visit. This solution suggests that the directory where this session information is stored is not writable and therefore SugarCRM is unable to continue past the login screen.
So where is this directory? The first place to look is in your SugarCRM configuration file. This can found in the root of your SugarCRM installation and is in a file called config.php. Within this PHP file is a reference to where sessions will be stored. If this contains a valid path then ensure SugarCRM has permission to write to it.
If the above path in config.php is blank then SugarCRM will use the path set in the php.ini file. You can view what this is set to by creating a PHP file and entering the following:
  1. echo ini_get("session.save_path");  
Solution Two – Disk Out Of Space
The other possible cause of the error was that the disk where SugarCRM is located was out of space which was the case in my scenario. By simply deleting a few old backups and cleaning down unused files I was then able to login again immediately.

(By http://biostall.com)

[sugarcrm] Supported Versions

SugarCRM regularly retires older versions of the Sugar application in order to be able to focus on delivering higher quality in the latest and upcoming product releases. See below for the list of currently supported versions and their end-of-life (EOL) plan.

End-of-Life Plan

The Sugar EOL plan applies to all On-Site versions and editions of the Sugar application, Sugar mobile solutions, and the Sugar Plug-ins, connectors, and extensions. Currently, only the latest released versions of the Sugar Connector for Marketo, Sugar mobile solutions, and the Sugar plug-ins for Microsoft Outlook, Word, Excel, and IBM Notes are supported.
After the EOL dates below have passed, SugarCRM will no longer provide customer support, maintenance patches, or bug fixes for the listed versions. All available upgrade and maintenance patches available at the time of the end-of-life date for a given version will remain available for download but no additional packages will be produced from that point forward.
Version End-of-Life Date
Sugar 6.5.x 12 months from the GA release of 7.7.0.0
Sugar 7.5.x March 30, 2016
Sugar 7.6.x 9 months from the GA release of 7.7.0.0
Sugar Mobile Plus 12 months from the GA release of 7.7.0.0
Versions earlier than 6.5 are no longer supported. Please visit this page regularly for updates.

Upgrading to Supported Versions

To upgrade to the latest supported version, find upgrade packages on SourceForge if you use Community Edition or Download Manager for all other editions. After downloading the appropriate upgrade files, upload and install them using the Upgrade Wizard in the Administration page in your Sugar instance. The most current versions of the Sugar plug-ins and extensions can also be found within the Download Manager.
If you run into any issues with upgrading your commercial edition of Sugar, you can contact SugarCRM Support team by submitting a new case within the Case Tracker.
(By http://support.sugarcrm.com)

[Zurmo] Branding and Global Configuration

Once logged into CRM.me, click the gear icon General-Icon-Pack-1_0037_settings.png and select “Administration” from the drop-down.  At the Administration screen, select Global Configuration

Application Name
This is the name which the system will identify itself.
Time zone
This is the system default timezone used as the default timezone for new users logging into CRM.me for the first time.
Sublist page size
This is the default number of records that will display in sublists for all newly created users.
List page size
This is the default number of records that will display in List views for all newly created users.
Dashboard portlet list page size
This is the default number of records that will display in Portlets. This is set globally for all users here.
Popup list page size
This is the default number of records that will display in Pop lists from where the user can select a record. This is set globally for all users here.
Default From Email Address
For system notifications, specify the default email address.
Default Test To Email Address
For use with the Testing Outbound Email Connection Job.
ReCaptcha Private Key
For use with Web Forms to enable Captcha. A private key can be generated at http://recaptcha.net.
ReCaptcha Public Key
For use with Web Forms to enable Captcha. A public key can be generated at http://recaptcha.net.

Enable game notification popup
Globally enables/disables the game notification popups for all users
Enable game collection popup
Globally enables/disables the game collection notification popups for all users
Enable game coin popup
Globally enables/disables the game coin notification popups for all users
Enable real-time updates
Globally enables/disables real-time desktop notifications for all users. This can also be controlled individually by users in their User Profile. Requires browser plugin.
(By support.crm.me)

[Vtiger] Scheduler Cron Job Not Working: Access Denied

Here is the working method to run cron job with vtiger 6 under any linux, unix type host, even the shared hosts.

1. edit the /vtiger_root/vtigercron.php file.
in the line 42 there is a condition php_sapi === "cli" . change the "cli" value to the right php_sapi value of your server. it can be different server by server.
to obtain the right php_sapi value insert a line before the line 42 to this file.
the inserted line is: echo(php_sapi."\n");
it will echo your php_sapi value.

save the change.

2. edit the /vtiger_root/cron/vtigercron.sh file.
comment out all shell commands from this file and put the following command instead of:
wget http://yourdomain_vtigerurl/vtigercron.php -o /vtiger_root/log/cronlog.txt

save the change.

3. create an empty text file in the /vtiger_root/log/ folder with the name cronlog.txt

4. set the correct access permissions for the above mentioned files:
cronlog.txt chmod 755
vtigercron.sh chmod 755
vtigercron.php chmod 755

755 is enough. the most of system will show 'error 500' if a file has 777 permissions. it is the security issue.

5. create a cron job using the proper interface (for example in the c-panel there is an interface for the setup cron jobs):

*/15 * * * * sh /vtiger_root/cron/vtigercron.sh >/dev/null 2>&1

this command will run in every 15 minutes and call the vtigercron.sh that will execute the vtigercron.php file. the result of executing with all messages will save into the /vtiger_root/log/cronlog.txt

after the first run of the cron you should check the content of the cronlog.txt. the first line of the file will show you the exact value of the php_sapi in your server.

6. go back to the point 1, the /vtiger_root/vtigercron.php file
and change the "cli" value to the right php_sapi value of your server.

comment out or delete the line echo(php_sapi."\n");
and save your change.

7. check the content of the /vtiger_root/log/cronlog.txt after the new run of the cron job.
the file will show the exact state of the crons. you will see something like these lines:
[cron],"1396701901.848",http://yourdomain_vtigerurl/,instance,"2014-04-05 12:45:01","",[starts]
[cron],"1396701901.848",http://yourdomain_vtigerurl/,workflow,"2014-04-05 12:45:01","",[starts]

[cron],"1396701901.848",http://yourdomain_vtigerurl/,workflow,"2014-04-05 12:45:01","2014-04-05 12:45:01",[ends]
[info] recurringinvoice - not ready to run as the time to run again is not completed
[cron],"1396701901.848",http://yourdomain_vtigerurl/,sendreminder,"2014-04-05 12:45:01","",[starts]

[cron],"1396701901.848",http://yourdomain_vtigerurl/,sendreminder,"2014-04-05 12:45:01","2014-04-05 12:45:01",[ends]
[cron],"1396701901.848",http://yourdomain_vtigerurl/,mailscanner,"2014-04-05 12:45:01","",[starts]
no mailbox configured for scanning!
[cron],"1396701901.848",http://yourdomain_vtigerurl/,mailscanner,"2014-04-05 12:45:01","2014-04-05 12:45:01",[ends]
[cron],"1396701901.848",http://yourdomain_vtigerurl/,scheduled import,"2014-04-05 12:45:01","",[starts]

[cron],"1396701901.848",http://yourdomain_vtigerurl/,scheduled import,"2014-04-05 12:45:01","2014-04-05 12:45:02",[ends]
[cron],"1396701901.848",http://yourdomain_vtigerurl/,instance,"2014-04-05 12:45:01","2014-04-05 12:45:02",[ends]

8. check the vtiger 6 admin settings section "scheduler" and check the state of crons.
(from vtiger.com)

Tuesday, January 12, 2016

[sugarcrm6.5] Reset selected users preference from ListView (for developer)

The second way for reset multil user:
You can create class or new action then you get ids of select users which you want to reset prefence.
You develop to loop through it and use following my code to reset:

$u = new User();
$u->retrieve();
$u->resetPreferences();

[sugarcrm] Reset selected users preference from ListView

As users make changes while navigating around Sugar, their preferences are stored in the Sugar database. This includes preferences such as placement of subpanels, sort orders on list view, previous searches on both basic and advanced searches, and settings in the Advanced tab of the User Profile. If there have been unwanted changes and the user would like to start fresh, the "Reset User Preferences" option can be used to undo all preferences saved by Sugar. This will revert the specific user's preferences back to the out of the box settings. This action cannot be undone.

Note: If the user is currently logged in, the changes will not take effect until the user is logged out and then back in.

Note: Resetting a user's preferences is the only way to allow a user access to Sugar if they have been locked out using the Login Lockout feature in Password Management.
Use the following steps to reset a user's preferences:
  1.     Navigate to the user's detail view via Admin > User Management and selecting the user from the list view.
  2.     Select "Reset User Preferences" from the Actions Menu of the detail view.  
  3. An error box will appear confirming the reset. Click "OK" to proceed.
(http://support.sugarcrm.com)

Saturday, January 9, 2016

[sugarcrm] Export data into excel 2007 using PHPExcel

How can we export data to excel 2007? You can use library PHPExcel

Step 1: You need to download PHPExcel from https://phpexcel.codeplex.com/. i used PHPExcel1.8.0 version.
Step 2: Copy this library into custom\include\.
Step 3: On module which you want to use this library for export to excel, you need include it

include('custom/include/PHPExcel1.8.0/PHPExcel.php');
Step 4: Developing data to excel 2007. Please parammeter of createWriter method. the second param is excel version. If you want to export data excel 2007 you need to set Excel2007.
More information,you can read at https://github.com/PHPOffice/PHPExcel/wiki

// Send and close the file
$workbook->close();
$objPHPExcel = PHPExcel_IOFactory::load($path);
// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Student Data.xlsx"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');

// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
unlink($path);
exit;


[sugarcrm] Add fields non-db into search advance

Example for this case that i want add from date and to date for advance search.
i want to find student with condition student of birhtday.
I do the some step below
Step 1: Go to custome Vardefs modue (ex: custom\Extension\modules\isa_students\Ext\Vardefs\ )folder and create new file with name tanphuqn_field_nondb_fromdatetodate.php
Then you copy and paste my scirpt
// taphuqn add 01/11/2015
 $dictionary["isa_students"]["fields"]["fromdatetodate_non_db"]= array(
   'name' => 'fromdatetodate_non_db',
    'rname' => 'fromdatetodate_non_db',
   'vname' => 'LBL_FROMDATE_TODATE_NON_DB',
   'source' => 'non-db',
   'dbType' => 'non-db',
   'type' => 'date',
   'options' => 'date_range_search_dom',
   'enable_range_search' => true,
   'studio' => 'visible',
   'is_date_field' => true,
);

this field is non db when source and dbType is non-db.

Step 2: Add language for this non-db field. You go to custom module(ex:custom\modules\isa_students\language\)
Ex:
'LBL_FROMDATE_TODATE_NON_DB' => 'From date and to date',

Step 3: Repair sugarcrm
You go to Admin-> Repair

Then you click Quick Repair and Rebuild
Step 4: Add field which you have just added to advance search
Go to Admin->Studio and select module which you added non-db field. Ex this module is student
Then you go to advance seach layout


Click advance search icon 

Then you select this non-db field(ex: from date and to date) to Default from Hidden

Step 5: Quick Repair and Rebuild again
Step 6: Check advance search on module which you want to display non-db field (ex: student module)




Friday, January 8, 2016

[sugarcrm] Add today, tomorrow and yesterday into date range search drowdown

If you want to add 3 items (today, tomorrow and yesterday) into date range search dropdown on search field.
We need to modify some things
Step 1: if en_us.lang.php don't exist, you need to create new file en_us.lang.php and save it at custom\include\language\ then you add 3 items

$GLOBALS['app_list_strings']['date_range_search_dom']=array (
    '=' => 'Equals',
    'today' => 'Today',
    'yesterday' => 'Yesterday',
    'tomorrow' => 'Tomorrow',

    'not_equal' => 'Not On',
    'greater_than' => 'After',
    'less_than' => 'Before',
    'last_7_days' => 'Last 7 Days',
    'next_7_days' => 'Next 7 Days',
    'last_30_days' => 'Last 30 Days',
    'next_30_days' => 'Next 30 Days',
    'last_month' => 'Last Month',
    'this_month' => 'This Month',
    'next_month' => 'Next Month',
    'last_year' => 'Last Year',
    'this_year' => 'This Year',
    'next_year' => 'Next Year',
    'between' => 'Is Between',
  );




Step 2: Copy SearchForm2.php file from \include\SearchForm\ to custom\include\SearchForm.
Then you go to line 1154(case 'next_year':) then add new code.
case 'next_year':
case 'yesterday':
case 'today':
case 'tomorrow': 


Step 3: Open include\MVC\View\views\ view.list.php file then go to line 216. You need to replace old  to new script.

// tanphuqn begin to comment this code for run custom search form on 31/12/2015
//require_once('include/SearchForm/SearchForm2.php');
require_once('custom/include/SearchForm/SearchForm2.php');
// tanphuqn end31/12/2015


This my result: