Beispiel #1
0
	public function install() {
		
		$fields = array(
			array('name' => _M('Project Name'), 'type'=>'text', 'required'=>true, 'param'=>'64', 'extra'=>false, 'visible'=>true,'display_callback'=>array('Tests_BugtrackCommon', 'display_bugtrack')),	
			array('name' => _M('Company Name'), 'type'=>'select', 'required'=>true, 'param'=>array('company'=>'Company Name'), 'extra'=>false, 'visible'=>true),
			array('name' => _M('Due Date'), 'type'=>'date', 'required'=>true, 'param'=>64, 'extra'=>false, 'visible'=>true),
			array('name' => _M('Status'), 'type'=>'commondata', 'required'=>true, 'param'=>'Bugtrack_Status', 'extra'=>false,'visible'=>true),
			array('name' => _M('Description'), 'type'=>'long text', 'required'=>false, 'param'=>'64', 'extra'=>false)
		);
		Utils_RecordBrowserCommon::install_new_recordset('bugtrack', $fields);
		Utils_RecordBrowserCommon::new_filter('bugtrack', 'Company Name');
		Utils_RecordBrowserCommon::set_quickjump('bugtrack', 'Project Name');
		Utils_RecordBrowserCommon::set_favorites('bugtrack', true);
		Utils_RecordBrowserCommon::set_recent('bugtrack', 15);
		Utils_RecordBrowserCommon::set_caption('bugtrack', _M('Bugtrack'));
		Utils_RecordBrowserCommon::set_icon('bugtrack', Base_ThemeCommon::get_template_filename('Tests/Bugtrack', 'icon.png'));
		
// ************ addons ************** //
		Utils_AttachmentCommon::new_addon('bugtrack');
		Utils_RecordBrowserCommon::new_addon('company', 'Tests/Bugtrack', 'company_bugtrack_addon', 'Bugtrack');

// ************ other ************** //	
		Utils_CommonDataCommon::new_array('Bugtrack_Status',array('new'=>_M('New'),'inprog'=>_M('In Progress'),'cl'=>_M('Closed')),true,true);

		Utils_RecordBrowserCommon::add_access('bugtrack', 'view', 'ACCESS:employee');
		Utils_RecordBrowserCommon::add_access('bugtrack', 'add', 'ACCESS:employee');
		Utils_RecordBrowserCommon::add_access('bugtrack', 'edit', 'ACCESS:employee');
		Utils_RecordBrowserCommon::add_access('bugtrack', 'delete', array('ACCESS:employee', 'ACCESS:manager'));

		return true;
	}
Beispiel #2
0
 public function uninstall()
 {
     Base_ThemeCommon::uninstall_default_theme('CRM/Contacts/Activities');
     Utils_RecordBrowserCommon::set_tpl('contact', Base_ThemeCommon::get_template_filename('CRM/Contacts', 'Contact'));
     Utils_RecordBrowserCommon::unregister_processing_callback('contact', array('CRM_Contacts_PhotoCommon', 'submit_contact'));
     $this->remove_data_dir();
     DB::DropTable(CRM_Contacts_PhotoCommon::table_name);
     return true;
 }
Beispiel #3
0
 public function install()
 {
     Base_ThemeCommon::install_default_theme(CRM_ContactsInstall::module_name());
     Utils_RecordBrowserCommon::register_datatype('crm_company', 'CRM_ContactsCommon', 'crm_company_datatype');
     Utils_RecordBrowserCommon::register_datatype('crm_contact', 'CRM_ContactsCommon', 'crm_contact_datatype');
     Utils_RecordBrowserCommon::register_datatype('crm_company_contact', 'CRM_ContactsCommon', 'crm_company_contact_datatype');
     Utils_RecordBrowserCommon::register_datatype('email', 'CRM_ContactsCommon', 'email_datatype');
     ModuleManager::include_common('CRM_Contacts', 0);
     // ************ companies ************** //
     $fields = array(array('name' => _M('Company Name'), 'type' => 'text', 'required' => true, 'param' => '128', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_cname')), array('name' => _M('Short Name'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => false), array('name' => _M('Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Fax'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Email'), 'type' => 'email', 'required' => false, 'param' => array('unique' => true), 'extra' => true, 'visible' => false), array('name' => _M('Web address'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_webaddress'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_webaddress')), array('name' => _M('Group'), 'type' => 'multiselect', 'required' => false, 'visible' => true, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Companies_Groups'), 'extra' => false, 'filter' => true), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => true), array('name' => _M('Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Country'), 'type' => 'commondata', 'required' => true, 'param' => array('Countries'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country'), 'extra' => true, 'visible' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Tax ID'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_tax_id')));
     Utils_RecordBrowserCommon::install_new_recordset('company', $fields);
     // ************ contacts ************** //
     $fields = array(array('name' => _M('Last Name'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label')), array('name' => _M('First Name'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label')), array('name' => _M('Company Name'), 'type' => 'crm_company', 'param' => array('field_type' => 'select'), 'required' => false, 'extra' => false, 'visible' => true, 'filter' => true), array('name' => _M('Related Companies'), 'type' => 'crm_company', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => true, 'visible' => false, 'filter' => true), array('name' => _M('Group'), 'type' => 'multiselect', 'required' => false, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Contacts_Groups'), 'extra' => true, 'filter' => true), array('name' => _M('Title'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Work Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Mobile Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Fax'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Email'), 'type' => 'email', 'required' => false, 'param' => array('unique' => true), 'extra' => false, 'visible' => false), array('name' => _M('Web address'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_webaddress'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_webaddress')), array('name' => _M('Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Country'), 'type' => 'commondata', 'required' => true, 'param' => array('Countries'), 'extra' => true, 'visible' => false, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country'), 'extra' => true, 'visible' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => true), array('name' => _M('Details'), 'type' => 'page_split'), array('name' => _M('Home Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Home Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home Country'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Home Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Home Country'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Home Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Birth Date'), 'type' => 'date', 'required' => false, 'param' => 64, 'extra' => true), array('name' => _M('Login Panel'), 'type' => 'page_split', 'param' => 1), array('name' => _M('Login'), 'type' => 'integer', 'required' => false, 'param' => '64', 'extra' => false, 'display_callback' => array('CRM_ContactsCommon', 'display_login'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_login'), 'style' => ''), array('name' => _M('Username'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_username')), array('name' => _M('Set Password'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_password')), array('name' => _M('Confirm Password'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_repassword')), array('name' => _M('Admin'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_admin'), 'display_callback' => array('CRM_ContactsCommon', 'display_admin')), array('name' => _M('Access'), 'type' => 'multiselect', 'required' => false, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Contacts/Access'), 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_access')));
     Utils_RecordBrowserCommon::install_new_recordset('contact', $fields);
     DB::CreateIndex('contact_data_1__f_login_idx', 'contact_data_1', 'f_login,active');
     // ************ company settings ************** //
     Utils_RecordBrowserCommon::register_processing_callback('company', array('CRM_ContactsCommon', 'submit_company'));
     Utils_RecordBrowserCommon::set_quickjump('company', 'Company Name');
     Utils_RecordBrowserCommon::set_favorites('company', true);
     Utils_RecordBrowserCommon::set_recent('company', 15);
     Utils_RecordBrowserCommon::set_caption('company', _M('Companies'));
     Utils_RecordBrowserCommon::set_icon('company', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'companies.png'));
     Utils_RecordBrowserCommon::set_description_callback('company', array('CRM_ContactsCommon', 'company_format_default'));
     Utils_RecordBrowserCommon::enable_watchdog('company', array('CRM_ContactsCommon', 'company_watchdog_label'));
     Utils_RecordBrowserCommon::set_clipboard_pattern('company', "%{{company_name}<BR>}\n%{{address_1}<BR>}\n%{{address_2}<BR>}\n%{%{{city} }%{{zone} }{postal_code}<BR>}\n%{{country}<BR>}\n%{tel. {phone}<BR>}\n%{fax. {fax}<BR>}\n%{{web_address}<BR>}");
     // ************ contacts settings ************** //
     Utils_RecordBrowserCommon::set_tpl('contact', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'Contact'));
     Utils_RecordBrowserCommon::register_processing_callback('contact', array('CRM_ContactsCommon', 'submit_contact'));
     Utils_RecordBrowserCommon::set_quickjump('contact', 'Last Name');
     Utils_RecordBrowserCommon::set_favorites('contact', true);
     Utils_RecordBrowserCommon::set_recent('contact', 15);
     Utils_RecordBrowserCommon::set_caption('contact', _M('Contacts'));
     Utils_RecordBrowserCommon::set_icon('contact', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'icon.png'));
     Utils_RecordBrowserCommon::set_description_callback('contact', array('CRM_ContactsCommon', 'contact_format_default'));
     Utils_RecordBrowserCommon::enable_watchdog('contact', array('CRM_ContactsCommon', 'contact_watchdog_label'));
     Utils_RecordBrowserCommon::set_clipboard_pattern('contact', "%{{first_name} {last_name}<BR>}\n%{{title}<BR>}\n%{{company_name}<BR>}\n%{{address_1}<BR>}\n%{{address_2}<BR>}\n%{%{{city} }%{{zone} }{postal_code}<BR>}\n%{{country}<BR>}\n%{tel. {work_phone}<BR>}\n%{{email}<BR>}");
     // ************ addons ************** //
     Utils_RecordBrowserCommon::new_addon('company', CRM_ContactsInstall::module_name(), 'company_addon', _M('Contacts'));
     Utils_AttachmentCommon::new_addon('company');
     Utils_AttachmentCommon::new_addon('contact');
     // ************ other ************** //
     Utils_CommonDataCommon::new_array('Companies_Groups', array('customer' => _M('Customer'), 'vendor' => _M('Vendor'), 'other' => _M('Other'), 'manager' => _M('Manager')), true, true);
     Utils_CommonDataCommon::new_array('Contacts_Groups', array('office' => _M('Office Staff'), 'field' => _M('Field Staff'), 'custm' => _M('Customer')), true, true);
     Utils_CommonDataCommon::new_array('Contacts/Access', array('manager' => _M('Manager')), true, true);
     Utils_BBCodeCommon::new_bbcode('contact', 'CRM_ContactsCommon', 'contact_bbcode');
     Utils_BBCodeCommon::new_bbcode('company', 'CRM_ContactsCommon', 'company_bbcode');
     Utils_RecordBrowserCommon::set_search('company', 1, 2);
     Utils_RecordBrowserCommon::set_search('contact', 1, 2);
     Base_AclCommon::add_clearance_callback(array('CRM_ContactsCommon', 'crm_clearance'));
     Utils_CommonDataCommon::extend_array('Contacts/Access', array('employee' => _M('Employee')));
     self::install_permissions();
     return true;
 }
Beispiel #4
0
 public function install()
 {
     Base_ThemeCommon::install_default_theme($this->get_type());
     $fields = array(array('name' => _M('Name'), 'type' => 'text', 'required' => true, 'param' => 16, 'extra' => false, 'visible' => true), array('name' => _M('Description'), 'type' => 'long text', 'required' => false, 'extra' => false), array('name' => _M('Percentage'), 'type' => 'float', 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('data_tax_rates', $fields);
     Utils_RecordBrowserCommon::new_record('data_tax_rates', array('name' => 'Non-taxable', 'percentage' => 0));
     Utils_RecordBrowserCommon::set_caption('data_tax_rates', _M('Tax Rates'));
     Utils_RecordBrowserCommon::set_icon('data_tax_rates', Base_ThemeCommon::get_template_filename('Data/TaxRates', 'icon.png'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'add', array('ACCESS:employee', 'ACCESS:manager'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'edit', array('ACCESS:employee', 'ACCESS:manager'));
     Utils_RecordBrowserCommon::add_access('data_tax_rates', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
     return true;
 }
Beispiel #5
0
 public function install()
 {
     //addons table
     $fields = array(array('name' => _M('Recordset'), 'type' => 'text', 'param' => 64, 'display_callback' => array($this->get_type() . 'Common', 'display_recordset'), 'QFfield_callback' => array($this->get_type() . 'Common', 'QFfield_recordset'), 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('phonecall_related', $fields);
     Utils_RecordBrowserCommon::set_caption('phonecall_related', _M('Phonecalls Related Recordsets'));
     Utils_RecordBrowserCommon::register_processing_callback('phonecall_related', array('CRM_PhoneCallCommon', 'processing_related'));
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'add', 'ADMIN');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'edit', 'SUPERADMIN');
     Utils_RecordBrowserCommon::add_access('phonecall_related', 'delete', 'SUPERADMIN');
     // ************ phone calls ************** //
     Base_ThemeCommon::install_default_theme(CRM_PhoneCallInstall::module_name());
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_subject')), array('name' => _M('Contact Name'), 'type' => 'hidden', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_contact_name')), array('name' => _M('Phone Number'), 'type' => 'hidden', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_phone_number')), array('name' => _M('Customer'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'select'), 'extra' => false), array('name' => _M('Other Customer'), 'type' => 'checkbox', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_other_contact')), array('name' => _M('Other Customer Name'), 'type' => 'text', 'param' => '64', 'extra' => false), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => false), array('name' => _M('Employees'), 'type' => 'crm_contact', 'param' => array('field_type' => 'multiselect', 'crits' => array('CRM_PhoneCallCommon', 'employees_crits'), 'format' => array('CRM_ContactsCommon', 'contact_format_no_company')), 'required' => true, 'extra' => false, 'visible' => true, 'filter' => true), array('name' => _M('Status'), 'type' => 'commondata', 'required' => true, 'filter' => true, 'param' => array('order_by_key' => true, 'CRM/Status'), 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_PhoneCallCommon', 'display_status')), array('name' => _M('Priority'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Priority'), 'extra' => false), array('name' => _M('Phone'), 'type' => 'integer', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_phone'), 'display_callback' => array('CRM_PhoneCallCommon', 'display_phone')), array('name' => _M('Other Phone'), 'type' => 'checkbox', 'extra' => false, 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_other_phone')), array('name' => _M('Other Phone Number'), 'type' => 'text', 'param' => '64', 'extra' => false), array('name' => _M('Date and Time'), 'type' => 'timestamp', 'required' => true, 'extra' => false, 'visible' => true), array('name' => _M('Description'), 'type' => 'long text', 'required' => false, 'param' => '255', 'extra' => false), array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_PhoneCallCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_PhoneCallCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('phonecall', $fields);
     Utils_RecordBrowserCommon::set_tpl('phonecall', Base_ThemeCommon::get_template_filename(CRM_PhoneCallInstall::module_name(), 'default'));
     Utils_RecordBrowserCommon::register_processing_callback('phonecall', array('CRM_PhoneCallCommon', 'submit_phonecall'));
     Utils_RecordBrowserCommon::set_icon('phonecall', Base_ThemeCommon::get_template_filename(CRM_PhoneCallInstall::module_name(), 'icon.png'));
     Utils_RecordBrowserCommon::set_recent('phonecall', 5);
     Utils_RecordBrowserCommon::set_caption('phonecall', _M('Phonecalls'));
     Utils_RecordBrowserCommon::enable_watchdog('phonecall', array('CRM_PhoneCallCommon', 'watchdog_label'));
     Utils_RecordBrowserCommon::set_search('phonecall', 2, 0);
     // ************ addons ************** //
     Utils_AttachmentCommon::new_addon('phonecall');
     Utils_RecordBrowserCommon::new_addon('phonecall', CRM_PhoneCallInstall::module_name(), 'messanger_addon', _M('Alerts'));
     CRM_RoundcubeCommon::new_addon('phonecall');
     // ************ other ************** //
     CRM_CalendarCommon::new_event_handler(_M('Phonecalls'), array('CRM_PhoneCallCommon', 'crm_calendar_handler'));
     Utils_BBCodeCommon::new_bbcode('phone', 'CRM_PhoneCallCommon', 'phone_bbcode');
     if (ModuleManager::is_installed('Premium_SalesOpportunity') >= 0) {
         Utils_RecordBrowserCommon::new_record_field('phonecall', _M('Opportunity'), 'select', true, false, 'premium_salesopportunity::Opportunity Name;Premium_SalesOpportunityCommon::crm_opportunity_reference_crits', '', false);
     }
     Utils_RecordBrowserCommon::add_access('phonecall', 'view', 'ACCESS:employee', array('(!permission' => 2, '|employees' => 'USER'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('phonecall', 'edit', 'ACCESS:employee', array('(permission' => 0, '|employees' => 'USER', '|customer' => 'USER'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'delete', 'ACCESS:employee', array(':Created_by' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('phonecall', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
     return true;
 }
Beispiel #6
0
 public function install()
 {
     Utils_CommonDataCommon::new_array('crm_assets_category', array(_M('Desktop'), _M('Server'), _M('Notebook'), _M('Monitor'), _M('Printer'), _M('Other')), true, true);
     Utils_CommonDataCommon::new_id('crm_assets_monitor_type', true);
     Utils_CommonDataCommon::new_array('crm_assets_monitor_type', array(_M('CRT'), _M('LCD'), _M('Other')));
     Utils_CommonDataCommon::new_id('crm_assets_printer_type', true);
     Utils_CommonDataCommon::new_array('crm_assets_printer_type', array(_M('Ink'), _M('Laser'), _M('Other')));
     $fields = array(array('name' => _M('Asset ID'), 'type' => 'calculated', 'param' => Utils_RecordBrowserCommon::actual_db_type('text', 16), 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_AssetsCommon', 'display_asset_id')), array('name' => _M('Active'), 'type' => 'checkbox', 'extra' => false, 'visible' => true, 'filter' => true), array('name' => _M('Category'), 'type' => 'commondata', 'param' => array('crm_assets_category'), 'extra' => false, 'visible' => true, 'filter' => true, 'required' => true, 'QFfield_callback' => array('CRM_AssetsCommon', 'QFfield_category')), array('name' => _M('Asset Name'), 'type' => 'text', 'param' => '128', 'extra' => false, 'visible' => true, 'required' => true), array('name' => _M('Asset Tag'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Company'), 'type' => 'crm_company', 'extra' => false, 'visible' => true, 'param' => array('field_type' => 'select', 'crits' => array('CRM_AssetsCommon', 'company_crits')), 'filter' => true), array('name' => _M('Date Purchased'), 'type' => 'date', 'extra' => false), array('name' => _M('Serial Number'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('IP Address'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('General Info'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_AssetsCommon', 'display_info'), 'QFfield_callback' => array('CRM_AssetsCommon', 'QFfield_info')), array('name' => _M('Host Name'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Operating System'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Processor'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('RAM'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('HDD'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Optical Devices'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Audio'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Software'), 'type' => 'long text', 'extra' => false), array('name' => _M('Display Type'), 'type' => 'commondata', 'extra' => false, 'param' => array('crm_assets_monitor_type')), array('name' => _M('Screen Size'), 'type' => 'text', 'param' => '128', 'extra' => false), array('name' => _M('Printer Type'), 'type' => 'commondata', 'extra' => false, 'param' => array('order_by_key' => true, 'crm_assets_printer_type')), array('name' => _M('Color Printing'), 'type' => 'checkbox', 'extra' => false));
     Utils_RecordBrowserCommon::install_new_recordset('crm_assets', $fields);
     Utils_RecordBrowserCommon::set_recent('crm_assets', 10);
     Utils_RecordBrowserCommon::set_favorites('crm_assets', true);
     Utils_RecordBrowserCommon::set_caption('crm_assets', _M('Assets'));
     Utils_RecordBrowserCommon::set_quickjump('crm_assets', 'Asset Name');
     Utils_RecordBrowserCommon::set_icon('crm_assets', Base_ThemeCommon::get_template_filename('CRM/Assets', 'icon.png'));
     Utils_RecordBrowserCommon::register_processing_callback('crm_assets', array('CRM_AssetsCommon', 'process_request'));
     Utils_RecordBrowserCommon::enable_watchdog('crm_assets', array('CRM_AssetsCommon', 'watchdog_label'));
     Utils_RecordBrowserCommon::add_default_access('crm_assets');
     Utils_RecordBrowserCommon::set_search('crm_assets', 2, 0);
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Assets', 'assets_addon', _M('Assets'));
     Utils_AttachmentCommon::new_addon('crm_assets');
     Base_ThemeCommon::install_default_theme($this->get_type());
     return true;
 }
Beispiel #7
0
	public function install() {
		$ret = true;
        Utils_RecordBrowserCommon::uninstall_recordset('utils_attachment');
        $fields = array(
            array(
                'name' => _M('Edited on'),
                'type' => 'timestamp',
                'extra'=>false,
                'visible'=>true,
                'required' => false,
                'display_callback'=>array('Utils_AttachmentCommon','display_date'),
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_date')
            ),
            array(
                'name' => _M('Title'),
                'type' => 'text',
                'param' => 255,
                'required' => false, 'extra' => false, 'visible' => false
            ),
            array('name' => _M('Note'),
                'type' => 'long text',
                'required' => false,
                'extra' => false,
                'visible'=>true,
                'display_callback'=>array('Utils_AttachmentCommon','display_note'),
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_note'),
            ),
            array('name' => _M('Permission'),
                'type' => 'commondata',
                'required' => true,
                'param' => array('order_by_key' => true, 'CRM/Access'),
                'extra' => false),
            array('name' => _M('Sticky'),
                'type' => 'checkbox',
                'visible' => true,
                'extra' => false),
            array('name' => _M('Crypted'),
                'type' => 'checkbox',
                'extra' => false,
                'QFfield_callback'=>array('Utils_AttachmentCommon','QFfield_crypted')),
            array('name' => _M('Attached to'),
                'type' => 'calculated',
                'extra' => false,
                'display_callback'=>array('Utils_AttachmentCommon','display_attached_to')),
        );
        Utils_RecordBrowserCommon::install_new_recordset('utils_attachment',$fields);
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'view', 'ACCESS:employee', array('(!permission'=>2, '|:Created_by'=>'USER_ID'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', 'ACCESS:employee', array(':Created_by'=>'USER_ID'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', array('ACCESS:employee','ACCESS:manager'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'add', 'ACCESS:employee',array(),array('edited_on'));
        Utils_RecordBrowserCommon::add_access('utils_attachment', 'edit', 'ACCESS:employee', array('(permission'=>0, '|:Created_by'=>'USER_ID'),array('edited_on'));
        Utils_RecordBrowserCommon::register_processing_callback('utils_attachment',array('Utils_AttachmentCommon','submit_attachment'));
        Utils_RecordBrowserCommon::set_tpl('utils_attachment', Base_ThemeCommon::get_template_filename('Utils/Attachment', 'View_entry'));
        Utils_RecordBrowserCommon::enable_watchdog('utils_attachment', array('Utils_AttachmentCommon','watchdog_label'));
        Utils_RecordBrowserCommon::set_caption('utils_attachment', _M('Note'));
        Utils_RecordBrowserCommon::set_description_callback('utils_attachment', array('Utils_AttachmentCommon','description_callback'));
        Utils_RecordBrowserCommon::set_jump_to_id('utils_attachment', false);
        Utils_RecordBrowserCommon::set_search('utils_attachment',1,0);

        $ret &= DB::CreateTable('utils_attachment_local','
			local C(255) NOTNULL,
			attachment I4 NOTNULL,
			func C(255),
			args C(255)',
            array('constraints'=>', FOREIGN KEY (attachment) REFERENCES utils_attachment_data_1(ID)'));
        if(!$ret){
            print('Unable to create table utils_attachment_local.<br>');
            return false;
        }
        DB::CreateIndex('utils_attachment_local__idx', 'utils_attachment_local', 'local');

		$ret &= DB::CreateTable('utils_attachment_file','
			id I4 AUTO KEY NOTNULL,
			attach_id I4 NOTNULL,
			original C(255) NOTNULL,
			created_by I4,
			created_on T DEFTIMESTAMP,
			deleted I1 NOTNULL DEFAULT 0',
			array('constraints'=>', FOREIGN KEY (created_by) REFERENCES user_login(ID), FOREIGN KEY (attach_id) REFERENCES utils_attachment_data_1(id)'));
		if(!$ret){
			print('Unable to create table utils_attachment_file.<br>');
			return false;
		}
        DB::CreateIndex('attach_id_idx','utils_attachment_file','attach_id');
		$ret &= DB::CreateTable('utils_attachment_download','
			id I4 AUTO KEY NOTNULL,
			attach_file_id I4 NOTNULL,
			created_by I4,
			created_on T,
			expires_on T,
			remote I1 DEFAULT 0,
			download_on T DEFTIMESTAMP,
			ip_address C(32),
			host_name C(64),
			description C(128),
			token C(32)',
			array('constraints'=>', FOREIGN KEY (created_by) REFERENCES user_login(ID), FOREIGN KEY (attach_file_id) REFERENCES utils_attachment_file(id)'));
		if(!$ret){
			print('Unable to create table utils_attachment_download.<br>');
			return false;
		}
		$ret &= DB::CreateTable('utils_attachment_clipboard','
			id I4 AUTO KEY NOTNULL,
			filename C(255),
			created_by I4,
			created_on T DEFTIMESTAMP',
			array('constraints'=>''));

		$this->create_data_dir();
		file_put_contents($this->get_data_dir().'.htaccess','deny from all');
		Base_ThemeCommon::install_default_theme($this->get_type());
		
		DB::CreateTable('utils_attachment_googledocs','
			id I4 AUTO KEY NOTNULL,
			note_id I4 NOTNULL,
			view_link C(255),
			doc_id C(128)',
			array('constraints'=>''));
		
		Base_AclCommon::add_permission(_M('Attachments - view full download history'), array('ACCESS:employee'));

		Variable::set('utils_attachments_google_user', '');
		Variable::set('utils_attachments_google_pass', '');
		return $ret;
	}
Beispiel #8
0
    public function show_data($crits = array(), $cols = array(), $order = array(), $admin = false, $special = false, $pdf = false, $limit = null) {
		$this->help('RecordBrowser','main');
		if (Utils_RecordBrowserCommon::$admin_access) $admin = true;
        if (isset($_SESSION['client']['recordbrowser']['admin_access'])) Utils_RecordBrowserCommon::$admin_access = true;
        if (self::$clone_result!==null && $this->jump_to_new_record) {
            if (is_numeric(self::$clone_result)) $this->navigate('view_entry', 'view', self::$clone_result);
            $clone_result = self::$clone_result;
            self::$clone_result = null;
            if ($clone_result!='canceled') return;
        }
        if ($this->check_for_jump()) return;
        Utils_RecordBrowserCommon::$cols_order = $this->col_order;
        if ($this->get_access('browse')===false) {
            print(__('You are not authorised to browse this data.'));
            return;
        }

        $this->init();
        $this->action = 'Browse';
        if (!Base_AclCommon::i_am_admin() && $admin) {
            print(__('You don\'t have permission to access this data.'));
        }
        if ($this->data_gb!==null) $gb = $this->data_gb;
        else $gb = $this->init_module('Utils/GenericBrowser', null, $this->tab);

        if(!$pdf) $gb->set_expandable(true);
        
        if($pdf) $gb->set_resizable_columns(false);
        else $gb->set_fixed_columns_class($this->fixed_columns_class);

        if ($special) {
            $gb_per_page = Base_User_SettingsCommon::get('Utils/GenericBrowser','per_page');
            $gb->set_per_page(Base_User_SettingsCommon::get('Utils/RecordBrowser/RecordPicker','per_page'));
        }
        if (!$this->disabled['search']) {
            $gb->is_adv_search_on();
            $is_searching = $gb->get_module_variable('search','');
            if (!empty($is_searching)) {
                if ($this->get_module_variable('browse_mode')!='all'
//                  || $gb->get_module_variable('quickjump_to')!=null
                    ) {
                    $this->set_module_variable('browse_mode','all');
//                  $gb->set_module_variable('quickjump_to',null);
                    location(array());
                    return;
                }
            }
        }

        if ($special) {
            $table_columns = array(array('name'=>__('Select'), 'width'=>'40px'));
        } else {
            $table_columns = array();
            if (!$pdf && !$admin && $this->favorites) {
                $fav = array('name'=>'&nbsp;', 'width'=>'24px', 'attrs'=>'class="Utils_RecordBrowser__favs"');
                if (!isset($this->force_order)) $fav['order'] = ':Fav';
                $table_columns[] = $fav;
            }
            if (!$pdf && !$admin && $this->watchdog)
                $table_columns[] = array('name'=>'', 'width'=>'24px', 'attrs'=>'class="Utils_RecordBrowser__watchdog"');
        }
        if (!$this->disabled['quickjump']) $quickjump = DB::GetOne('SELECT quickjump FROM recordbrowser_table_properties WHERE tab=%s', array($this->tab));
        else $quickjump = '';

        $hash = array();
        $query_cols = array();
        foreach($this->table_rows as $field => $args) {
            $hash[$args['id']] = $field;
            if ($field === 'id') continue;
            if ((!$args['visible'] && (!isset($cols[$args['id']]) || $cols[$args['id']] === false))) continue;
            if (isset($cols[$args['id']]) && $cols[$args['id']] === false) continue;
            $query_cols[] = $args['id'];
            $arr = array('name'=>$args['name']);
            if (!$pdf && !isset($this->force_order) && $this->browse_mode!='recent' && $args['type']!=='multiselect' && ($args['type']!=='calculated' || $args['param']!='') && $args['type']!=='hidden') $arr['order'] = $field;
            if ($args['type']=='checkbox' || (($args['type']=='date' || $args['type']=='timestamp' || $args['type']=='time') && !$this->add_in_table) || $args['type']=='commondata') {
                $arr['wrapmode'] = 'nowrap';
                $arr['width'] = 50;
            } else {
                $arr['width'] = 100;
			}
            $arr['name'] = _V($arr['name']); // ****** Translate field name for table header
            if (isset($this->more_table_properties[$args['id']])) {
                foreach (array('name','wrapmode','width','display','order') as $v) if (isset($this->more_table_properties[$args['id']][$v])) {
                    if (is_numeric($this->more_table_properties[$args['id']][$v]) && $v=='width') $this->more_table_properties[$args['id']][$v] = $this->more_table_properties[$args['id']][$v]*10;
                    $arr[$v] = $this->more_table_properties[$args['id']][$v];
                }
            }
            if (is_array($args['param']))
                $str = explode(';', $args['param']['array_id']);
            else
                $str = explode(';', $args['param']);
            $ref = explode('::', $str[0]);
            $each = array();
            if (!$pdf && $quickjump!=='' && $args['name']===$quickjump) $each[] = 'quickjump';
            if (!$pdf && !$this->disabled['search']) $each[] = 'search';
            foreach ($each as $e) {
                if ($args['type']=='text' || $args['type']=='currency' || $args['type'] == 'autonumber' || ($args['type']=='calculated' && preg_match('/^[a-z]+(\([0-9]+\))?$/i',$args['param'])!==0)) $arr[$e] = $args['id'];
				
                if (isset($args['ref_field']) && $args['ref_field']) $arr[$e] = $args['id'];
                if ($args['commondata'] && (!is_array($args['param']) || strpos($args['param']['array_id'],':')===false)) {
                    $arr[$e] = $args['id'];
                }
            }
            if (isset($arr['quickjump'])) $arr['quickjump'] = '"~'.$arr['quickjump'];
			if ($pdf) {
				$arr['attrs'] = 'style="border:1px solid black;font-weight:bold;text-align:center;color:white;background-color:gray"';
				if (!isset($arr['width'])) $arr['width'] = 100;
				if ($arr['width']==1) $arr['width'] = 100;
			}
            $table_columns[] = $arr;
        }
		if ($pdf) {
			$max = 0;
			$width_sum = 0;
			foreach ($table_columns as $k=>$v)
				if ($v['width']>$max) $max = $v['width'];
			foreach ($table_columns as $k=>$v) {
				$table_columns[$k]['width'] = intval($table_columns[$k]['width']);
				if ($table_columns[$k]['width']<$max/2) $table_columns[$k]['width'] = $max/2;
				$width_sum += $table_columns[$k]['width'];
			}
			$fraction = 0;
			foreach ($table_columns as $k=>$v) {
				$table_columns[$k]['width'] = floor(100*$v['width']/$width_sum);
				$fraction += 100*$v['width']/$width_sum - $table_columns[$k]['width'];
				if ($fraction>1) {
					$table_columns[$k]['width'] += 1;
					$fraction -= 1;
				}
				$table_columns[$k]['width'] = $table_columns[$k]['width'].'%';
			}
		}
		if (empty($table_columns)) {
			print('Invalid view, no fields to display');
			return;
		}

		$gb->set_table_columns( $table_columns );
		
		if (!$pdf) {
			$clean_order = array();
			foreach ($order as $k => $v) {
                if ($k[0] == ':') {
                    $clean_order[$k] = $v;
                    continue;
                }
				if(!in_array($k,$query_cols)) continue;
				if (isset($this->more_table_properties[$k]) && isset($this->more_table_properties[$k]['name'])) $key = $this->more_table_properties[$k]['name'];
				elseif (isset($hash[$k])) $key = $hash[$k];
				else $key = $k;
   				$clean_order[_V($key)] = $v; // TRSL
			}

			if ($this->browse_mode != 'recent')
				$gb->set_default_order($clean_order, $this->changed_view);
		}

        $search = $gb->get_search_query(true);
        $search_res = array();
		if ($this->search_calculated_callback) {
			$search_res = call_user_func($this->search_calculated_callback, $search);
		}
        if ($gb->is_adv_search_on()) {
            foreach ($search as $k=>$v) {
				$f_id = str_replace(array('"','~'),'',$k);
				$args = $this->table_rows[$hash[$f_id]];
				if ($args['commondata']) $k = $k.'[]';
				elseif (isset($args['ref_field']) && $args['ref_field']) $k = $k.'['.Utils_RecordBrowserCommon::get_field_id($args['ref_field']).']';
                if ($k[0]=='"') {
                    $search_res['~_'.$k] = $v;
                    continue;
                }
                if (is_array($v)) $v = $v[0];
                $v = explode(' ', $v);
                foreach ($v as $w) {
					if (!$args['commondata']) {
						$w = DB::Concat(DB::qstr('%'),DB::qstr($w),DB::qstr('%'));
						$op = '"';
					} else {
						$op = '';
					}
                    $search_res = Utils_RecordBrowserCommon::merge_crits($search_res, array('~'.$op.$k =>$w));
				}
            }
        } else {
            $val = reset($search);
            $isearch = $gb->get_module_variable('search');
            if (empty($isearch)) $val = null;
            $val2 = explode(' ', $val[0]);
            $leftovers = array();
            foreach ($val2 as $vv) {
                foreach ($search as $k=>$v) {
                    if ($v!=$val) {
                        $leftovers[$k] = $v;
                        continue;
                    }
                    if ($k[0]=='"') {
                        $search_res['~_'.$k] = $vv;
                        continue;
                    }
					$args = $this->table_rows[$hash[trim($k, '(|')]];
					if ($args['commondata']) $k = $k.'[]';
					elseif (isset($args['ref_field']) && $args['ref_field']) $k = $k.'['.Utils_RecordBrowserCommon::get_field_id($args['ref_field']).']';
					if (!$args['commondata']) {
						$w = DB::Concat(DB::qstr('%'),DB::qstr($vv),DB::qstr('%'));
						$op = '"';
					} else {
						$w = $vv;
						$op = '';
					}
                    $search_res = Utils_RecordBrowserCommon::merge_crits($search_res, array('~'.$op.$k =>$w));
                }
            }
            $search_res = Utils_RecordBrowserCommon::merge_crits($search_res, $leftovers);
        }

        if (!$pdf) $order = $gb->get_order();
        $crits = array_merge($crits, $search_res);
        if ($this->browse_mode == 'favorites')
            $crits[':Fav'] = true;
        if ($this->browse_mode == 'watchdog')
            $crits[':Sub'] = true;
        if ($this->browse_mode == 'recent') {
            $crits[':Recent'] = true;
            $order = array(':Visited_on'=>'DESC');
        }

        if ($admin && !$pdf) {
            $order = array(':Edited_on'=>'DESC');
            $form = $this->init_module('Libs/QuickForm', null, $this->tab.'_admin_filter');
            $form->addElement('select', 'show_records', __('Show records'), array(0=>'['.__('All').']',1=>'['.__('All active').']',2=>'['.__('All deactivated').']'), array('onchange'=>$form->get_submit_form_js()));
            $f = $this->get_module_variable('admin_filter', 0);
            $form->setDefaults(array('show_records'=>$f));
            $admin_filter = $form->exportValue('show_records');
            $this->set_module_variable('admin_filter', $admin_filter);
            switch($admin_filter) {
                case 0: Utils_RecordBrowserCommon::$admin_filter = '';
                    break;
                case 1: Utils_RecordBrowserCommon::$admin_filter = 'active=1 AND ';
                    break;
                case 2: Utils_RecordBrowserCommon::$admin_filter = 'active=0 AND ';
                    break;
            }
            $form->display_as_row();
        }
        if (isset($this->force_order)) $order = $this->force_order;
        if (!$order) $order = array();

        $this->amount_of_records = Utils_RecordBrowserCommon::get_records_count($this->tab, $crits, $admin, $order);

        if ($limit === null && !$this->disabled['pagination'])
            $limit = $gb->get_limit($this->amount_of_records);

		if (!$this->disabled['pdf'] && !$pdf && $this->get_access('print')) {
            $limited_print_records = 200;
            $limited_print = ($this->amount_of_records >= $limited_print_records);
            $print_limit = $limited_print ? $limit : null;
            $key = md5(serialize($this->tab).serialize($crits).serialize($cols).serialize($order).serialize($admin).serialize($print_limit));
            $_SESSION['client']['utils_recordbrowser'][$key] = array(
                'tab'=>$this->tab,
                'crits'=>$crits,
                'cols'=>$cols,
                'order'=>$order,
                'admin'=>$admin,
                'more_table_properties'=>$this->more_table_properties,
                'limit' => $print_limit,
            );
            $print_href = 'href="modules/Utils/RecordBrowser/print.php?'.http_build_query(array('key'=>$key, 'cid'=>CID)).'" target="_blank"';
            $print_tooltip_text = $limited_print ?
                __('Due to more than %d records, you are allowed to print current view', array($limited_print_records)) :
                __('Print all records');
            $print_tooltip = Utils_TooltipCommon::open_tag_attrs($print_tooltip_text, false);
            $this->new_button('print', __('Print'), "$print_href $print_tooltip");
		}

        $records = Utils_RecordBrowserCommon::get_records($this->tab, $crits, array(), $order, $limit, $admin);

        if (($this->get_access('export') || $this->enable_export) && !$this->disabled['export'])
            $this->new_button('save',__('Export'), 'href="modules/Utils/RecordBrowser/csv_export.php?'.http_build_query(array('tab'=>$this->tab, 'admin'=>$admin, 'cid'=>CID, 'path'=>$this->get_path())).'"');

        $this->set_module_variable('crits_stuff',$crits?$crits:array());
        $this->set_module_variable('order_stuff',$order?$order:array());

        $custom_label = '';
        if (!$pdf && !$special && $this->get_access('add',$this->custom_defaults)!==false) {
            if ($this->add_button!==null) $label = $this->add_button;
            elseif (!$this->multiple_defaults) $label = $this->create_callback_href(array($this, 'navigate'), array('view_entry', 'add', null, $this->custom_defaults));
            else $label = Utils_RecordBrowserCommon::create_new_record_href($this->tab,$this->custom_defaults,'multi',true,true);
            if ($label!==false && $label!=='') $custom_label = '<a '.$label.'><span class="record_browser_add_new" '.Utils_TooltipCommon::open_tag_attrs(__('Add new record')).'><img src="'.Base_ThemeCommon::get_template_file('Utils/RecordBrowser/add.png').'" /><div class="add_new">'.__('Add new').'</div></span></a>';
        }
        if ($this->more_add_button_stuff) {
            if ($custom_label) $custom_label = '<table><tr><td>'.$custom_label.'</td><td>'.$this->more_add_button_stuff.'</td></tr></table>';
            else $custom_label = $this->more_add_button_stuff;
        }
        $gb->set_custom_label($custom_label);

        if ($admin) $this->browse_mode = 'all';
        if ($this->browse_mode == 'recent') {
            $ret = DB::Execute('SELECT * FROM '.$this->tab.'_recent WHERE user_id=%d ORDER BY visited_on DESC', array(Acl::get_user()));
            while ($row = $ret->FetchRow()) {
                if (!isset($records[$row[$this->tab.'_id']])) continue;
                $records[$row[$this->tab.'_id']]['visited_on'] = Base_RegionalSettingsCommon::time2reg(strtotime($row['visited_on']));
            }
        } else {
            $this->set_module_variable('set_browsed_records',array('tab'=>$this->tab,'crits'=>$crits, 'order'=>$order, 'records'=>array()));
        }
        if ($special) $rpicker_ind = array();

        if (!$pdf && !$admin && $this->favorites) {
            $favs = array();
            $ret = DB::Execute('SELECT '.$this->tab.'_id FROM '.$this->tab.'_favorite WHERE user_id=%d', array(Acl::get_user()));
            while ($row=$ret->FetchRow()) $favs[$row[$this->tab.'_id']] = true;
        }
        self::$access_override['tab'] = $this->tab;
        if (isset($limit)) $i = $limit['offset'];

        $grid_enabled = $this->grid===null?Base_User_SettingsCommon::get('Utils/RecordBrowser','grid'):$this->grid;
        if ($grid_enabled) load_js('modules/Utils/RecordBrowser/grid.js');

        $this->view_fields_permission = $this->get_access('add', $this->custom_defaults);
        if (!$pdf && !$special && $this->add_in_table && $this->view_fields_permission) {
            $form = $this->init_module('Libs/QuickForm',null, 'add_in_table__'.$this->tab);
            $form_name = $form->get_name();
        } else $form_name = '';
        foreach ($records as $row) {
            if ($this->browse_mode!='recent' && isset($limit)) {
                self::$browsed_records['records'][$row['id']] = $i;
                $i++;
            }
            $row = Utils_RecordBrowserCommon::record_processing($this->tab, $row, 'browse');
            self::$access_override['id'] = $row['id'];
            $gb_row = $gb->get_new_row();
			$row_data = array();
            if (!$pdf && !$admin && $this->favorites) {
                $isfav = isset($favs[$row['id']]);
                $row_data[] = Utils_RecordBrowserCommon::get_fav_button($this->tab, $row['id'], $isfav);
            }
            if (!$pdf && !$admin && $this->watchdog)
                $row_data[] = Utils_WatchdogCommon::get_change_subscription_icon($this->tab,$row['id']);
            if ($special) {
                $element = $this->get_module_variable('element');
                $format = $this->get_module_variable('format_func');
                $row_data = array('<input type="checkbox" id="leightbox_rpicker_'.$element.'_'.$row['id'].'" formated_name="'.(is_callable($format)?strip_tags(call_user_func($format, $row, true)):'').'" />');
                $rpicker_ind[] = $row['id'];
            }
            $r_access = $this->get_access('view', $row);
            foreach($query_cols as $k=>$argsid) {
				if (!$r_access || !$r_access[$argsid]) {
					$row_data[] = '';
					continue;
				}
                $field = $hash[$argsid];
                $args = $this->table_rows[$field];
                $value = $this->get_val($field, $row, ($special || $pdf), $args);
                if (strip_tags($value)=='') $value .= '&nbsp;';
                if ($args['style']=='currency' || $args['style']=='number') $value = array('style'=>'text-align:right;','value'=>$value);
                if ($grid_enabled && !in_array($args['type'], array('calculated','multiselect','commondata'))) {
                    $table = '<table class="Utils_RecordBrowser__grid_table" style="width:100%" cellpadding="0" cellspacing="0" border="0"><tr><td id="grid_form_field_'.$argsid.'_'.$row['id'].'" style="display:none;">Loading...</td><td id="grid_value_field_'.$argsid.'_'.$row['id'].'">';
                    $ed_icon = '</td><td style="min-width:18px;width:18px;padding:0px;margin:0px;">'.
                                '<span id="grid_edit_'.$argsid.'_'.$row['id'].'" style="float:right;display:none;"><a href="javascript:void(0);" onclick="grid_enable_field_edit(\''.$argsid.'\','.$row['id'].',\''.$this->tab.'\',\''.$form_name.'\');"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'edit.png').'"></a></span>'.
                                '<span id="grid_save_'.$argsid.'_'.$row['id'].'" style="float:right;display:none;"><a href="javascript:void(0);" onclick="grid_submit_field(\''.$argsid.'\','.$row['id'].',\''.$this->tab.'\');"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils/RecordBrowser', 'save_grid.png').'"></a></span>'.
                                '</td></tr></table>';

/*                  $table = '<span id="grid_form_field_'.$argsid.'_'.$row['id'].'" style="display:none;">Loading...</span><span id="grid_value_field_'.$argsid.'_'.$row['id'].'">';
                    $ed_icon = '</span>'.
                                '<span id="grid_edit_'.$argsid.'_'.$row['id'].'" style="float:right;display:none;"><a href="javascript:void(0);" onclick="grid_enable_field_edit(\''.$argsid.'\','.$row['id'].',\''.$this->tab.'\',\''.$form_name.'\');"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'edit.png').'"></a></span>'.
                                '<span id="grid_save_'.$argsid.'_'.$row['id'].'" style="float:right;display:none;"><a href="javascript:void(0);" onclick="grid_submit_field(\''.$argsid.'\','.$row['id'].',\''.$this->tab.'\');"><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils/RecordBrowser', 'save_grid.png').'"></a></span>';*/


                    $attrs = 'onmouseover="if(typeof(mouse_over_grid)!=\'undefined\')mouse_over_grid(\''.$argsid.'\',\''.$row['id'].'\');" onmouseout="if(typeof(mouse_out_grid)!=\'undefined\')mouse_out_grid(\''.$argsid.'\',\''.$row['id'].'\');"';
//                  $attrs = 'onmouseover="$(\'grid_edit_'.$argsid.'_'.$row['id'].'\').style.display=\'inline\'" onmouseout="$(\'grid_edit_'.$argsid.'_'.$row['id'].'\').style.display=\'none\'"';
                } else {
                    $table = '';
                    $ed_icon = '';
                    $attrs = '';
                }
                if (is_array($value)) {
                    $value['value'] = $table.$value['value'].$ed_icon;
                    $value['attrs'] = $attrs;
                } else {
                    $value = array(
                        'value'=>$table.$value.$ed_icon,
                        'attrs'=>$attrs
                    );
                }
				if ($pdf) {
                    $value['overflow_box'] = false;
					$value['attrs'] = $attrs.' style="border:1px solid black;"';
					$value['value'] = '&nbsp;'.$value['value'].'&nbsp;';
				}
                $row_data[] = $value;
            }

            $gb_row->add_data_array($row_data);
            if (!$pdf && $this->disabled['actions']!==true) {
                if ($this->disabled['actions']===false) $da = array();
                else $da = array_flip($this->disabled['actions']);
                if (!$special) {
                    if (!isset($da['view'])) $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_entry', 'view', $row['id'])),__('View'), null, 'view');
					if (!isset($da['edit'])) {
						if ($this->get_access('edit',$row)) $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_entry', 'edit',$row['id'])),__('Edit'), null, 'edit');
						else $gb_row->add_action('',__('Edit'),__('You don\'t have permission to edit this record.'),'edit',0,true);
					}
                    if ($admin) {
                        if (!$row[':active']) $gb_row->add_action($this->create_callback_href(array($this,'set_active'),array($row['id'],true)),__('Activate'), null, 'active-off');
                        else $gb_row->add_action($this->create_callback_href(array($this,'set_active'),array($row['id'],false)),__('Deactivate'), null, 'active-on');
                        $info = Utils_RecordBrowserCommon::get_record_info($this->tab, $row['id']);
                        if ($info['edited_on']===null) $gb_row->add_action('',__('This record was never edited'),null,'history_inactive');
                        else $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_edit_history', $row['id'])),__('View edit history'),null,'history');
                    } else {
						if (!isset($da['delete'])) {
                            if ($this->get_access('delete',$row)) $gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this record?'),array($this,'delete_record'),array($row['id'], false)),__('Delete'), null, 'delete');
                            else $gb_row->add_action('',__('Delete'),__('You don\'t have permission to delete this record'),'delete',0,true);
                        }
					}
                }
                if (!isset($da['info'])) $gb_row->add_info(($this->browse_mode=='recent'?'<b>'.__('Visited on: %s', array($row['visited_on'])).'</b><br>':'').Utils_RecordBrowserCommon::get_html_record_info($this->tab, isset($info)?$info:$row['id']));
                $this->call_additional_actions_methods($row, $gb_row);
            }
        }
        if (!$special && $this->add_in_table && $this->view_fields_permission) {

            $visible_cols = array();
            foreach($this->table_rows as $field => $args){
                if ((!$args['visible'] && (!isset($cols[$args['id']]) || $cols[$args['id']] === false))) continue;
                if (isset($cols[$args['id']]) && $cols[$args['id']] === false) continue;
                $visible_cols[$args['id']] = true;
            }

			self::$last_record = $this->record = $this->custom_defaults = Utils_RecordBrowserCommon::record_processing($this->tab, $this->custom_defaults, 'adding');

            $this->prepare_view_entry_details($this->custom_defaults, 'add', null, $form, $visible_cols);
            $form->setDefaults($this->custom_defaults);

            if ($form->isSubmitted()) {
                $this->set_module_variable('force_add_in_table_after_submit', true);
                if ($form->validate()) {
                    $values = $form->exportValues();
                    foreach ($this->custom_defaults as $k=>$v)
                        if (!isset($values[$k])) $values[$k] = $v;
                    $id = Utils_RecordBrowserCommon::new_record($this->tab, $values);
                    location(array());
                } else {
                    $this->show_add_in_table = true;
                }
            }
            $form->addElement('submit', 'submit_qanr', __('Save'), array('style'=>'width:100%;height:19px;', 'class'=>'button'));
            $renderer = new HTML_QuickForm_Renderer_TCMSArraySmarty();
            $form->accept($renderer);
            $data = $renderer->toArray();

            $gb->set_prefix($data['javascript'].'<form '.$data['attributes'].'>'.$data['hidden']."\n");
            $gb->set_postfix("</form>\n");

            if (!$admin && $this->favorites) {
                $row_data= array('&nbsp;');
            } else $row_data= array();
            if (!$admin && $this->watchdog)
                $row_data[] = '&nbsp;';


            $first = true;
            foreach($visible_cols as $k => $v) {
                if (isset($data[$k])) {
                    $row_data[] = array('value'=>$data[$k]['error'].$data[$k]['html'], 'overflow_box'=>false);
                    if ($first) eval_js('focus_on_field = "'.$k.'";');
                    $first = false;
                } else $row_data[] = '&nbsp;';
            }

//          if ($this->browse_mode == 'recent')
//              $row_data[] = '&nbsp;';

            $gb_row = $gb->get_new_row();
            $gb_row->add_action('',$data['submit_qanr']['html'],'', null, 0, false, 7);
            $gb_row->set_attrs('id="add_in_table_row" style="display:'.($this->show_add_in_table?'':'none').';"');
            $gb_row->add_data_array($row_data);
        }
        if ($special) {
            $this->set_module_variable('rpicker_ind',$rpicker_ind);
            $ret = $this->get_html_of_module($gb);
            Base_User_SettingsCommon::save('Utils/RecordBrowser/RecordPicker','per_page',$gb->get_module_variable('per_page'));
            Base_User_SettingsCommon::save('Utils/GenericBrowser','per_page',$gb_per_page);
            return $ret;
        }
		if ($pdf) {
			$gb->absolute_width(true);
			$args = array(Base_ThemeCommon::get_template_filename('Utils_GenericBrowser','pdf'));
		} else $args = array();
		$this->display_module($gb, $args);
    }
Beispiel #9
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
Utils_RecordBrowserCommon::set_icon('rc_multiple_emails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'icon.png'));
Beispiel #10
0
 public function install()
 {
     $this->create_data_dir();
     // create htaccess to prevent logs to be available on the internet
     $htaccess = $this->get_data_dir() . '.htaccess';
     $f = fopen($htaccess, 'w');
     if ($f === false) {
         print "Cannot create .htaccess file ({$htaccess}). " . "Your Roundcube logs may be available on the internet!";
     } else {
         fwrite($f, "deny from all\n");
         fclose($f);
     }
     Base_ThemeCommon::install_default_theme($this->get_type());
     $this->drop_all_rc_tables();
     if (DB::is_mysql()) {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/mysql.initial.sql');
     } else {
         $f = file_get_contents('modules/CRM/Roundcube/RC/SQL/postgres.initial.sql');
     }
     foreach (explode(';', $f) as $q) {
         $q = trim($q);
         if (!$q) {
             continue;
         }
         DB::Execute($q);
     }
     Utils_CommonDataCommon::new_array('CRM/Roundcube/Security', array('tls' => _M('TLS'), 'ssl' => _M('SSL')), true, true);
     //addons table
     $fields = array(array('name' => _M('Recordset'), 'type' => 'text', 'param' => 64, 'display_callback' => array($this->get_type() . 'Common', 'display_recordset'), 'QFfield_callback' => array($this->get_type() . 'Common', 'QFfield_recordset'), 'required' => true, 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('rc_related', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_related', _M('Mail Related Recordsets'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_related', array('CRM_RoundcubeCommon', 'processing_related'));
     Utils_RecordBrowserCommon::add_access('rc_related', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_related', 'add', 'ADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'edit', 'SUPERADMIN');
     Utils_RecordBrowserCommon::add_access('rc_related', 'delete', 'SUPERADMIN');
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'company'));
     Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'contact'));
     //accounts table
     $fields = array(array('name' => _M('EPESI User'), 'type' => 'integer', 'extra' => false, 'visible' => true, 'required' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_epesi_user'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_epesi_user')), array('name' => _M('Email'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 128), array('name' => _M('Account Name'), 'type' => 'text', 'extra' => false, 'visible' => true, 'required' => true, 'param' => 32, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_account_name')), array('name' => _M('Server'), 'type' => 'text', 'extra' => false, 'visible' => true, 'param' => '255', 'required' => true), array('name' => _M('Login'), 'type' => 'text', 'required' => true, 'param' => '255', 'extra' => false, 'visible' => true), array('name' => _M('Password'), 'type' => 'text', 'required' => true, 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_security')), array('name' => _M('SMTP Server'), 'type' => 'text', 'extra' => false, 'visible' => false, 'param' => '255', 'required' => true), array('name' => _M('SMTP Auth'), 'type' => 'checkbox', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_auth')), array('name' => _M('SMTP Login'), 'type' => 'text', 'required' => false, 'param' => '255', 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_login')), array('name' => _M('SMTP Password'), 'type' => 'text', 'extra' => false, 'param' => '255', 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_password'), 'display_callback' => array('CRM_RoundcubeCommon', 'display_password')), array('name' => _M('SMTP Security'), 'type' => 'commondata', 'param' => array('CRM/Roundcube/Security'), 'extra' => false, 'visible' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_smtp_security')), array('name' => _M('Default Account'), 'type' => 'checkbox', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_default_account')), array('name' => _M('Advanced'), 'type' => 'page_split'), array('name' => _M('Archive on sending'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('Use EPESI Archive directories'), 'type' => 'checkbox', 'extra' => true, 'visible' => false), array('name' => _M('IMAP Root'), 'type' => 'text', 'param' => 32, 'extra' => true, 'visible' => false), array('name' => _M('IMAP Delimiter'), 'type' => 'text', 'param' => 8, 'extra' => true, 'visible' => false));
     Utils_RecordBrowserCommon::install_new_recordset('rc_accounts', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_accounts', _M('Mail accounts'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_accounts', array('CRM_RoundcubeCommon', 'submit_account'));
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Count'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_count'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_count')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('First Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Last Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_thread_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_thread_attachments')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mail_threads', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mail_threads', _M('Mail Thread'));
     Utils_RecordBrowserCommon::new_addon('rc_mail_threads', 'CRM/Roundcube', 'thread_addon', _M('E-mails'));
     Utils_RecordBrowserCommon::set_search('rc_mail_threads', 2, -1);
     $fields = array(array('name' => _M('Subject'), 'type' => 'text', 'param' => '256', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_subject')), array('name' => _M('Contacts'), 'type' => 'crm_company_contact', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('Employee'), 'type' => 'crm_contact', 'param' => array('field_type' => 'select'), 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_RoundcubeCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true), array('name' => _M('Date'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false), array('name' => _M('Attachments'), 'type' => 'calculated', 'extra' => false, 'visible' => true, 'display_callback' => array('CRM_RoundcubeCommon', 'display_attachments'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_attachments')), array('name' => _M('Headers Data'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Body'), 'type' => 'long text', 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_body')), array('name' => _M('From'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('To'), 'type' => 'text', 'param' => 4096, 'extra' => false, 'visible' => false, 'required' => false), array('name' => _M('Thread'), 'type' => 'select', 'param' => 'rc_mail_threads::Count', 'extra' => false, 'visible' => false, 'required' => false, 'display_callback' => array('CRM_RoundcubeCommon', 'display_mail_thread'), 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_mail_thread')), array('name' => _M('Message ID'), 'type' => 'text', 'param' => 128, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')), array('name' => _M('References'), 'type' => 'text', 'param' => 4096 * 4, 'extra' => false, 'visible' => false, 'required' => false, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_hidden')));
     Utils_RecordBrowserCommon::install_new_recordset('rc_mails', $fields);
     Utils_RecordBrowserCommon::set_caption('rc_mails', _M('Mails'));
     Utils_RecordBrowserCommon::set_tpl('rc_mails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'mails'));
     Utils_RecordBrowserCommon::register_processing_callback('rc_mails', array('CRM_RoundcubeCommon', 'submit_mail'));
     Utils_RecordBrowserCommon::set_search('rc_mails', 2, -1);
     DB::CreateIndex('rc_mails_thread_idx', 'rc_mails_data_1', 'f_thread');
     DB::CreateIndex('rc_mails_msgid_idx', 'rc_mails_data_1', 'f_message_id');
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_body_addon', _M('Body'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'attachments_addon', _M('Attachments'));
     Utils_RecordBrowserCommon::new_addon('rc_mails', 'CRM/Roundcube', 'mail_headers_addon', _M('Headers'));
     @DB::DropTable('rc_mails_attachments');
     DB::CreateTable('rc_mails_attachments', '
         mail_id I4 NOTNULL,
         type C(32),
         name C(255),
         mime_id C(32),
         attachment I1 DEFAULT 1', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     DB::CreateTable('rc_mails_attachments_download', '
         mail_id I4 NOTNULL,
         hash C(32),
         created_on T DEFTIMESTAMP', array('constraints' => ', FOREIGN KEY (mail_id) REFERENCES rc_mails_data_1(ID)'));
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'addon', _M('E-mails'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'addon', _M('E-mails'));
     $fields = array(array('name' => _M('Record Type'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('text', 64), 'required' => false, 'visible' => false, 'filter' => true, 'extra' => false), array('name' => _M('Record ID'), 'type' => 'hidden', 'param' => Utils_RecordBrowserCommon::actual_db_type('integer'), 'filter' => false, 'required' => false, 'extra' => false, 'visible' => false), array('name' => _M('Nickname'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_nickname')), array('name' => _M('Email'), 'type' => 'email', 'required' => true, 'param' => array('unique' => true), 'extra' => false, 'visible' => true));
     Utils_RecordBrowserCommon::install_new_recordset('rc_multiple_emails', $fields);
     Utils_RecordBrowserCommon::set_favorites('rc_multiple_emails', true);
     Utils_RecordBrowserCommon::set_caption('rc_multiple_emails', _M('Mail addresses'));
     Utils_RecordBrowserCommon::set_icon('rc_multiple_emails', Base_ThemeCommon::get_template_filename('CRM/Roundcube', 'icon.png'));
     Utils_RecordBrowserCommon::set_search('rc_multiple_emails', 2, 0);
     Utils_RecordBrowserCommon::new_addon('contact', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Utils_RecordBrowserCommon::new_addon('company', 'CRM/Roundcube', 'mail_addresses_addon', _M('E-mail addresses'));
     Variable::set('crm_roundcube_global_signature', "Message sent with EPESI - managing business your way!<br /><a href=\"http://epe.si\">http://epe.si</a>");
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'view', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'edit', 'ACCESS:employee', array(), array('epesi_user'));
     Utils_RecordBrowserCommon::add_access('rc_accounts', 'delete', 'ACCESS:employee', array('epesi_user' => 'USER_ID'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'view', 'ACCESS:employee', array(), array('headers_data'));
     Utils_RecordBrowserCommon::add_access('rc_mails', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mails', 'edit', 'ACCESS:employee', array(), array('subject', 'employee', 'date', 'headers_data', 'body', 'from', 'to', 'thread', 'message_id', 'references'));
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_mail_threads', 'delete', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'view', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'add', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'edit', 'ACCESS:employee');
     Utils_RecordBrowserCommon::add_access('rc_multiple_emails', 'delete', 'ACCESS:employee');
     return true;
 }
Beispiel #11
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
Utils_RecordBrowserCommon::set_icon('rc_multiple_emails', Base_ThemeCommon::get_template_filename(CRM_Roundcube::module_name(), 'icon.png'));
Beispiel #12
0
@ini_set('memory_limit', '256M');
@ini_set('memory_limit', '512M');
Utils_WatchdogCommon::dont_notify();
$rs_checkpoint = Patch::checkpoint('recordset');
if (!$rs_checkpoint->is_done()) {
    Patch::require_time(5);
    Utils_RecordBrowserCommon::uninstall_recordset('utils_attachment');
    $fields = array(array('name' => _M('Edited on'), 'type' => 'timestamp', 'extra' => false, 'visible' => true, 'required' => false, 'display_callback' => array('Utils_AttachmentCommon', 'display_date'), 'QFfield_callback' => array('Utils_AttachmentCommon', 'QFfield_date')), array('name' => _M('Title'), 'type' => 'text', 'param' => 255, 'required' => false, 'extra' => false, 'visible' => true), array('name' => _M('Note'), 'type' => 'long text', 'required' => false, 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_AttachmentCommon', 'display_note'), 'QFfield_callback' => array('Utils_AttachmentCommon', 'QFfield_note')), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => false), array('name' => _M('Sticky'), 'type' => 'checkbox', 'visible' => true, 'extra' => false), array('name' => _M('Crypted'), 'type' => 'checkbox', 'extra' => false, 'QFfield_callback' => array('Utils_AttachmentCommon', 'QFfield_crypted')), array('name' => _M('Func'), 'type' => 'text', 'param' => 255, 'required' => true, 'extra' => false, 'visible' => false), array('name' => _M('Args'), 'type' => 'text', 'param' => 255, 'required' => true, 'extra' => false, 'visible' => false));
    Utils_RecordBrowserCommon::install_new_recordset('utils_attachment', $fields);
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'view', 'ACCESS:employee', array('(!permission' => 2, '|employees' => 'USER'), array('func', 'args'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', 'ACCESS:employee', array(':Created_by' => 'USER_ID'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'add', 'ACCESS:employee');
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'edit', 'ACCESS:employee', array('(permission' => 0, '|employees' => 'USER', '|customer' => 'USER'), array('edited_on'));
    Utils_RecordBrowserCommon::register_processing_callback('utils_attachment', array('Utils_AttachmentCommon', 'submit_attachment'));
    Utils_RecordBrowserCommon::set_tpl('utils_attachment', Base_ThemeCommon::get_template_filename(Utils_Attachment::module_name(), 'View_entry'));
    $ret = DB::CreateTable('utils_attachment_local', '
			local C(255) NOTNULL,
			attachment I4 NOTNULL,
			func C(255),
			args C(255)', array('constraints' => ', FOREIGN KEY (attachment) REFERENCES utils_attachment_data_1(ID)'));
    if (!$ret) {
        print 'Unable to create table utils_attachment_link.<br>';
        return false;
    }
    DB::CreateIndex('utils_attachment_local__idx', 'utils_attachment_local', 'local');
    $rs_checkpoint->done();
}
//parse old notes
Patch::set_message('Processing notes');
$old_checkpoint = Patch::checkpoint('old');
Beispiel #13
0
    ),
    array(
        'name' => _M('Args'),
        'type' => 'text',
        'param' => 255,
        'required' => true, 'extra' => false, 'visible' => false
    ),
    );
    Utils_RecordBrowserCommon::install_new_recordset('utils_attachment',$fields);
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'view', 'ACCESS:employee', array('(!permission'=>2, '|employees'=>'USER'), array('func','args'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', 'ACCESS:employee', array(':Created_by'=>'USER_ID'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'delete', array('ACCESS:employee','ACCESS:manager'));
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'add', 'ACCESS:employee');
    Utils_RecordBrowserCommon::add_access('utils_attachment', 'edit', 'ACCESS:employee', array('(permission'=>0, '|employees'=>'USER', '|customer'=>'USER'),array('edited_on'));
    Utils_RecordBrowserCommon::register_processing_callback('utils_attachment',array('Utils_AttachmentCommon','submit_attachment'));
    Utils_RecordBrowserCommon::set_tpl('utils_attachment', Base_ThemeCommon::get_template_filename('Utils/Attachment', 'View_entry'));

    $ret = DB::CreateTable('utils_attachment_local','
			local C(255) NOTNULL,
			attachment I4 NOTNULL,
			func C(255),
			args C(255)',
        array('constraints'=>', FOREIGN KEY (attachment) REFERENCES utils_attachment_data_1(ID)'));
    if(!$ret){
        print('Unable to create table utils_attachment_link.<br>');
        return false;
    }
    DB::CreateIndex('utils_attachment_local__idx', 'utils_attachment_local', 'local');
    
    $rs_checkpoint->done();
}