From 9247a33f869879b195a825d7213d9d7d2b348931 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 17 Jul 2019 14:03:30 +0100 Subject: [PATCH] Bug 23321: Add cash register permission Sponsored-by: PTFS Europe Sponsored-by: Cheshire Libraries Shared Services Signed-off-by: Maryse Simard Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- .../atomicupdate/bug_23321_permissions.perl | 18 ++++++++++++++++++ installer/data/mysql/userflags.sql | 3 ++- installer/data/mysql/userpermissions.sql | 3 ++- .../prog/en/includes/permissions.inc | 9 +++++++++ members/member-flags.pl | 1 + 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23321_permissions.perl diff --git a/installer/data/mysql/atomicupdate/bug_23321_permissions.perl b/installer/data/mysql/atomicupdate/bug_23321_permissions.perl new file mode 100644 index 0000000000..9d08ac49d7 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23321_permissions.perl @@ -0,0 +1,18 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + $dbh->do(qq{ + INSERT IGNORE INTO `userflags` (`bit`, `flag`, `flagdesc`, `defaulton`) + VALUES (25, 'cash_management', 'Cash management', 0) + }); + + $dbh->do(qq{ + INSERT IGNORE permissions (module_bit, code, description) + VALUES + (25, 'manage_cash_registers', 'Add and remove cash registers') + }); + + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 23321 - Add cash register permissions)\n"; +} diff --git a/installer/data/mysql/userflags.sql b/installer/data/mysql/userflags.sql index 7712a9b709..5b1748d15d 100644 --- a/installer/data/mysql/userflags.sql +++ b/installer/data/mysql/userflags.sql @@ -20,5 +20,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (21, 'clubs', 'Patron clubs', '0'), (22,'ill','The Interlibrary Loans Module',0), (23,'self_check','Self check modules',0), -(24, 'stockrotation', 'Manage stockrotation operations', 0) +(24, 'stockrotation', 'Manage stockrotation operations', 0), +(25, 'cash_management', 'Cash management', 0) ; diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index 4401b5dda6..d9caa0e454 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -116,5 +116,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES (23, 'self_checkin_module', 'Log into the self check-in module'), (23, 'self_checkout_module', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID'), (24, 'manage_rotas', 'Create, edit and delete rotas'), - (24, 'manage_rota_items', 'Add and remove items from rotas') + (24, 'manage_rota_items', 'Add and remove items from rotas'), + (25, 'manage_cash_registers', 'Add and remove cash registers') ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 26f779a1ff..e3faeddbba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -66,6 +66,9 @@ [%- CASE 'stockrotation' -%] Manage stockrotation operations ([% name | html %]) + [%- CASE 'cash_management' -%] + Cash management + ([% name | html %]) [%- END -%] [%- END -%] @@ -667,5 +670,11 @@ Create, edit and delete rotas ([% name | html %]) + [%# cash_management %] + [%- CASE 'manage_cash_registers' -%] + + Add, edit and archive cash registers + + ([% name | html %]) [%- END -%] [%- END -%] diff --git a/members/member-flags.pl b/members/member-flags.pl index 9657a92246..f493a0605c 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -178,6 +178,7 @@ if ($input->param('newflags')) { if ($#sub_perm_loop > -1) { $row{sub_perm_loop} = \@sub_perm_loop; } + next if ( ( $row{flag} eq 'cash_management' ) && !C4::Context->preference('UseCashRegisters') ); push @loop, \%row; } -- 2.39.5