Commit e2ecb6dd authored by vogelor's avatar vogelor
Browse files

Fixed a bug in handling client templates

parent 8d46ba68
......@@ -14,6 +14,7 @@
<label for="template_additional">{tmpl_var name='template_additional_txt'}</label>
<select id="tpl_add_select" name="tpl_add_select">{tmpl_var name='tpl_add_select'}</select>
</span>
<span id="template_additional_list">{tmpl_var name='template_additional_list'}</span>
<input type="hidden" id="template_additional" name="template_additional" value="{tmpl_var name='template_additional'}">
</fieldset>
<fieldset id="wf_area_client"><legend>Limits</legend>
......
......@@ -410,36 +410,35 @@ function pass_contains(pass, check) {
return false;
}
function addAdditionalTemplate(){
var tpl_add = document.getElementById('template_additional').value;
if(tpl_add != '') {
var tpl_list = document.getElementById('template_additional_list').innerHTML;
var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
var addTplId = addTemplate[0];
var addTplText = addTemplate[1];
var newVal = tpl_add + '/' + addTplId + '/';
newVal = newVal.replace('//', '/');
var newList = tpl_list + '<br>' + addTplText;
newList = newList.replace('<br><br>', '<br>');
document.getElementById('template_additional').value = newVal;
document.getElementById('template_additional_list').innerHTML = newList;
alert('additional template ' + addTplText + ' added to customer');
}
}
function delAdditionalTemplate(){
var tpl_add = document.getElementById('template_additional').value;
var tpl_list = document.getElementById('template_additional_list').innerHTML;
var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
var addTplId = addTemplate[0];
var addTplText = addTemplate[1];
var newVal = tpl_add;
newVal = newVal.replace(addTplId, '');
newVal = newVal.replace('//', '/');
var newList = tpl_list.replace(addTplText, '');
newList = newList.replace('<br><br>', '<br>');
document.getElementById('template_additional').value = newVal;
document.getElementById('template_additional_list').innerHTML = newList;
alert('additional template ' + addTplText + ' deleted from customer');
}
function addAdditionalTemplate(){
var tpl_add = document.getElementById('template_additional').value;
var tpl_list = document.getElementById('template_additional_list').innerHTML;
var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
var addTplId = addTemplate[0];
var addTplText = addTemplate[1];
var newVal = tpl_add + '/' + addTplId + '/';
newVal = newVal.replace('//', '/');
var newList = tpl_list + '<br>' + addTplText;
newList = newList.replace('<br><br>', '<br>');
document.getElementById('template_additional').value = newVal;
document.getElementById('template_additional_list').innerHTML = newList;
alert('additional template ' + addTplText + ' added to customer');
}
function delAdditionalTemplate(){
var tpl_add = document.getElementById('template_additional').value;
if(tpl_add != '') {
var tpl_list = document.getElementById('template_additional_list').innerHTML;
var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
var addTplId = addTemplate[0];
var addTplText = addTemplate[1];
var newVal = tpl_add;
newVal = newVal.replace(addTplId, '');
newVal = newVal.replace('//', '/');
var newList = tpl_list.replace(addTplText, '');
newList = newList.replace('<br><br>', '<br>');
document.getElementById('template_additional').value = newVal;
document.getElementById('template_additional_list').innerHTML = newList;
}
alert('additional template ' + addTplText + ' deleted from customer');
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment