[Koha-patches] [PATCH] bug_7825: Changed OPACItemHolds syspref to be no|tes|force choice

Marc Balmer marc at msys.ch
Tue Mar 27 08:05:48 CEST 2012


Am 27.03.2012 07:41, schrieb Srdjan:
> Amended opac-reserve.tt accordingly

Please remove the backquotes in column names, at least in SQL Code you 
change.  That will help to Support the efforts to run Koha on PostgreSQL.

Thanks,
Marc

> ---
>   installer/data/mysql/sysprefs.sql                  |    2 +-
>   installer/data/mysql/updatedatabase.pl             |    7 +++
>   .../prog/en/modules/admin/preferences/opac.pref    |    5 +-
>   .../opac-tmpl/prog/en/modules/opac-reserve.tt      |   42 +++++++-------------
>   4 files changed, 26 insertions(+), 30 deletions(-)
>
> diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
> index 3e850b3..359805a 100644
> --- a/installer/data/mysql/sysprefs.sql
> +++ b/installer/data/mysql/sysprefs.sql
> @@ -191,7 +191,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
>   INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
>   INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
>   INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
> -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
> +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','yes','Allow OPAC users to place hold on specific items. If No, users can only request next available copy. If Yes, users can choose between next available and specific copy. If Force, users *must* choose a specific copy.','no|yes|force','Choice');
>
>   INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
>   INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
> diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
> index 8259bf2..a34d02d 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -5036,6 +5036,13 @@ if ( C4::Context->preference("Version")<  TransformToNum($DBversion) ) {
>       SetVersion($DBversion);
>   }
>
> +$DBversion = "3.07.00.XXX";
> +if ( C4::Context->preference("Version")<  TransformToNum($DBversion) ) {
> +	$dbh->do("UPDATE systempreferences SET type = 'Choice', options = 'no|yes|force', value = CASE value WHEN '1' THEN 'yes' ELSE  'no' END, explanation = 'Allow OPAC users to place hold on specific items. If No, users can only request next available copy. If Yes, users can choose between next available and specific copy. If Force, users *must* choose a specific copy.' WHERE variable = 'OPACItemHolds'");
> +    print "Upgrade to $DBversion done (Changed OPACItemHolds syspref to Choice)\n";
> +    SetVersion($DBversion);
> +}
> +
>   =head1 FUNCTIONS
>
>   =head2 DropAllForeignKeys($table)
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> index ae6b620..1a75fd9 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> @@ -339,9 +339,10 @@ OPAC:
>           -
>               - pref: OPACItemHolds
>                 choices:
> -                  yes: Allow
>                     no: "Don't allow"
> -            - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item.
> +                  yes: Allow
> +                  force: Force
> +            - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item. If this is forced, users must put a hold on a specific item.
>           -
>               - pref: OpacRenewalAllowed
>                 choices:
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
> index 7597a4a..38527c4 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
> @@ -249,7 +249,7 @@
>   		<th>Hold Starts on Date</th>
>   		[% END %]
>   		<th>Hold Not Needed After</th>
> -                  [% IF ( OPACItemHolds ) %]
> +                  [% IF OPACItemHolds == 'yes' %]
>                       <th id="place_on_hdr" style="display:none">Place On</th>
>                     [% END %]
>                     [% UNLESS ( singleBranchMode ) %]
> @@ -384,50 +384,38 @@
>       </td>[% END %]
>
>                       [% IF ( bibitemloo.holdable ) %]
> -		<!-- HOLD ABLE -->
> -		    [% IF ( OPACItemHolds ) %]
> -		<!-- ITEM HOLDS -->
> +		<!-- HOLDABLE -->
> +		        [% IF OPACItemHolds == 'yes' %]
> +		<!-- ITEM HOLDS -->
>                                             <td class="place_on_type" style="display:none">
>                                               <ul>
>                                                   <li>
> -                                                  [% UNLESS ( bibitemloo.holdable ) %]
> -<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
> -                                                           id="reqany_[% bibitemloo.biblionumber %]"
> -                                                           class="selectany"
> -                                                           value="Any"
> -                                                           disabled="disabled"
> -                                                    />
> -                                                  [% ELSE %]
>                                                       <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
>                                                              id="reqany_[% bibitemloo.biblionumber %]"
>                                                              class="selectany"
>                                                              value="Any"
>                                                              checked="checked"
>                                                       />
> -                                                  [% END %]
> -<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
> +<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
>                                                   </li>
>                                                   <li>
> -                                                  [% UNLESS ( bibitemloo.holdable ) %]
> -<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
> -                                                           id="reqspecific_[% bibitemloo.biblionumber %]"
> -                                                           class="selectspecific"
> -                                                           disabled="disabled"
> -                                                           value="Specific"
> -                                                    />
> -                                                  [% ELSE %]
>                                                       <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
>                                                              id="reqspecific_[% bibitemloo.biblionumber %]"
>                                                              class="selectspecific"
>                                                              value="Specific"
>                                                       />
> -                                                  [% END %]
> -<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
> +<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
>                                                   </li>
>                                               </ul>
>                                             </td>
> -                                        [% END %][% END %]
> -
> +		        [% ELSIF OPACItemHolds == 'force' %]
> +<script type="text/javascript">
> +    $(document).ready(function() {
> +        $("#copiesrow_[% bibitemloo.biblionumber %]").show();
> +    });
> +</script>
> +                        [% END %]
> +                    [% END  # holdable%]
>                       [% UNLESS ( singleBranchMode ) %]
>                           [% IF ( bibitemloo.holdable ) %]
>   			    [% IF ( choose_branch ) %]
> @@ -459,7 +447,7 @@
>                       [% END %]
>                     </tr>
>
> -                  [% IF ( OPACItemHolds ) %]
> +                  [% IF OPACItemHolds == 'yes' || OPACItemHolds == 'force' %]
>                     [% IF ( bibitemloo.holdable ) %]
>                       <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
>                         <td>&nbsp;</td>



More information about the Koha-patches mailing list