Class: Admin::DraftInvoicesController
- Inherits:
-
InvoicesController
- Object
- InvoicesController
- Admin::DraftInvoicesController
- Includes:
- DraftInvoicesHelper
- Defined in:
- app/controllers/admin/draft_invoices_controller.rb
Class Method Summary collapse
-
.active_scaffold_paths ⇒ Object
TODO: Put in a plugin-helper We need to be sure the view is looking in the right place, this little hack should do it:.
Instance Method Summary collapse
- #batch_create ⇒ Object
-
#batch_create_on_date_change ⇒ Object
/TODO: Put in a plugin-helper.
- #conditions_for_collection ⇒ Object
Class Method Details
.active_scaffold_paths ⇒ Object
TODO: Put in a plugin-helper We need to be sure the view is looking in the right place, this little hack should do it:
23 24 25 26 27 |
# File 'app/controllers/admin/draft_invoices_controller.rb', line 23 def self.active_scaffold_paths ret = super ret << BRISKBILLS_ROOT+'/app/views/admin/invoices' ret end |
Instance Method Details
#batch_create ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/admin/draft_invoices_controller.rb', line 41 def batch_create if params.has_key? :batch_client invoiceable_client_ids = params[:batch_client].keys.collect(&:to_i) if invoiceable_client_ids.length > 0 all_activity_types = ActivityType.find(:all) invoice_date = utc_date_from_param params[:batch_invoice_date_at] @new_invoices = Client.find( :all, :conditions => ['id IN (?)', invoiceable_client_ids] ).each do |client| Invoice.create!( :client => client, :activity_types => all_activity_types, :issued_on => invoice_date, :activities => Invoice.recommended_activities_for( client.id, invoice_date, all_activity_types ) ) end do_list end render :action => 'batch_create.js' else @invoice_date_at = Time.utc(*Time.now.to_a).prev_month.end_of_month render :action => 'batch_create.html', :layout => false end end |
#batch_create_on_date_change ⇒ Object
/TODO: Put in a plugin-helper
30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/admin/draft_invoices_controller.rb', line 30 def batch_create_on_date_change # This is kind of an annoying way to make a date ... @invoice_date_at = utc_date_from_param( params[:batch_invoice_date_at] ) if params[:batch_invoice_date_at] logger.error "Well?" + @invoice_date_at.inspect # I didn't really feel the need to create a partial just for this one line: render :inline => '<%= batch_create_clients_form_column(@invoice_date_at) %>' if @invoice_date_at end |
#conditions_for_collection ⇒ Object
17 18 19 |
# File 'app/controllers/admin/draft_invoices_controller.rb', line 17 def conditions_for_collection ['is_published = ?', false] end |