--- /dev/null
+[%
+ WRAPPER "staff/base.tt2";
+ ctx.page_title = l("Auto-Print Settings");
+ ctx.page_app = "egAdminConfig";
+ ctx.page_ctrl = 'AutoPrintCtl';
+%]
+
+[% BLOCK APP_JS %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/admin/local/config/auto_print.js"></script>
+<link rel="stylesheet" href="[% ctx.base_path %]/staff/css/admin.css" />
+[% END %]
+
+<div class="container-fluid" style="text-align:center">
+ <div class="alert alert-info alert-less-pad strong-text-2">
+ [% l('Auto-Print Settings') %]
+ </div>
+</div>
+
+<div id="auto-print-container">
+
+ <div class="strong-text-2 row">
+ [% l('Disable Automatic Print Attempt Type List') %]
+ </div>
+
+ <div class="row">
+[% | l %]Disable automatic print attempts from staff client interfaces
+for the receipt types in this list. Possible values: "Checkout", "Bill
+Pay", "Hold Slip", "Transit Slip", and "Hold/Transit Slip". This is
+different from the Auto-Print checkbox in the pertinent interfaces
+in that it disables automatic print attempts altogether, rather than
+encouraging silent printing by suppressing the print dialog. The
+Auto-Print checkbox in these interfaces have no effect on the behavior
+for this setting. In the case of the Hold, Transit, and Hold/Transit
+slips, this also suppresses the alert dialogs that precede the print
+dialog (the ones that offer Print and Do Not Print as options).[% END %]
+ </div>
+
+ <div class="row">
+ <div class="strong-text-2">[% l('New Setting') %]</div>
+ <div>
+ [% l('Disable auto-print attempts for these receipt/slip types') %]
+ </div>
+ </div>
+
+ <div class="row"></div><!-- add some padding -->
+
+ <div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('Checkout Receipt') %]</label>
+ <input type="checkbox" ng-model="co_recpt"/>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('Bill Pay Receipt') %]</label>
+ <input type="checkbox" ng-model="bill_recpt"/>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('Hold Slip') %]</label>
+ <input type="checkbox" ng-model="hold_slip"/>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('Transit Slip') %]</label>
+ <input type="checkbox" ng-model="transit_slip"/>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('Hold/Transit Slip') %]</label>
+ <input type="checkbox" ng-model="hold_transit_slip"/>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2">[% l('For This Library and Descendants') %]</label>
+ <eg-org-selector selected="context_org"
+ onchange="show_org_values" disable-test="cant_use_org"></eg-org-selector>
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <button class="btn btn-default"
+ ng-class="{disabled : in_flight}"
+ ng-click="update_auto_print()">
+ [% l('Update Settings') %]
+ </button>
+ </div>
+ </div>
+
+</div>
+
+[% END %]
<div class="container admin-splash-container">
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/actor/address_alert">
[% l('Address Alerts') %]
</a>
</div>
+ <div class="col-md-4">
+ <span class="glyphicon glyphicon-pencil"></span>
+ <a target="_self" href="./admin/local/asset/copy_locations">
+ [% l('Copy Locations Editor') %]
+ </a>
+ </div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/circ/age_to_lost">
[% l('Age Overdue Circs to Lost') %]
</a>
</div>
+ <div class="col-md-4">
+ <span class="glyphicon glyphicon-pencil"></span>
+ <a target="_self" href="./admin/local/asset/copy_template">
+ [% l('Copy Template Editor') %]
+ </a>
+ </div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/config/barcode_completion">
[% l('Barcode Completion') %]
</a>
</div>
+ <div class="col-md-4">
+ <span class="glyphicon glyphicon-pencil"></span>
+ <a target="_self" href="./admin/local/config/auto_print">
+ [% l('Auto-Print Settings') %]
+ </a>
+ </div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/money/cash_reports">
[% l('Cash Reports') %]
</div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/config/circ_limit_set">
[% l('Circ Limit Sets') %]
</div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/config/circ_matrix_matchpoint">
[% l('Circulation Policies') %]
</div>
</div>
<div class="row new-entry">
- <div class="col-md-3">
+ <div class="col-md-4">
<span class="glyphicon glyphicon-pencil"></span>
<a target="_self" href="./admin/local/actor/closed_dates">
- [% l('Closed Dates Editor') %]
+ [% l('Closed Dates Editor (pending)') %]
+ </a>
+ </div>
+ </div>
+ <div class="row new-entry">
+ <div class="col-md-4">
+ <span class="glyphicon glyphicon-pencil"></span>
+ <a target="_self" href="./admin/local/asset/copy_location_group">
+ [% l('Copy Location Groups') %]
+ </a>
+ </div>
+ </div>
+ <div class="row new-entry">
+ <div class="col-md-4">
+ <span class="glyphicon glyphicon-pencil"></span>
+ <a target="_self" href="./admin/local/asset/copy_location_order">
+ [% l('Copy Location Order') %]
</a>
</div>
</div>
border-top: 2px solid #F5F5F5;
}
+#auto-print-container {
+ margin-top: 20px;
+}
+
+#auto-print-container .row {
+ margin-top: 20px;
+}
controller: 'EmbedXHTMLCtl', // non-conify
resolve : resolver
});
+
+ // non-conify routes come first
+ $routeProvider.when('/admin/local/asset/copy_locations', {
+ template: eframe_template,
+ controller: 'EmbedXHTMLCtl', // non-conify
+ resolve : resolver
+ });
// Conify page handler
$routeProvider.when('/admin/local/:schema/:page', {
--- /dev/null
+
+angular.module('egAdminConfig',
+ ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
+
+.controller('AutoPrintCtl',
+ ['$scope','egCore',
+function($scope , egCore) {
+
+ $scope.allowed_orgs = [];
+ $scope.cant_use_org = function(org_id) {
+ return $scope.allowed_orgs.indexOf(org_id) == -1;
+ }
+
+ // The org setting stores the values as English words.
+ // Map those to scope-storable bools
+ var values_map = {
+ co_recpt : 'Checkout',
+ bill_recpt : 'Bill Pay',
+ hold_slip : 'Hold Slip',
+ transit_slip : 'Transit Slip',
+ hold_transit_slip : 'Hold/Transit Slip'
+ }
+
+ // fetch and display values for the currently selected org unit
+ $scope.show_org_values = function(org) {
+ egCore.org.settings(
+ ['circ.staff_client.do_not_auto_attempt_print'], org.id()
+ ).then(function(values) {
+ list = values['circ.staff_client.do_not_auto_attempt_print'] || [];
+ angular.forEach(values_map, function(val, key) {
+ if (list.indexOf(val) > -1) {
+ $scope[key] = true;
+ } else {
+ $scope[key] = false;
+ }
+ });
+ });
+ }
+
+ function fetch_data() {
+ // TODO: The XUL app tested the ADMIN_ORG_UNIT_SETTING_TYPE perm
+ // to see wher the user could change the print settings. There
+ // should be a separate, less powerful permission that allows
+ // users to change this value.
+ egCore.perm.hasPermAt(['ADMIN_ORG_UNIT_SETTING_TYPE'], true)
+ .then(function(settings) {
+ $scope.allowed_orgs = settings.ADMIN_ORG_UNIT_SETTING_TYPE;
+ });
+ $scope.show_org_values(egCore.org.get(egCore.auth.user().ws_ou()));
+ }
+
+ $scope.update_auto_print = function() {
+ $scope.in_flight = true;
+ var values = [];
+ angular.forEach(values_map, function(val, key) {
+ if ($scope[key]) { values.push(val) }
+ });
+
+ console.log('updating for ' + $scope.context_org.id());
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.org_unit.settings.update',
+ egCore.auth.token(),
+ $scope.context_org.id(),
+ {"circ.staff_client.do_not_auto_attempt_print": values}
+ ).then(function() {
+ $scope.in_flight = false; // re-enable the submit button
+ });
+ }
+
+ // This is a standalone with page w/ no startup resolver.
+ // Kick off startup locally.
+ egCore.startup.go().then(fetch_data);
+
+}])