Show discount column in quotation template when discount column is filled, otherwise, not shown in template

I got a little bit further, with this topic.

But I miss the percent symbols, when a discount is entered.
Important is, no percent symbols should be displayed, if no discount is entered.

Here is the file I’m working on:
suitecrm \ htdocs \ modules \ AOS_PDF_Templates \ templateParser.php

Blockquote

    foreach ($repl_arr as $name => $value) {
        if (strpos($name, 'product_discount') !== false || strpos($name, 'quotes_discount') !== false) {
            if ($value !== '0,00') {
                if ($isValidator->isPercentageField($repl_arr['aos_products_quotes_discount'])) {
                    $sep = get_number_separators();
                    $value = rtrim(
                        rtrim(format_number($value), ''),
                        $sep[1]
                    ) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
                }
            } 
                            
            else {
                $value = '';
            }
        }

        if ($name === 'aos_products_product_image' && !empty($value)) {
            $value = '<img src="' . $value . '" class="img-responsive"/>';
        }

        if ($name === 'aos_products_quotes_product_qty') {
            $sep = get_number_separators();
            $value = rtrim(rtrim(format_number($value), '0'), $sep[1]);
        }

        if ($isValidator->isPercentageField($name)) {
            $sep = get_number_separators();
            $value = rtrim(rtrim(format_number($value), ''), $sep[1]) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
        }

        if (
            $focus->field_defs[$name]['dbType'] == 'datetime' &&
            (strpos($name, 'date') > 0 || strpos($name, 'expiration') > 0)
        ) {
            if ($value != '') {
                $dt = explode(' ', $value);
                $value = $dt[0];
                if (isset($dt[1]) && $dt[1] != '') {
                    if (strpos($dt[1], 'am') > 0 || strpos($dt[1], 'pm') > 0) {
                        $value = $dt[0] . ' ' . $dt[1];
                    }
                }
            }
        }

        if ($value != '' && is_string($value)) {
            $string = str_replace("\$$name", $value, $string);
        } else {
            if (strpos($name, 'address') > 0) {
                $string = str_replace("\$$name<br />", '', $string);
                $string = str_replace("\$$name <br />", '', $string);
                $string = str_replace("\$$name", '', $string);
            } else {
                $string = str_replace("\$$name", '&nbsp;', $string);
            }
        }
    }

Blockquote

Hope someone can help.
Many thanks in forward and best wishes.