@@ -, +, @@ permissions --- ...98_add_permissions_circulate_self_checkout.perl | 27 ++++++++++++++++++++++ .../data/mysql/en/mandatory/userpermissions.sql | 1 + 2 files changed, 28 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl --- a/installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl +++ a/installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl @@ -0,0 +1,27 @@ +use Modern::Perl; + +use C4::Context; +my $dbh = C4::Context->dbh; + +$dbh->do(q| + INSERT INTO permissions (module_bit, code, description) + VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID') +|); + +my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); + +$dbh->do(q| + UPDATE borrowers + SET flags=0 + WHERE userid=? +|, undef, $AutoSelfCheckID); + +$dbh->do(q| + DELETE FROM user_permissions + WHERE borrowernumber=(SELECT borrowernumber FROM borrowers WHERE userid=?) +|, undef, $AutoSelfCheckID); + +$dbh->do(q| + INSERT INTO user_permissions(borrowernumber, module_bit, code) + SELECT borrowernumber, 1, 'self_checkout' FROM borrowers WHERE userid=? +|, undef, $AutoSelfCheckID); --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ a/installer/data/mysql/en/mandatory/userpermissions.sql @@ -4,6 +4,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'overdues_report', 'Execute overdue items report'), ( 1, 'force_checkout', 'Force checkout if a limitation exists'), ( 1, 'manage_restrictions', 'Manage restrictions for accounts'), + ( 1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), --