Complete refactoring of orders-workflow.

OrderResult tables are removed. Data consistency is now possible through new article.price-history (ArticlePrice).
Balancing-workflow needs to be updated.
This commit is contained in:
Benjamin Meichsner 2009-01-29 01:57:51 +01:00
parent 80287aeea4
commit 9eb2125f15
98 changed files with 1121 additions and 1717 deletions

View file

@ -1,7 +0,0 @@
* revision 8: Changed has_many :dependent => true to :dependent => :destroy for Rails 1.2.2
+ Thanks Josh Martin
Added an order clause in the has_many relationship.
Made comment column type to text from string in migration example in README
+ Thanks Patrick Crowley
Added this CHANGELOG file.

View file

@ -1,20 +0,0 @@
Copyright (c) 2006 Cosmin Radoi
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,59 +0,0 @@
Acts As Commentable
=================
Allows for comments to be added to multiple and different models.
== Resources
Install
* Run the following command:
script/plugin install http://juixe.com/svn/acts_as_commentable
* Create a new rails migration and add the following self.up and self.down methods
def self.up
create_table "comments", :force => true do |t|
t.column "title", :string, :limit => 50, :default => ""
t.column "comment", :text, :default => ""
t.column "created_at", :datetime, :null => false
t.column "commentable_id", :integer, :default => 0, :null => false
t.column "commentable_type", :string, :limit => 15, :default => "", :null => false
t.column "user_id", :integer, :default => 0, :null => false
end
add_index "comments", ["user_id"], :name => "fk_comments_user"
end
def self.down
drop_table :comments
end
== Usage
* Make you ActiveRecord model act as commentable.
class Model < ActiveRecord::Base
acts_as_commentable
end
* Add a comment to a model instance
model = Model.new
comment = Comment.new
comment.comment = 'Some comment'
model.comments << comment
* Each comment reference commentable object
model = Model.find(1)
model.comments.get(0).commtable == model
== Credits
Xelipe - This plugin is heavily influced by Acts As Tagglable.
== More
http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/
http://www.juixe.com/projects/acts_as_commentable

View file

@ -1,3 +0,0 @@
# Include hook code here
require 'acts_as_commentable'
ActiveRecord::Base.send(:include, Juixe::Acts::Commentable)

View file

@ -1 +0,0 @@
# Install hook code here

View file

@ -1,62 +0,0 @@
# ActsAsCommentable
module Juixe
module Acts #:nodoc:
module Commentable #:nodoc:
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def acts_as_commentable
has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at ASC'
include Juixe::Acts::Commentable::InstanceMethods
extend Juixe::Acts::Commentable::SingletonMethods
end
end
# This module contains class methods
module SingletonMethods
# Helper method to lookup for comments for a given object.
# This method is equivalent to obj.comments.
def find_comments_for(obj)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
Comment.find(:all,
:conditions => ["commentable_id = ? and commentable_type = ?", obj.id, commentable],
:order => "created_at DESC"
)
end
# Helper class method to lookup comments for
# the mixin commentable type written by a given user.
# This method is NOT equivalent to Comment.find_comments_for_user
def find_comments_by_user(user)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
Comment.find(:all,
:conditions => ["user_id = ? and commentable_type = ?", user.id, commentable],
:order => "created_at DESC"
)
end
end
# This module contains instance methods
module InstanceMethods
# Helper method to sort comments by date
def comments_ordered_by_submitted
Comment.find(:all,
:conditions => ["commentable_id = ? and commentable_type = ?", id, self.type.name],
:order => "created_at DESC"
)
end
# Helper method that defaults the submitted time.
def add_comment(comment)
comments << comment
end
end
end
end
end

View file

@ -1,34 +0,0 @@
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
# NOTE: install the acts_as_votable plugin if you
# want user to vote on the quality of comments.
#acts_as_voteable
# NOTE: Comments belong to a user
belongs_to :user
# Helper class method to lookup all comments assigned
# to all commentable types for a given user.
def self.find_comments_by_user(user)
find(:all,
:conditions => ["user_id = ?", user.id],
:order => "created_at DESC"
)
end
# Helper class method to look up all comments for
# commentable class name and commentable id.
def self.find_comments_for_commentable(commentable_str, commentable_id)
find(:all,
:conditions => ["commentable_type = ? and commentable_id = ?", commentable_str, commentable_id],
:order => "created_at DESC"
)
end
# Helper class method to look up a commentable object
# given the commentable class name and id
def self.find_commentable(commentable_str, commentable_id)
commentable_str.constantize.find(commentable_id)
end
end

View file

@ -1,4 +0,0 @@
# desc "Explaining what the task does"
# task :acts_as_commentable do
# # Task goes here
# end

View file

@ -1,8 +0,0 @@
require 'test/unit'
class ActsAsCommentableTest < Test::Unit::TestCase
# Replace this with your real tests.
def test_this_plugin
flunk
end
end

View file

@ -8,6 +8,7 @@ require 'prawnto/action_view'
require 'prawnto/template_handler/compile_support'
require 'prawnto/template_handlers/base'
require 'prawn/layout' # Added by benni
#require 'prawnto/template_handlers/raw'
# for now applying to all Controllers