Commit 3ddde8cfbdddda3f4d35a26b5965416ba59ab985

Authored by Joenio Costa
Committed by Antonio Terceiro
1 parent 0f49bd45

ActionItem862: script to apply inactive enterprises template

Showing 1 changed file with 10 additions and 0 deletions   Show diff stats
script/apply-enterprise-inactive-template 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +#!/usr/bin/env ruby
  2 +require File.dirname(__FILE__) + '/../config/environment'
  3 +include GetText
  4 +ActionController::Base.init_gettext 'noosfero'
  5 +set_locale_all 'pt_BR'
  6 +
  7 +e = Environment.default
  8 +inactive_enterprises = Enterprise.find(:all, :conditions => ['enabled = ?', false]) - [e.inactive_enterprise_template, e.enterprise_template]
  9 +apply_in = inactive_enterprises[$ARGV[0].to_i..$ARGV[1].to_i]
  10 +apply_in.each_with_index { |obj,i| obj.apply_template(e.inactive_enterprise_template); puts i.to_s + ' - ' + obj.identifier}
... ...