/** * Return a HTML select with localtax values for thirdparties * * @param int $local LocalTax * @param int $selected Preselected value * @param string $htmlname HTML select name * @return void */ function select_localtax($local, $selected, $htmlname) { $tax = get_localtax_by_third($local); $num = $this->db->num_rows($tax); $i = 0; if ($num) { $valors = explode(":", $tax); if (count($valors) > 1) { //montar select print '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">'; while ($i <= count($valors) - 1) { if ($selected == $valors[$i]) { print '<option value="' . $valors[$i] . '" selected="selected">'; } else { print '<option value="' . $valors[$i] . '">'; } print $valors[$i]; print '</option>'; $i++; } print '</select>'; } } }
/** * Return true if LocalTax is unique * * @param int $local Local taxt to test * @return boolean True if LocalTax have multiple values, False if not */ function isOnlyOneLocalTax($local) { $tax = get_localtax_by_third($local); $valors = explode(":", $tax); if (count($valors) > 1) { return false; } else { return true; } }