Skip to content

Commit

Permalink
Merge pull request #619 from krico/jas-616
Browse files Browse the repository at this point in the history
Jas 616
  • Loading branch information
krico committed Jul 26, 2015
2 parents e40727e + 233b55a commit d23b7a3
Show file tree
Hide file tree
Showing 20 changed files with 438 additions and 396 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
}

function confirmClearPackageSelection() {
var translation = $translate('CLEAR_PACKAGE_SELECTION_PROMPT');
var translation = $translate('CLEAR_ACTIVITY_PACKAGE_SELECTION_PROMPT');
jasDialogs.ruSure(translation, function () {
$rootScope.$apply(function () {
vm.activityPackageSelection = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2>{{ 'NO_ITEMS_SELECTED' | translate }}
<h2 class="lvh-label">{{ 'SELECTED_ACTIVITY_PACKAGES' | translate }}</h2>
<button ng-click="vm.confirmClearPackageSelection ()"
class="btn btn-warning pull-right">
{{ 'CLEAR_PACKAGE_SELECTION' | translate }}
{{ 'CLEAR_ACTIVITY_PACKAGE_SELECTION' | translate }}
</button>
</div>
<div class="lv-body">
Expand Down
8 changes: 4 additions & 4 deletions schedule/schedule-appengine/src/main/i18n/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"CHECKOUT_ERROR": "System was unable to determine the result of your checkout operation",
"CHECKOUT_NOT_COMPLETE_RETRY_SELECTION": "You did not finish your checkout. You can change your selections and try again",
"CHECKOUT_PAYMENT_NOT_COMPLETE_RETRY_SELECTION": "You did not complete your payment. You can change your selections and try again",
"CLEAR_ACTIVITY_PACKAGE_SELECTION": "Clear Package selection",
"CLEAR_ACTIVITY_PACKAGE_SELECTION_PROMPT": "Do you want to remove all Activity Packages?",
"CLEAR_ACTIVITY_SELECTION": "Clear Activity selection",
"CLEAR_ACTIVITY_SELECTION_PROMPT": "Do you want to remove all Activities?",
"CLICK_TO_DESELECT": "Click to deselect",
"CLICK_TO_SELECT": "Click to select",
"COLOUR": "Colour",
Expand Down Expand Up @@ -125,10 +129,6 @@
"PROCEED_TO_BOOKING_VIA_JASIFY": "Booking is done via Jasify. A new window will be opened where you will be able to Sign In or Create an account and proceed to your checkout",
"PROFILE_SETTINGS": "Profile Settings",
"REMOVE": "Remove",
"CLEAR_PACKAGE_SELECTION": "Clear Package Selection",
"CLEAR_PACKAGE_SELECTION_PROMPT": "Do you want to remove all Packages?",
"CLEAR_ACTIVITY_SELECTION": "Clear Activity Selection",
"CLEAR_ACTIVITY_SELECTION_PROMPT": "Do you want to remove all Activities?",
"REMOVE_ACTIVITY": "Do you want to remove this Activity?",
"REMOVE_ACTIVITY_PACKAGE": "Do you want to remove this Activity Package?",
"REPEAT_DAILY": "Repeat daily",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ void initializeDevSystem() {
UserServiceFactory.getUserService().create(admin, "admin");
} catch (UsernameExistsException | EmailExistsException e) {
// Don't really care
log.warn(e.getMessage());
}

if (EnvironmentUtil.isContinuousIntegrationEnvironment()) {
log.warn("CONTINUOUS INTEGRATION: Creating test values for OAuth2ProviderConfig");
for (OAuth2ProviderEnum provider : OAuth2ProviderEnum.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.jasify.schedule.appengine.meta.balance.UserAccountMeta;
import com.jasify.schedule.appengine.meta.common.OrganizationMeta;
import com.jasify.schedule.appengine.meta.users.UserMeta;
import com.jasify.schedule.appengine.model.ModelOperation;
import com.jasify.schedule.appengine.model.TransactionOperator;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -26,8 +28,8 @@ public final class AccountUtil {
public static final String PROFIT_AND_LOSS_ACCOUNT = "P&L";
public static final String USER_ACCOUNT_PREFIX = "u";
public static final String ORGANIZATION_ACCOUNT_PREFIX = "o";
private static final Logger log = LoggerFactory.getLogger(AccountUtil.class);
public static final String DEFAULT_CURRENCY = "CHF";
private static final Logger log = LoggerFactory.getLogger(AccountUtil.class);

private AccountUtil() {
}
Expand All @@ -41,25 +43,21 @@ public static Key profitAndLossAccountKey() {
}

public static Account profitAndLossAccount() {
com.google.appengine.api.datastore.Transaction tx = Datastore.beginTransaction();
try {
Key id = profitAndLossAccountKey();
Account account = Datastore.getOrNull(AccountMeta.get(), id);
if (account == null) {
account = new Account(id);
account.setCurrency(DEFAULT_CURRENCY);
log.info("Created P&L account:{}", account);
Datastore.put(tx, account);
return TransactionOperator.executeNoEx(new ModelOperation<Account>() {
@Override
public Account execute(com.google.appengine.api.datastore.Transaction tx) {
Key id = profitAndLossAccountKey();
Account account = Datastore.getOrNull(AccountMeta.get(), id);
if (account == null) {
account = new Account(id);
account.setCurrency(DEFAULT_CURRENCY);
log.info("Created P&L account:{}", account);
Datastore.put(tx, account);
tx.commit();
}
return account;
}

tx.commit();
return account;
} finally {

if (tx.isActive())
tx.rollback();

}
});
}

/**
Expand Down Expand Up @@ -122,28 +120,21 @@ public static Key memberAccountIdMustExist(Key memberId) {
return memberAccountMustExist(memberId).getId();
}

public static Account memberAccountMustExist(Key memberId) {
Key memberAccountId = AccountUtil.memberIdToAccountId(memberId);
com.google.appengine.api.datastore.Transaction tx = Datastore.beginTransaction();
Account account;
try {

account = Datastore.getOrNull(AccountMeta.get(), memberAccountId);
if (account == null) {
account = AccountUtil.newMemberAccount(memberId);
log.info("Created member account:{} for member:{}", memberAccountId, memberId);
Datastore.put(tx, account);
public static Account memberAccountMustExist(final Key memberId) {
final Key memberAccountId = AccountUtil.memberIdToAccountId(memberId);

return TransactionOperator.executeNoEx(new ModelOperation<Account>() {
@Override
public Account execute(com.google.appengine.api.datastore.Transaction tx) {
Account account = Datastore.getOrNull(AccountMeta.get(), memberAccountId);
if (account == null) {
account = AccountUtil.newMemberAccount(memberId);
log.info("Created member account:{} for member:{}", memberAccountId, memberId);
Datastore.put(tx, account);
tx.commit();
}
return account;
}

tx.commit();

} finally {

if (tx.isActive())
tx.rollback();

}

return account;
});
}
}
Loading

0 comments on commit d23b7a3

Please sign in to comment.