[open-ils-commits] [GIT] Evergreen ILS branch master updated. e0a936729ada587e33ab3a701901c3d0a1ed3acb
Evergreen Git
git at git.evergreen-ils.org
Thu Dec 1 16:02:33 EST 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via e0a936729ada587e33ab3a701901c3d0a1ed3acb (commit)
via 73944dd4501b982a17f5f7a54474b6e2e8d01ee8 (commit)
via 176890efb3162fa488fc4cfbfc9cc23fc350c976 (commit)
via 76a9ebb18fb60bc6b1f041f11009f9dab947058c (commit)
via 8d0168013b8281c3e10ecbc78c4b45fdf92760f9 (commit)
from 7ab686868965f22323a330f119be950c0db7bd76 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e0a936729ada587e33ab3a701901c3d0a1ed3acb
Author: Jason Etheridge <jason at esilibrary.com>
Date: Thu Dec 1 16:02:29 2011 -0500
pin a version number for the patron card editor upgrade script
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 9930af5..54865b3 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0653', :eg_version); -- berick/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0654', :eg_version); -- phasefx/tsbere
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql b/Open-ILS/src/sql/Pg/upgrade/0654.patron_card_editor.sql
similarity index 81%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql
rename to Open-ILS/src/sql/Pg/upgrade/0654.patron_card_editor.sql
index 2c7cd3a..06c40e8 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0654.patron_card_editor.sql
@@ -1,6 +1,11 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0654', :eg_version);
+
INSERT INTO permission.perm_list ( id, code, description ) VALUES
( 514, 'UPDATE_PATRON_ACTIVE_CARD', oils_i18n_gettext( 514,
'Allows a user to manually adjust a patron''s active cards', 'ppl', 'description')),
( 515, 'UPDATE_PATRON_PRIMARY_CARD', oils_i18n_gettext( 515,
'Allows a user to manually adjust a patron''s primary card', 'ppl', 'description'));
+COMMIT;
commit 73944dd4501b982a17f5f7a54474b6e2e8d01ee8
Author: Thomas Berezansky <tsbere at mvlc.org>
Date: Tue Nov 1 14:00:46 2011 -0400
When editing cards, lock tab on apply changes
Hopefully to prevent people from moving away before saving.
Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js
index a29920a..56b7261 100644
--- a/Open-ILS/web/js/ui/default/actor/user/register.js
+++ b/Open-ILS/web/js/ui/default/actor/user/register.js
@@ -394,6 +394,7 @@ function drawAllCards() {
function applyCardChanges() {
var cardrows = dojo.query('[cardid]', allCardsDialog.domNode);
+ var changed = false;
dojo.forEach(cardrows,
function(row) {
if(cardPerms['UPDATE_PATRON_ACTIVE_CARD']) {
@@ -401,15 +402,21 @@ function applyCardChanges() {
if(row.card.active() != active) {
row.card.active(active);
row.card.ischanged(1);
+ changed = true;
}
}
if(cardPerms['UPDATE_PATRON_PRIMARY_CARD']) {
if(row.primary_radiobutton.checked && row.card.id() != patron.card().id()) {
patron.card(row.card);
+ changed = true;
}
}
}
);
+ if(changed && lock_ready && xulG && typeof xulG.lock_tab == 'function' && !already_locked) {
+ xulG.lock_tab();
+ already_locked = true;
+ }
allCardsDialog.hide();
}
commit 176890efb3162fa488fc4cfbfc9cc23fc350c976
Author: Thomas Berezansky <tsbere at mvlc.org>
Date: Tue Nov 1 10:11:24 2011 -0400
Seed values/upgrade script for card edit perms
Not assigned to anyone by default.
Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 2422cfe..628856f 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -1442,7 +1442,11 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
( 512, 'ACQ_INVOICE_REOPEN', oils_i18n_gettext( 512,
'Allows a user to reopen an Acquisitions invoice', 'ppl', 'description' )),
( 513, 'DEBUG_CLIENT', oils_i18n_gettext( 513,
- 'Allows a user to use debug functions in the staff client', 'ppl', 'description' ));
+ 'Allows a user to use debug functions in the staff client', 'ppl', 'description' )),
+ ( 514, 'UPDATE_PATRON_ACTIVE_CARD', oils_i18n_gettext( 514,
+ 'Allows a user to manually adjust a patron''s active cards', 'ppl', 'description')),
+ ( 515, 'UPDATE_PATRON_PRIMARY_CARD', oils_i18n_gettext( 515,
+ 'Allows a user to manually adjust a patron''s primary card', 'ppl', 'description'));
SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql
new file mode 100644
index 0000000..2c7cd3a
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.patron_card_editor.sql
@@ -0,0 +1,6 @@
+INSERT INTO permission.perm_list ( id, code, description ) VALUES
+ ( 514, 'UPDATE_PATRON_ACTIVE_CARD', oils_i18n_gettext( 514,
+ 'Allows a user to manually adjust a patron''s active cards', 'ppl', 'description')),
+ ( 515, 'UPDATE_PATRON_PRIMARY_CARD', oils_i18n_gettext( 515,
+ 'Allows a user to manually adjust a patron''s primary card', 'ppl', 'description'));
+
commit 76a9ebb18fb60bc6b1f041f11009f9dab947058c
Author: Thomas Berezansky <tsbere at mvlc.org>
Date: Tue Nov 1 10:01:43 2011 -0400
Check Profile Editing Perms for Card Editor
Don't allow Active/Primary card changes unless you have the ability to edit
the patron's primary profile group.
Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js
index 42bf177..a29920a 100644
--- a/Open-ILS/web/js/ui/default/actor/user/register.js
+++ b/Open-ILS/web/js/ui/default/actor/user/register.js
@@ -240,7 +240,7 @@ function load() {
dojo.connect(allCards, 'onClick', drawAllCards);
if(patron.isnew()) {
dojo.addClass(dojo.byId('uedit-all-barcodes'), 'hidden');
- } else {
+ } else if(checkGrpAppPerm(patron.profile())) {
new openils.User().getPermOrgList(
'UPDATE_PATRON_ACTIVE_CARD',
function(orgList) {
commit 8d0168013b8281c3e10ecbc78c4b45fdf92760f9
Author: Thomas Berezansky <tsbere at mvlc.org>
Date: Tue Nov 1 09:18:47 2011 -0400
Active/Primary Editing for Patron Cards
Changes "See All" into an editing interface, allowing for changing of the
active and primary state of each card.
Each requires a specific permission:
UPDATE_PATRON_ACTIVE_CARD
UPDATE_PATRON_PRIMARY_CARD
Without the appropriate permission the interface will show the green check
or red x instead of the editing elements. If you don't have either
permission then the Apply Changes button is hidden.
As the editing interface exists, also show the "See All" button when there
is only one card, but not when registering a new patron. This allows for
toggling the lone card's active flag, as well as replacing a card but
leaving the old one active.
To ensure that you can do the above, and to avoid some other errors, the
new card on a patron is saved to the editCard variable, rather than using
patron.card(). This both allows for "Replacing" a new non-primary card into
place as well as avoiding issues with editing the primary and active states
at the same time (the interface would try and update the new primary card
with the old primary card's barcode). Also, when checking for duplicate
barcodes, update the editCard with the barcode so the See All interface can
show the new card's barcode in the list properly.
Finally, included is localization for the All Cards interface headers and
buttons.
Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/src/templates/actor/user/register.tt2 b/Open-ILS/src/templates/actor/user/register.tt2
index b03047b..379405f 100644
--- a/Open-ILS/src/templates/actor/user/register.tt2
+++ b/Open-ILS/src/templates/actor/user/register.tt2
@@ -47,20 +47,23 @@
<table class='oils-generic-table' style='margin:10px;'>
<thead>
<tr>
- <th>Barcode</th>
- <th>Active</th>
+ <th id='uedit-all-cards-barcode'>Barcode</th>
+ <th id='uedit-all-cards-active'>Active</th>
+ <th id='uedit-all-cards-primary'>Primary</th>
</tr>
</thead>
<tbody id='uedit-all-cards-tbody'>
<tr id='uedit-all-cards-tr-template'>
<td><div name='barcode'></div></td>
<td><div name='active'></div></td>
+ <td><div name='primary'></div></td>
</tr>
</tbody>
<tbody>
<tr>
- <td colspan='2' style='text-align:center;'>
- <button dojoType='dijit.form.Button' onClick='allCardsDialog.hide()' scrollOnFocus='false'>Close</button>
+ <td colspan='3' style='text-align:center;'>
+ <button jsId='allCardsClose' dojoType='dijit.form.Button' onClick='allCardsDialog.hide()' scrollOnFocus='false'>Close</button>
+ <span id='uedit-apply-card-changes'><button jsId='allCardsApply' dojoType='dijit.form.Button' onClick='applyCardChanges()' scrollOnFocus='false'>Apply Changes</button></span>
</td>
</tr>
</tbody>
diff --git a/Open-ILS/src/templates/actor/user/register_table.tt2 b/Open-ILS/src/templates/actor/user/register_table.tt2
index 5528252..1a41295 100644
--- a/Open-ILS/src/templates/actor/user/register_table.tt2
+++ b/Open-ILS/src/templates/actor/user/register_table.tt2
@@ -6,7 +6,7 @@
<span id='uedit-dupe-barcode-warning' style='color:red; font-weight:bold' class='hidden'>
</span>
</td>
- <td id='uedit-all-barcodes' class='hidden'>
+ <td id='uedit-all-barcodes'>
<button dojoType='dijit.form.Button' jsId='allCards' scrollOnFocus='false'></button>
</td>
</tr>
diff --git a/Open-ILS/web/js/dojo/openils/actor/nls/register.js b/Open-ILS/web/js/dojo/openils/actor/nls/register.js
index b16af89..3df6e1b 100644
--- a/Open-ILS/web/js/dojo/openils/actor/nls/register.js
+++ b/Open-ILS/web/js/dojo/openils/actor/nls/register.js
@@ -30,5 +30,10 @@
"SAVE_CLONE" : "Save & Clone",
"SHOW_REQUIRED" : "Show Only Required Fields",
"SHOW_SUGGESTED" : "Show Suggested Fields",
- "SHOW_ALL" : "Show All Fields"
+ "SHOW_ALL" : "Show All Fields",
+ "ALL_CARDS_BARCODE" : "Barcode",
+ "ALL_CARDS_ACTIVE" : "Active",
+ "ALL_CARDS_PRIMARY" : "Primary",
+ "ALL_CARDS_CLOSE" : "Close",
+ "ALL_CARDS_APPLY" : "Apply Changes"
}
diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js
index 30359fe..42bf177 100644
--- a/Open-ILS/web/js/ui/default/actor/user/register.js
+++ b/Open-ILS/web/js/ui/default/actor/user/register.js
@@ -46,6 +46,8 @@ var optInSettings;
var allCardsTemplate;
var uEditCloneCopyAddr; // if true, copy addrs on clone instead of link
var homeOuTypes = {};
+var cardPerms = {};
+var editCard;
var dupeUsrname = false;
var dupeBarcode = false;
@@ -76,6 +78,11 @@ function load() {
dojo.byId('parentGuardian').innerHTML = localeStrings.PARENT_OR_GUARDIAN;
dojo.byId('userSettings').innerHTML = localeStrings.USER_SETTINGS;
dojo.byId('statCats').innerHTML = localeStrings.STAT_CATS;
+ dojo.byId('uedit-all-cards-barcode').innerHTML = localeStrings.ALL_CARDS_BARCODE;
+ dojo.byId('uedit-all-cards-active').innerHTML = localeStrings.ALL_CARDS_ACTIVE;
+ dojo.byId('uedit-all-cards-primary').innerHTML = localeStrings.ALL_CARDS_PRIMARY;
+ allCardsClose.attr("label", localeStrings.ALL_CARDS_CLOSE);
+ allCardsApply.attr("label", localeStrings.ALL_CARDS_APPLY);
dojo.query("td[name='addressHeader']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_HEADER; });
dojo.query("span[name='mailingAddress']").forEach( function(item) { item.innerHTML = localeStrings.ADDRESS_MAILING; });
@@ -231,8 +238,28 @@ function load() {
dojo.connect(replaceBarcode, 'onClick', replaceCardHandler);
dojo.connect(allCards, 'onClick', drawAllCards);
- if(patron.cards().length > 1)
- dojo.removeClass(dojo.byId('uedit-all-barcodes'), 'hidden');
+ if(patron.isnew()) {
+ dojo.addClass(dojo.byId('uedit-all-barcodes'), 'hidden');
+ } else {
+ new openils.User().getPermOrgList(
+ 'UPDATE_PATRON_ACTIVE_CARD',
+ function(orgList) {
+ if(orgList.indexOf(patron.home_ou()) != -1)
+ cardPerms['UPDATE_PATRON_ACTIVE_CARD'] = true;
+ },
+ true,
+ true
+ );
+ new openils.User().getPermOrgList(
+ 'UPDATE_PATRON_PRIMARY_CARD',
+ function(orgList) {
+ if(orgList.indexOf(patron.home_ou()) != -1)
+ cardPerms['UPDATE_PATRON_PRIMARY_CARD'] = true;
+ },
+ true,
+ true
+ );
+ }
var input = findWidget('ac', 'barcode');
if (patron.isnew()) {
@@ -313,22 +340,50 @@ function drawAllCards() {
tbody.removeChild(tbody.childNodes[0]);
}
+ if(cardPerms['UPDATE_PATRON_ACTIVE_CARD'] || cardPerms['UPDATE_PATRON_PRIMARY_CARD']) {
+ dojo.removeClass(dojo.byId('uedit-apply-card-changes'), 'hidden');
+ } else {
+ dojo.addClass(dojo.byId('uedit-apply-card-changes'), 'hidden');
+ }
+
var first = true;
dojo.forEach(
- [patron.card()].concat(patron.cards()), // grab the main card first
+ patron.cards().filter(function(c) { return c.id() == patron.card().id(); }).concat(patron.cards()), // grab the main card first
function(card) {
if(!first) {
if(card.id() == patron.card().id())
return;
}
var row = allCardsTemplate.cloneNode(true);
+ row.setAttribute("cardid", card.id());
+ row.card = card;
getByName(row, 'barcode').innerHTML = card.barcode();
- getByName(row, 'active').appendChild(
- openils.Util.isTrue(card.active()) ?
- dojo.byId('true').cloneNode(true) :
- dojo.byId('false').cloneNode(true)
- );
-
+ if(cardPerms['UPDATE_PATRON_ACTIVE_CARD']) {
+ row.active_checkbox = new dijit.form.CheckBox({
+ scrollOnFocus:false,
+ checked: openils.Util.isTrue(card.active())
+ }, getByName(row, 'active'));
+ } else {
+ getByName(row, 'active').appendChild(
+ openils.Util.isTrue(card.active()) ?
+ dojo.byId('true').cloneNode(true) :
+ dojo.byId('false').cloneNode(true)
+ );
+ }
+ if(cardPerms['UPDATE_PATRON_PRIMARY_CARD']) {
+ row.primary_radiobutton = new dijit.form.RadioButton({
+ scrollOnFocus:false,
+ checked: card.id() == patron.card().id(),
+ value: card.id(),
+ name: 'card_primary'
+ }, getByName(row, 'primary'));
+ } else {
+ getByName(row, 'primary').appendChild(
+ openils.Util.isTrue(card.id() == patron.card().id()) ?
+ dojo.byId('true').cloneNode(true) :
+ dojo.byId('false').cloneNode(true)
+ );
+ }
tbody.appendChild(row);
first = false;
}
@@ -337,6 +392,27 @@ function drawAllCards() {
allCardsDialog.show();
}
+function applyCardChanges() {
+ var cardrows = dojo.query('[cardid]', allCardsDialog.domNode);
+ dojo.forEach(cardrows,
+ function(row) {
+ if(cardPerms['UPDATE_PATRON_ACTIVE_CARD']) {
+ var active = row.active_checkbox.checked ? 't' : 'f'
+ if(row.card.active() != active) {
+ row.card.active(active);
+ row.card.ischanged(1);
+ }
+ }
+ if(cardPerms['UPDATE_PATRON_PRIMARY_CARD']) {
+ if(row.primary_radiobutton.checked && row.card.id() != patron.card().id()) {
+ patron.card(row.card);
+ }
+ }
+ }
+ );
+ allCardsDialog.hide();
+}
+
/**
* Mark the current card inactive, create a new primary card
*/
@@ -357,6 +433,7 @@ function replaceCardHandler() {
newc.isnew(1);
newc.active('t');
patron.card(newc);
+ editCard = newc;
var t = patron.cards();
if (!t) { t = []; }
t.push(newc);
@@ -747,7 +824,7 @@ function fleshFMRow(row, fmcls, args) {
var fmObject = null;
switch(fmcls) {
case 'au' : fmObject = patron; break;
- case 'ac' : fmObject = patron.card(); break;
+ case 'ac' : if(!editCard) editCard = patron.card(); fmObject = editCard; break;
case 'aua' :
fmObject = patron.addresses().filter(
function(i) { return (i.id() == args.addr) })[0];
@@ -995,6 +1072,7 @@ function attachWidgetEvents(fmcls, fmfield, widget) {
} else {
dupeBarcode = false;
dojo.addClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden');
+ editCard.barcode(barcode); // Keep the "All" interface up to date
var un = findWidget('au', 'usrname');
if(!un.widget.attr('value'))
un.widget.attr('value', barcode);
@@ -1387,7 +1465,8 @@ function _uEditSave(doClone) {
break;
case 'ac':
- patron.card()[w._fmfield](val);
+ if(!editCard) editCard = patron.card();
+ editCard[w._fmfield](val);
break;
case 'aua':
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/950.data.seed-values.sql | 6 +-
.../src/sql/Pg/upgrade/0654.patron_card_editor.sql | 11 ++
Open-ILS/src/templates/actor/user/register.tt2 | 11 ++-
.../src/templates/actor/user/register_table.tt2 | 2 +-
Open-ILS/web/js/dojo/openils/actor/nls/register.js | 7 +-
Open-ILS/web/js/ui/default/actor/user/register.js | 108 ++++++++++++++++++--
7 files changed, 128 insertions(+), 19 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0654.patron_card_editor.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list