-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/datacite/lupo
- Loading branch information
Showing
13 changed files
with
254 additions
and
81 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class BillingInformationValidator < ActiveModel::EachValidator | ||
def validate_each(record, attribute, value) | ||
# Don't try to validate if we have nothing | ||
return unless value.present? | ||
|
||
unless value["city"].present? | ||
record.errors[attribute] << "has no city specified" | ||
end | ||
|
||
unless value["state"].present? | ||
record.errors[attribute] << "has no state/province specified" | ||
end | ||
unless value["country"].present? | ||
record.errors[attribute] << "has no country specified" | ||
end | ||
unless value["department"].present? | ||
record.errors[attribute] << "has no department specified" | ||
end | ||
|
||
unless value["address"].present? | ||
record.errors[attribute] << "has no street address specified" | ||
end | ||
|
||
unless value["postCode"].present? || value["post_code"].present? | ||
record.errors[attribute] << "has no post/zip code specified" | ||
end | ||
unless value["organization"].present? | ||
record.errors[attribute] << "has no organization specified" | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class AddBillingContact < ActiveRecord::Migration[5.2] | ||
def up | ||
add_column :allocator, :billing_contact, :json | ||
add_column :allocator, :secondary_billing_contact, :json | ||
end | ||
|
||
def down | ||
remove_column :allocator, :billing_contact | ||
remove_column :allocator, :secondary_billing_contact | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class RemoveGeneralContact < ActiveRecord::Migration[5.2] | ||
def up | ||
remove_column :allocator, :general_contact | ||
end | ||
|
||
def down | ||
add_column :allocator, :general_contact, :json | ||
end | ||
end |
Oops, something went wrong.