Bonuses for flank and rear attacks can only be earned once per enemy unit – having multiple units engaging the same enemy unit in either its flank or in its rear does not grant additional bonuses.
For example, if you have two units engaging a single enemy unit in combat, each of which is engaging a different flank of that unit, you can only claim a single flank attack bonus. However, if one unit is engaging the enemy unit's flank and the other is engaging the enemy unit's rear, you can claim both the flank attack and the rear attack bonus.