Bugzilla – Attachment 7303 Details for
Bug 4158
cannot create list whose title is '0'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Now allows list names that evaluate to false. Also doesn't allow list names that have leading or trailing whitespace.
0014-Bug-4158-Now-allows-lists-called-0-and-doesn-t-allow.patch (text/plain), 4.46 KB, created by
Aleksa Vujicic
on 2012-01-23 23:09:33 UTC
(
hide
)
Description:
Now allows list names that evaluate to false. Also doesn't allow list names that have leading or trailing whitespace.
Filename:
MIME Type:
Creator:
Aleksa Vujicic
Created:
2012-01-23 23:09:33 UTC
Size:
4.46 KB
patch
obsolete
>From 434b0cb277bf9b45a4d92b5f6161631bc3585c4f Mon Sep 17 00:00:00 2001 >From: Aleksa Vujicic <aleksa@catalyst.net.nz> >Date: Wed, 18 Jan 2012 09:34:20 +1300 >Subject: [PATCH 14/20] Bug 4158: Now allows lists called '0' and doesn't > allow lists that start or end with whitespace > >--- > C4/VirtualShelves/Page.pm | 3 ++- > .../prog/en/modules/virtualshelves/shelves.tt | 9 +++++---- > .../opac-tmpl/prog/en/modules/opac-shelves.tt | 13 ++++++++----- > 3 files changed, 15 insertions(+), 10 deletions(-) > >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index cfa4f60..ffab631 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -258,7 +258,8 @@ sub shelfpage ($$$$$) { > } > if ( $query->param('shelves') ) { > my $stay = 1; >- if ( my $newshelf = $query->param('addshelf') ) { >+ my $newshelf = $query->param('addshelf'); >+ if ($newshelf =~ /^\S.*\S$/ || $newshelf =~ /^\S$/) { > > # note: a user can always add a new shelf > my $shelfnumber = AddShelf( $newshelf, $query->param('owner'), $query->param('category'), $query->param('sortfield') ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 5b7e2db..ac2cffd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -94,12 +94,13 @@ function placeHold () { > function Check(f) { > var _alertString=""; > var alertString2; >+ var addshelf = $("#addshelf").val(); > >- if($("#addshelf").val() == "0"){ >- alert("The number 0 is not a valid name for a list, please enter another name."); >+ if ( !(/^\S.*\S$/.test(addshelf)) && !( /^\S$/.test(addshelf)) ) { >+ _alertString += _("The List Name is not valid."); > } > >- if($("#addshelf").val() == ""){ >+ if (addshelf == ""){ > _alertString += _("- You must enter a List Name") + "\n"; > } > >@@ -133,7 +134,7 @@ function placeHold () { > [% FOREACH paramsloo IN paramsloop %] > <div class="yui-ge"> > <div class="yui-u first"> >- [% IF ( paramsloo.already ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %] >+ [% IF ( paramsloo.already || paramsloo.already == 0 ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %] > [% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %] > [% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] > [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >index abf78b4..5fbe30d 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >@@ -117,13 +117,16 @@ $(function() { > function Check(f) { > var _alertString=""; > var alertString2; >+ var addshelf = f.addshelf.value; >+ >+ if ( !(/^\S.*\S$/.test(addshelf)) && !( /^\S$/.test(addshelf)) ) { >+ _alertString += _("The List Name is not valid."); >+ } > >- if(f.addshelf.value.length ==0){ >+ if(addshelf.length ==0){ > _alertString += _("- You must enter a List Name") + "\n"; > } >- else if(f.addshelf.value == "0"){ >- alert("The number '0' is not a valid name for a list, please enter another name."); >- } >+ > if (_alertString.length==0) { > f.submit(); > } else { >@@ -148,7 +151,7 @@ $(function() { > [% FOREACH paramsloo IN paramsloop %] > <div class="yui-ge"> > <div class="yui-u first"> >- [% IF ( paramsloo.already ) %]<div class="dialog alert">A List named <b>[% paramsloo.already %]</b> already exists!</div>[% END %] >+ [% IF ( paramsloo.already || paramsloo.already == 0 ) %]<div class="dialog alert">A List named <b>[% paramsloo.already %]</b> already exists!</div>[% END %] > [% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %] > [% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] > [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %] >-- >1.7.5.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4158
:
6878
| 7303