[-] MO : #PSTEST-41 : update ProcessAttachment method
This commit is contained in:
@@ -99,11 +99,45 @@
|
||||
</tr>
|
||||
</table>
|
||||
<div class="clear"> </div>
|
||||
<input type="hidden" name="arrayAttachments" id="arrayAttachments" value="{foreach $attach1 as $attach}{$attach.id_attachment},{/foreach}" />
|
||||
<input type="submit" name="submitAttachments" id="submitAttachments" value="{l s='Update attachments'}" class="button" />
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
displayFlags(languages, id_language, allowEmployeeFormLang);
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#addAttachment").live('click', function() {
|
||||
$("#selectAttachment2 option:selected").each(function(){
|
||||
var val = $('#arrayAttachments').val();
|
||||
var tab = val.split(',');
|
||||
for (var i=0; i < tab.length; i++)
|
||||
if (tab[i] == $(this).val())
|
||||
return false;
|
||||
$('#arrayAttachments').val(val+$(this).val()+',');
|
||||
});
|
||||
return !$("#selectAttachment2 option:selected").remove().appendTo("#selectAttachment1");
|
||||
});
|
||||
$("#removeAttachment").live('click', function() {
|
||||
$("#selectAttachment1 option:selected").each(function(){
|
||||
var val = $('#arrayAttachments').val();
|
||||
var tab = val.split(',');
|
||||
var tabs = '';
|
||||
for (var i=0; i < tab.length; i++)
|
||||
if (tab[i] != $(this).val())
|
||||
{
|
||||
tabs = tabs+','+tab[i];
|
||||
$('#arrayAttachments').val(tabs);
|
||||
}
|
||||
});
|
||||
return !$("#selectAttachment1 option:selected").remove().appendTo("#selectAttachment2");
|
||||
});
|
||||
$("#product").submit(function() {
|
||||
$("#selectAttachment1 option").each(function(i) {
|
||||
$(this).attr("selected", "selected");
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{/if}
|
||||
|
||||
@@ -165,20 +165,6 @@
|
||||
$('#desc-product-newCombination').show();
|
||||
populate_attrs();
|
||||
}
|
||||
else if (btn_name == 'Attachments')
|
||||
{
|
||||
$("#addAttachment").live('click', function() {
|
||||
return !$("#selectAttachment2 option:selected").remove().appendTo("#selectAttachment1");
|
||||
});
|
||||
$("#removeAttachment").live('click', function() {
|
||||
return !$("#selectAttachment1 option:selected").remove().appendTo("#selectAttachment2");
|
||||
});
|
||||
$("#product").submit(function() {
|
||||
$("#selectAttachment1 option").each(function(i) {
|
||||
$(this).attr("selected", "selected");
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#desc-product-newCombination').hide();
|
||||
|
||||
Reference in New Issue
Block a user