getOptions()); $zendViewObj->setScriptPath(__DIR__ . '/../../../application/modules/oa/views/scripts'); $awsConfig = yaml_parse_file(APPLICATION_PATH . '/configs/aws.yml'); $configuration = Zend_Registry::get('configuration'); $oauthConfig = new Vectorapi\ApiConfig($configuration); $oauthConfig->setVapiConfig('oa', $_SESSION['S_USERID']); $featuresService = new FeatureService($logger); $userId = $_SESSION['S_USERID']; $graphqlGatewayServiceClient = new GraphqlGatewayServiceClient($userId, $logger); $vendorObj = $graphqlGatewayServiceClient->getVendorObjByVendorId(intval($vendor_id)); $isWorkstationImpersonateLinkInOaFFEnabled = $featuresService->isVariant( 'workstation_impersonate_link_in_oa', 'enabled', AccountContext::fromLegacy((string)$_SESSION['S_USERID'], 'oa') ); $canImpersonate = $isWorkstationImpersonateLinkInOaFFEnabled && userCanImpersonate(); $canShowLegacyLogin = !$isWorkstationImpersonateLinkInOaFFEnabled; $isSuiteTestAppFeatureEnabled = $featuresService->isVariant( 'oa_solfege_account_info', 'enabled', AccountContext::fromLegacy((string)$_SESSION['S_USERID'], 'oa') ); $hideContractDetails = hideContractDetails($vendor_id); $isMysqliWrapper = $wrapperObj instanceof MysqliWrapper; //Check contact information $getContact = 'select contact_first_name, contact_last_name, contact_phone, address_street, address_city, address_zip, orchard_country,vc.contact_id, vc.login, vc.id, vc.auth0_user_id, vc.active from contact c inner join vend_contact vc on vc.contact_id = c.contact_id and vc.master = "Y" inner join vendor v on v.vendor_id = vc.vendor_id where v.vendor_id = ? order by (vc.active = "Y") desc, vc.id asc limit 1'; if ($isMysqliWrapper) { $get_contact_stmt = $mysqli->prepare($getContact); $get_contact_stmt->bind_param('i', $vendor_id); if (!$get_contact_stmt->execute()) { showierror($getContact); } $getContact_rs = $get_contact_stmt->get_result(); } else { $getContact_rs = $wrapperObj->executeQuery($getContact, [$vendor_id]); if ($getContact_rs === false) { show_pdo_error($getContact, $wrapperObj->getLastStatement()); } } $missing_contact = false; $elements = array('First Name', 'Last Name', 'Contact Phone', 'Street Address', 'City', 'Zip/Postal code', 'Country'); $missing_elements = array(); if($isMysqliWrapper) { while ($getContact_row = $getContact_rs->fetch_array()) { if (!$getContact_row['contact_first_name'] || !$getContact_row['contact_phone'] || !$getContact_row['contact_last_name'] || !$getContact_row['address_street'] || !$getContact_row['address_city'] || !$getContact_row['address_zip'] || !$getContact_row['orchard_country']) { for ($i=0; $iprepare($sql); $sql_stmt->bind_param('i', $label_id); if (!$sql_stmt->execute()) { showierror($sql); } $label_check_result = $sql_stmt->get_result(); $label_check_row = $label_check_result->fetch_assoc(); } else { $label_check_row = $wrapperObj->executeQuery($sql, [$label_id], QueryWrapper::RETURN_RESULT, QueryWrapper::ART_RELATIONS, true); if ($label_check_row === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } if ($label_status != $label_check_row['status'] && !$missing_contact) { $orchadmin_user_id = $_SESSION["S_USERID"]; $sql = 'UPDATE vendor SET status = ?, last_modified_by = ?' . ($label_status == 'signed' ? ', date_signed = NOW()' : '') . ' WHERE vendor_id = ?'; if ($isMysqliWrapper) { $sql_stmt = $mysqli->prepare($sql); $sql_stmt->bind_param('sii', $label_status, $orchadmin_user_id, $label_id); if (!$sql_stmt->execute()) { showierror($sql); } } else { $sql_stmt = $wrapperObj->executeQuery($sql, [$label_status, $orchadmin_user_id, $label_id], QueryWrapper::RETURN_AFFECTED_ROWS); if ($sql_stmt === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } //check for vendor.status and if status=`deletion` then call for disable fields if ($label_status == 'deletion') { //set Feature Control Rules setFeaturesControlsForDeletion($wrapperObj, $label_id); } //@TODO: updated label status, update label instead of creating new label //for proposed term if ($label_status != 'inactive' && $label_status != 'deletion') { $sql = 'UPDATE vendor_proposed_term SET status = ? WHERE vendor_id = ? and status <> "signed" and status <> "passed"'; if ($isMysqliWrapper) { $sql_stmt = $mysqli->prepare($sql); $sql_stmt->bind_param('si', $label_status, $label_id); if (!$sql_stmt->execute()) { showierror($sql); } } else { $sql_stmt = $wrapperObj->executeQuery($sql, [$label_status, $label_id], QueryWrapper::RETURN_AFFECTED_ROWS); if ($sql_stmt === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } } // create alert if status is signed $orchadmin_user_id = $_SESSION['S_USERID']; if ($label_status == 'signed') { add_alert(3, $orchadmin_user_id, 'Label ' . $label_check_row['company'] . ' is added/turned active.', 'vendor', $label_id, '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id, $wrapperObj); if ($label_check_row['priority'] == 1) { add_alert(7, $orchadmin_user_id, 'Priority 1 Label ' . QueryFormatString($label_check_row['company']) . ' is added/turned active.', 'vendor', $label_id, '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id, $wrapperObj); } elseif ($label_check_row['est_total_releases'] >= 100) { add_alert(10, $orchadmin_user_id, 'Label ' . QueryFormatString($label_check_row['company']) . ' with more than 100 expected releases is added/turned active.', 'vendor', $label_id, '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id, $wrapperObj); } } elseif ($label_status == 'verbal') { add_alert(12, $orchadmin_user_id, 'Label ' . QueryFormatString($label_check_row['company']) . ' is turned verbal.', 'vendor', $label_id, '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id, $wrapperObj); } // add label status change comment $comment = 'Label status changed from ' . $label_check_row['status'] . ' to ' . $label_status . '.'; $insert_note = 'INSERT INTO note (note_text, note_date, orchadmin_user_id) VALUES (?, now(), ?)'; $insert_note_id = 'INSERT INTO vendor_notes (vendor_id, note_id) VALUES (?, ?)'; if ($isMysqliWrapper) { $insert_note_stmt = $mysqli->prepare($insert_note); $insert_note_stmt->bind_param('si', $comment, $orchadmin_user_id); if (!$insert_note_stmt->execute()) { showierror($insert_note); } $note_id = $mysqli->insert_id; $insert_note_id_stmt = $mysqli->prepare($insert_note_id); $insert_note_id_stmt->bind_param('ii', $vendor_id, $note_id); if (!$insert_note_id_stmt->execute()) { showierror($insert_note_id); } } else { $note_id = $wrapperObj->executeQuery($insert_note, [$comment, $orchadmin_user_id], QueryWrapper::RETURN_INSERT_ID); if ($note_id === false) { show_pdo_error($insert_note, $wrapperObj->getLastStatement()); } $insert_note_id_stmt = $wrapperObj->executeQuery($insert_note_id, [$vendor_id, $note_id], QueryWrapper::RETURN_INSERT_ID); if ($insert_note_id_stmt === false) { show_pdo_error($insert_note_id, $wrapperObj->getLastStatement()); } } $msg = 'a4ca8183'; // redirect back to source page $returnURL = '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id; header("Location: $returnURL&confirm_msg=$msg"); exit(); } else { if ($label_status == $label_check_row['status']) { $msg = 'c48eea75'; } else { $missing_elements = array_unique($missing_elements); $encrypt = WebMessage::getParamHandler('Encrypt'); $msg_missing_elements = $encrypt->process(implode(', ', $missing_elements)); $msg = '2d61f03a&msg_missing_elements=' . $msg_missing_elements; } // redirect back to source page $returnURL = '/cont_mgmt/view_vendor.php?vendor_id=' . $label_id; header("Location: $returnURL&err_msg=$msg"); exit(); } } } $vend_query = 'SELECT IF(company="" or company is null,name,company) as company, v.priority, v.status, v.owner, v.wel_email_sender, v.label_summary FROM vendor v WHERE v.vendor_id = ?'; $sql = 'SELECT COUNT(ls.id) AS total_login, MAX(ls.login_time) AS login_time FROM login_stat ls left join vend_contact vc on vc.id=ls.user_id WHERE ls.user_type = "client_area_member" AND vc.vendor_id = ?'; if ($isMysqliWrapper) { $vend_stmt = $mysqli->prepare($vend_query); $vend_stmt->bind_param('i', $item_info_vendor_id); if (!$vend_stmt->execute()) { showierror($vend_query); } $lbl_item_info_result = $vend_stmt->get_result(); $lbl_item_info_row = $lbl_item_info_result->fetch_assoc(); $sql_stmt = $mysqli->prepare($sql); $sql_stmt->bind_param('i', $item_info_vendor_id); if (!$sql_stmt->execute()) { showierror($sql); } $label_login = $sql_stmt->get_result(); $label_login_row = $label_login->fetch_assoc(); $vendor_status = $lbl_item_info_row['status']; $label_owner = $lbl_item_info_row['owner']; } else { $lbl_item_info_row = $wrapperObj->executeQuery($vend_query, [$item_info_vendor_id], QueryWrapper::RETURN_RESULT, QueryWrapper::ART_RELATIONS, true); if ($lbl_item_info_row === false) { show_pdo_error($vend_query, $wrapperObj->getLastStatement()); } $vendor_status = $lbl_item_info_row['status']; $label_owner = $lbl_item_info_row['owner']; $label_login_row = $wrapperObj->executeQuery($sql, [$item_info_vendor_id], QueryWrapper::RETURN_RESULT, QueryWrapper::ART_RELATIONS, true); if ($label_login_row === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } $sql = 'SELECT IF(vcon.contract_type = "per_release_term",if(vcon.cont_start = "0000-00-00" or vcon.release_term <= 0,"0000-00-00",vcon.cont_start + interval vcon.release_term month),vcon.cont_end) AS expiration_date FROM vendor_contract vc INNER JOIN (SELECT vc1.vendor_id, vc1.cont_start, vc1.cont_end, vc1.contract_type, vc1.release_term FROM vendor_contract vc1 WHERE vc1.vendor_id = ? AND vc1.cont_start IN ( SELECT MAX(vc2.cont_start) FROM vendor_contract vc2 WHERE vc2.vendor_id = vc1.vendor_id ) GROUP BY vc1.vendor_id ) vcon on vcon.vendor_id = vc.vendor_id WHERE vc.vendor_id = ? GROUP BY expiration_date'; if ($isMysqliWrapper) { $sql_stmt = $mysqli->prepare($sql); $sql_stmt->bind_param('ii', $item_info_vendor_id, $item_info_vendor_id); if (!$sql_stmt->execute()) { showierror($sql); } $vc_result = $sql_stmt->get_result(); $vc_row = $vc_result->fetch_assoc(); } else { $vc_row = $wrapperObj->executeQuery($sql, [$item_info_vendor_id, $item_info_vendor_id], QueryWrapper::RETURN_RESULT, QueryWrapper::ART_RELATIONS, true); if ($vc_row === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } if (!empty($vc_row)) { $vc_expiration_date = ($vc_row['expiration_date'] and $vc_row['expiration_date'] != '9999-01-01' and $vc_row['expiration_date'] != '0000-00-00') ? format_date($vc_row['expiration_date']) : 'No Expiration Date'; } ?> encryptWithCustomKey($session_id, $auth0Config['client_id']); $memcached = Zend_Registry::get('memcached'); $memcached->remove($session_id); $memcached->save($_SESSION, $session_id); $workstation_login_url = $config->workstation_login_url; // auth0_user_id is required for impersonation; hide the link when absent (self-heals once it syncs). // QA-OA mirrors the two QA post-login gates that decide whether // Workstation impersonation will succeed: // (1) workstation-impersonation step 2 -- GET /users/identity/auth0/; // fails for OSP-1409 contacts whose Neo4j Identity.auth0UserId // was rewritten away from MySQL. // (2) hydrate-id-token getPrimaryVendor -- GET /users/identity//vendor/ // parsed as OwsVendorSchema { id: number }; the wildcard Vendor // (`id='*'`, "All Orchard Labels") makes the Zod parse throw, // which surfaces as api.access.deny. // Either failing means the link click would 4xx, so we grey it. // PROD blocks the identity endpoint, so the IS NULL check stays. // Three disable classes drive the tooltip: // A = auth0_user_id NULL -> "no active login" // B = identity-by-auth0 404 -> OSP-1409 stale // C = wildcard Vendor (id='*') -> all-labels, no single-vendor session // In-memory, no ows call: no auth0 or inactive master can never be impersonated. $canImpersonateMaster = $canImpersonate && !empty($master_auth0_user_id) && !empty($master_active); $isQaImpersonationEnv = defined('APPLICATION_ENV') && APPLICATION_ENV !== 'production'; $masterDisableClass = (empty($master_auth0_user_id) || empty($master_active)) ? 'A' : null; if ($canImpersonateMaster && $isQaImpersonationEnv) { try { $owsUsersClient = new OwsUsersServiceClient(logger: $logger); $identity = $owsUsersClient->getIdentityByAuth0UserId($master_auth0_user_id); if (empty($identity) || empty($identity['id'])) { $masterDisableClass = 'B'; $canImpersonateMaster = false; } else { $vendor = $owsUsersClient->getVendorForIdentityVc($identity['id'], $master_vend_contact_id); $vendorIdField = is_array($vendor) ? (isset($vendor['id']) ? $vendor['id'] : null) : null; if (empty($vendor) || !is_numeric($vendorIdField)) { $masterDisableClass = 'C'; $canImpersonateMaster = false; } } } catch (\Exception $e) { // fail-open: transient ows-users error must not blank a working link $logger->warning('labelItemInfo impersonation gate check failed: ' . $e->getMessage()); } } $_guideLink = 'check guide'; $wsImpTooltipMsg = $masterDisableClass === 'B' ? "Impersonation unavailable, user deactivated — {$_guideLink}" : ($masterDisableClass === 'C' ? "Impersonation unavailable, wildcard vendor — {$_guideLink}" : "Impersonation unavailable, no active login — {$_guideLink}"); ?>

$vendor_id, 'label_contact_login' => $vendor_login, 'master_vend_contact_id' => $master_vend_contact_id, ]; ?>

View in Application:


partial('/quicksearch/_applications.phtml', array( 'labelResults' => $resultData, 'sessionId' => $sid, 'workstationURL' => $config->workstation_url, 'canImpersonate' => $canImpersonate, 'canShowLegacyLogin' => $canShowLegacyLogin, 'canImpersonateResolvable' => $canImpersonateMaster, 'wsImpTooltipMsg' => $wsImpTooltipMsg, )); } else { ?>

Workstation login Workstation Login Workstation impersonation Workstation Impersonate Workstation impersonation Workstation Impersonate Login as Admin Login as Admin

  • Label ID:
  • Label Status: Deletion Signed
  • Contract Expiration:
  • Label Total Login:
  • Label Last Login:
Priority