[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 /********************************************************************************* 2 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 * 9 ********************************************************************************/ 10 11 prod_array = new Array(); 12 function addtopricebook() 13 { 14 x = document.addToPB.selected_id.length; 15 prod_array = new Array(x); 16 idstring = ""; 17 18 if ( x == undefined) 19 { 20 if (document.addToPB.selected_id.checked) 21 { 22 yy = document.addToPB.selected_id.value+"_listprice"; 23 document.addToPB.idlist.value=document.addToPB.selected_id.value; 24 25 var elem = document.addToPB.elements; 26 var ele_len =elem.length; 27 var i=0,j=0; 28 29 for(i=0; i<ele_len; i++) 30 { 31 if(elem[i].name == yy) 32 { 33 if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 34 { 35 alert("List Price cannot be empty"); 36 return false; 37 } 38 else if(isNaN(elem[i].value)) 39 { 40 alert("Invalid List Price"); 41 return false; 42 } 43 44 } 45 46 } 47 } 48 else 49 { 50 alert("Please select at least one entity"); 51 return false; 52 } 53 } 54 else 55 { 56 xx = 0; 57 for(i = 0; i < x ; i++) 58 { 59 if(document.addToPB.selected_id[i].checked) 60 { 61 idstring = document.addToPB.selected_id[i].value +";"+idstring; 62 prod_array[xx] = document.addToPB.selected_id[i].value; 63 64 xx++; 65 } 66 } 67 if (xx != 0) 68 { 69 document.addToPB.idlist.value=idstring; 70 var elem = document.addToPB.elements; 71 var ele_len =elem.length; 72 var i=0,j=0; 73 for(i=0; i<ele_len; i++) 74 { 75 for(j=0; j < xx; j++) 76 { 77 var xy= prod_array[j]+"_listprice"; 78 if(elem[i].name == xy) 79 { 80 if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 81 { 82 83 alert("List Price cannot be empty"); 84 return false; 85 } 86 else if(isNaN(elem[i].value)) 87 { 88 alert("Invalid List Price"); 89 return false; 90 91 } 92 } 93 } 94 95 } 96 } 97 else 98 { 99 alert("Please select at least one entity"); 100 return false; 101 } 102 } 103 document.addToPB.action="index.php?module=Products&action=addPbProductRelToDB&return_module=Products&return_action=AddProductsToPriceBook" 104 } 105 106 function updateListPrice(unitprice,fieldname,oSelect) 107 { 108 if(oSelect.checked == true) 109 { 110 document.getElementById(fieldname).style.visibility = 'visible'; 111 document.getElementById(fieldname).value = unitprice; 112 }else 113 { 114 document.getElementById(fieldname).style.visibility = 'hidden'; 115 } 116 } 117 118 function check4null(form) 119 { 120 var isError = false; 121 var errorMessage = ""; 122 if (trim(form.productname.value) =='') 123 { 124 isError = true; 125 errorMessage += "\n Product Name"; 126 form.productname.focus(); 127 } 128 if (isError == true) 129 { 130 alert("Missing required fields: " + errorMessage); 131 return false; 132 } 133 return true; 134 } 135 136 137 138 function set_return_specific(vendor_id, vendor_name) 139 { 140 //getOpenerObj used for DetailView 141 var fldName = getOpenerObj("vendor_name"); 142 var fldId = getOpenerObj("vendor_id"); 143 fldName.value = vendor_name; 144 fldId.value = vendor_id; 145 } 146 function set_return_inventory_pb(listprice, fldname) 147 { 148 window.opener.document.EditView.elements[fldname].value = listprice; 149 window.opener.document.EditView.elements[fldname].focus(); 150 } 151 152 function deletePriceBookProductRel(id,pbid) 153 { 154 $("status").style.display="inline"; 155 new Ajax.Request( 156 'index.php', 157 {queue: {position: 'end', scope: 'command'}, 158 method: 'post', 159 postBody: 'module=Products&action=ProductsAjax&file=DeletePriceBookProductRel&ajax=true&return_action=CallRelatedList&return_module=PriceBooks&record='+id+'&pricebook_id='+pbid+'&return_id='+pbid, 160 onComplete: function(response) { 161 $("status").style.display="none"; 162 $("RLContents").innerHTML= response.responseText; 163 } 164 } 165 ); 166 } 167
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |