/** * Return all companies that are on specific projects, determined by a CVS list of project ids. * * @access public * @param string $projects_csv CSV list of projects * @param string $additional_conditions Additional SQL conditions * @param bool $include_owner Include the owner company * @return array Array of Companies */ static function getCompaniesByProjects($projects_csv, $additional_conditions = null, $include_owner = true) { $companies = array(); $companies_table = Companies::instance()->getTableName(true); $project_companies_table = ProjectCompanies::instance()->getTableName(true); // Restrict result only on owner company $ownerCond = ''; if (!$include_owner) { $owner_id = owner_company()->getId(); $ownerCond = "{$companies_table}.`client_of_id` = '{$owner_id}' AND "; } $sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE {$ownerCond} ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` IN ( " . $projects_csv . '))'; if (trim($additional_conditions) != '') { $sql .= " AND ({$additional_conditions}) ORDER BY {$companies_table}.`name`"; } $rows = DB::executeAll($sql); if (is_array($rows)) { foreach ($rows as $row) { $companies[] = Companies::instance()->loadFromRow($row); } // foreach } // if return count($companies) ? $companies : null; }
/** * Constructor * * @param Request $request * @return CompanyProfileController */ function __construct($request) { parent::__construct($request); $company_id = $this->request->getId('company_id'); if ($company_id) { $this->active_company = Companies::findById($company_id); } // if if (instance_of($this->active_company, 'Company')) { $this->wireframe->page_actions = array(); if (!$this->active_company->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->active_company->getIsArchived() && $this->logged_user->isPeopleManager()) { $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('people_archive')); } // if $this->wireframe->addBreadCrumb($this->active_company->getName(), $this->active_company->getViewUrl()); // Collect company tabs $tabs = new NamedList(); $tabs->add('overview', array('text' => str_excerpt($this->active_company->getName(), 25), 'url' => $this->active_company->getViewUrl())); $tabs->add('people', array('text' => lang('People'), 'url' => $this->active_company->getViewUrl())); $tabs->add('projects', array('text' => lang('Projects'), 'url' => $this->active_company->getViewUrl())); event_trigger('on_company_tabs', array(&$tabs, &$this->logged_user, &$this->active_company)); $this->smarty->assign(array('company_tabs' => $tabs, 'company_tab' => 'overview')); } else { $this->active_company = new Company(); } // if $this->smarty->assign(array('active_company' => $this->active_company)); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id = NULL) { $currUser = Auth::user(); $oCategories = Category::all(); $oCity = Cities::all(); $oVacancy = null; if ($id > 0) { $oVacancy = Vacancy::find($id); } foreach ($oCategories as $item) { $aCategories[$item->id] = $item->name; } if (Auth::user()->is_admin == 0) { $aCompanies = Companies::where('user_id', '=', $currUser->id)->get(); } else { $aCompanies = Companies::all(); } foreach ($aCompanies as $item) { $aCompany[$item->id] = $item->name; } $oQuery = Regions::join('country', 'country.id', '=', 'country_id')->select('regions.id as id', 'regions.name', 'country.name as country_name', 'country.id as country_id'); if ($oRegions = $oQuery->get()) { } foreach ($oRegions as $item) { $aRegions[$item->country_name] = array(); $aCity = Cities::where('region_id', '=', $item->id)->get(); foreach ($aCity as $city) { $aRegions[$item->name][$city->id] = $city->name; } } if ($currUser->is_admin == 0 && (empty($oVacancy) === false && $oVacancy->user_id != $currUser->id)) { return Redirect::route('vacancy-list', array('user_id' => $currUser->id)); } return View::make('/vacancy/edit', array('currUser' => $currUser, 'aCategories' => $aCategories, 'aCompany' => $aCompany, 'aRegions' => $aRegions, 'oVacancy' => $oVacancy, 'id' => $id)); }
/** * Init company based on subdomain * * @access public * @param string * @return null * @throws Error */ private function initCompany() { $company = Companies::getOwnerCompany(); if (!$company instanceof Company) { throw new OwnerCompanyDnxError(); } // if // check the cache if available $owner = null; if (GlobalCache::isAvailable()) { $owner = GlobalCache::get('owner_company_creator', $success); } if (!$owner instanceof User) { $owner = $company->getCreatedBy(); // Update cache if available if ($owner instanceof User && GlobalCache::isAvailable()) { GlobalCache::update('owner_company_creator', $owner); } } if (!$owner instanceof User) { throw new AdministratorDnxError(); } // if $this->setCompany($company); }
/** * Return invoice company * * @param void * @return Company */ function getCompany() { if ($this->company === false) { $this->company = Companies::findById($this->getCompanyId()); } // if return $this->company; }
/** * Return relation company * * @param void * @return Company */ function getCompany() { if (is_null($this->company)) { $this->company = Companies::findById($this->getCompanyId()); } // if return $this->company; }
/** * Check Fed ID rule */ public function check_fed_id() { $company = Companies::model()->find('Company_Fed_ID=:Fed_ID', array(':Fed_ID'=>$this->Fed_ID)); if($company != null) { $this->addError('Fed_ID','Company with this Fed ID already exists'); } else if (!preg_match('/^(\d{2}\-\d{7})|(\d{3}\-\d{2}\-\d{4})$/', $this->Fed_ID)) { $this->addError('Fed_ID','Invalid Fed ID, correct formatting: xx-xxxxxxx'); } }
/** * Render select company box * * Parameters: * * - value - Value of selected company * - optional - Is value of this field optional or not * - exclude - Array of company ID-s that will be excluded * - can_create_new - Should this select box offer option to create a new * company from within the list * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_select_company($params, &$smarty) { static $ids = array(); $companies = Companies::getIdNameMap(array_var($params, 'companies')); $value = array_var($params, 'value', null, true); $id = array_var($params, 'id', null, true); if (empty($id)) { $counter = 1; do { $id = "select_company_dropdown_{$counter}"; $counter++; } while (in_array($id, $ids)); } // if $ids[] = $id; $params['id'] = $id; $optional = array_var($params, 'optional', false, true); $exclude = array_var($params, 'exclude', array(), true); if (!is_array($exclude)) { $exclude = array(); } // if $can_create_new = array_var($params, 'can_create_new', true, true); if ($optional) { $options = array(option_tag(lang('-- None --'), ''), option_tag('', '')); } else { $options = array(); } // if foreach ($companies as $company_id => $company_name) { if (in_array($company_id, $exclude)) { continue; } // if $option_attributes = array('class' => 'object_option'); if ($value == $company_id) { $option_attributes['selected'] = true; } // if $options[] = option_tag($company_name, $company_id, $option_attributes); } // if if ($can_create_new) { $logged_user = get_logged_user(); if (instance_of($logged_user, 'User') && Company::canAdd($logged_user)) { $params['add_object_url'] = assemble_url('people_companies_quick_add'); $params['object_name'] = 'company'; $params['add_object_message'] = lang('Please insert new company name'); $options[] = option_tag('', ''); $options[] = option_tag(lang('New Company...'), '', array('class' => 'new_object_option')); } // if } // if return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>'; }
public function run() { // Uncomment the below to wipe the table clean before populating // DB::table('companies')->truncate(); Eloquent::unguard(); DB::table('companies')->delete(); Companies::create(array('id' => 1, 'name' => 'АТБ', 'description' => 'Продуктовый супермаркет', 'phone' => 123456789, 'email' => '*****@*****.**', 'web_site' => 'web.site.ua', 'city_id' => 3, 'user_id' => 1, 'cover_image' => '', 'logo' => '')); Companies::create(array('id' => 2, 'name' => 'Фокстрот', 'description' => 'Супермаркет електронной техники', 'phone' => 0516155555, 'email' => 'fokstroy@ua', 'web_site' => 'fokstrot.ua', 'city_id' => 2, 'user_id' => 1, 'cover_image' => '', 'logo' => '')); Companies::create(array('id' => 3, 'name' => 'Web-studio', 'description' => 'Web-studio, создание и продвижение сайтов', 'phone' => 0656565655, 'email' => '*****@*****.**', 'web_site' => 'web.ua', 'city_id' => 1, 'user_id' => 1, 'cover_image' => '', 'logo' => '')); $this->command->info('Companies table seeded!'); }
/** * Check Auth_Code rule */ public function check_auth() { $client = Clients::model()->findByPk($this->Client_ID); if($client) { $company = Companies::model()->findByPk($client->Company_ID); if ($company->Auth_Code != $this->Auth_Code) { $this->addError('Auth_Code','Invalid Authorization Code'); } } else { $this->addError('Auth_Code',"Company with this Authorization Code doesn't exists"); } }
/** * Init company based on subdomain * * @access public * @param string * @return null * @throws Error */ private function initCompany() { $company = Companies::getOwnerCompany(); if (!$company instanceof Company) { throw new OwnerCompanyDnxError(); } // if if (!$company->getCreatedBy() instanceof User) { throw new AdministratorDnxError(); } // if $this->setCompany($company); }
/** * Return owner company instance * * @param void * @return Company */ function get_owner_company() { static $instance = null; if ($instance === null) { $instance = cache_get('owner_company'); if (!$instance) { $instance = Companies::findOwnerCompany(); } // if } // if return $instance; }
/** * Show archive page * * @param void * @return null */ function archive() { if ($this->logged_user->isPeopleManager()) { $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('people_archive')); $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if list($companies, $pagination) = Companies::paginateArchived($this->logged_user, $page, 30); $this->smarty->assign(array('companies' => $companies, 'pagination' => $pagination)); } else { $this->httpError(HTTP_ERR_FORBIDDEN); } // if }
/** * Init company based on subdomain * * @access public * @param string * @return null * @throws Error */ private function initCompany() { trace(__FILE__, 'initCompany()'); $company = Companies::getOwnerCompany(); trace(__FILE__, 'initCompany() - company check'); if (!$company instanceof Company) { throw new OwnerCompanyDnxError(); } // if trace(__FILE__, 'initCompany() - admin check'); if (!$company->getCreatedBy() instanceof User) { throw new AdministratorDnxError(); } // if trace(__FILE__, 'initCompany() - setCompany()'); $this->setCompany($company); }
/** * Display company details * */ function company() { $current_company = Companies::findById($this->request->get('object_id')); if (!instance_of($current_company, 'Company')) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$current_company->isOwner() && !in_array($current_company->getId(), $this->logged_user->visibleCompanyIds())) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if $users = $current_company->getUsers($this->logged_user->visibleUserIds()); if (!$current_company->isOwner()) { $projects = Projects::findByUserAndCompany($this->logged_user, $current_company); } $this->smarty->assign(array('current_company' => $current_company, 'current_company_users' => $users, 'current_company_projects' => $projects, "page_title" => $current_company->getName(), "page_back_url" => assemble_url('mobile_access_people'))); }
/** * Return contacts grouped by company * * @param void * @return array */ static function getGroupedByCompany() { $companies = Companies::getAll(); if (!is_array($companies) || !count($companies)) { return null; } // if $result = array(); foreach ($companies as $company) { $contacts = $company->getContacts(); if (is_array($contacts) && count($contacts)) { $result[$company->getName()] = array('details' => $company, 'contacts' => $contacts); // array } // if } // foreach return count($result) ? $result : null; }
/** * Return all companies that are on specific project. Owner company is excluded from * this listing (only client companies are returned) * * @access public * @param Project $project * @param string $additional_conditions Additional SQL conditions * @return array */ static function getCompaniesByProject(Project $project, $additional_conditions = null) { $companies_table = Companies::instance()->getTableName(true); $project_companies_table = ProjectCompanies::instance()->getTableName(true); // Restrict result only on owner company $owner_id = owner_company()->getId(); $companies = array(); $sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE ({$companies_table}.`client_of_id` = '{$owner_id}') AND ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` = " . DB::escape($project->getId()) . ')'; if (trim($additional_conditions) != '') { $sql .= " AND ({$additional_conditions})"; } $rows = DB::executeAll($sql); if (is_array($rows)) { foreach ($rows as $row) { $companies[] = Companies::instance()->loadFromRow($row); } // foreach } // if return count($companies) ? $companies : null; }
public function getUpdate($idCourse, $idContent = '') { if ($idContent == '') { return Redirect::to(self::parseRoute($idCourse)); } else { $content = CoursesSection::find($idContent); if (!$content) { return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_display_err')); } else { $course = Courses::find($idCourse); $array = array('course' => $course, 'content' => $content, 'route' => self::parseRoute($idCourse)); $view = null; switch ($content->section->type) { case 'text': $view = 'backend.content.section'; break; case 'teachers': $array['teachers'] = Teachers::getPublish(); $view = 'backend.content.teachers'; break; case 'helpers': $array['helpers'] = Companies::getPublish(); $view = 'backend.content.helpers'; break; case 'promotioners': $array['promotioners'] = Companies::getPublish(); $view = 'backend.content.promotioners'; break; case 'supporters': $array['supporters'] = Companies::getPublish(); $view = 'backend.content.supporters'; break; default: $view = 'backend.content.section'; break; } return View::make($view, $array); } } }
/** * Show billed / canceled company invoices * * @param void * @return null */ function company() { $status = $this->request->get('status') ? $this->request->get('status') : 'billed'; $company = null; $company_id = $this->request->getId('company_id'); if ($company_id) { $company = Companies::findById($company_id); } // if if (instance_of($company, 'Company')) { $this->wireframe->addBreadCrumb($company->getName(), assemble_url('company_invoices', array('company_id' => $company->getId()))); } else { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($status == 'canceled') { $invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_CANCELED), 'closed_on DESC')); } else { $invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_BILLED), 'closed_on DESC')); } // if $this->smarty->assign(array('company' => $company, 'invoices' => $invoices, 'status' => $status)); }
/** * Return owner company * * @access public * @param void * @return Company */ function getCompany() { return Companies::findById($this->getCompanyId()); }
/** * Return responsible company * * @access public * @param void * @return Company */ protected function getAssignedToCompany() { return Companies::findById($this->getAssignedToCompanyId()); }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2048 $ */ if (!defined('IN_PHPB2B')) { exit('Not A Valid Entry Point'); } require CACHE_LANG_PATH . 'lang_space.php'; require CACHE_PATH . 'cache_membergroup.php'; uses("templet", "member", "company", "membertype", "space"); $member = new Members(); $space = new Space(); $membertype = new Membertypes(); $company = new Companies(); $templet = new Templets(); $space_name = ''; if (empty($theme_name)) { $theme_name = "default"; $style_name = isset($_PB_CACHE['setting']['theme']) && !empty($_PB_CACHE['setting']['theme']) ? $_PB_CACHE['setting']['theme'] : "default"; $ADODB_CACHE_DIR = DATA_PATH . 'dbcache'; } $pdb->setFetchMode(ADODB_FETCH_ASSOC); $smarty->flash_layout = $theme_name . "/flash"; $smarty->assign("theme_img_path", "templates/" . $theme_name . "/"); $smarty->assign('ThemeName', $theme_name); //if caches $space_cache_cycle = 86400; $cache_data = $push_data = array(); $pdb->Execute("DELETE FROM {$tb_prefix}spacecaches WHERE expiration<" . $time_stamp);
/** * Render assign to SELECT * * @param string $list_name Name of the select control * @param Project $project Selected project, if NULL active project will be used * @param integer $selected ID of selected user * @param array $attributes Array of select box attributes, if needed * @return null */ function assign_to_select_box($list_name, $project = null, $selected = null, $attributes = null) { if (is_null($project)) { $project = active_project(); } // if if (!$project instanceof Project) { throw new InvalidInstanceError('$project', $project, 'Project'); } // if $logged_user = logged_user(); $can_assign_to_owners = $logged_user->isMemberOfOwnerCompany() || $logged_user->getProjectPermission($project, PermissionManager::CAN_ASSIGN_TO_OWNERS); $can_assign_to_other = $logged_user->isMemberOfOwnerCompany() || $logged_user->getProjectPermission($project, PermissionManager::CAN_ASSIGN_TO_OTHER); $grouped_users = $project->getUsers(true); $options = array(option_tag(lang('anyone'), '0:0')); if (is_array($grouped_users) && count($grouped_users)) { foreach ($grouped_users as $company_id => $users) { $company = Companies::findById($company_id); if (!$company instanceof Company) { continue; } // if // Check if $logged_user can assign task to members of this company if ($company_id != $logged_user->getCompanyId()) { if ($company->isOwner()) { if (!$can_assign_to_owners) { continue; } // if } else { if (!$can_assign_to_other) { continue; } // if } // if } // if $options[] = option_tag('--', '0:0'); // separator $option_attributes = $company->getId() . ':0' == $selected ? array('selected' => 'selected') : null; $options[] = option_tag($company->getName(), $company_id . ':0', $option_attributes); if (is_array($users)) { foreach ($users as $user) { $option_attributes = $company_id . ':' . $user->getId() == $selected ? array('selected' => 'selected') : null; $options[] = option_tag($company->getName() . ': ' . $user->getDisplayName(), $company_id . ':' . $user->getId(), $option_attributes); } // foreach } // if } // foreach } // if return select_box($list_name, $options, $attributes); }
/** * Return manager instance * * @access protected * @param void * @return Companies */ function manager() { if (!$this->manager instanceof Companies) { $this->manager = Companies::instance(); } return $this->manager; }
/** * Returns link HTML for a data item. * * @param flag Data Item type flag. * @param integer Data Item ID. * @param boolean Show name / data item title? * @return string Link HTML (<a href="...">...</a>). */ private function getHTMLOfLink($dataItemID, $dataItemType, $showTitle = true) { $string = '<a href="' . CATSUtility::getIndexName(); switch ($dataItemType) { case DATA_ITEM_CANDIDATE: $candidates = new Candidates($this->_siteID); $string .= '?m=candidates&a=show&candidateID=' . $dataItemID . '">'; $string .= '<img src="images/mru/candidate.gif" alt="" style="border: none;" title="Candidate" />'; if ($showTitle) { $data = $candidates->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Candidate Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } $image = 'images/mru/candidate.gif'; break; case DATA_ITEM_COMPANY: $companies = new Companies($this->_siteID); $string .= '?m=companies&a=show&companyID=' . $dataItemID . '">'; $string .= '<img src="images/mru/company.gif" alt="" style="border: none;" title="Company" />'; if ($showTitle) { $data = $companies->get($dataItemID); if (!isset($data['name'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Company Deleted)<a>'; } else { $string .= ' ' . $data['name']; } } break; case DATA_ITEM_CONTACT: $contacts = new Contacts($this->_siteID); $string .= '?m=contacts&a=show&contactID=' . $dataItemID . '">'; $string .= '<img src="images/mru/contact.gif" alt="" style="border: none;" title="Contact" />'; if ($showTitle) { $data = $contacts->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/contact.gif" alt="" style="border: none;" /> (Contact Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } break; case DATA_ITEM_JOBORDER: $jobOrders = new JobOrders($this->_siteID); $string .= '?m=joborders&a=show&jobOrderID=' . $dataItemID . '">'; $string .= '<img src="images/mru/job_order.gif" alt="" style="border: none;" title="Job Order" />'; if ($showTitle) { $data = $jobOrders->get($dataItemID); if (!isset($data['title'])) { $string = '<img src="images/mru/job_order.gif" alt="" style="border: none;" /> (Job Order Deleted)<a>'; } else { $string .= ' ' . $data['title']; } } break; } $string .= '</a>'; return $string; }
</div> </div> <div class="coInputMainBlock adminMainBlock"> <?php if (!isset($result_msg)) { ?> <table style="width:350px;"><tr><th style="text-align:center;" colspan="2"><?php echo lang('fields to export'); ?> </th></tr> <?php if ($import_type == 'contact') { $contact_fields = Contacts::getContactFieldNames(); } else { $contact_fields = Companies::getCompanyFieldNames(); } $isAlt = false; $i = 0; $label_w = $label_h = $label_o = false; foreach ($contact_fields as $c_field => $c_label) { if (str_starts_with($c_field, 'contact[w') && !$label_w) { ?> <tr><td colspan="3" style="text-align:center;"><b><?php echo lang('work'); ?> </b></td></tr> <?php $label_w = true; } else { if (str_starts_with($c_field, 'contact[h') && !$label_h) { ?>
/** * Delete company logo * * @param void * @return null */ function delete_logo() { if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if $company = Companies::findById(get_id()); if (!$company instanceof Company) { flash_error(lang('company dnx')); $this->redirectToReferer(get_url('administration', 'clients')); } // if try { DB::beginWork(); $company->deleteLogo(); $company->save(); ApplicationLogs::createLog($company, null, ApplicationLogs::ACTION_EDIT); DB::commit(); flash_success(lang('success delete company logo')); } catch (Exception $e) { DB::rollback(); flash_error(lang('error delete company logo')); } // try $this->redirectToUrl($company->getEditLogoUrl()); }
<?php $genid = gen_id(); $assign_type = 0; //All if (isset($assigned_to_user_filter) && $assigned_to_user_filter > 0){ $assigned_to = Users::findById($assigned_to_user_filter); $assigned_to_me = $assigned_to->getId() == logged_user()->getId(); $assign_type = $assigned_to_me? 1 : 2; } else if (isset($assigned_to_company_filter) && $assigned_to_company_filter > 0){ $assigned_to = Companies::findById($assigned_to_company_filter); $assign_type = 3; } ?> <script> var cant_tips = 0; var tips_array = []; function addTip(div_id, title, bdy) { tips_array[cant_tips++] = new Ext.ToolTip({ target: div_id, html: bdy, title: title, hideDelay: 1500, closable: true }); } </script> <div id="<?php echo $genid ?>-db" style="padding:7px;">
/** * Import Vendors * @param $clientID * @param $importedVendors */ public static function importVendors($clientID, $importedVendors) { $all_amount=count($importedVendors); $i=0; $pb= ProgressBar::init(); foreach($importedVendors as $importedVendor) { $company = Companies::model()->with('client')->findByAttributes(array( 'Company_Fed_ID' => $importedVendor['fedId'], )); if ($company) { $client = $company->client; } else { //if company does not exists, create new company $client = Companies::createEmptyCompany($importedVendor['fedId'], $importedVendor['companyName'], $importedVendor); } $vendorClientId = $client->Client_ID; $vendor = Vendors::model()->findByAttributes(array( 'Client_Client_ID' => $clientID, 'Vendor_Client_ID' => $vendorClientId, )); $newVendor = false; if (!$vendor) { $vendor = new Vendors(); $newVendor = true; } else { $vendor->Active_Relationship = self::ACTIVE_RELATIONSHIP; $vendor->save(); } $vendor->Vendor_ID_Shortcut = $importedVendor['shortcut']; $vendor->Vendor_Client_ID = $vendorClientId; $vendor->Client_Client_ID = $clientID; $vendor->Vendor_Name_Checkprint = $importedVendor['checkprint']; $vendor->Vendor_1099 = $importedVendor['v1099']; $vendor->Vendor_Default_GL = $importedVendor['defG']; $vendor->Vendor_Default_GL_Note = $importedVendor['defGLNote']; $vendor->Vendor_Note_General = $importedVendor['noteGeneral']; if ($vendor->validate()) { $vendor->save(); } else if ($newVendor) { $vendor = new Vendors(); $vendor->Vendor_ID_Shortcut = ''; $vendor->Vendor_Client_ID = $vendorClientId; $vendor->Client_Client_ID = $clientID; $vendor->Vendor_Name_Checkprint = ''; $vendor->Vendor_1099 = ''; $vendor->Vendor_Default_GL = ''; $vendor->Vendor_Default_GL_Note = ''; $vendor->Vendor_Note_General = ''; $vendor->Active_Relationship = self::ACTIVE_RELATIONSHIP; $vendor->save(); } $i++; $percent=intval($i/$all_amount*100); session_start(); $_SESSION['progress']=$percent; session_write_close(); } }
/** * Generates a string of Company info used for the popup tooltips. * * @param integer company ID * @param integer site ID * @return string info string */ private static function _company($companyID, $siteID) { $companies = new Companies($siteID); $infoRS = $companies->get($companyID); if (empty($infoRS)) { return 'The specified company could not be found.'; } $infoString = sprintf('<span class="bold">Company:</span> %s', htmlspecialchars($infoRS['name'])); if (!empty($infoRS['billingContactFullName'])) { $infoString .= sprintf('<br /><span class="bold">Billing Contact:</span> %s', htmlspecialchars($infoRS['billingContactFullName'])); } if (!empty($infoRS['phone1'])) { $infoString .= sprintf('<br /><span class="bold">Primary Phone:</span> %s', htmlspecialchars($infoRS['phone1'])); } if (!empty($infoRS['phone2'])) { $infoString .= sprintf('<br /><span class="bold">Secondary Phone:</span> %s', htmlspecialchars($infoRS['phone2'])); } if (!empty($infoRS['faxNumber'])) { $infoString .= sprintf('<br /><span class="bold">Fax Number:</span> %s', htmlspecialchars($infoRS['faxNumber'])); } if (!empty($infoRS['keyTechnologies'])) { $infoString .= sprintf('<br /><span class="bold">Key Technologies:</span> %s', htmlspecialchars($infoRS['keyTechnologies'])); } return $infoString; }