Example #1
0
 /**
  * event function to activate a plugin from setting page
  * @param object $evctl
  */
 public function eventActivatePlugin(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         if (trim($evctl->plugin_name) != '') {
             if (false === $this->get_plugin_by_name($evctl->plugin_name)) {
                 $this->addNew();
                 $this->name = trim($evctl->plugin_name);
                 $this->add();
                 $plugin_id = $this->getInsertId();
                 $this->do_sorting_on_activate(trim($evctl->plugin_name));
                 echo $plugin_id;
             }
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "plugins");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
 /**
  * function to update the datashare permission across the module
  * @param object $evctl
  */
 public function eventUpdateModuleDataShareRel(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $qry = "select idmodule_datashare_rel,idmodule from `" . $this->getTable() . "`";
         $stmt = $this->getDbConnection()->executeQuery($qry);
         while ($data = $stmt->fetch()) {
             $datashare_permission_form_name = 'mod_' . $data["idmodule"];
             $permission_flag = $evctl->{$datashare_permission_form_name};
             $this->cleanValues();
             $this->permission_flag = $permission_flag;
             $this->update($data["idmodule_datashare_rel"]);
         }
         $dis = new Display($evctl->next_page);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to add record ! '));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
Example #3
0
 /**
  * function to edit the combo values
  * @param object $evctl
  */
 public function eventEditComboValues(EventControler $evctl)
 {
     $idfields = (int) $evctl->idfields;
     if ($idfields > 0) {
         $referrar_module_id = (int) $evctl->referrar_module_id;
         $pick_values_seperated = preg_split('/[\\r\\n]+/', $evctl->pick_values, -1, PREG_SPLIT_NO_EMPTY);
         $this->update_combo_values($idfields, $pick_values_seperated);
         //check if the field is mapped with some other fields and if yes then update the mapped fields also
         $do_crm_fields_mapping = new CRMFieldsMapping();
         $mapped_fields = $do_crm_fields_mapping->is_mapped($idfields);
         if (is_array($mapped_fields) && count($mapped_fields) > 0) {
             foreach ($mapped_fields as $mapped_fieldid) {
                 $this->update_combo_values($mapped_fieldid, $pick_values_seperated);
             }
         }
         $_SESSION["do_crm_messages"]->set_message('success', _('Data has been updated successfully.'));
         $next_page = NavigationControl::getNavigationLink("Settings", "picklist");
         $dis = new Display($next_page);
         $dis->addParam("cmid", $referrar_module_id);
         $evctl->setDisplayNext($dis);
     }
 }
    /**
     * event function to load the recently viewed infomation
     * @param object $evctl
     * @return string html
     */
    function eventAjaxLoadRecentlyViewed(EventControler $evctl)
    {
        $html = '';
        $iduser = $_SESSION["do_user"]->iduser;
        $this->get_recently_viewed($iduser);
        if ($this->getNumRows() > 0) {
            $do_crm_entity = new CRMEntity();
            $html .= '<ul id="recently_viewed">
						<li><a href="" class="current">' . _('Recently Viewed') . '</a></li>
					';
            while ($this->next()) {
                $identifier = '';
                $record_url = '';
                $module = $_SESSION["do_module"]->modules_full_details[$this->idmodule]["name"];
                $identifier = $do_crm_entity->get_entity_identifier($this->idrecord, $module);
                $record_url = NavigationControl::getNavigationLink($module, "detail", $this->idrecord);
                $html .= '<li><a href="' . $record_url . '">' . $identifier . '</a></li>';
            }
            $html .= '</ul>';
        }
        echo $html;
    }
Example #5
0
$do_roles = new Roles();
?>
<div class="container-fluid">
	<div class="row">
		<?php 
include_once "modules/Settings/settings_leftmenu.php";
?>
		<div class="col-md-9">
			<div class="box_content">
				<ol class="breadcrumb">
					<li class="active"><?php 
echo _('Settings');
?>
</li>
					<li><a href="<?php 
echo NavigationControl::getNavigationLink($module, "roles_list");
?>
"><?php 
echo _('Roles');
?>
</a></li>
				</ol>
				<p class="lead"><?php 
echo _('Manage Roles hierarchy for users');
?>
</p> 
			</div>
			<div class="datadisplay-outer">
				<h2><small class="text-muted"><?php 
echo _('Tree view of roles and hierarchy');
?>
Example #6
0
File: edit.php Project: sQcrm/sqcrm
$inv_terms_cond = $do_global_settings->get_inventory_terms_condition();
$tems_condition = $inv_terms_cond["salesorder_terms_condition"];
$module_obj = new SalesOrder();
$module_obj->getId($sqcrm_record_id);
$do_lineitems = new Lineitems();
$do_lineitems->get_line_items($module_id, $sqcrm_record_id);
$do_products = new Products();
$lineitems = array();
if ($do_lineitems->getNumRows() > 0) {
    while ($do_lineitems->next()) {
        $product_available_tax = '';
        if ($do_lineitems->item_type == 'product') {
            $product_available_tax = $do_products->get_products_tax($do_lineitems->item_value);
        }
        $lineitems[] = array("idlineitems" => $do_lineitems->idlineitems, "item_type" => $do_lineitems->item_type, "item_name" => $do_lineitems->item_name, "item_value" => $do_lineitems->item_value, "item_description" => $do_lineitems->item_description, "item_quantity" => $do_lineitems->item_quantity, "item_price" => $do_lineitems->item_price, "discount_type" => $do_lineitems->discount_type, "discount_value" => $do_lineitems->discount_value, "discounted_amount" => $do_lineitems->discounted_amount, "tax_values" => $do_lineitems->tax_values, "product_available_tax" => $product_available_tax, "taxed_amount" => $do_lineitems->taxed_amount, "total_after_discount" => $do_lineitems->total_after_discount, "total_after_tax" => $do_lineitems->total_after_tax, "net_total" => $do_lineitems->net_total);
    }
}
//print_r($lineitems);
if (isset($_GET["return_page"]) && $_GET["return_page"] != '') {
    $return = $_GET["return_page"];
    $cancel_return = NavigationControl::getNavigationLink($module, $return, $sqcrm_record_id);
} else {
    $cancel_return = NavigationControl::getNavigationLink($module, "list");
}
//Assigned to iduser or group ?
if ($module_obj->iduser > 0) {
    $assigned_to = 'user_' . $module_obj->iduser;
} elseif ($module_obj->idgroup > 0) {
    $assigned_to = 'group_' . $module_obj->idgroup;
}
require_once 'view/edit_view.php';
Example #7
0
 /**
  * Event function to update the organization data
  * @param object $evctl
  */
 public function eventEditRecord(EventControler $evctl)
 {
     $id_entity = (int) $evctl->sqrecord;
     if ($id_entity > 0 && true === $_SESSION["do_crm_action_permission"]->action_permitted('edit', 11, (int) $evctl->sqrecord)) {
         $obj = $this->getId($id_entity);
         $obj = (object) $obj;
         // convert the data array to Object
         $do_process_plugins = new CRMPluginProcessor();
         // process before update plugin. If any error is raised display that.
         $do_process_plugins->process_action_plugins((int) $evctl->idmodule, $evctl, 3, $id_entity, $obj);
         if (strlen($do_process_plugins->get_error()) > 2) {
             $_SESSION["do_crm_messages"]->set_message('error', $do_process_plugins->get_error());
             $next_page = NavigationControl::getNavigationLink($evctl->module, "edit");
             $dis = new Display($next_page);
             $dis->addParam("sqrecord", $id_entity);
             if ($evctl->return_page != '') {
                 $dis->addParam("return_page", $evctl->return_page);
             }
             $evctl->setDisplayNext($dis);
         } else {
             $do_crm_fields = new CRMFields();
             $crm_fields = $do_crm_fields->get_field_information_by_module_as_array((int) $evctl->idmodule);
             $table_entity = 'vendor';
             $table_entity_address = 'vendor_address';
             $table_entity_custom = 'vendor_custom_fld';
             $table_entity_to_grp = 'vendor_to_grp_rel';
             $entity_data_array = array();
             $custom_data_array = array();
             $addr_data_array = array();
             $assigned_to_as_group = false;
             foreach ($crm_fields as $crm_fields) {
                 $field_name = $crm_fields["field_name"];
                 $field_value = $do_crm_fields->convert_field_value_onsave($crm_fields, $evctl, 'edit');
                 if (is_array($field_value) && count($field_value) > 0) {
                     if ($field_value["field_type"] == 15) {
                         $field_name = 'iduser';
                         $value = $field_value["value"];
                         $assigned_to_as_group = $field_value["assigned_to_as_group"];
                         $group_id = $field_value["group_id"];
                     } elseif ($field_value["field_type"] == 12) {
                         $value = $field_value["name"];
                         $avatar_array[] = $field_value;
                     }
                 } else {
                     $value = $field_value;
                 }
                 if ($crm_fields["table_name"] == $table_entity && $crm_fields["idblock"] > 0) {
                     $entity_data_array[$field_name] = $value;
                 }
                 if ($crm_fields["table_name"] == $table_entity_address && $crm_fields["idblock"] > 0) {
                     $addr_data_array[$field_name] = $value;
                 }
                 if ($crm_fields["table_name"] == $table_entity_custom && $crm_fields["idblock"] > 0) {
                     $custom_data_array[$field_name] = $value;
                 }
             }
             $this->update(array($this->primary_key => $id_entity), $table_entity, $entity_data_array);
             //updating the last_modified,last_modified_by
             $q_upd = "\n\t\t\t\tupdate `" . $this->getTable() . "` set \n\t\t\t\t`last_modified` = ? ,\n\t\t\t\t`last_modified_by` = ? \n\t\t\t\twhere `" . $this->primary_key . "` = ?";
             $this->query($q_upd, array(date("Y-m-d H:i:s"), $_SESSION["do_user"]->iduser, $id_entity));
             if (count($custom_data_array) > 0) {
                 $this->update(array($this->primary_key => $id_entity), $table_entity_custom, $custom_data_array);
             }
             if (count($addr_data_array) > 0) {
                 $this->update(array($this->primary_key => $id_entity), $table_entity_address, $addr_data_array);
             }
             if ($assigned_to_as_group === false) {
                 $qry_grp_rel = "DELETE from `{$table_entity_to_grp}` where idvendor = ? LIMIT 1";
                 $this->query($qry_grp_rel, array($id_entity));
             } else {
                 $qry_grp_rel = "select * from `{$table_entity_to_grp}` where idvendor = ?";
                 $this->query($qry_grp_rel, array($id_entity));
                 if ($this->getNumRows() > 0) {
                     $this->next();
                     $id_grp_rel = $this->idvendor_to_grp_rel;
                     $q_upd = "\n\t\t\t\t\t\tupdate `{$table_entity_to_grp}` set \n\t\t\t\t\t\t`idgroup` = ?\n\t\t\t\t\t\twhere `idvendor_to_grp_rel` = ? LIMIT 1";
                     $this->query($q_upd, array($group_id, $id_grp_rel));
                 } else {
                     $this->insert($table_entity_to_grp, array("idvendor" => $id_entity, "idgroup" => $group_id));
                 }
             }
             // Record the history
             $do_data_history = new DataHistory();
             $do_data_history->add_history($id_entity, (int) $evctl->idmodule, 'edit');
             $do_data_history->add_history_value_changes($id_entity, (int) $evctl->idmodule, $obj, $evctl);
             //record the feed
             $feed_other_assigne = array();
             if ($assigned_to_as_group === true) {
                 $feed_other_assigne = array("related" => "group", "data" => array("key" => "newgroup", "val" => $group_id));
             }
             $do_feed_queue = new LiveFeedQueue();
             $do_feed_queue->add_feed_queue($id_entity, (int) $evctl->idmodule, $evctl->vendor_name, 'edit', $feed_other_assigne);
             // process after update plugin
             $do_process_plugins->process_action_plugins((int) $evctl->idmodule, $evctl, 4, $id_entity, $obj);
             $_SESSION["do_crm_messages"]->set_message('success', _('Data updated successfully !'));
             $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
             $dis = new Display($next_page);
             $dis->addParam("sqrecord", $id_entity);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to edit the record ! '));
         $next_page = NavigationControl::getNavigationLink($evctl->module, "list");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
Example #8
0
 /**
  * event function to activate the cpanel login
  * @param object $evctl
  * @return void
  */
 function eventActivateCpanelLogin(EventControler $evctl)
 {
     if ((int) $evctl->record_id > 0) {
         $this->getId((int) $evctl->record_id);
         $err = '';
         if ((int) $this->idorganization == 0) {
             $err = _('Contact must be associated with an organization for portal login activation');
         }
         if (strlen(trim($this->email)) == 0) {
             $err = _('Missing the primary email id for portal login activation');
         }
     } else {
         $err = _('Missing idcontacts for portal activation');
     }
     if (strlen($err) == 0) {
         $pass = $this->activate_cpanel_login((int) $evctl->record_id, $this->email, (int) $this->idorganization);
         $contact_data = array("firstname" => $this->firstname, "lastname" => $this->lastname, "email" => $this->email, "password" => $pass);
         $this->send_cpanel_login_details($contact_data);
         $_SESSION["do_crm_messages"]->set_message('success', _('Portal user is created and email sent with the details ! '));
         $next_page = NavigationControl::getNavigationLink('Contacts', "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $evctl->record_id);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', $err);
         $next_page = NavigationControl::getNavigationLink('Contacts', "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $evctl->record_id);
         $evctl->setDisplayNext($dis);
     }
 }
Example #9
0
 /**
  * Static function to display the data in detail view
  * @param string $value
  * @param string $cont_name
  * @param boolean $linked
  */
 public static function display_value($value, $cont_name = '', $linked = true)
 {
     if ($cont_name != '') {
         if ($linked === true) {
             return '<a href="' . NavigationControl::getNavigationLink('Contacts', "detail", $value) . '">' . $cont_name . '</a>';
         } else {
             return $cont_name;
         }
     } else {
         $display_val = self::get_value($value);
         if ($display_val == '') {
             return $display_val;
         } else {
             if ($linked === true) {
                 return '<a href="' . NavigationControl::getNavigationLink('Contacts', "detail", $value) . '">' . $display_val . '</a>';
             } else {
                 return $display_val;
             }
         }
     }
 }
Example #10
0
*/ 
?>
<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="row">
				<div class="datadisplay-outer">
					<?php
					$e_edit_entity = new Event($module."->eventEditRecord");
					$e_edit_entity->addParam("idmodule",$module_id);
					$e_edit_entity->addParam("module",$module);
					$e_edit_entity->addParam("sqrecord",$sqcrm_record_id);
					if (isset($_REQUEST["return_page"]) && strlen($_REQUEST["return_page"]) > 2) {
						$e_edit_entity->addParam("return_page",$_REQUEST["return_page"]);
					}
					$e_edit_entity->addParam("error_page",NavigationControl::getNavigationLink($module,"edit",$sqcrm_record_id));
					echo '<form class="form-horizontal" id="'.$module.'__editRecord" name="'.$module.'__editRecord" action="/eventcontroler.php" method="post" enctype="multipart/form-data">';
					echo $e_edit_entity->getFormEvent();
					require("edit_view_form_fields.php");
					?>          
					</form>
				</div>
			</div><!--/row-->
		</div><!--/span-->
	</div><!--/row-->
</div>
<script>
<?php 
	echo $do_crmfields->get_js_form_validation($module_id,$module."__editRecord","edit");
?>
$.validator.addMethod("notEqual", function(value,element,param) {
Example #11
0
 /**
  * Event function to discard the last import
  * will set the deleted = 0 for the last imported data for the module
  * @param object $evctl
  */
 public function eventDiscardImport(EventControler $evctl)
 {
     $import_module_id = $this->get_import_module_id();
     switch ($import_module_id) {
         case 3:
             $import_object = new LeadsImport();
             break;
         case 4:
             $import_object = new ContactsImport();
             break;
         case 5:
             $import_object = new PotentialsImport();
             break;
         case 6:
             $import_object = new OrganizationImport();
             break;
         case 11:
             $import_object = new VendorImport();
             break;
         case 12:
             $import_object = new ProductsImport();
             break;
     }
     $qry = "\n\t\tselect * from " . $this->getTable() . " \n\t\twhere \n\t\t`idmodule` = " . $import_module_id . " \n\t\tAND `iduser` = " . $_SESSION["do_user"]->iduser;
     $stmt = $this->getDbConnection()->executeQuery($qry, array("idmodule" => $import_module_id, "iduser" => $_SESSION["do_user"]->iduser));
     if ($stmt->rowCount() > 0) {
         while ($data = $stmt->fetch()) {
             $qry = "\n\t\t\t\tupdate " . $import_object->getTable() . " \n\t\t\t\tset `deleted` = 1\n\t\t\t\twhere `" . $import_object->primary_key . "` = ?\n\t\t\t\tAND `iduser` =  ? limit 1 ";
             $import_object->query($qry, array($data["idrecord"], $data["iduser"]));
         }
     }
     $this->clean_previous_imports();
     $next_page = NavigationControl::getNavigationLink("Import", "index");
     $dis = new Display($next_page);
     $dis->addParam("return_module", $this->get_import_module_id());
     $evctl->setDisplayNext($dis);
 }
        echo '<span style="font-size: 11px;">' . _('and') . '</span>';
    }
    ?>
						</td>
					</tr>
					<tr><td></td></tr>
					<tr><td></td></tr>
					<?php 
}
?>
				</table>
			</div>
			<hr class="form_hr">
			<div class="left_600">
				<a href="<?php 
echo NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$module_obj->idmodule]["name"], "list");
?>
" class="btn btn-inverse">
				<i class="icon-white icon-remove-sign"></i> <?php 
echo _('Cancel');
?>
</a>  
				<input type="submit" class="btn btn-primary" value="<?php 
echo _('Save');
?>
"/>
			</div>
		</div>
	</div>
</div>
<script>
			</a>
		</li>
	</ul>
    <?php } elseif ($module_id == 11) { ?>
	<ul class="list-group">	
		<li class="list-group-item">
			<a href="<?php echo NavigationControl::getNavigationLink("Vendor","create_purchase_order",$sqcrm_record_id,'&return_page=detail'); ?>" onclick = "">
			<img src="/themes/images/purchase_order.png" style="vertical-align:center;">
			<?php echo _('create purchase order');?>
			</a>
		</li>
	</ul>
    <?php } elseif ($module_id == 12) { ?>
	<ul class="list-group">	
		<li class="list-group-item">
			<a href="<?php echo NavigationControl::getNavigationLink("Products","create_purchase_order",$sqcrm_record_id,'&return_page=detail'); ?>" onclick = "">
			<img src="/themes/images/purchase_order.png" style="vertical-align:center;">
			<?php echo _('create purchase order');?>
			</a>
		</li>
	</ul>
    <?php } ?>
    <?php
	$do_queue = new Queue() ;
	if (true === $do_queue->queue_permitted_for_module($module_id)) {
		echo '<div id="queue_section" style="margin-left:16px;">' ;
		echo '</div>' ;
	}
    ?>
</div>
<?php
Example #14
0
 protected function createComponentNavigation($name)
 {
     $nav = new NavigationControl($this, $name);
     $menuItems = dibi::select("id, label_{$this->lang} AS label, nette_link, nette_link_args, current_link, uri")->from('menu')->where('is_visible = 1')->orderBy('sort')->fetchAll();
     foreach ($menuItems as $item) {
         $args = !is_null($item->nette_link_args) ? Basic::string2array(str_replace('%id%', $item->id, $item->nette_link_args)) : array();
         // expand nette link args
         $uri = $item->nette_link !== null ? $this->link($item->nette_link, $args) : $item->uri;
         // nette link or standard URI
         $nav->add($item->label, $uri, $item->current_link);
     }
 }
Example #15
0
 /**
  * function to get data history display text
  * @param object $obj
  * @param boolean $link
  * @param boolean $user_history
  * @return array $ret_array
  */
 public function get_data_history_display_text($obj, $link = false, $user_history = false)
 {
     $row1 = '<strong>' . $obj->firstname . ' ' . $obj->lastname . '</strong> ' . _('on ') . '<i>' . i18nDate::i18n_long_time(TimeZoneUtil::convert_to_user_timezone($obj->date_modified, true)) . '</i>';
     switch ($obj->action) {
         case 'add':
             if ($user_history === true) {
                 $row2 = _('Added') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Added the record');
             }
             break;
         case 'delete':
             if ($user_history === true) {
                 $row2 = _('Deleted') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Deleted the record');
             }
             break;
         case 'edit':
             if ($user_history === true) {
                 $row2 = _('Updated') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Updated the record');
             }
             break;
         case 'value_changes':
             $do_crm_fields = new CRMFields();
             $do_crm_fields->getId($obj->idfields);
             if ($do_crm_fields->getNumRows() > 0) {
                 $field_label = $do_crm_fields->field_label;
                 $old_value = $obj->old_value;
                 $new_value = $obj->new_value;
                 if ($do_crm_fields->field_type == 9) {
                     $old_value = FieldType9::display_value($old_value);
                     $new_value = FieldType9::display_value($new_value);
                 }
                 if ($user_history === true) {
                     $row2 = _('Changed value in') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule) . ' , ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 } else {
                     $row2 = _('Changed') . ' ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 }
             }
             $do_crm_fields->free();
             break;
     }
     if ($obj->user_avatar != '') {
         $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
         $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension;
     }
     if ($link === true) {
         $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->id_referrer);
         $row2 .= '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $GLOBALS['SITE_URL'] . $detail_url . '</a>';
     }
     $ret_array = array("avatar" => $thumb, "row1" => $row1, "row2" => $row2);
     return $ret_array;
 }
Example #16
0
 /**
  * event function to signout
  * @param object $evctl
  */
 public function eventLogout(EventControler $evctl)
 {
     //do login audit
     $do_login_audit = new LoginAudit();
     $do_login_audit->do_login_audit("Logout");
     $this->setFree();
     $this->free();
     // Unset all of the session variables.
     $_SESSION = array();
     // If it's desired to kill the session, also delete the session cookie.
     // Note: This will destroy the session, and not just the session data!
     if (isset($_COOKIE[session_name()])) {
         setcookie(session_name(), '', time() - 42000, '/');
     }
     // Finally, destroy the session.
     session_destroy();
     $dis = new Display(NavigationControl::getNavigationLink("User", "login"));
     $evctl->setDisplayNext($dis);
 }
?>
				</table>
			</div>
			<div class="form-actions">  
				<?php 
if (isset($edit) && $edit == 1) {
    ?>
					<a href="<?php 
    echo NavigationControl::getNavigationLink($module, "edit?step=5&sqrecord=" . $sqcrm_record_id);
    ?>
" class="btn btn-inverse">
				<?php 
} else {
    ?>
					<a href="<?php 
    echo NavigationControl::getNavigationLink($module, "add?step=5");
    ?>
" class="btn btn-inverse">
				<?php 
}
?>
					<i class="icon-white icon-remove-sign"></i> <?php 
echo _('Back');
?>
</a>  
					<input type="submit" class="btn btn-primary" value="<?php 
echo _('Next');
?>
"/>
			</div>
			</form>
Example #18
0
 /**
  * function to add a custom field
  * It will recieve the custom field information for custom field add form
  * Add the data in the fields table and then to the custom field table
  * @see CustomFields::get_custom_fields_tablename()
  * @see popups/add_custom_field_modal.php
  */
 public function eventAddCustomField(EventControler $evctl)
 {
     $idmodule = $evctl->idmodule;
     $custom_field_type = $evctl->custom_field_type;
     $req = $evctl->cf_req;
     $field_validation = array();
     $is_required = false;
     if ($req == 'on') {
         $is_required = true;
         $field_validation["required"] = true;
     }
     $field_data_type = '';
     switch ($custom_field_type) {
         case 1:
             $fld_length = (int) $evctl->cf_len;
             $field_data_type = 'VARCHAR(' . $fld_length . ')';
             if ($is_required === true) {
                 if ($evctl->cf_max_len != '' || (int) $evctl->cf_max_len > 0) {
                     $field_validation["maxlength"] = (int) $evctl->cf_max_len;
                 }
                 if ($evctl->cf_min_len != '' || (int) $evctl->cf_min_len > 0) {
                     $field_validation["minlength"] = (int) $evctl->cf_min_len;
                 }
             }
             break;
         case 2:
             $field_data_type = 'TEXT';
             break;
         case 3:
             $field_data_type = 'VARCHAR(3)';
             break;
         case 5:
             $pick_values = $evctl->cf_pick;
             $not_equal = $evctl->cf_pick_notequal;
             if ($is_required === true) {
                 $field_validation["notEqual"] = $not_equal;
             }
             $field_data_type = 'VARCHAR(100)';
             break;
         case 6:
             $pick_values = $evctl->cf_pick;
             $field_data_type = 'VARCHAR(100)';
             break;
         case 7:
             $fld_length = (int) $evctl->cf_len;
             $field_data_type = 'VARCHAR(' . $fld_length . ')';
             break;
         case 8:
             $fld_length = (int) $evctl->cf_len;
             $field_data_type = 'VARCHAR(' . $fld_length . ')';
             break;
         case 9:
             $field_data_type = 'DATE';
             break;
         case 10:
             $field_data_type = 'VARCHAR(10)';
             break;
         case 210:
             $field_data_type = 'VARCHAR(15)';
             break;
     }
     if (count($field_validation) > 0) {
         $field_validation_entry = json_encode($field_validation);
     } else {
         $field_validation_entry = '';
     }
     $qry = "select * from " . $this->getTable() . " where field_name like '%ctf_%' order by idfields desc limit 1 ";
     $stmt = $this->getDbConnection()->executeQuery($qry);
     if ($stmt->rowCount() > 0) {
         $data = $stmt->fetch();
         $last_custom_field = $data["field_name"];
         $field_sequence = $data["field_sequence"];
         $last_custom_field_explode = explode("_", $last_custom_field);
         $custom_field_suffix = $last_custom_field_explode[1];
         $new_custom_field_suffix = $custom_field_suffix + 1;
         $custom_field_name = "ctf_" . $new_custom_field_suffix;
         $custom_field_sequence = $field_sequence + 1;
     } else {
         $custom_field_name = "ctf_1";
         $custom_field_sequence = 1;
     }
     $insert_data = array('field_name' => $custom_field_name, 'field_label' => CommonUtils::purify_input($evctl->cf_label), 'field_sequence' => $custom_field_sequence, 'idblock' => $this->get_custom_field_blocks($idmodule), 'idmodule' => $idmodule, 'table_name' => $this->get_custom_fields_tablename($idmodule), 'field_type' => $custom_field_type, 'field_validation' => $field_validation_entry);
     $this->insert($this->getTable(), $insert_data);
     $idfields = $this->getInsertId();
     if ($idfields > 0) {
         if ($custom_field_type == 5 || $custom_field_type == 6) {
             //$pick_values_seperated = explode(PHP_EOL,$evctl->cf_pick);
             $pick_values_seperated = preg_split('/[\\r\\n]+/', $evctl->cf_pick, -1, PREG_SPLIT_NO_EMPTY);
             $do_combo_values = new ComboValues();
             $do_combo_values->add_combo_values($idfields, $pick_values_seperated);
         }
         // add field to the custom field table for the moduleedit_custom_field_modal
         $qry_alter = "\n\t\t\talter table `" . $this->get_custom_fields_tablename($idmodule) . "` \n\t\t\tadd column `{$custom_field_name}` {$field_data_type}\n\t\t\t";
         $this->query($qry_alter);
         $_SESSION["do_crm_messages"]->set_message('success', _('Custom field added successfully.'));
         $next_page = NavigationControl::getNavigationLink("Settings", "customfield");
         $dis = new Display($next_page);
         $dis->addParam("cmid", $idmodule);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('Custom field could not be added, please try again ! '));
     }
 }
    ?>
" onclick = "">
			<img src="/themes/images/purchase_order.png" style="vertical-align:center;">
			<?php 
    echo _('create purchase order');
    ?>
			</a>
		</li>
	</ul>
    <?php 
} elseif ($module_id == 12) {
    ?>
	<ul class="nav nav-list">	
		<li>
			<a href="<?php 
    echo NavigationControl::getNavigationLink("Products", "create_purchase_order", $sqcrm_record_id, '&return_page=detail');
    ?>
" onclick = "">
			<img src="/themes/images/purchase_order.png" style="vertical-align:center;">
			<?php 
    echo _('create purchase order');
    ?>
			</a>
		</li>
	</ul>
    <?php 
}
?>
    <?php 
$do_queue = new Queue();
if (true === $do_queue->queue_permitted_for_module($module_id)) {
Example #20
0
        $dropdown_selected = in_array($module_id, $analytics_drop_down) ? 'active' : '';
        echo '<li class="dropdown ' . $dropdown_selected . '">';
        echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . _('Analytics') . '<b class="caret"></b></a>';
        echo '<ul class="dropdown-menu">';
        foreach ($analytics_drop_down as $k) {
            $style_li = '';
            if ($module_id == $k && $current_file != 'custom_report') {
                $style_li = 'active';
            }
            echo '<li class="' . $style_li . '"><a href="' . NavigationControl::getNavigationLink($modules_with_full_info[$k]["name"], "index") . '">' . $modules_with_full_info[$k]["label"] . '</a></li>';
        }
        $style_li = '';
        if ($current_file == 'custom_report') {
            $style_li = 'active';
        }
        echo '<li class="' . $style_li . '"><a href="' . NavigationControl::getNavigationLink($modules_with_full_info[$k]["name"], "custom_report") . '">' . _('Custom Reports') . '</a></li>';
        echo '</ul>';
        echo '</li>';
        echo '</ul>';
    }
}
?>
				<ul class="nav pull-right">
					<?php 
$user_profile = '';
if (isset($_SESSION["do_user"]) && $_SESSION["do_user"]->iduser != '') {
    if ($_SESSION["do_user"]->user_avatar != '') {
        $user_profile .= '<div id="user-profile"><div class="circular_35" style="background-image: url(\'' . FieldType12::get_file_name_with_path($_SESSION["do_user"]->user_avatar, 's') . '\')"></div></div>';
    } else {
        $user_profile .= '<div id="user-profile"><div style="margin-top:7px;">' . _('Welcome,') . ' ' . $_SESSION["do_user"]->firstname . '</div></div>';
    }
Example #21
0
							$fieldobject::display_field($do_crmfields->field_name,'','form-control input-sm');
						}
						?>
						</div>
					</div>
				</div>
			</div>
		<?php
		if ($tot_count != 1 && $tot_count%2 == 0 ) {  ?> 
		</div>
		<?php 
		} 
	} 
	if ($tot_count%2 != 0) echo '</div>';
	?>
</div>
<?php 
} 
?>
<?php 
if ($module_id == 13 || $module_id == 14 || $module_id == 15 || $module_id == 16) {
	require("add_view_line_items.php");
}
?>
<hr class="form_hr">
<div class="left_large">
	<a href="<?php echo NavigationControl::getNavigationLink($module,"list");?>" class="btn btn-default active">
	<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <?php echo _('Cancel');?></a>  
	<input type="submit" class="btn btn-primary" value="<?php echo _('Save');?>"/>
</div>
<div class="clear_float"></div>
* datahistory fields page
* @author Abhik Chakraborty
*/
?>
<div class="container-fluid">
	<div class="row-fluid">
		<?php 
include_once "modules/Settings/settings_leftmenu.php";
?>
		<div class="span9" style="margin-left:3px;">
			<div class="box_content">
				<h3><?php 
echo _('Settings');
?>
 > <a href="<?php 
echo NavigationControl::getNavigationLink($module, "datahistory_settings");
?>
"><?php 
echo _('Data History');
?>
</a></h3>
				<p><?php 
echo _('Manage data history for the modules');
?>
</p> 
			</div>
			<div class="datadisplay-outer">
				<div id="message"></div>
				<div class="left_300"><h4><?php 
echo _('Choose fields for history tracking');
?>
Example #23
0
 /**
  * event function to send sales order by email
  * @param object $evctl
  */
 public function sendSalesOrderWithEmail(EventControler $evctl)
 {
     $record_id = $evctl->idsales_order;
     $sales_order_email = $evctl->sales_order_email;
     $crm_global_settings = new CRMGlobalSettings();
     $inventory_prefixes = $crm_global_settings->get_inventory_prefixes();
     $company_address = $crm_global_settings->get_setting_data_by_name('company_address');
     $export_inventory = new ExportInventoryData();
     if ((int) $record_id > 0) {
         if (is_array($sales_order_email) && count($sales_order_email) > 0) {
             $email_template = new EmailTemplate("send_sales_order_email");
             $emailer = new SQEmailer();
             $pdf_filename = $export_inventory->generate_inventory_pdf((int) $record_id, 14, true);
             foreach ($sales_order_email as $key => $val) {
                 $val_exploded = explode(':::', $val);
                 $to_email = $val_exploded[0];
                 $name = $val_exploded[1];
                 $name_explode = explode('::', $name);
                 $email_data = array("sales_order_number" => $inventory_prefixes["salesorder_num_prefix"] . $record_id, "company_name" => CRM_NAME, "firstname" => array_key_exists(0, $name_explode) ? $name_explode[0] : '', "lastname" => array_key_exists(1, $name_explode) ? $name_explode[1] : '', "company_address" => nl2br($company_address));
                 $to_name = (array_key_exists(0, $name_explode) ? $name_explode[0] : '') . ' ' . (array_key_exists(1, $name_explode) ? $name_explode[1] : '');
                 $emailer->IsSendmail();
                 $emailer->setEmailTemplate($email_template);
                 $emailer->mergeArray($email_data);
                 $emailer->AddAddress($to_email, $to_name);
                 $emailer->AddAttachment(OUTBOUND_PATH . '/' . $pdf_filename);
                 $emailer->send();
                 $_SESSION["do_crm_messages"]->set_message('success', _('Email has been sent !'));
                 $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
                 $dis = new Display($next_page);
                 $dis->addParam("sqrecord", $record_id);
                 $evctl->setDisplayNext($dis);
             }
         } else {
             $_SESSION["do_crm_messages"]->set_message('error', _('Operation failed! No email id specified.'));
             $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
             $dis = new Display($next_page);
             $dis->addParam("sqrecord", $record_id);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('Operation failed! No record id specified.'));
         $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $record_id);
         $evctl->setDisplayNext($dis);
     }
 }
Example #24
0
 /**
  * function to delete a group
  * while deleting a group the related data will be transferred to user or group which is selected
  * which is selected during the delete process
  * @param object $evctl
  * @see self :: transfer_group_data_to_user()
  * @see self :: transfer_group_data_to_group()
  * @see popups/delete_group_modal.php
  */
 public function eventDeleteRecord(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $id = (int) $evctl->id;
         $group_transfer_opt = false;
         $transfer_to_user = false;
         $transfer_to_group = false;
         if ($evctl->group_transfer_opt == 'yes') {
             $group_transfer_opt = true;
         }
         if ($group_transfer_opt === true) {
             if ($evctl->assigned_to_selector == 'user') {
                 $transfer_to_user = true;
             } elseif ($evctl->assigned_to_selector == 'group') {
                 $transfer_to_group = true;
             }
         } else {
             $transfer_to_user = true;
         }
         if (($transfer_to_user === true || $transfer_to_group === true) && $id > 0) {
             $do_module = new Module();
             $do_module->getAll();
             while ($do_module->next()) {
                 if ($do_module->idmodule == 1 || $do_module->idmodule == 7 || $do_module->idmodule == 8 || $do_module->idmodule == 9) {
                     continue;
                 }
                 $module_name = $do_module->name;
                 $object = new $module_name();
                 if ($transfer_to_user === true) {
                     // transfer group data to selected user
                     $idtransfer = (int) $evctl->user_selector;
                     $this->transfer_group_data_to_user($object, $id, $idtransfer);
                 } elseif ($transfer_to_group === true) {
                     // transfer group data to selected group
                     $idtransfer = (int) $evctl->group_selector;
                     $this->transfer_group_data_to_group($object, $id, $idtransfer);
                 }
             }
             $this->query("delete from `group` where `idgroup` = ?", array($id));
             $_SESSION["do_crm_messages"]->set_message('success', _('Group has been deleted successfully and related data has been transferred !'));
         } else {
             $_SESSION["do_crm_messages"]->set_message('error', _('Unable to delete the group,id is missing !'));
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* create invoice from sales order
* @author Abhik Chakraborty
*/ 
?>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12" style="margin-left:3px;">
			<div class="row-fluid">
				<div class="datadisplay-outer">
					<?php
					$e_add_entity = new Event("Invoice->eventAddRecord");
					$e_add_entity->addParam("idmodule",15);
					$e_add_entity->addParam("module","Invoice");
					$e_add_entity->addParam("error_page",NavigationControl::getNavigationLink($module,"add"));
					echo '<form class="form-horizontal" id="Invoice__addRecord" name="Invoice__addRecord" action="/eventcontroler.php" method="post" enctype="multipart/form-data">';
					echo $e_add_entity->getFormEvent();
					require("edit_view_form_fields.php");
					?>  
					</form>
				</div>
			</div><!--/row-->
		</div><!--/span-->
	</div><!--/row-->
</div>
<script>
<?php 
	echo $do_crmfields->get_js_form_validation($module_id,"Invoice__addRecord","edit");
?>
$.validator.addMethod("notEqual", function(value,element,param) {
Example #26
0
 /**
  * event function to delete the role
  * before deleting it will set the idrole of users to a new selected role which were earlier attached with the role to be deleted
  * @param object $evctl
  * @see popups/role_delete.php
  */
 public function eventDeleteRole(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $do_delete = false;
         $msg = '';
         if ($evctl->idrole != '') {
             if ($evctl->idrole == 'N1' || $evctl->idrole == 'N2') {
                 $msg = _('The role you are trying to delete is not allowd !');
             } else {
                 $role_detail = $this->get_role_detail($evctl->idrole);
                 if (count($role_detail) > 0) {
                     if ($evctl->role_transfer == 'yes') {
                         if ($evctl->idrole_transfer == '') {
                             $msg = _('No role selected to re-assign users !');
                         } else {
                             $do_delete = true;
                         }
                     } else {
                         $do_delete = true;
                     }
                 } else {
                     $msg = _('The role you are trying to delete does not exist !');
                 }
             }
         } else {
             $msg = _('Invalid roleid to perform delete operation !');
         }
         if ($do_delete === false) {
             $_SESSION["do_crm_messages"]->set_message('error', $msg);
             $dis = new Display($evctl->next_page);
             $evctl->setDisplayNext($dis);
         } else {
             $qry = "select * from `role` where `parentrole` like ? AND `idrole` <> ?";
             $this->query($qry, array($role_detail["parentrole"] . '%', $role_detail["idrole"]));
             if ($this->getNumRows() > 0) {
                 while ($this->next()) {
                     $depth = $this->depth;
                     $depth = $depth - 1;
                     $qry1 = "update `role` set `depth` = ? where `idrole` = ? ";
                     $this->getDbConnection()->executeQuery($qry1, array($depth, $this->idrole));
                 }
             }
             $this->query("delete from `role` where `idrole` = ?", array($role_detail["idrole"]));
             $this->query("delete from `role_profile_rel` where `idrole` = ?", array($role_detail["idrole"]));
             if ($evctl->idrole_transfer != '') {
                 $q_upd = "\n\t\t\t\t\tupdate `user` \n\t\t\t\t\tset `idrole` = ?\n\t\t\t\t\twhere `idrole` = ?\n\t\t\t\t\t";
                 $this->query($q_upd, array($evctl->idrole_transfer, $role_detail["idrole"]));
             }
             $_SESSION["do_crm_messages"]->set_message('success', _('Role has been deleted successfully ! '));
             $dis = new Display($evctl->next_page);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
				<a href="<?php 
        echo NavigationControl::getNavigationLink($module, "run_report", $v["idreport"]);
        ?>
">
				<?php 
        echo $v["name"];
        ?>
				</a>
			</td>  
			<td width="50%"><?php 
        echo nl2br($v["description"]);
        ?>
</td>
			<td width="15%">
				<a href="<?php 
        echo NavigationControl::getNavigationLink($module, "edit", $v["idreport"]);
        ?>
" class="btn btn-primary btn-mini">
				<i class="icon-white icon-edit"></i>
				</a>
				<a href="#" onclick = "del_report('<?php 
        echo $v["idreport"];
        ?>
','<?php 
        echo $val["idreport_folder"];
        ?>
','<?php 
        echo $folder_name;
        ?>
')" class="btn btn-primary btn-mini bs-prompt" id="">
				<i class="icon-white icon-trash"></i>
        $select = "SELECTED";
    }
    echo '<option value="' . $idmodule . '" ' . $select . '>' . $val["label"] . '</option>';
}
?>
					</select>
					<a href="#" class="btn btn-primary" onclick="add_custom_field('<?php 
echo $module;
?>
','customfield');">
					<i class="icon-white icon-plus"></i><?php 
echo _('Add New');
?>
</a>
					<a href="<?php 
echo NavigationControl::getNavigationLink($module, "customfield_mapping");
?>
" class="btn btn-primary" id="map_custom_field">
					<i class="icon-white icon-edit"></i><?php 
echo _('Map Custom Fields');
?>
</a>
				</div>
				<div class="clear_float"></div>
				<?php 
require "customfield_entry_view.php";
?>
			</div>
		</div><!--/span-->
	</div><!--/row-->
</div>
Example #29
0
$obj = $_REQUEST["classname"];
$module = $_REQUEST["m"];
$return_page = $_REQUEST["referrar"];
$id = (int) $_REQUEST["sqrecord"];
$do_user = new User();
$do_user->get_all_users();
$group_transfer = false;
$do_group = new Group();
$do_group->get_all_groups();
//if there is only one group in the system and we choose to delete it then there is no group to trasfer data
if ($do_group->getNumRows() > 1) {
    $group_transfer = true;
}
$e_del = new Event($obj . "->eventDeleteRecord");
$e_del->addParam("id", $id);
$e_del->addParam("next_page", NavigationControl::getNavigationLink($obj, $return_page));
if ($group_transfer === true) {
    $e_del->addParam("group_transfer_opt", "yes");
} else {
    $e_del->addParam("group_transfer_opt", "no");
}
echo '<form class="form-horizontal" id="' . $obj . '__eventDeleteRecord" name="' . $obj . '__eventDeleteRecord" action="/eventcontroler.php" method="post">';
echo $e_del->getFormEvent();
?>
<div class="modal-dialog" role="document">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			<h3><span class="label label-info"><?php 
echo _('Delete group data transfer');
?>
Example #30
0
echo '<p>' . nl2br($do_group->description) . '</p>';
?>
					</div>
					<div class="right_200">
						<a href="<?php 
echo NavigationControl::getNavigationLink($module, "group_edit", $do_group->idgroup);
?>
" class="btn btn-primary"><i class="icon-white icon-edit"></i> <?php 
echo _('Update');
?>
</a>
					</div>
					<div class="clear_float"></div>
					<h3><?php 
echo _('Members associated to this group');
?>
</h3>
					<?php 
$do_group_user_rel = new GroupUserRelation();
$do_group_user_rel->get_users_related_to_group($do_group->idgroup);
if ($do_group_user_rel->getNumRows() > 0) {
    while ($do_group_user_rel->next()) {
        echo '<p><a href="' . NavigationControl::getNavigationLink("User", "detail", $do_group_user_rel->iduser) . '">' . $do_group_user_rel->firstname . ' ' . $do_group_user_rel->lastname . '(' . $do_group_user_rel->user_name . ')</a></p>';
    }
}
?>
				</div>
			</div>
		</div><!--/row-->
	</div><!--/span-->
</div><!--/row-->