[Koha-patches] [PATCH] [SIGNED-OFF] Bug 5811: Add sysprefs to control overriding fines

Jared Camins-Esakov jcamins at cpbibliography.com
Sat Mar 5 05:22:21 CET 2011


I'm not sure this should go in 3.2.x, but, if you think it should, I'll
resubmit one that applies.

On Fri, Mar 4, 2011 at 7:09 PM, Chris Nighswonger <
cnighswonger at foundations.edu> wrote:

> This patch does not apply cleanly to 3.2.x. Please fixup and resubmit with
> [3.2.x] in the subject line.
>
> Kind Regards,
> Chris
>
> # On branch 3.2.x
> # Your branch is ahead of 'origin/3.2.x' by 3 commits.
> #
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       modified:   C4/Circulation.pm
> #       modified:   C4/Members.pm
> #       modified:
> koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
> #
> # Unmerged paths:
> #   (use "git reset HEAD <file>..." to unstage)
> #   (use "git add/rm <file>..." as appropriate to mark resolution)
> #
> #       both modified:
> installer/data/mysql/de-DE/mandatory/sysprefs.sql
> #       both modified:      installer/data/mysql/en/mandatory/sysprefs.sql
> #       both modified:
> installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
> #       both modified:
> installer/data/mysql/it-IT/necessari/sysprefs.sql
> #       both modified:
> installer/data/mysql/pl-PL/mandatory/sysprefs.sql
> #       both modified:
> installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
> #       both modified:
> installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
> #       both modified:      installer/data/mysql/updatedatabase.pl
> #
>
>
>
>
> On Sun, Feb 20, 2011 at 9:55 PM, Nicole C. Engard <
> nengard at bywatersolutions.com> wrote:
>
>> From: Jared Camins-Esakov <jcamins at bywatersolutions.com>
>>
>> This patch adds two sysprefs to allow libraries more fine-grained control
>> over
>> when fines can and can't be overridden. The two sysprefs are:
>> * AllFinesNeedOverride - when this syspref is set to "Require" (default)
>> any
>>    fine will require a staffmember to override the fine in order to check
>> out a
>>    book.  When set to "Don't require," fines below noissuescharge will not
>> need
>>    any override.
>> * AllowFineOverride - when this syspref is set to "Allow," staff will be
>> able to
>>    override fines that are above noissuescharge. When set to "Don't allow"
>>    (default), staff will not be able to check out items to patrons with
>> fines
>>    greater than noissuescharge.
>>
>> Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
>> ---
>>  C4/Circulation.pm                                  |   17
>> ++++++++++++-----
>>  C4/Members.pm                                      |    2 +-
>>  installer/data/mysql/de-DE/mandatory/sysprefs.sql  |    2 ++
>>  installer/data/mysql/en/mandatory/sysprefs.sql     |    2 ++
>>  .../1-Obligatoire/unimarc_standard_systemprefs.sql |    4 +++-
>>  installer/data/mysql/it-IT/necessari/sysprefs.sql  |    4 +++-
>>  installer/data/mysql/pl-PL/mandatory/sysprefs.sql  |    4 +++-
>>  ...m_preferences_full_optimal_for_install_only.sql |    4 +++-
>>  ...m_preferences_full_optimal_for_install_only.sql |    4 +++-
>>  installer/data/mysql/updatedatabase.pl             |    8 ++++++++
>>  .../en/modules/admin/preferences/circulation.pref  |   12 ++++++++++++
>>  11 files changed, 52 insertions(+), 11 deletions(-)
>>
>> diff --git a/C4/Circulation.pm b/C4/Circulation.pm
>> index f7846ac..2b4e86c 100644
>> --- a/C4/Circulation.pm
>> +++ b/C4/Circulation.pm
>> @@ -730,17 +730,24 @@ sub CanBookBeIssued {
>>     # DEBTS
>>     my ($amount) =
>>       C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'},
>> '' && $duedate->output('iso') );
>> +    my $amountlimit = C4::Context->preference("noissuescharge");
>> +    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
>> +    my $allfinesneedoverride =
>> C4::Context->preference("AllFinesNeedOverride");
>>     if ( C4::Context->preference("IssuingInProcess") ) {
>> -        my $amountlimit = C4::Context->preference("noissuescharge");
>> -        if ( $amount > $amountlimit && !$inprocess ) {
>> +        if ( $amount > $amountlimit && !$inprocess &&
>> !$allowfineoverride) {
>>             $issuingimpossible{DEBT} = sprintf( "%.2f", $amount );
>> -        }
>> -        elsif ( $amount > 0 && $amount <= $amountlimit && !$inprocess ) {
>> +        } elsif ( $amount > $amountlimit && !$inprocess &&
>> $allowfineoverride) {
>> +            $needsconfirmation{DEBT} = sprintf( "%.2f", $amount );
>> +        } elsif ( $allfinesneedoverride && $amount > 0 && $amount <=
>> $amountlimit && !$inprocess ) {
>>             $needsconfirmation{DEBT} = sprintf( "%.2f", $amount );
>>         }
>>     }
>>     else {
>> -        if ( $amount > 0 ) {
>> +        if ( $amount > $amountlimit && $allowfineoverride ) {
>> +            $needsconfirmation{DEBT} = sprintf( "%.2f", $amount );
>> +        } elsif ( $amount > $amountlimit && !$allowfineoverride) {
>> +            $issuingimpossible{DEBT} = sprintf( "%.2f", $amount );
>> +        } elsif ( $amount > 0 && $allfinesneedoverride ) {
>>             $needsconfirmation{DEBT} = sprintf( "%.2f", $amount );
>>         }
>>     }
>> diff --git a/C4/Members.pm b/C4/Members.pm
>> index fafc99b..a292054 100644
>> --- a/C4/Members.pm
>> +++ b/C4/Members.pm
>> @@ -444,7 +444,7 @@ sub patronflags {
>>         my $noissuescharge = C4::Context->preference("noissuescharge") ||
>> 5;
>>         $flaginfo{'message'} = sprintf "Patron owes \$%.02f", $amount;
>>         $flaginfo{'amount'}  = sprintf "%.02f", $amount;
>> -        if ( $amount > $noissuescharge ) {
>> +        if ( $amount > $noissuescharge &&
>> !C4::Context->preference("AllowFineOverride") ) {
>>             $flaginfo{'noissues'} = 1;
>>         }
>>         $flags{'CHARGES'} = \%flaginfo;
>> diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
>> b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
>> index 02511d8..221017a 100644
>> --- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
>> +++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
>> @@ -285,3 +285,5 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql
>> b/installer/data/mysql/en/mandatory/sysprefs.sql
>> index 0b75e98..363774d 100644
>> --- a/installer/data/mysql/en/mandatory/sysprefs.sql
>> +++ b/installer/data/mysql/en/mandatory/sysprefs.sql
>> @@ -285,3 +285,5 @@ INSERT INTO `systempreferences`
>> (variable,value,explanation,options,type) VALUES
>>  INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>>  INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git
>> a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
>> b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
>> index 757f255..9386fee 100644
>> ---
>> a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
>> +++
>> b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
>> @@ -286,4 +286,6 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>> -INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> \ No newline at end of file
>> +INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql
>> b/installer/data/mysql/it-IT/necessari/sysprefs.sql
>> index 79c469c..49da6ce 100644
>> --- a/installer/data/mysql/it-IT/necessari/sysprefs.sql
>> +++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql
>> @@ -271,4 +271,6 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>> -INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> \ No newline at end of file
>> +INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
>> b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
>> index 8689c4c..5715de1 100644
>> --- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
>> +++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
>> @@ -283,4 +283,6 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>> -INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> \ No newline at end of file
>> +INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git
>> a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
>> b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
>> index c862e60..2b38cfa 100644
>> ---
>> a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
>> +++
>> b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
>> @@ -338,4 +338,6 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>> -INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> \ No newline at end of file
>> +INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git
>> a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
>> b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
>> index 82e285b..874a6e4 100644
>> ---
>> a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
>> +++
>> b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
>> @@ -363,4 +363,6 @@ INSERT INTO systempreferences
>> (variable,value,explanation,options,type) VALUES('
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding
>> items for the shelf browser.','1','YesNo');
>>  INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when
>> finding items for the shelf browser.','1','YesNo');
>> -INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> \ No newline at end of file
>> +INSERT INTO systempreferences (variable,value,explanation,options,type)
>> VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when
>> finding items for the shelf browser.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo');
>> +INSERT INTO `systempreferences` (variable,value,explanation,options,type)
>> VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override
>> every fine, even if it is below noissuescharge.','0','YesNo');
>> diff --git a/installer/data/mysql/updatedatabase.plb/installer/data/mysql/
>> updatedatabase.pl
>> index 31aa998..c297810 100755
>> --- a/installer/data/mysql/updatedatabase.pl
>> +++ b/installer/data/mysql/updatedatabase.pl
>> @@ -4014,6 +4014,14 @@ if (C4::Context->preference("Version") <
>> TransformToNum($DBversion)) {
>>     SetVersion ($DBversion);
>>  }
>>
>> +$DBversion = '3.03.00.XXX';
>> +if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> +    $dbh->do("INSERT INTO `systempreferences`
>> (variable,value,explanation,options,type) VALUES
>> ('AllowFineOverride','0','If on, staff will be able to issue books to
>> patrons with fines greater than noissuescharge.','0','YesNo')");
>> +    $dbh->do("INSERT INTO `systempreferences`
>> (variable,value,explanation,options,type) VALUES
>> ('AllFinesNeedOverride','1','If on, staff will be asked to override every
>> fine, even if it is below noissuescharge.','0','YesNo')");
>> +    print "Upgrade to $DBversion done (Bug 5811: Add sysprefs controlling
>> overriding fines)\n";
>> +    SetVersion($DBversion);
>> +};
>> +
>>  =head1 FUNCTIONS
>>
>>  =head2 DropAllForeignKeys($table)
>> diff --git
>> a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
>> b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
>> index 3742b23..87769b6 100644
>> ---
>> a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
>> +++
>> b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
>> @@ -86,6 +86,18 @@ Circulation:
>>                   no: "Don't allow"
>>             - staff to manually override the renewal limit and renew a
>> checkout when it would go over the renewal limit.
>>         -
>> +            - pref: AllFinesNeedOverride
>> +              choices:
>> +                  yes: Require
>> +                  no: "Don't require"
>> +            - staff to manually override all fines, even fines less than
>> noissuescharge.
>> +        -
>> +            - pref: AllowFineOverride
>> +              choices:
>> +                  yes: Allow
>> +                  no: "Don't allow"
>> +            - staff to manually override and check out items to patrons
>> who have more than noissuescharge in fines.
>> +        -
>>             - pref: InProcessingToShelvingCart
>>               choices:
>>                   yes: Move
>> --
>> 1.7.2.3
>>
>> _______________________________________________
>> Koha-patches mailing list
>> Koha-patches at lists.koha-community.org
>> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
>> website : http://www.koha-community.org/
>> git : http://git.koha-community.org/
>> bugs : http://bugs.koha-community.org/
>>
>
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>



-- 
Jared Camins-Esakov
Freelance bibliographer, C & P Bibliography Services, LLC
(phone) +1 (917) 727-3445
(e-mail) jcamins at cpbibliography.com
(web) http://www.cpbibliography.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20110304/9b215869/attachment-0001.htm>


More information about the Koha-patches mailing list