};
my $r = $e->json_query($q);
$self->ctx->{bookbag_count} = $r->[0]->{'count'};
+ # Someone has requested that we use the default list's name
+ # rather than "Default List."
+ if ($exclude) {
+ $q = {
+ 'select' => {'cbreb' => ['name']},
+ 'from' => 'cbreb',
+ 'where' => {'id' => $exclude}
+ };
+ $r = $e->json_query($q);
+ $self->ctx->{default_bookbag} = $r->[0]->{'name'};
+ }
} else {
return $stat;
}
opac.hits_per_page
opac.default_search_location
opac.default_pickup_location
- opac.temporary_list_warn
+ opac.temporary_list_no_warn
/;
my $stat = $self->_load_user_with_prefs;
}
+sub check_for_temp_list_warning {
+ my $self = shift;
+ my $ctx = $self->ctx;
+ my $cgi = $self->cgi;
+
+ my $lib = $self->_get_search_lib;
+ my $warn = ($ctx->{get_org_setting}->($lib, 'opac.patron_temporary_list_warn')) ? 1 : 0;
+
+ if ($warn && $ctx->{user}) {
+ $self->_load_user_with_prefs;
+ my $map = $ctx->{user_setting_map};
+ $warn = 0 if ($$map{'opac.temporary_list_no_warn'});
+ }
+
+ # Check for a cookie disabling the warning.
+ $warn = 0 if ($warn && $cgi->cookie('no_temp_list_warn'));
+
+ return $warn;
+}
+
1;
'bool'
);
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'opac.patron.temporary_list_warn',
+ 'opac',
+ oils_i18n_gettext(
+ 'opac.patron.temporary_list_warn',
+ 'Warn patrons when adding to a temporary book list',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.patron.temporary_list_warn',
+ 'Present a warning dialog to the patron when a patron adds a book to a temporary book bag.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+INSERT INTO config.usr_setting_type
+ (name,grp,opac_visible,label,description,datatype)
+VALUES (
+ 'opac.temporary_list_no_warn',
+ 'opac',
+ TRUE,
+ oils_i18n_gettext(
+ 'opac.temporary_list_no_warn',
+ 'Opt out of warning when adding a book to a temporary book list',
+ 'cust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.temporary_list_no_warn',
+ 'Opt out of warning when adding a book to a temporary book list',
+ 'cust',
+ 'description'
+ ),
+ 'bool'
+);
+
+INSERT INTO config.usr_setting_type
+ (name,grp,opac_visible,label,description,datatype)
+VALUES (
+ 'opac.default_list',
+ 'opac',
+ FALSE,
+ oils_i18n_gettext(
+ 'opac.default_list',
+ 'Default list to use when adding to a bookbag',
+ 'cust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.default_list',
+ 'Default list to use when adding to a bookbag',
+ 'cust',
+ 'description'
+ ),
+ 'integer'
+);
--- /dev/null
+BEGIN;
+
+-- Check for the upgrade deps block
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'opac.patron.temporary_list_warn',
+ 'opac',
+ oils_i18n_gettext(
+ 'opac.patron.temporary_list_warn',
+ 'Warn patrons when adding to a temporary book list',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.patron.temporary_list_warn',
+ 'Present a warning dialog to the patron when a patron adds a book to a temporary book bag.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+INSERT INTO config.usr_setting_type
+ (name,grp,opac_visible,label,description,datatype)
+VALUES (
+ 'opac.temporary_list_no_warn',
+ 'opac',
+ TRUE,
+ oils_i18n_gettext(
+ 'opac.temporary_list_no_warn',
+ 'Opt out of warning when adding a book to a temporary book list',
+ 'cust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.temporary_list_no_warn',
+ 'Opt out of warning when adding a book to a temporary book list',
+ 'cust',
+ 'description'
+ ),
+ 'bool'
+);
+
+INSERT INTO config.usr_setting_type
+ (name,grp,opac_visible,label,description,datatype)
+VALUES (
+ 'opac.default_list',
+ 'opac',
+ FALSE,
+ oils_i18n_gettext(
+ 'opac.default_list',
+ 'Default list to use when adding to a bookbag',
+ 'cust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'opac.default_list',
+ 'Default list to use when adding to a bookbag',
+ 'cust',
+ 'description'
+ ),
+ 'integer'
+);
+
+COMMIT;
</td>
</tr>
<tr>
- <td>[% l('Warn when adding to temporary book list?') %]</td>
+ <td>[% l('Skip warning when adding to temporary book list?') %]</td>
<td>
- [% setting = 'opac.temporary_list_warn' %]
+ [% setting = 'opac.temporary_list_no_warn' %]
<input name='[% setting %]' type="checkbox"
[% IF ctx.user_setting_map.$setting %] checked='checked' [% END %]/>
</td>
<a href="[% href %]">[% l('Temporary List') %]</a>
</li>
[% IF ctx.user_setting_map.$dsetting;
+ label = (ctx.default_bookbag) ? ctx.default_bookbag : l('Default List');
class = (ctx.bookbags.size) ? "default divider" : "default";
href = mkurl(ctx.opac_root _ '/myopac/list/update',
{action => 'add_rec', list => ctx.user_setting_map.$dsetting,
record => ctx.bre_id, anchor => ctx.bre_id}, stop_parms);
%]
<li class="[% class %]">
- <a href="[% href %]">[% l('Default List') %]</a>
+ <a href="[% href %]">[% label %]</a>
</li>
[% END %]
[% IF ctx.bookbags.size;
</li>
[% IF ctx.user_setting_map.$dsetting;
class = (ctx.bookbags.size) ? "default divider" : "default";
+ label = (ctx.default_bookbag) ? ctx.default_bookbag : l('Default List');
href = mkurl(ctx.opac_root _ '/myopac/list/update',
{action => 'add_rec', list => ctx.user_setting_map.$dsetting,
record => rec.id, anchor => 'record_' _ rec.id}, 1);
%]
<li class="[% class %]">
- <a href="[% href %]">[% l('Default List') %]</a>
+ <a href="[% href %]">[% label %]</a>
</li>
[% END %]
[% IF ctx.bookbags.size;
</li>
<li class="new">
<a href="[% mkurl(ctx.opac_root _ '/myopac/lists',
- {add_rec => rec.id, anchor => 'record_' _ rec.id}, 0) %]">
+ {add_rec => rec.id, anchor => 'record_' _ rec.id}, 0) %]">
[% l('Add to new list') %]
</a>
</li>