26 public function __construct( $sObjectsInListName =
'oxpayment' )
41 if ( is_array( $sHomeCountry ) ) {
42 $this->_sHomeCountry =
current( $sHomeCountry );
44 $this->_sHomeCountry = $sHomeCountry;
72 $sBoni = ($oUser && $oUser->oxuser__oxboni->value )?$oUser->oxuser__oxboni->value:0;
74 $sTable = getViewName(
'oxpayments' );
75 $sQ =
"select {$sTable}.* from ( select distinct {$sTable}.* from {$sTable} ";
76 $sQ .=
"left join oxobject2group ON oxobject2group.oxobjectid = {$sTable}.oxid ";
77 $sQ .=
"inner join oxobject2payment ON oxobject2payment.oxobjectid = ".$oDb->quote( $sShipSetId ).
" and oxobject2payment.oxpaymentid = {$sTable}.oxid ";
78 $sQ .=
"where {$sTable}.oxactive='1' ";
79 $sQ .=
" and {$sTable}.oxfromboni <= ".$oDb->quote( $sBoni ) .
" and {$sTable}.oxfromamount <= ".$oDb->quote( $dPrice ) .
" and {$sTable}.oxtoamount >= ".$oDb->quote( $dPrice );
88 foreach ( $oUser->getUserGroups() as $oGroup ) {
92 $sGroupIds .=
"'".$oGroup->getId().
"'";
96 $sGroupTable = getViewName(
'oxgroups' );
97 $sCountryTable = getViewName(
'oxcountry' );
99 $sCountrySql = $sCountryId ?
"exists( select 1 from oxobject2payment as s1 where s1.oxpaymentid={$sTable}.OXID and s1.oxtype='oxcountry' and s1.OXOBJECTID=".$oDb->quote( $sCountryId ).
" limit 1 )":
'0';
100 $sGroupSql = $sGroupIds ?
"exists( select 1 from oxobject2group as s3 where s3.OXOBJECTID={$sTable}.OXID and s3.OXGROUPSID in ( {$sGroupIds} ) limit 1 )":
'0';
102 $sQ .=
" ) as $sTable where (
104 if( exists( select 1 from oxobject2payment as ss1, $sCountryTable where $sCountryTable.oxid=ss1.oxobjectid and ss1.oxpaymentid={$sTable}.OXID and ss1.oxtype='oxcountry' limit 1 ),
107 if( exists( select 1 from oxobject2group as ss3, $sGroupTable where $sGroupTable.oxid=ss3.oxgroupsid and ss3.OXOBJECTID={$sTable}.OXID limit 1 ),
110 ) order by {$sTable}.oxsort asc ";
125 $sCountryId = $oUser->getActiveCountry();
128 if ( !$sCountryId ) {
158 $sTable = getViewName(
'oxpayments' );
159 $sSubSql =
"SELECT * FROM oxobject2payment WHERE oxobject2payment.OXPAYMENTID = $sTable.OXID AND oxobject2payment.OXTYPE = 'rdfapayment'";
160 $this->
selectString(
"SELECT $sTable.* FROM $sTable WHERE NOT EXISTS($sSubSql) AND $sTable.OXACTIVE = 1" );
174 $sTable = getViewName(
'oxpayments' );
175 $sQ =
"select $sTable.*, oxobject2payment.oxobjectid from $sTable left join (select oxobject2payment.* from oxobject2payment where oxobject2payment.oxtype = 'rdfapayment') as oxobject2payment on oxobject2payment.oxpaymentid=$sTable.oxid ";
176 $sQ .=
"where $sTable.oxactive = 1 ";
177 if ( $dPrice !== null ) {
178 $sQ .=
"and $sTable.oxfromamount <= ".$oDb->quote( $dPrice ) .
" and $sTable.oxtoamount >= ".$oDb->quote( $dPrice );
180 $rs = $oDb->select( $sQ );
181 if ($rs !=
false && $rs->recordCount() > 0) {
184 $oListObject = clone $oSaved;
186 $this->_aArray[] = $oListObject;