From: Galen Charlton Date: Thu, 24 Aug 2017 21:51:58 +0000 (-0400) Subject: Merge remote-tracking branch 'working/collab/gmcharlt/lp1708291-webstaff-serials... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fgmcharlt%2Ftmp-serials-batch-patron-edit-merge;p=working%2FEvergreen.git Merge remote-tracking branch 'working/collab/gmcharlt/lp1708291-webstaff-serials' into user/gmcharlt/tmp-serials-batch-patron-edit-merge Conflicts: Open-ILS/src/sql/Pg/950.data.seed-values.sql Open-ILS/web/js/ui/default/staff/cat/catalog/app.js Open-ILS/web/js/ui/default/staff/services/ui.js Open-ILS/web/js/ui/default/staff/test/karma.conf.js --- dbfb3c9968b96bea513e5398c88a90ac42cdbf2e diff --cc Open-ILS/src/sql/Pg/950.data.seed-values.sql index dd31ec7b25,c306fee759..52db49ad8c --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@@ -1679,9 -1679,9 +1679,12 @@@ INSERT INTO permission.perm_list ( id, ( 590, 'ADMIN_COPY_TAG_TYPES', oils_i18n_gettext( 590, 'Administer copy tag types', 'ppl', 'description' )), ( 591, 'ADMIN_COPY_TAG', oils_i18n_gettext( 591, - 'Administer copy tag', 'ppl', 'description' )) - ( 590,'CONTAINER_BATCH_UPDATE', oils_i18n_gettext( 590, - 'Allow batch update via buckets', 'ppl', 'description' )) + 'Administer copy tag', 'ppl', 'description' )), - ( 592, 'ADMIN_SERIAL_PATTERN_TEMPLATE', oils_i18n_gettext( 592, ++ ( 592,'CONTAINER_BATCH_UPDATE', oils_i18n_gettext( 592, ++ 'Allow batch update via buckets', 'ppl', 'description' )), ++ ( 593, 'ADMIN_SERIAL_PATTERN_TEMPLATE', oils_i18n_gettext( 593, + 'Administer serial prediction pattern templates', 'ppl', 'description' )) ++>>>>>>> working/collab/gmcharlt/lp1708291-webstaff-serials ; SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); diff --cc Open-ILS/src/templates/staff/cat/catalog/index.tt2 index b98c3f14ec,50a1f8f7bd..3d19ca2646 --- a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 @@@ -8,9 -8,12 +8,13 @@@ + + [% INCLUDE 'staff/serials/share/serials_strings.tt2' %] + + + [% INCLUDE 'staff/cat/share/marcedit_strings.tt2' %] diff --cc Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 8b541f5914,6f8700288e..a26e202bd5 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@@ -7,7 -7,7 +7,8 @@@ * */ -angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast', 'egSerialsMod', 'egSerialsAppDep']) +angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast','egPatronSearchMod']) ++angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast', 'egSerialsMod', 'egSerialsAppDep','egPatronSearchMod']) .config(['ngToastProvider', function(ngToastProvider) { ngToastProvider.configure({ diff --cc Open-ILS/web/js/ui/default/staff/services/ui.js index f6dc3a0ce2,590a418345..2c1322b7a7 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@@ -84,145 -84,18 +84,157 @@@ function($timeout , $parse) }; }) +// 'date' filter +// Overriding the core angular date filter with a moment-js based one for +// better timezone and formatting support. +.filter('date',function() { + + var formatMap = { + short : 'l LT', + medium : 'lll', + long : 'LLL', + full : 'LLLL', + + shortDate : 'l', + mediumDate : 'll', + longDate : 'LL', + fullDate : 'LL', + + shortTime : 'LT', + mediumTime : 'LTS' + }; + + var formatReplace = [ + [ /yyyy/g, 'YYYY' ], + [ /yy/g, 'YY' ], + [ /y/g, 'Y' ], + [ /ww/g, 'WW' ], + [ /w/g, 'W' ], + [ /dd/g, 'DD' ], + [ /d/g, 'D' ], + [ /sss/g, 'SSS' ], + [ /EEEE/g, 'dddd' ], + [ /EEE/g, 'ddd' ], + [ /Z/g, 'ZZ' ] + ]; + + return function (date, format, tz) { + if (!date) return ''; + + if (date == 'now') + date = new Date().toISOString(); + + if (format) { + var fmt = formatMap[format] || format; + angular.forEach(formatReplace, function (r) { + fmt = fmt.replace(r[0],r[1]); + }); + } + + var d = moment(date); + if (tz && tz !== '-') d.tz(tz); + + return d.isValid() ? d.format(fmt) : ''; + } + +}) + +// 'egOrgDate' filter +// Uses moment.js and moment-timezone.js to put dates into the most appropriate +// timezone for a given (optional) org unit based on its lib.timezone setting +.filter('egOrgDate',['$filter','egCore', + function($filter , egCore) { + + var tzcache = {}; + + function eg_date_filter (date, fmt, ouID) { + if (ouID) { + if (angular.isObject(ouID)) { + if (angular.isFunction(ouID.id)) { + ouID = ouID.id(); + } else { + ouID = ouID.id; + } + } + + if (!tzcache[ouID]) { + tzcache[ouID] = '-'; + egCore.org.settings('lib.timezone', ouID) + .then(function(s) { + tzcache[ouID] = s['lib.timezone'] || OpenSRF.tz; + }); + } + } + + return $filter('date')(date, fmt, tzcache[ouID]); + } + + eg_date_filter.$stateful = true; + + return eg_date_filter; +}]) + +// 'egOrgDateInContext' filter +// Uses the egOrgDate filter to make time and date location aware, and further +// modifies the format if one of [short, medium, long, full] to show only the +// date if the optional interval parameter is day-granular. This is +// particularly useful for due dates on circulations. +.filter('egOrgDateInContext',['$filter','egCore', + function($filter , egCore) { + + function eg_context_date_filter (date, format, orgID, interval) { + var fmt = format; + if (!fmt) fmt = 'shortDate'; + + // if this is a simple, one-word format, and it doesn't say "Date" in it... + if (['short','medium','long','full'].filter(function(x){return fmt == x}).length > 0 && interval) { + var secs = egCore.date.intervalToSeconds(interval); + if (secs !== null && secs % 86400 == 0) fmt += 'Date'; + } + + return $filter('egOrgDate')(date, fmt, orgID); + } + + eg_context_date_filter.$stateful = true; + + return eg_context_date_filter; +}]) + +// 'egDueDate' filter +// Uses the egOrgDateInContext filter to make time and date location aware, but +// only if the supplied interval is day-granular. This is as wrapper for +// egOrgDateInContext to be used for circulation due date /only/. +.filter('egDueDate',['$filter','egCore', + function($filter , egCore) { + + function eg_context_due_date_filter (date, format, orgID, interval) { + if (interval) { + var secs = egCore.date.intervalToSeconds(interval); + if (secs === null || secs % 86400 != 0) { + orgID = null; + interval = null; + } + } + return $filter('egOrgDateInContext')(date, format, orgID, interval); + } + + eg_context_due_date_filter.$stateful = true; + + return eg_context_due_date_filter; +}]) + + // 'join' filter + // TODO: perhaps this should live elsewhere + .filter('join', function() { + return function(arr,sep) { + if (typeof arr == 'object' && arr.constructor == Array) { + return arr.join(sep || ','); + } else { + return ''; + } + }; + }) + /** * Progress Dialog. * diff --cc Open-ILS/web/js/ui/default/staff/test/karma.conf.js index a5e9d26722,900cb67ddf..36675b8e4f --- a/Open-ILS/web/js/ui/default/staff/test/karma.conf.js +++ b/Open-ILS/web/js/ui/default/staff/test/karma.conf.js @@@ -44,9 -44,8 +44,10 @@@ module.exports = function(config) 'services/ui.js', 'services/grid.js', 'services/op_change.js', + 'services/patron_search.js', 'services/navbar.js', 'services/date.js', + 'services/user-bucket.js', + 'services/i18n.js', // load app scripts 'app.js', 'circ/**/*.js',