Commit 7e7227c04e934c91e3d3e5b342ad9aa575e7634b

Authored by Rodrigo Souto
1 parent 79485323

[bsc-contract] Fixing sql query and interface

  * Postgres doesn't accept emtpy string or null value in the in clause
    so i'm changing the empty value for -1, as there is no negative id.
  * Adjusting sizes of inputs

(ActionItem2079)
plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb
... ... @@ -196,9 +196,9 @@ class BscPluginMyprofileController < MyProfileController
196 196 def search_sale_product
197 197 query = params[:sales].map {|key, value| value}[0][:product_id]
198 198 enterprises = (params[:enterprises] || []).split(',')
199   - enterprises = enterprises.blank? ? '' : enterprises
  199 + enterprises = enterprises.blank? ? -1 : enterprises
200 200 added_products = (params[:added_products] || []).split(',')
201   - added_products = added_products.blank? ? '' : added_products
  201 + added_products = added_products.blank? ? -1 : added_products
202 202 render :text => Product.find(:all, :conditions => ["LOWER(name) LIKE ? AND enterprise_id IN (?) AND id NOT IN (?)", "%#{query}%", enterprises, added_products]).
203 203 map {|product| { :id => product.id,
204 204 :name => short_text(product_display_name(product), 60),
... ...
plugins/bsc/public/contracts.js
... ... @@ -47,7 +47,7 @@ var BSCContracts = {};
47 47 input.keydown(function(event){ if(event.keyCode == '13') return false })
48 48 .tokenInput(searchUrl, opts);
49 49 $('#bsc-plugin-contract-total-row').before(tr);
50   - $('<input id="bsc-plugin-sale-'+id+'-quantity" class="bsc-plugin-sales-quantity '+required+' digits" name="sales['+id+'][quantity]" align="center" size="7" value="'+quantity+'"/>').appendTo(tds[1]);
  50 + $('<input id="bsc-plugin-sale-'+id+'-quantity" class="bsc-plugin-sales-quantity '+required+' digits" name="sales['+id+'][quantity]" align="center" size="8" value="'+quantity+'"/>').appendTo(tds[1]);
51 51 $('<input id="bsc-plugin-sale-'+id+'-price" class="bsc-plugin-sales-price '+required+' number" name="sales['+id+'][price]" value="'+price+'"/>').appendTo(tds[2]);
52 52 };
53 53  
... ...
plugins/bsc/public/style.css
... ... @@ -73,7 +73,7 @@
73 73 }
74 74  
75 75 .bsc-plugin-sales-price {
76   - width: 85%;
  76 + width: 75%;
77 77 }
78 78  
79 79 .bsc-plugin-sales-products-column {
... ...