This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generates .m3u files for all .cue files found in a game directory | |
# | |
# I created this to auto-generate .m3u files for a single layer of game directories in a | |
# system directory such as psx, ps2, dreamcast, etc... | |
# | |
# I keep this powershell script in my emulation root folder (i.e. c:\Emulation\CreateM3U.ps1) | |
# | |
# Run this in a game system directory in your roms folder (i.e. c:\Emulation\Roms\psx) | |
# Full use example in powershell window: | |
# cd \Emulation\Roms\psx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Admin::ShipmentsController.class_eval do | |
def destroy_all | |
Spree::Order.transaction do | |
if not @order | |
@order = Spree::Order.find_by_number(params[:order_id]) | |
end | |
Spree::Adjustment.connection.execute("delete from spree_adjustments where id in (select id from spree_adjustments where adjustable_id = #{@order.id} and adjustable_type = 'Spree::Order' and originator_type = 'Spree::ShippingMethod')") | |
@order.shipments.delete_all | |
@order.save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first name | last name | company | address1 | address2 | city | postal code | ISO3 country | State abbr | phone | quantity-line-item1|quantity-line-item2|quantity-line-itemN | |
---|---|---|---|---|---|---|---|---|---|---|---|
first name | last name | company | address1 | address2 | city | postal code | ISO3 country | State abbr | phone | quantity-line-item1|quantity-line-item2|quantity-line-itemN | |
first name | last name | company | address1 | address2 | city | postal code | ISO3 country | State abbr | phone | quantity-line-item1|quantity-line-item2|quantity-line-itemN | |
first name | last name | company | address1 | address2 | city | postal code | ISO3 country | State abbr | phone | quantity-line-item1|quantity-line-item2|quantity-line-itemN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::OrderMailer.class_eval do | |
def address_upload_complete(order, original_shipment, address_count, address_errors) | |
@order = order | |
@original_shipment = original_shipment | |
@address_count = address_count | |
@address_errors = address_errors | |
mail(to: order.admin_user.email, | |
from: from_address, | |
subject: "Address upload completed for #{order.number} - #{address_errors.keys.size == 0 ? "SUCCESS" : "ERROR"}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @order.state == "complete" and @order.shipment_state != "shipped" and @order.shipments.size == 1 %> | |
<div id="upload-address-csv-form" class="align-center"> | |
<h6>Multiple Shipments – Upload CSV import file</h6> | |
<%= form_tag(admin_upload_addresses_url(@order), method: "post", multipart: true) do%> | |
<%= file_field_tag :address_csv, placeholder: "CSV addresses" %> | |
<%= submit_tag "Process" %> | |
<% end %> | |
</div> | |
<br/> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Core::Engine.routes.draw do | |
namespace :admin do | |
post 'orders/:order_id/upload_addresses' => 'orders#upload_addresses', as: :upload_addresses | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Admin::OrdersController.class_eval do | |
def upload_addresses | |
require 'tempfile' | |
require 'fileutils' | |
if params[:order_id] =~ /R/ | |
@order = Spree::Order.find_by_number(params[:order_id]) | |
else | |
@order = Spree::Order.find(params[:order_id]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Gateway::BraintreeGateway.class_eval do | |
def options_for_payment(p) | |
o = Hash.new | |
o[:email] = p.order.email | |
unless p.source.gateway_customer_profile_id.blank? | |
o[:customer] = p.source.gateway_customer_profile_id | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Gateway::BraintreeGateway.class_eval do | |
def options_for_payment(p) | |
o = Hash.new | |
o[:email] = p.order.email | |
if p.order.bill_address | |
o[:billing_address] = p.order.bill_address | |
o[:billing_address][:state] = p.order.bill_address.state.abbr | |
o[:billing_address][:country_code_alpha3] = p.order.bill_address.country.iso3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Order.class_eval do | |
def self.outgoing_order_total(start_at,end_at) | |
order_totals = Spree::Order.fully_shipped_during(start_at, end_at) | |
Spree::Order.select{"sum(ot.order_total)"}.from{"(#{order_totals.to_sql}) as ot"}.first.sum | |
end | |
def self.fully_shipped_during(start_at, end_at) | |
shipped_orders = Spree::Shipment.shipped. | |
select(:order_id). | |
where{(shipped_at >= start_at) & (shipped_at <= end_at)}. |
NewerOlder