delimiter_userinfo not following configuration settings

Started by AH, June 16, 2014, 21:23:41 PM

Previous topic - Next topic

AH

VM2.6.6

I noticed a fieldset issue when testing my checkout process

http://forum.virtuemart.net/index.php?topic=104003.msg375308#msg375308  post #7

The delimeter should be delivered to the page when configured to do so.

But after some digging I can see that for some reason this has been excluded from "certain" pages

If users set the delimiter to show in the various screens, registration/shipment/account maintenance, it should show in these screens NOT be stripped by a fixed and unseen/undocumented piece of coding.

administrator\components\com_virtuemart\models\userfields.php

         // MattLG: Added this line because it leaves the empty fieldset with just the label when editing the ST addresses
         // A better solution might be to make this a setting rather than hard coding this whole block here
         $skips[] = 'delimiter_userinfo';


Hmm I think the issue with hard coding was already noticed
// A better solution might be to make this a setting rather than hard coding this whole block here


/**
*
* @author Max Milbers
*/
public function getUserFieldsFor($layoutName, $type,$userId = -1){

//vmdebug('getUserFieldsFor '.$layoutName.' '. $type .' ' . $userId);
$register = false;

if(VmConfig::get('oncheckout_show_register',1) and $type=='BT'){
$user = JFactory::getUser();
if(!empty($user)){
if(empty($user->id)){
$register = true;
}
} else {
$register = true;
}
} else {
$register = false;
}

$skips = array();
//Maybe there is another method to define the skips
$skips = array('address_type');

if((!$register or $type =='ST') and $layoutName !='edit'){
$skips[] = 'name';
$skips[] = 'username';
$skips[] = 'password';
$skips[] = 'password2';
$skips[] = 'user_is_vendor';
$skips[] = 'agreed';
// MattLG: Added this line because it leaves the empty fieldset with just the label when editing the ST addresses
// A better solution might be to make this a setting rather than hard coding this whole block here
$skips[] = 'delimiter_userinfo';
    }

//Here we get the fields
if ($type == 'BT') {
$userFields = $this->getUserFields(
'account'
, array() // Default toggles
, $skips// Skips
);
} else {
$userFields = $this->getUserFields(
'shipment'
, array() // Default toggles
, $skips
);
}


//Small ugly hack to make registering optional //do we still need that? YES !  notice by Max Milbers
if($register && $type == 'BT'  && VmConfig::get('oncheckout_show_register',1) ){

$corefields = $this->getCoreFields();
unset($corefields[2]); //the 2 is for the email field, it is necessary in almost anycase.
foreach($userFields as $field){
if(in_array($field->name,$corefields)){
$field->required = 0;
$field->value = '';
$field->default = '';

}
}
}

return $userFields;
}


Of course the simple thing for me to do is to just comment out this line, but the simple route does not help the community
Regards
A

Joomla 3.10.11
php 8.0