/** * function to export the list view data * @param string $module * @param integer $module_id * @param string $type * @param integer $view_id * @see self::export_data() */ public function export_list_data($module, $module_id, $type, $view_id = 0) { $file_name = $module; $object = new $module(); $do_crm_fields = new CRMFields(); $do_crm_list_view = new CRMListView(); $fields_info = $do_crm_list_view->get_listview_field_info($module, $module_id, "list", $view_id); $entity_table_name = $object->getTable(); $security_where = ""; $security_where = $_SESSION["do_crm_action_permission"]->get_user_where_condition($entity_table_name, $module_id); $additional_where_condition = ''; $group_by = ''; $order_by = ''; $object->get_list_query(); $qry = $object->getSqlQuery(); if (property_exists($object, "list_query_group_by") === true && $object->list_query_group_by != '') { $group_by = " group by " . $object->list_query_group_by; } if ($object->get_default_order_by() != "") { $order_by = " order by " . $object->get_default_order_by(); } if ((int) $view_id > 0) { $do_custom_view_filter = new CustomViewFilter(); $custom_view_date_filter_qry = $do_custom_view_filter->parse_custom_view_date_filter($view_id); $custom_view_adv_filter_qry = $do_custom_view_filter->parse_custom_view_advanced_filter($view_id); $additional_where_condition .= ' ' . $custom_view_date_filter_qry; if (false !== $custom_view_adv_filter_qry) { $additional_where_condition .= ' ' . $custom_view_adv_filter_qry["where"]; } $qry .= $security_where . $additional_where_condition . $group_by . $order_by; if (false !== $custom_view_adv_filter_qry) { $this->query($qry, $custom_view_adv_filter_qry["bind_params"]); } else { $this->query($qry); } } else { $this->query($qry . $security_where . $group_by . $order_by); } $this->export_data($file_name, $fields_info, $type, $module_id); }
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * View modal for the list view of crm module data * Included in the module/list.php file * Get the filed information of module for the list view and generate the header for the datatable display * Sets the fields information in the object member list_view_field_information and sets the object in the persistent session * @author Abhik Chakraborty */ if (!isset($list_special)) { // if not special list $do_crm_list_view = new CRMListView(); $custom_view_id = 0; if ($_SESSION["do_crm_action_permission"]->action_permitted('view', 17)) { if (isset($_REQUEST["custom_view_id"]) && (int) $_REQUEST["custom_view_id"] > 0) { $custom_view_id = (int) $_REQUEST["custom_view_id"]; } else { if (isset($_SESSION[$module]["pinned_list_view"]) && (int) $_SESSION[$module]["pinned_list_view"] > 0) { $custom_view_id = $_SESSION[$module]["pinned_list_view"]; } else { $custom_view_id = $default_custom_view; // check list.php for the module ex. modules/Leads/list.php } } } $_SESSION[$module]["pinned_list_view"] = $custom_view_id; $fields_info = $do_crm_list_view->get_listview_field_info($module, $module_id, "list", $custom_view_id); $lp = 'n'; $lp_object = ''; $method = '';
$do_data_display->set_ds_show_detail_link(false); $do_data_display->set_ds_show_delete_link(false); $do_data_display->set_ds_show_record_selector(false); if ($method_param != '') { $method_param = json_decode($method_param, true); if (is_array($method_param) && count($method_param) > 0) { call_user_func_array(array($object, $method), $method_param); $method_param_used = true; } else { $object->{$method}(); } } else { $object->{$method}(); } } else { $do_crm_list_view = new CRMListView(); $object = $do_crm_list_view->get_list_view_object($m, "list"); $object->get_list_query(); //check if the custom view is on and get the date filter and advanced filter query if (isset($_REQUEST["custom_view_id"]) && (int) $_REQUEST["custom_view_id"] > 0) { $do_custom_view_filter = new CustomViewFilter(); $additional_where_condition = ''; $custom_view_date_filter_qry = $do_custom_view_filter->parse_custom_view_date_filter((int) $_REQUEST["custom_view_id"]); $custom_view_adv_filter_qry = $do_custom_view_filter->parse_custom_view_advanced_filter((int) $_REQUEST["custom_view_id"]); $additional_where_condition .= ' ' . $custom_view_date_filter_qry; //print_r($custom_view_adv_filter_qry); if (false !== $custom_view_adv_filter_qry) { $additional_where_condition = ' ' . $custom_view_adv_filter_qry["where"]; $do_data_display->set_ds_additional_query_param($custom_view_adv_filter_qry["bind_params"]); } $do_data_display->set_ds_additional_where($additional_where_condition);
/** * Used for loading the data using the jquery datatable server side proceesing modal * Gets the module name as a GET and gets the list query for the module * The fileds information is stored in the memmber array list_view_field_information of the object * @see view/related_listview.php * @author Abhik Chakraborty */ include_once "config.php"; $m = $_GET["m"]; $related_method = $_GET["related_method"]; $object = ''; $mid = $_SESSION["do_module"]->get_idmodule_by_name($m, $_SESSION["do_module"]); //Get the module from which the request is comming and use this object to other operation $module = $_GET["module"]; $sqcrmid = (int) $_GET["sqcrmid"]; $do_crm_list_view = new CRMListView(); $related_object = $do_crm_list_view->get_list_view_object($m, "related"); $entity_table_name = $related_object->getTable(); $fields_info = $related_object->list_view_field_information; $primary_key = $related_object->primary_key; $object = new $module(); $object->{$related_method}($sqcrmid); /** * FIXME * For some reason when the array index starts with 0 the text box search works well but the asc/desc on the header does not * So $aColumns array is used for text search and adding a new array $ahColumns for header sort */ $aColumns = array(); $col_count = 0; foreach ($fields_info as $field_name => $info) { $aColumns[$col_count++] = $field_name;
/** * Popup modal for the list data for different modules * @author Abhik Chakraborty */ include_once "config.php"; $m = $_GET["m"]; $field = $_GET["fieldname"]; $fielddisp = $_GET["fielddisp"]; $special_field = ''; $special_field_name = ''; if (isset($_GET["special_field"]) && $_GET["special_field"] == 'yes') { $special_field = $_GET["special_field"]; $special_field_name = $_GET["special_field_name"]; } $module_id = $_SESSION["do_module"]->get_idmodule_by_name($m, $_SESSION["do_module"]); $do_crm_list_view = new CRMListView(); $fields_info = $do_crm_list_view->get_listview_field_info($m, $module_id, "popup"); $allow = true; if ($allow === true) { // FIXME ugly heck to fix the issue of not loading the datatable on popup on multiple try $table_div_id = 'sqcrmpopuplist' . time(); ?> <!-- Modifying the existing style for the datatable to fit the popup window /--> <style> div.dataTables_length label { width :250px; margin-left:5px; text-align: left; } div.dataTables_length select {
function get_field_info_related_view($related_module, $mid) { $do_crm_list_view = new CRMListView(); return $do_crm_list_view->get_listview_field_info($related_module, $mid, "related"); }
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * Used for loading the data using the jquery datatable server side proceesing modal * Gets the module name as a GET and gets the list query for the module * The fileds information is stored in the memmber array list_view_field_information of the object * @see popups/listdata_popup_modal */ include_once "config.php"; $m = $_GET["m"]; $object = ''; $mid = $_SESSION["do_module"]->get_idmodule_by_name($m, $_SESSION["do_module"]); $do_crm_list_view = new CRMListView(); $object = $do_crm_list_view->get_list_view_object($m, "popup"); //--handle FieldType142 if ($_REQUEST["org_dependent"] == 'yes' && (int) $_REQUEST["idorganization"] > 0) { $do_organization = new Organization(); $do_organization->get_contacts((int) $_REQUEST["idorganization"]); $object->setSqlQuery($do_organization->getSqlQuery()); } else { $object->get_list_query(); } $entity_table_name = $object->getTable(); $fields_info = $object->list_view_field_information; /** * FIXME * For some reason when the array index starts with 0 the text box search works well but the asc/desc on the header does not * So $aColumns array is used for text search and adding a new array $ahColumns for header sort */ $aColumns = array();
?> </a> <? $e_finish = new Event("do_import->eventFinishImport"); ?> <a href="/<?php echo $e_finish->getUrl(); ?> " class="btn btn-primary"> <?php echo _('Done'); ?> </a> </div> <div class="clear_float"></div> <hr class="form_hr"> <div class="clear_float"></div> </div> <?php $do_crm_list_view = new CRMListView(); $fields_info = $do_crm_list_view->get_listview_field_info($_SESSION["do_module"]->modules_full_details[$import_module_id]["name"], $import_module_id, "list"); if (!is_object($_SESSION[$list_special_object])) { $ImportModule = new $list_special_object(); $ImportModule->sessionPersistent($list_special_object, "logout.php", TTL); } $list_special = true; $lp_mid = $import_module_id; $_SESSION[$list_special_object]->list_view_field_information = $fields_info; $method = "list_imported_data"; require_once 'view/listview_entry.php'; }