$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);
            }
        }
    }
    // pr($dtls); exit;
}
//
if (is_array($dtls) && count($dtls) > 0) {
    ?>
<table cellpadding="0" cellspacing="0" style="background:#f7f7f7; font-size:12px;">
<tr>
    exit;
}
if (!isset($b2spsObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Supplier_SProduct_Association.php";
    $b2spsObj = new Buyer2_Supplier_SProduct_Association();
}
if (!isset($b2spsvObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Supplier_SProduct_Association_ToVerify.php";
    $b2spsvObj = new Buyer2_Supplier_SProduct_Association_ToVerify();
}
if (!isset($emailObj)) {
    include_once SITE_CLASS_APPLICATION . 'class.EmailTemplate.php';
    $emailObj = new EmailTemplate();
}
$flds = "b2sps.*, (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2sps.iBuyer2Id) as vBuyer2,\r\n\t\t\t\t\t(Select vProductName from " . PRJ_DB_PREFIX . "_sproduct_organization where iProductId=b2sps.iProductId) as vProduct,\r\n               (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2sps.iSupplierId) as vSupplier";
$assocs = $b2spsObj->getDetails($flds, " AND b2sps.eStatus IN ('Active','Inactive') AND b2sps.eNeedToVerify!='Yes' AND b2sps.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_supplier_sproduct_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_supplier_sproduct_association_toverify\r\n            (iAssociationId,iBuyer2Id,iSupplierId,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_supplier_sproduct_association WHERE iAssociationId IN ({$vl})";
    // $rs = $dbobj->dotransaction($sqls);
    $rs = $dbobj->sql_query($sql1);
    if ($rs) {
Exemple #3
0
         $whr_cndt = " AND vType='{$esubtyp}' AND eSection='Member' ";
         $email_cnt = $emailObj->getDetails('*', $whr_cndt);
         $type = "Modified";
         $body = array("#BUYER2#", "#PRODUCT#", "#SUPPLIER#", "#ACODE#", "#LINK#", "#MODIFIED_BY#");
         $body_arr = array("#USER#", "#BUYER2#", "#PRODUCT#", "#SUPPLIER#", "#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 = $b2spsObj->getDetails('*', " AND iBuyer2Id=" . $Data['iBuyer2Id'] . " AND iSupplierId=" . $Data['iSupplierId'] . " 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 . "b2sprodtsasoclist");
             }
             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'] = $b2spsObj->getUniqueCode('');
         $rs = $id = $b2spsObj->insert($Data);