本文整理汇总了PHP中getRecordOwnerId函数的典型用法代码示例。如果您正苦于以下问题:PHP getRecordOwnerId函数的具体用法?PHP getRecordOwnerId怎么用?PHP getRecordOwnerId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRecordOwnerId函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CustomerCommentFromPortal
function CustomerCommentFromPortal($entityData)
{
$adb = PearDatabase::getInstance();
$data = $entityData->getData();
$customerWSId = $data['customer'];
$relatedToWSId = $data['related_to'];
$relatedToId = explode('x', $relatedToWSId);
$moduleName = getSalesEntityType($relatedToId[1]);
if ($moduleName == 'HelpDesk' && !empty($customerWSId)) {
$ownerIdInfo = getRecordOwnerId($relatedToId[1]);
if (!empty($ownerIdInfo['Users'])) {
$ownerId = $ownerIdInfo['Users'];
$ownerName = getOwnerName($ownerId);
$toEmail = getUserEmailId('id', $ownerId);
}
if (!empty($ownerIdInfo['Groups'])) {
$ownerId = $ownerIdInfo['Groups'];
$groupInfo = getGroupName($ownerId);
$ownerName = $groupInfo[0];
$toEmail = implode(',', getDefaultAssigneeEmailIds($ownerId));
}
$subject = getTranslatedString('LBL_RESPONDTO_TICKETID', $moduleName) . "##" . $relatedToId[1] . "## " . getTranslatedString('LBL_CUSTOMER_PORTAL', $moduleName);
$contents = getTranslatedString('Dear', $moduleName) . " " . $ownerName . "," . "<br><br>" . getTranslatedString('LBL_CUSTOMER_COMMENTS', $moduleName) . "<br><br>\n\t\t\t\t\t<b>" . $data['commentcontent'] . "</b><br><br>" . getTranslatedString('LBL_RESPOND', $moduleName) . "<br><br>" . getTranslatedString('LBL_REGARDS', $moduleName) . "<br>" . getTranslatedString('LBL_SUPPORT_ADMIN', $moduleName);
$customerId = explode('x', $customerWSId);
$result = $adb->pquery("SELECT email FROM vtiger_contactdetails WHERE contactid=?", array($customerId[0]));
$fromEmail = $adb->query_result($result, 0, 'email');
send_mail('HelpDesk', $toEmail, '', $fromEmail, $subject, $contents);
}
}
示例2: sendPrdStckMail
/**
* This function sends a mail to the handler whenever the product reaches the reorder level.
* Param $product_id - product id
* Param $upd_qty - updated product quantity in no's
* Param $prod_name - product name
* Param $qtyinstk - quantity in stock
* Param $qty - quantity
* Param $module - module name
* return type void
*/
function sendPrdStckMail($product_id, $upd_qty, $prod_name, $qtyinstk, $qty, $module)
{
global $log;
$log->debug("Entering sendPrdStckMail(" . $product_id . "," . $upd_qty . "," . $prod_name . "," . $qtyinstk . "," . $qty . "," . $module . ") method ...");
global $current_user;
global $adb;
$reorderlevel = getPrdReOrderLevel($product_id);
$log->debug("Inside sendPrdStckMail function, module=" . $module);
$log->debug("Prd reorder level " . $reorderlevel);
if ($upd_qty < $reorderlevel) {
//send mail to the handler
$handler = getRecordOwnerId($product_id);
foreach ($handler as $type => $id) {
$handler = $id;
}
$handler_name = getOwnerName($handler);
if (vtws_isRecordOwnerUser($handler)) {
$to_address = getUserEmail($handler);
} else {
$to_address = implode(',', getDefaultAssigneeEmailIds($handler));
}
//Get the email details from database;
if ($module == 'SalesOrder') {
$notification_table = 'SalesOrderNotification';
$quan_name = '{SOQUANTITY}';
}
if ($module == 'Quotes') {
$notification_table = 'QuoteNotification';
$quan_name = '{QUOTEQUANTITY}';
}
if ($module == 'Invoice') {
$notification_table = 'InvoiceNotification';
}
$query = "select * from vtiger_inventorynotification where notificationname=?";
$result = $adb->pquery($query, array($notification_table));
$subject = $adb->query_result($result, 0, 'notificationsubject');
$body = $adb->query_result($result, 0, 'notificationbody');
$status = $adb->query_result($result, 0, 'status');
if ($status == 0 || $status == '') {
return false;
}
$subject = str_replace('{PRODUCTNAME}', $prod_name, $subject);
$body = str_replace('{HANDLER}', $handler_name, $body);
$body = str_replace('{PRODUCTNAME}', $prod_name, $body);
if ($module == 'Invoice') {
$body = str_replace('{CURRENTSTOCK}', $upd_qty, $body);
$body = str_replace('{REORDERLEVELVALUE}', $reorderlevel, $body);
} else {
$body = str_replace('{CURRENTSTOCK}', $qtyinstk, $body);
$body = str_replace($quan_name, $qty, $body);
}
$body = str_replace('{CURRENTUSER}', $current_user->user_name, $body);
$mail_status = send_mail($module, $to_address, $current_user->user_name, $current_user->email1, decode_html($subject), nl2br(to_html($body)));
}
$log->debug("Exiting sendPrdStckMail method ...");
}
示例3: HelpDesk_notifyOnPortalTicketComment
function HelpDesk_notifyOnPortalTicketComment($entityData)
{
$adb = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$wsId = $entityData->getId();
$parts = explode('x', $wsId);
$entityId = $parts[1];
$ownerIdInfo = getRecordOwnerId($entityId);
if (!empty($ownerIdInfo['Users'])) {
$ownerId = $ownerIdInfo['Users'];
$ownerName = getOwnerName($ownerId);
$to_email = getUserEmailId('id', $ownerId);
}
if (!empty($ownerIdInfo['Groups'])) {
$ownerId = $ownerIdInfo['Groups'];
$groupInfo = getGroupName($ownerId);
$ownerName = $groupInfo[0];
$to_email = implode(',', getDefaultAssigneeEmailIds($ownerId));
}
$wsParentId = $entityData->get('contact_id');
$parentIdParts = explode('x', $wsParentId);
$parentId = $parentIdParts[1];
$entityDelta = new VTEntityDelta();
$oldComments = $entityDelta->getOldValue($entityData->getModuleName(), $entityId, 'comments');
$newComments = $entityDelta->getCurrentValue($entityData->getModuleName(), $entityId, 'comments');
$commentDiff = str_replace($oldComments, '', $newComments);
$latestComment = strip_tags($commentDiff);
//send mail to the assigned to user when customer add comment
// SalesPlatform.ru begin
$subject = getTranslatedString('LBL_RESPONDTO_TICKETID', $moduleName) . " " . $entityData->get('ticket_no') . " " . getTranslatedString('LBL_CUSTOMER_PORTAL', $moduleName);
//$subject = getTranslatedString('LBL_RESPONDTO_TICKETID', $moduleName)."##". $entityId."##". getTranslatedString('LBL_CUSTOMER_PORTAL', $moduleName);
// SalesPlatform.ru end
$contents = getTranslatedString('Dear', $moduleName) . " " . $ownerName . "," . "<br><br>" . getTranslatedString('LBL_CUSTOMER_COMMENTS', $moduleName) . "<br><br>\n\t\t\t\t\t\t<b>" . $latestComment . "</b><br><br>" . getTranslatedString('LBL_RESPOND', $moduleName) . "<br><br>" . getTranslatedString('LBL_REGARDS', $moduleName) . "<br>" . getTranslatedString('LBL_SUPPORT_ADMIN', $moduleName);
//get the contact email id who creates the ticket from portal and use this email as from email id in email
$result = $adb->pquery("SELECT lastname, firstname, email FROM vtiger_contactdetails WHERE contactid=?", array($parentId));
$customername = $adb->query_result($result, 0, 'firstname') . ' ' . $adb->query_result($result, 0, 'lastname');
$customername = decode_html($customername);
//Fix to display the original UTF-8 characters in sendername instead of ascii characters
$from_email = $adb->query_result($result, 0, 'email');
send_mail('HelpDesk', $to_email, '', $from_email, $subject, $contents);
}
示例4: getRecordOwnerId
//4600 ends
$smarty->assign("UPLOADSIZE", $upload_maxsize / 1000000);
//Convert to MB
$smarty->assign("UPLOAD_MAXSIZE", $upload_maxsize);
if ($_REQUEST['upload_error'] == true) {
echo '<br><b><font color="red"> ' . $mod_strings['FILE_HAS_NO_DATA'] . '.</font></b><br>';
}
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'], "Documents");
$focus->name = $focus->column_fields['notes_title'];
}
if ($focus->mode != 'edit') {
if (isset($_REQUEST['parent_id']) && isset($_REQUEST['return_module'])) {
$owner = getRecordOwnerId($_REQUEST['parent_id']);
if (isset($owner['Users']) && $owner['Users'] != '') {
$permitted_users = get_user_array('true', 'Active', $current_user->id);
if (!in_array($owner['Users'], $permitted_users)) {
$owner['Users'] = $current_user->id;
}
$focus->column_fields['assigntype'] = 'U';
$focus->column_fields['assigned_user_id'] = $owner['Users'];
} elseif (isset($owner['Groups']) && $owner['Groups'] != '') {
$focus->column_fields['assigntype'] = 'T';
$focus->column_fields['assigned_user_id'] = $owner['Groups'];
}
}
}
if (empty($_REQUEST['record']) && $focus->mode != 'edit') {
setObjectValuesFromRequest($focus);
示例5: getParentRecordOwner
/** Function to get parent record owner
* @param $tabid -- tabid :: Type integer
* @param $parModId -- parent module id :: Type integer
* @param $record_id -- record id :: Type integer
* @returns $parentRecOwner -- parentRecOwner:: Type integer
*/
function getParentRecordOwner($tabid, $parModId, $record_id)
{
global $log;
$log->debug("Entering getParentRecordOwner(" . $tabid . "," . $parModId . "," . $record_id . ") method ...");
$parentRecOwner = array();
$parentTabName = getTabname($parModId);
$relTabName = getTabname($tabid);
$fn_name = "get" . $relTabName . "Related" . $parentTabName;
$ent_id = $fn_name($record_id);
if ($ent_id != '') {
$parentRecOwner = getRecordOwnerId($ent_id);
}
$log->debug("Exiting getParentRecordOwner method ...");
return $parentRecOwner;
}
示例6: createpdffile
//.........这里部分代码省略.........
$date_modified = getDisplayDate($focus->column_fields['modifiedtime']);
$date_array = explode(" ", $date_modified);
$date_to_display_array[2] = str_replace("-", ".", $date_array[0]);
$date_to_display = $date_to_display_array[$pdf_config_details['dateused']];
//number of lines after headline
$space_headline = $pdf_config_details['space_headline'];
//display logo?
$logoradio = $pdf_config_details['logoradio'];
//display customer sign?
$clientid = $pdf_config_details['clientid'];
//display summary?
$summaryradio = $pdf_config_details['summaryradio'];
//display footer?
$footerradio = $pdf_config_details['footerradio'];
//display footer page number?
$pageradio = $pdf_config_details['pageradio'];
// get company information from settings
$add_query = "select * from vtiger_organizationdetails";
$result = $adb->query($add_query);
$num_rows = $adb->num_rows($result);
if ($num_rows > 0) {
$org_name = $adb->query_result($result, 0, "organizationname");
$org_address = $adb->query_result($result, 0, "address");
$org_city = $adb->query_result($result, 0, "city");
$org_state = $adb->query_result($result, 0, "state");
$org_country = $adb->query_result($result, 0, "country");
$org_code = $adb->query_result($result, 0, "code");
$org_phone = $adb->query_result($result, 0, "phone");
$org_fax = $adb->query_result($result, 0, "fax");
$org_website = $adb->query_result($result, 0, "website");
$logo_name = $adb->query_result($result, 0, "logoname");
}
// get owner information
$recordOwnerArr = getRecordOwnerId($_REQUEST['record']);
foreach ($recordOwnerArr as $type => $id) {
$ownertype = $type;
$ownerid = $id;
}
if ($ownertype == 'Users') {
// get owner information for user
$sql = "SELECT * FROM vtiger_users,vtiger_crmentity WHERE vtiger_users.id = vtiger_crmentity.smownerid AND vtiger_crmentity.crmid = '" . $_REQUEST['record'] . "'";
$result = $adb->query($sql);
$owner_lastname = $adb->query_result($result, 0, 'last_name');
$owner_firstname = $adb->query_result($result, 0, 'first_name');
$owner_id = $adb->query_result($result, 0, 'smownerid');
$owner_phone = $adb->query_result($result, 0, 'phone_work');
$owner_title = decode_html(trim($adb->query_result($result, 0, 'title')));
} else {
// get owner information for Groups
$sql = "SELECT * FROM vtiger_groups,vtiger_crmentity WHERE vtiger_groups.groupid = vtiger_crmentity.smownerid AND vtiger_crmentity.crmid = '" . $_REQUEST['record'] . "'";
$result = $adb->query($sql);
$owner_lastname = '';
$owner_firstname = $adb->query_result($result, 0, 'groupname');
$owner_id = $adb->query_result($result, 0, 'smownerid');
$owner_phone = $org_phone;
$owner_title = '';
}
//display owner?
$owner = $pdf_config_details['owner'];
//display owner phone#?
$ownerphone = $pdf_config_details['ownerphone'];
//to display at product description based on tax type
$gproddetailarray = array($pdf_config_details[gprodname], $pdf_config_details[gproddes], $pdf_config_details[gprodcom]);
$gproddetails = 0;
foreach ($gproddetailarray as $key => $value) {
if ($value == 'true') {
示例7: isReadWritePermittedBySharing
/** Function to check if the currently logged in user has Write Access due to Sharing for the specified record
* @param $module -- Module Name:: Type varchar
* @param $actionid -- Action Id:: Type integer
* @param $recordid -- Record Id:: Type integer
* @param $tabid -- Tab Id:: Type integer
* @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user
*/
function isReadWritePermittedBySharing($module, $tabid, $actionid, $record_id)
{
$log = vglobal('log');
$log->debug("Entering isReadWritePermittedBySharing(" . $module . "," . $tabid . "," . $actionid . "," . $record_id . ") method ...");
$adb = PearDatabase::getInstance();
$current_user = vglobal('current_user');
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
$ownertype = '';
$ownerid = '';
$sharePer = 'no';
$sharingModuleList = getSharingModuleList();
if (!in_array($module, $sharingModuleList)) {
$sharePer = 'no';
return $sharePer;
}
$recordOwnerArr = getRecordOwnerId($record_id);
foreach ($recordOwnerArr as $type => $id) {
$ownertype = $type;
$ownerid = $id;
}
$varname = $module . "_share_write_permission";
$write_per_arr = ${$varname};
if ($ownertype == 'Users') {
//Checking the Write Sharing Permission Array in Role Users
$write_role_per = $write_per_arr['ROLE'];
foreach ($write_role_per as $roleid => $userids) {
if (in_array($ownerid, $userids)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
//Checking the Write Sharing Permission Array in Groups Users
$write_grp_per = $write_per_arr['GROUP'];
foreach ($write_grp_per as $grpid => $userids) {
if (in_array($ownerid, $userids)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
} elseif ($ownertype == 'Groups') {
$write_grp_per = $write_per_arr['GROUP'];
if (array_key_exists($ownerid, $write_grp_per)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
//Checking for the Related Sharing Permission
$relatedModuleArray = $related_module_share[$tabid];
if (is_array($relatedModuleArray)) {
foreach ($relatedModuleArray as $parModId) {
$parRecordOwner = getParentRecordOwner($tabid, $parModId, $record_id);
if (sizeof($parRecordOwner) > 0) {
$parModName = getTabname($parModId);
$rel_var = $parModName . "_" . $module . "_share_write_permission";
$write_related_per_arr = ${$rel_var};
$rel_owner_type = '';
$rel_owner_id = '';
foreach ($parRecordOwner as $rel_type => $rel_id) {
$rel_owner_type = $rel_type;
$rel_owner_id = $rel_id;
}
if ($rel_owner_type == 'Users') {
//Checking in Role Users
$write_related_role_per = $write_related_per_arr['ROLE'];
foreach ($write_related_role_per as $roleid => $userids) {
if (in_array($rel_owner_id, $userids)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
//Checking in Group Users
$write_related_grp_per = $write_related_per_arr['GROUP'];
foreach ($write_related_grp_per as $grpid => $userids) {
if (in_array($rel_owner_id, $userids)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
} elseif ($rel_owner_type == 'Groups') {
$write_related_grp_per = $write_related_per_arr['GROUP'];
if (array_key_exists($rel_owner_id, $write_related_grp_per)) {
$sharePer = 'yes';
$log->debug("Exiting isReadWritePermittedBySharing method ...");
return $sharePer;
}
}
}
}
//.........这里部分代码省略.........
示例8: createSalesOpportunitiesFromRecords
public function createSalesOpportunitiesFromRecords($from_module, $recordIds)
{
$log = vglobal('log');
$current_user = vglobal('current_user');
$log->info("Entering Into createSalesOpportunitiesFromRecords( {$from_module}, {$recordIds} )");
$db = PearDatabase::getInstance();
$numRecords = 0;
$modulesSchema = array();
$modulesSchema['OutsourcedProducts'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => false, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'));
$modulesSchema['Assets'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => true, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'), 'updateField' => array('pot_renewal', 'vtiger_assets', 'assetsid'));
$modulesSchema['OSSOutsourcedServices'] = array('potentialId' => 'potential', 'num' => 'osssoldservices_no', 'closingdate' => 'dateinservice', 'relateProduct' => false, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'));
$modulesSchema['OSSSoldServices'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => true, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'), 'updateField' => array('pot_renewal', 'vtiger_osssoldservices', 'osssoldservicesid'));
if (array_key_exists($from_module, $modulesSchema)) {
$schema = $modulesSchema[$from_module];
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $from_module);
$potentialId = $recordModel->get($schema['potentialId']);
if ($potentialId != 0 && $potentialId != '') {
$potentialsRecordModel = Vtiger_Record_Model::getInstanceById($potentialId, 'Potentials');
$record = Vtiger_Record_Model::getCleanInstance('Potentials');
foreach ($schema['theSame'] as $name) {
$record->set($name, $potentialsRecordModel->get($name));
if ($name == 'assigned_user_id') {
$assigned_user_id = $potentialsRecordModel->get($name);
$ownerIdInfo = getRecordOwnerId($assigned_user_id);
if (!empty($ownerIdInfo['Users'])) {
$usersPrivileges = Users_Privileges_Model::getInstanceById($assigned_user_id);
if ($usersPrivileges->status != 'Active') {
$record->set($name, $current_user->id);
}
}
}
}
foreach ($schema['fixed'] as $key => $val) {
$record->set($key, $val);
}
if ($schema['closingdate']) {
$closingdate = $recordModel->get($schema['closingdate']);
if (strtotime($closingdate) < strtotime(date("Y-m-d"))) {
$closingdate = date("Y-m-d", strtotime("+30 day", strtotime(date("Y-m-d"))));
}
$record->set('closingdate', $closingdate);
}
$record->save();
if ($record->getId() != '') {
$numRecords++;
$newId = $record->getId();
if (array_key_exists('updateField', $schema)) {
$updateField = $recordModel->get($schema['updateField'][0]);
if ($updateField == '' || $updateField == 0) {
$db->pquery('UPDATE ' . $schema['updateField'][1] . ' SET ' . $schema['updateField'][0] . ' = ? WHERE ' . $schema['updateField'][2] . ' = ?', array($newId, $recordId));
}
}
$product = $recordModel->get('product');
if ($schema['relateProduct'] && $product != '' && $product != 0) {
$db->pquery('INSERT INTO vtiger_seproductsrel (crmid, productid, setype) VALUES (?,?,?);', array($newId, $product, 'Potentials'));
}
$content = vtranslate('LBL_GENERATING_COMMENT', 'Potentials') . ' ' . vtranslate($from_module, $from_module) . ': ' . $recordModel->get($schema['num']);
$rekord = Vtiger_Record_Model::getCleanInstance('ModComments');
$rekord->set('commentcontent', $content);
$rekord->set('assigned_user_id', $current_user->id);
$rekord->set('related_to', $newId);
$rekord->save();
}
}
}
}
return $numRecords;
$log->debug("Exiting createSalesOpportunitiesFromRecords() method ...");
}
示例9: buildDocumentModel
function buildDocumentModel()
{
global $adb;
$model = new Vtiger_PDF_Model();
if (isset($this->focus->column_fields["spcompany"]) && $this->focus->column_fields["spcompany"] != '') {
$selfcompany = html_entity_decode($this->focus->column_fields["spcompany"], ENT_QUOTES, 'UTF-8');
} else {
$selfcompany = "Default";
}
// Company information
$result = $adb->pquery("SELECT * FROM vtiger_organizationdetails WHERE company=?", array($selfcompany));
$num_rows = $adb->num_rows($result);
if ($num_rows) {
$resultrow = $adb->fetch_array($result);
$model->set('orgAddress', $adb->query_result($result, 0, "address"));
$model->set('orgCity', $adb->query_result($result, 0, "city"));
$model->set('orgState', $adb->query_result($result, 0, "state"));
$model->set('orgCountry', $adb->query_result($result, 0, "country"));
$model->set('orgCode', $adb->query_result($result, 0, "code"));
$model->set('orgBillingAddress', implode(', ', array($adb->query_result($result, 0, "code"), $adb->query_result($result, 0, "city"), $adb->query_result($result, 0, "address"))));
$model->set('orgPhone', $adb->query_result($result, 0, "phone"));
$model->set('orgFax', $adb->query_result($result, 0, "fax"));
$model->set('orgWebsite', $adb->query_result($result, 0, "website"));
$model->set('orgInn', $adb->query_result($result, 0, "inn"));
$model->set('orgKpp', $adb->query_result($result, 0, "kpp"));
$model->set('orgBankAccount', $adb->query_result($result, 0, "bankaccount"));
$model->set('orgBankName', $adb->query_result($result, 0, 'bankname'));
$model->set('orgBankId', $adb->query_result($result, 0, 'bankid'));
$model->set('orgCorrAccount', $adb->query_result($result, 0, 'corraccount'));
$model->set('orgOKPO', $adb->query_result($result, 0, "okpo"));
if ($adb->query_result($result, 0, 'director')) {
$model->set('orgDirector', $adb->query_result($result, 0, 'director'));
} else {
$model->set('orgDirector', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'bookkeeper')) {
$model->set('orgBookkeeper', $adb->query_result($result, 0, 'bookkeeper'));
} else {
$model->set('orgBookkeeper', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'entrepreneur')) {
$model->set('orgEntrepreneur', $adb->query_result($result, 0, 'entrepreneur'));
} else {
$model->set('orgEntrepreneur', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'entrepreneurreg')) {
$model->set('orgEntrepreneurreg', $adb->query_result($result, 0, 'entrepreneurreg'));
} else {
$model->set('orgEntrepreneurreg', str_repeat('_', 50));
}
$model->set('orgLogo', '<img src="test/logo/' . $resultrow['logoname'] . '" />');
$model->set('orgLogoPath', 'test/logo/' . $resultrow['logoname']);
$model->set('orgName', decode_html($resultrow['organizationname']));
}
$model->set('billingAddress', $this->buildHeaderBillingAddress());
$model->set('shippingAddress', $this->buildHeaderShippingAddress());
// Add owner info into model
if (isset($this->focus->column_fields['record_id']) && $this->focus->column_fields['record_id'] != '') {
$ownerArr = getRecordOwnerId($this->focus->column_fields['record_id']);
if (isset($ownerArr['Users'])) {
$userEntity = new Users();
$userEntity->retrieve_entity_info($ownerArr['Users'], 'Users');
$this->generateEntityModel($userEntity, 'Users', 'owner_', $model);
}
if (isset($ownerArr['Groups'])) {
$groupInstance = Settings_Groups_Record_Model::getInstance($ownerArr['Groups']);
$model->set('owner_groupid', $groupInstance->getId());
$model->set('owner_groupname', $groupInstance->getName());
$model->set('owner_description', $groupInstance->getDescription());
}
}
return $model;
}
示例10: CheckPermissions
public function CheckPermissions($actionKey, $record_id = '')
{
global $current_user;
if (empty($this->view_all)) {
$this->GetDefPermission($current_user->id);
}
if ($this->is_admin) {
return true;
}
if ($this->profile_Global_Permission[1] == "0" && $actionKey == "DETAIL") {
return true;
} elseif ($this->profile_Global_Permission[2] == "0" && $actionKey == "EDIT") {
return true;
} else {
$profileid = fetchUserProfileId($current_user->id);
if (isset($this->profilesActions[$actionKey])) {
$actionid = getActionid($this->profilesActions[$actionKey]);
$permissions = $this->GetProfilesPermissions();
if (isset($permissions[$profileid][$actionid]) && $permissions[$profileid][$actionid] == "0") {
if ($this->edit_all && ($actionKey == "DETAIL" || $actionKey == "EDIT") || $this->delete_all && $actionKey == "DELETE") {
return true;
} elseif ($record_id != "") {
$recOwnType = '';
$recOwnId = '';
$recordOwnerArr = getRecordOwnerId($record_id);
foreach ($recordOwnerArr as $type => $id) {
$recOwnType = $type;
$recOwnId = $id;
}
if ($recOwnType == 'Users') {
if ($current_user->id == $recOwnId) {
return true;
}
//Checking if the Record Owner is the Subordinate User
foreach ($this->subordinate_roles_users as $roleid => $userids) {
if (in_array($recOwnId, $userids)) {
return true;
}
}
$permission = isCalendarPermittedBySharing($record_id);
if ($permission == "yes" && $actionKey == "DETAIL") {
return true;
}
} elseif ($recOwnType == 'Groups') {
//Checking if the record owner is the current user's group
if (in_array($recOwnId, $this->current_user_groups)) {
return true;
}
}
if ($actionKey == "DETAIL") {
$ui = $this->isUserCalendarPermittedByInviti($record_id);
if ($ui) {
return true;
}
}
} else {
return true;
}
}
}
}
return false;
}