Is there a way to Uppercase ALL fields in a record?

I mean uppercase all fields without having to go through this..

$bean->first_name = strtoupper($bean->first_name);

$bean->last_name = strtoupper($bean->last_name );

$bean->address = strtoupper($bean->address );

$bean->gender = strtoupper($bean->gender );

$bean->title = strtoupper($bean->title );

etc etc..

I've got like more than a 100 fields to uppercase.

Parents
  • Hello,

    Try looping through the field_defs

    function allUpper($bean){

                foreach($bean->field_defs as $aField => $aDetails){

                    if($aDetails['type'] == "varchar" || $aDetails['dbType'] == "varchar"){ // add more options if you have to

                        $bean->$aField = strtoupper($bean->$aField);

                    }

                }

            }

    P.S. Have not tried this logic hook in 7.5

Reply
  • Hello,

    Try looping through the field_defs

    function allUpper($bean){

                foreach($bean->field_defs as $aField => $aDetails){

                    if($aDetails['type'] == "varchar" || $aDetails['dbType'] == "varchar"){ // add more options if you have to

                        $bean->$aField = strtoupper($bean->$aField);

                    }

                }

            }

    P.S. Have not tried this logic hook in 7.5

Children