kivi.Part.js: Part Picker Popup in ein separates widget verschoben
[kivitendo-erp.git] / js / kivi.js
index e17294a..542c663 100644 (file)
@@ -61,8 +61,16 @@ namespace("kivi", function(ns) {
 
     amount = amount.replace(/[\',]/g, "")
 
+    // Make sure no code wich is not a math expression ends up in eval().
+    if (!amount.match(/^[0-9 ()\-+*/.]*$/))
+      return 0;
+
     /* jshint -W061 */
-    return eval(amount);
+    try {
+      return eval(amount);
+    } catch (err) {
+      return 0;
+    }
   };
 
   ns.round_amount = function(amount, places) {
@@ -235,10 +243,7 @@ namespace("kivi", function(ns) {
       $(elt).datepicker();
     });
 
-    if (ns.PartPicker)
-      ns.run_once_for('input.part_autocomplete', 'part_picker', function(elt) {
-        kivi.PartPicker($(elt));
-      });
+    if (ns.Part) ns.Part.reinit_widgets();
 
     if (ns.ProjectPicker)
       ns.run_once_for('input.project_autocomplete', 'project_picker', function(elt) {