|
|
@@ -472,21 +472,22 @@ class Product < ActiveRecord::Base
|
|
|
end
|
|
|
puts 'termine'
|
|
|
end
|
|
|
-end
|
|
|
|
|
|
-def self.gen_barcode_img_for_existing_barcodes
|
|
|
- products = Product.activos_children
|
|
|
- counter = 0
|
|
|
- products.each do |product|
|
|
|
- if product.barcode?
|
|
|
- unless File.file?(Rails.public_path.join('barcodes', "#{product.barcode}.png"))
|
|
|
- save_path = Rails.public_path.join('barcodes', "#{product.barcode}.png")
|
|
|
- File.open(save_path, 'wb') { |f| f.write Barby::Code39.new(product.barcode).to_png(height: 50, margin: 5) }
|
|
|
- counter += 1;
|
|
|
+ def self.gen_barcode_img_for_existing_barcodes
|
|
|
+ products = Product.activos_children
|
|
|
+ counter = 0
|
|
|
+ products.each do |product|
|
|
|
+ if product.barcode?
|
|
|
+ unless File.file?(Rails.public_path.join('barcodes', "#{product.barcode}.png"))
|
|
|
+ save_path = Rails.public_path.join('barcodes', "#{product.barcode}.png")
|
|
|
+ File.open(save_path, 'wb') { |f| f.write Barby::Code39.new(product.barcode).to_png(height: 50, margin: 5) }
|
|
|
+ counter += 1;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ puts "***** NO TIENE BARCODE! #{product.id}"
|
|
|
end
|
|
|
- else
|
|
|
- puts "***** NO TIENE BARCODE! #{product.id}"
|
|
|
end
|
|
|
+ puts "TERMINÉ, generé: #{counter} imagenes de barcode"
|
|
|
end
|
|
|
- puts "TERMINÉ, generé: #{counter} imagenes de barcode"
|
|
|
end
|
|
|
+
|