Skip to content

Commit

Permalink
fix(cash): only allow auxiliary cashbox selection
Browse files Browse the repository at this point in the history
This commit ensures that only is_auxiliary cashboxes are available for
selection on the cash page.

Closes #746.
  • Loading branch information
Jonathan Niles committed Sep 27, 2016
1 parent e0661cb commit 68e48e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/src/partials/cash/cash.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<i class="fa fa-inbox"></i> {{ "CASH.VOUCHER.CASHBOXES.CHANGE_CASHBOX" | translate }}
</button>

<button class="btn btn-primary btn-block" ui-sref="cash.transfer({ id: CashCtrl.cashbox.id })" data-perform-transfer>
<button style="margin-bottom: 1em;" class="btn btn-primary btn-block" ui-sref="cash.transfer({ id: CashCtrl.cashbox.id })" data-perform-transfer>
<i class="fa fa-exchange"></i> {{ "CASH.VOUCHER.CASHBOXES.TRANSFER" | translate }}
</button>
</div>
Expand Down
25 changes: 13 additions & 12 deletions client/src/partials/cash/modals/selectCashbox.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ angular.module('bhima.controllers')

SelectCashboxModalController.$inject = [
'SessionService', '$uibModalInstance', 'CashboxService', '$stateParams',
'NotifyService', '$state'
'NotifyService'
];

/**
* This modal selects the active cashbox on the cash page
*/
function SelectCashboxModalController(Session, Instance, Cashboxes, $stateParams, Notify, $state) {
function SelectCashboxModalController(Session, Instance, Cashboxes, $stateParams, Notify) {
var vm = this;

vm.selectCashbox = selectCashbox;
Expand All @@ -23,17 +23,18 @@ function SelectCashboxModalController(Session, Instance, Cashboxes, $stateParams
toggleLoadingIndicator();

Cashboxes.read(undefined, {
project_id : Session.project.id
project_id : Session.project.id,
is_auxiliary : 1
})
.then(function (cashboxes) {
vm.cashboxes = cashboxes;

if (cashboxId) {
selectCashbox(cashboxId);
}
})
.catch(Notify.handleError)
.finally(toggleLoadingIndicator);
.then(function (cashboxes) {
vm.cashboxes = cashboxes;

if (cashboxId) {
selectCashbox(cashboxId);
}
})
.catch(Notify.handleError)
.finally(toggleLoadingIndicator);
}

// fired when a user selects a cashbox from a list
Expand Down

0 comments on commit 68e48e8

Please sign in to comment.