exit; } if (!isset($b2bpbObj)) { include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Buyer_BProduct_Association.php"; $b2bpbObj = new Buyer2_Buyer_BProduct_Association(); } if (!isset($b2bpbvObj)) { include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Buyer_BProduct_Association_ToVerify.php"; $b2bpbvObj = new Buyer2_Buyer_BProduct_Association_ToVerify(); } if (!isset($emailObj)) { include_once SITE_CLASS_APPLICATION . 'class.EmailTemplate.php'; $emailObj = new EmailTemplate(); } $flds = "b2bpb.*, (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2bpb.iBuyer2Id) as vBuyer2,\r\n\t\t\t\t\t(Select vProductName from " . PRJ_DB_PREFIX . "_bproduct_organization where iProductId=b2bpb.iProductId) as vProduct,\r\n (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2bpb.iBuyerId) as vBuyer"; $assocs = $b2bpbObj->getDetails($flds, " AND b2bpb.eStatus IN ('Active','Inactive') AND b2bpb.eNeedToVerify!='Yes' AND b2bpb.iAssociationId IN ({$val}) "); // pr($assocs); exit; $assocsids = multi21Array($assocs, 'iAssociationId'); $vl = ''; if (is_array($assocsids) && count($assocsids) > 0) { $vl = @implode(',', $assocsids); } $rs = false; $type = ''; $esubtyp = ''; if ($mode == 'status' && trim($vl) != '') { $sql1 = "UPDATE " . PRJ_DB_PREFIX . "_buyer2_buyer_bproduct_association SET eStatus = IF(eStatus='Inactive','Active','Inactive'), eNeedToVerify='Yes', eModifiedBy='" . $sess_usertype_short . "', iModifiedByID='" . $sess_id . "', dModifiedDate='" . date('Y-m-d H:i:s') . "', eVerifiedBy='', iVerifiedByID='', dVerifiedDate='', eRejectedBy='', iRejectedByID='', dRejectedDate='' WHERE iAssociationId IN ({$vl})"; $sql2 = "INSERT INTO " . PRJ_DB_PREFIX . "_buyer2_buyer_bproduct_association_toverify\r\n (iAssociationId,iBuyer2Id,iBuyerId,iProductId,vACode,fLimit,fFeePc,fFeeFlat,fAdvancePc,fMinValue,fMaxValue,vNarrative,fAutoAcceptLimit,fTotalGlobalLimit,fTotalOutstandingAmt,dADate,vFromIP,iCreatedByID,eCreatedBy,iModifiedByID,eModifiedBy,dModifiedDate,iRejectedByID,eRejectedBy,dRejectedDate,iVerifiedByID,eVerifiedBy,dVerifiedDate,tReasonToReject,eNeedToVerify,eStatus)\r\n SELECT * FROM " . PRJ_DB_PREFIX . "_buyer2_buyer_bproduct_association WHERE iAssociationId IN ({$vl})"; // $rs = $dbobj->dotransaction($sqls); $rs = $dbobj->sql_query($sql1); if ($rs) {
$whr_cndt = " AND vType='{$esubtyp}' AND eSection='Member' "; $email_cnt = $emailObj->getDetails('*', $whr_cndt); $type = "Modified"; $body = array("#BUYER2#", "#PRODUCT#", "#BUYER#", "#ACODE#", "#LINK#", "#MODIFIED_BY#"); $body_arr = array("#USER#", "#BUYER2#", "#PRODUCT#", "#BUYER#", "#ACODE#", "#LINK#", "#MODIFIED_BY#", "#MAIL_FOOTER#", "#SITE_URL#"); } else { $msg = 'uerr'; } $id = $iAssociationId; } else { if ($mod == 'add') { // $mod = 'add'; if (isset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE']) && $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE'] == 'Buyer2') { $Data['iBuyer2Id'] = $curORGID; } $drec = $b2bpbObj->getDetails('*', " AND iBuyer2Id=" . $Data['iBuyer2Id'] . " AND iBuyerId=" . $Data['iBuyerId'] . " AND iProductId=" . $Data['iProductId'] . ""); if (is_array($drec) && count($drec) > 0 && isset($drec[0]['iAssociationId']) && $drec[0]['iAssociationId'] > 0) { if (isset($_SERVER['HTTP_REFERER']) && trim($_SERVER['HTTP_REFERER']) != '') { header("Location: " . $_SERVER['HTTP_REFERER']); } else { header("Location: " . SITE_URL_DUM . "b2bprodtbasoclist"); } exit; } $Data['dADate'] = calcGTzTime(date('Y-m-d H:i:s'), 'Y-m-d H:i:s'); $Data['vFromIP'] = $_SERVER['REMOTE_ADDR']; $Data['eCreatedBy'] = $sess_usertype_short; $Data['iCreatedByID'] = $sess_id; $Data['eStatus'] = 'Need to Verify'; $Data['vACode'] = $b2bpbObj->getUniqueCode(''); $rs = $id = $b2bpbObj->insert($Data);
if ($invdtls[0]['iBuyerOrganizationID'] == $curORGID) { $orgas = "Buyer"; } else { if ($invdtls[0]['iSupplierOrganizationID'] == $curORGID) { $orgas = "Supplier"; } } $orgas = trim($orgas) != '' ? $orgas : $uorg_type; $dtls = array(); if ($curORGID > 0 && $orgas != '') { if ($orgas == 'Buyer') { if (!isset($b2bpbObj)) { include_once SITE_CLASS_APPLICATION . 'organization/class.Buyer2_Buyer_BProduct_Association.php'; $b2bpbObj = new Buyer2_Buyer_BProduct_Association(); } $dtls = $b2bpbObj->getDetails("*", " AND iBuyerId={$curORGID} AND iBuyer2Id={$iBuyer2Id} AND iProductId={$ipids} "); } else { if ($orgas == 'Supplier') { if (!isset($b2spsObj)) { include_once SITE_CLASS_APPLICATION . 'organization/class.Buyer2_Supplier_SProduct_Association.php'; $b2spsObj = new Buyer2_Supplier_SProduct_Association(); } $dtls = $b2spsObj->getDetails("*", " AND iSupplierId={$curORGID} AND iBuyer2Id={$iBuyer2Id} AND iProductId={$ipids} "); } else { if ($orgas == 'Both') { $sql = "(Select DISTINCT * from " . PRJ_DB_PREFIX . "_buyer2_buyer_bproduct_association where iBuyerId={$curORGID} AND iBuyer2Id={$iBuyer2Id} AND iProductId={$ipids})\r\n\t\t\t\t\tUNION\r\n\t\t\t\t\t(Select DISTINCT * from " . PRJ_DB_PREFIX . "_buyer2_supplier_sproduct_association where iSupplierId={$curORGID} AND iBuyer2Id={$iBuyer2Id} AND iProductId={$ipids})\r\n\t\t\t\t\tORDER BY vACode ASC"; // echo $sql; exit; $dtls = $dbobj->MySQLSelect($sql); } } }