function transferPriceBookCurrency($old_cur, $new_cur) { global $log, $adb; $log->debug("Entering function updatePriceBookCurrency..."); $pb_res = $adb->pquery("select pricebookid from vtiger_pricebook where currency_id = ?", array($old_cur)); $numRows = $adb->num_rows($pb_res); $pb_ids = array(); for ($i = 0; $i < $numRows; $i++) { $pb_ids[] = $adb->query_result($pb_res, $i, 'pricebookid'); } if (count($pb_ids) > 0) { require_once 'modules/PriceBooks/PriceBooks.php'; for ($i = 0; $i < count($pb_ids); $i++) { $pb_id = $pb_ids[$i]; $focus = new PriceBooks(); $focus->id = $pb_id; $focus->mode = 'edit'; $focus->retrieve_entity_info($pb_id, "PriceBooks"); $focus->column_fields['currency_id'] = $new_cur; $focus->save("PriceBooks"); } } $log->debug("Exiting function updatePriceBookCurrency..."); }
require_once 'include/utils/utils.php'; require_once 'modules/CustomView/CustomView.php'; require_once 'include/database/Postgres8.php'; global $app_strings, $mod_strings, $list_max_entries_per_page, $currentModule, $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $smarty = new vtigerCRM_Smarty(); $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("MODULE", $currentModule); $smarty->assign("SINGLE_MOD", 'PriceBook'); $category = getParentTab(); $smarty->assign("CATEGORY", $category); $focus = new PriceBooks(); // Initialize sort by fields $focus->initSortbyField('PriceBooks'); // END $other_text = array(); if (!$_SESSION['lvs'][$currentModule]) { unset($_SESSION['lvs']); $modObj = new ListViewSession(); $modObj->sorder = $sorder; $modObj->sortby = $order_by; $_SESSION['lvs'][$currentModule] = get_object_vars($modObj); } if ($_REQUEST['errormsg'] != '') { $errormsg = vtlib_purify($_REQUEST['errormsg']); $smarty->assign("ERROR", "The User does not have permission to delete " . $errormsg . " " . $currentModule); } else {
* The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ /********************************************************************************* * $Header$ * Description: Deletes an Account record and then redirects the browser to the * defined return URL. ********************************************************************************/ require_once 'modules/PriceBooks/PriceBooks.php'; global $mod_strings; require_once 'include/logging.php'; $log = LoggerManager::getLogger('product_delete'); $focus = new PriceBooks(); //Added to fix 4600 $url = getBasic_Advance_SearchURL(); if (!isset($_REQUEST['record'])) { die($mod_strings['ERR_DELETE_RECORD']); } //Added to delete the pricebook from Product related list if ($_REQUEST['record'] != '' && $_REQUEST['return_id'] != '' && $_REQUEST['module'] == 'PriceBooks' && ($_REQUEST['return_module'] == 'Products' || $_REQUEST['return_module'] == 'Services')) { $pricebookid = $_REQUEST['record']; $productid = $_REQUEST['return_id']; $adb->pquery("delete from vtiger_pricebookproductrel where pricebookid=? and productid=?", array($pricebookid, $productid)); } if ($_REQUEST['module'] == $_REQUEST['return_module']) { $focus->mark_deleted($_REQUEST['record']); } $parenttab = getParentTab();
$email->column_fields["date_start"] = $startdate_array[$i]; $email->column_fields["semodule"] = 'Tasks'; $email->column_fields["activitytype"] = 'Emails'; $email->column_fields["description"] = $body_array[$i]; $email->column_fields["saved_toid"] = $to_array[$i]; $focus->column_fields['ccmail'] = $cc_array[$i]; $focus->column_fields['bccmail'] = $bcc_array[$i]; $email->save("Emails"); $email_ids[] = $email->id; } //Populate PriceBook data $PB_array = array("Cd-R PB", "Vtiger PB", "Gator PB", "Kyple PB", "Pastor PB", "Zoho PB", "PB_100", "Per_PB", "CST_PB", "GATE_PB", "Chevron_PB", "Pizza_PB"); $Active_array = array("0", "1", "1", "0", "1", "0", "1", "1", "0", "1", "0", "1"); //$num_array = array(0,1,2,3,4); for ($i = 0; $i < 12; $i++) { $pricebook = new PriceBooks(); $rand = array_rand($num_array); $pricebook->column_fields["bookname"] = $PB_array[$i]; $pricebook->column_fields["active"] = $Active_array[$i]; $pricebook->column_fields["currency_id"] = '1'; $pricebook->save("PriceBooks"); $pricebook_ids[] = $pricebook->id; } // Populate Ticket data $status_array = array("Open", "In Progress", "Wait For Response", "Open", "Closed"); $category_array = array("Big Problem", "Small Problem", "Other Problem", "Small Problem", "Other Problem"); $ticket_title_array = array("Upload Attachment problem", "Individual Customization -Menu and RSS", "Export Output query", "Import Error CSV Leads", "How to automatically add a lead from a web form to VTiger"); for ($i = 0; $i < 5; $i++) { $helpdesk = new HelpDesk(); $rand = array_rand($num_array); $contact_key = array_rand($contact_ids);
/** * Get PriceBook list * * @param array $input_array input data * @return array resulted data */ function get_pricebooks_list($input_array) { require_once 'modules/PriceBooks/PriceBooks.php'; require_once 'include/utils/UserInfoUtil.php'; global $adb, $log; global $current_user; require_once 'modules/Users/Users.php'; $log->debug("Entering customer portal function get_pricebooks_list"); $user = new Users(); $userid = getPortalUserid(); $show_all = show_all('PriceBooks'); $current_user = $user->retrieveCurrentUserInfoFromFile($userid); $id = $input_array['id']; $only_mine = $input_array['onlymine']; $only_base = $input_array['onlybase']; $sessionid = $input_array['sessionid']; if (!validateSession($id, $sessionid)) { return null; } $entity_ids_list = array(); if ($only_mine == 'true') { array_push($entity_ids_list, $id); } else { // TODO } $focus = new PriceBooks(); $focus->filterInactiveFields('PriceBooks'); foreach ($focus->list_fields as $fieldlabel => $values) { foreach ($values as $table => $fieldname) { $fields_list[$fieldlabel] = $fieldname; } } $FieldVisibilityByColumn = array(); foreach ($fields_list as $fieldlabel => $fieldname) { $FieldVisibilityByColumn[$fieldname] = getColumnVisibilityPermission($current_user->id, $fieldname, 'PriceBooks'); } // PriceBooks items selection $query = "SELECT * FROM vtiger_pricebook " . "INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_pricebook.pricebookid AND vtiger_crmentity.deleted = 0 " . "WHERE active = 1 "; if (count($entity_ids_list) > 0) { $query .= "AND owner_id IN (" . generateQuestionMarks($entity_ids_list) . ")"; } $params = array($entity_ids_list); $res = $adb->pquery($query, $params); $noofdata = $adb->num_rows($res); for ($j = 0; $j < $noofdata; $j++) { $i = 0; foreach ($fields_list as $fieldlabel => $fieldname) { if (strcmp($fieldname, 'active') == 0) { continue; } $fieldper = $FieldVisibilityByColumn[$fieldname]; if ($fieldper == '1') { continue; } $output[0]['head'][0][$i]['fielddata'] = $fieldlabel; $fieldvalue = $adb->query_result($res, $j, $fieldname); $pricebookid = $adb->query_result($res, $j, 'pricebookid'); if ($fieldname == 'bookname') { $fieldvalue = '<a href="index.php?module=PriceBooks&action=index&fun=detail&pricebookid=' . $pricebookid . '">' . $fieldvalue . '</a>'; } if ($fieldname == 'owner_id') { // TODO } $output[1]['data'][$j][$i]['fielddata'] = $fieldvalue; $i++; } } $log->debug("Exiting customer portal function get_pricebooks_list"); return $output; }