Hello Everyone!
I have posted this to the suppert area and they derirected me here, so copypasting...
I am using v7.0.4 and found few bugs - maybe it will be useful.
inc/classes/BxDolProfileFields.php
1.
if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and is_array( $_POST[$sItemName][$iHuman] ) ) {
$aRange = $_POST[$sItemName][$iHuman];
$mValue = array( null, null );
$aRange[0] = isset( $aRange[0] ) ? trim( $aRange[0] ) : '';
$aRange[1] = isset( $aRange[1] ) ? trim( $aRange[1] ) : '';
if( $aRange[0] !== '' )
$mValue[0] = (int)$aRange[0];
if( $aRange[1] !== '' )
$mValue[1] = (int)$aRange[1];
}
- must be something like
if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and (!is_array( $_POST[$sItemName][$iHuman] )) ) {
$mValue = array( null, null );
list( $mValue[0], $mValue[1] ) = explode( '-', $_POST[$sItemName][$iHuman] ); // 25-34
$mValue[0] = intval(isset( $mValue[0] ) ? trim( $mValue[0] ):'0');
$mValue[1] = intval(isset( $mValue[1] ) ? trim( $mValue[1] ):'100');
}
- because it's not an array
2.
switch( "{$aField1['Type']} {$aField1['Type']}" ) {
- must be
switch( "{$aField1['Type']} {$aField2['Type']}" ) {
3.
if( (int)$aVal1[0] <= $sVal2 and $sVal2 <= (int)$aVal1[0] )
- must be
if( (int)$aVal1[0] <= $sVal2 and $sVal2 <= (int)$aVal1[1] )
- 2 occurences
4.
case 'range': $aInput['type'] = 'doublerange'; $aInput['value'] = $aValues[$iPerson]; break;
- must be
case 'range': $aInput['type'] = 'doublerange'; $aInput['value'] = is_array($aValues[$iPerson]) ? implode("-", $aValues[$iPerson]) : ""; break;
/inc/classes/BxDolPFM.php
list( $sFirst, $sSecond ) = explode( '-', trim( $aData['Default'], 2 ) );
$sFirst = (int)trim( $sFirst );
$sSecond = (int)trim( $sSecond );
$aUpdate['Default'] = "$sFirst-$sSecond";
- must be
list( $sFirst, $sSecond ) = explode( ',', trim( $aData['Default'], 2 ) );
$sFirst = (int)trim( $sFirst );
$sSecond = (int)trim( $sSecond );
$aUpdate['Default'] = "$sFirst,$sSecond";
- because it writes it in database, where range values are stored in "x,y" format
I would also add search by range intersection (e.g. searching for 20-30 would show person with set of 25-35, couse there is an intersection), I know where (templates/base/scripts/BxBaseProfileView.php, "case 'range':"), but I don't know how to build SQL condition for this (I bet it must be done by SQL function).
Best regards,
Yury