<?php
/**
*
* @author Octavian Blagoi
* @copyright Tavi Bit Service SRL
* @license MIT
* @version 0.1
* @package epesi-CRM
* @subpackage MyOrders
*/
defined("_VALID_ACCESS") || die('Direct access forbidden');
class CRM_MyOrdersInstall extends ModuleInstall {
public function install() {
Base_LangCommon::install_translations($this->get_type());
$fields = array(
array(
'name'=>'order id',
'type'=>'calculated',
'param'=>Utils_RecordBrowserCommon::actual_db_type('text', 16),
'extra'=>false,
'visible'=>true,
'display_callback'=>array('CRM_MyOrdersCommon', 'display_order_id')
),
array(
'name'=>'Active',
'type'=>'checkbox',
'extra'=>false,
'visible'=>true,
'filter'=>true
),
array(
'name'=>'Company Name',
'type'=>'text',
'param'=>'128',
'extra'=>false,
'visible'=>true,
'required'=>true
),
array(
'name'=>'Order Tag',
'type'=>'text',
'param'=>'128',
'extra'=>false
),
array(
'name'=>'Order Date',
'type'=>'date',
'extra'=>false,
'visible'=>true
),
/*************** DETAILS ***************/
array(
'name'=>'Product Id',
'type'=>'commondata',
'extra'=>false,
'visible'=>true,
'required'=>true
),
array(
'name'=>'Product Name',
'type'=>'text',
'param'=>'128',
'extra'=>false
),
array(
'name'=>'Unit',
'type'=>'text',
'param'=>'4',
'visible'=>true,
'extra'=>false
),
array(
'name'=>'Sale Price',
'type'=>'currency',
'visible'=>true,
'extra'=>false
),
array(
'name'=>'Quantity',
'type'=>'float',
'visible'=>true,
'extra'=>false
),
array(
'name'=>'Value',
'type'=>'float',
'visible'=>true,
'extra'=>false
)
);
Utils_RecordBrowserCommon::install_new_recordset('crm_MyOrders', $fields);
Utils_RecordBrowserCommon::set_recent('crm_MyOrders', 10);
Utils_RecordBrowserCommon::set_favorites('crm_MyOrders', true);
Utils_RecordBrowserCommon::set_caption('crm_MyOrders', 'MyOrders');
Utils_RecordBrowserCommon::set_quickjump('crm_MyOrders', 'order Name');
Utils_RecordBrowserCommon::set_icon('crm_MyOrders', Base_ThemeCommon::get_template_filename('CRM/MyOrders', 'icon.png'));
Utils_RecordBrowserCommon::register_processing_callback('crm_MyOrders', array('CRM_MyOrdersCommon', 'process_request'));
Utils_RecordBrowserCommon::enable_watchdog('crm_MyOrders', array('CRM_MyOrdersCommon','watchdog_label'));
Utils_RecordBrowserCommon::add_default_access('crm_MyOrders');
Utils_RecordBrowserCommon::new_addon('company', 'CRM/MyOrders', 'MyOrders_addon', 'MyOrders');
Utils_AttachmentCommon::new_addon('crm_MyOrders');
return true;
}
public function uninstall() {
Utils_CommonDataCommon::remove('crm_MyOrders_category');
Utils_CommonDataCommon::remove('crm_MyOrders_monitor_type');
Utils_CommonDataCommon::remove('crm_MyOrders_printer_type');
Utils_RecordBrowserCommon::delete_addon('company', 'CRM/MyOrders', 'MyOrders_addon');
Utils_AttachmentCommon::delete_addon('crm_MyOrders');
Utils_AttachmentCommon::persistent_mass_delete('crm_MyOrders');
Utils_RecordBrowserCommon::uninstall_recordset('crm_MyOrders');
Utils_RecordBrowserCommon::unregister_processing_callback('crm_MyOrders', array('CRM_MyOrdersCommon', 'process_request'));
return true;
}
public function version() {
return array("0.1");
}
public function requires($v) {
return array(
array('name'=>'Base/Lang','version'=>0),
array('name'=>'Utils/RecordBrowser','version'=>0),
array('name'=>'CRM/Contacts','version'=>0));
}
public static function info() {
return array(
'Description'=>'This module helps you to manage Orders',
'Author'=>'Octavian Blagoi <tavi343@gmail.com>',
'License'=>'MIT');
}
public static function simple_setup() {
return array('package'=>'CRM', 'option'=>'MyOrders');
}
}
?>