Bug 6748 - Add link to fast add framework while circulating, if a barcode is not...
authorChris Cormack <chrisc@catalyst.net.nz>
Fri, 19 Aug 2011 03:18:47 +0000 (15:18 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 26 Aug 2011 03:03:01 +0000 (15:03 +1200)
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
cataloguing/addbiblio.pl
cataloguing/additem.pl
koha-tmpl/intranet-tmpl/prog/en/lib/yui/imageloader/imageloader.js
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt

index b4d1e99..637d82d 100755 (executable)
@@ -835,7 +835,11 @@ my $frameworkcode = $input->param('frameworkcode');
 my $redirect      = $input->param('redirect');
 my $dbh           = C4::Context->dbh;
 
-my $userflags = ($frameworkcode eq 'FA') ? "fast_cataloging" : "edit_catalogue";
+    
+my $userflags = 'edit_catalogue';
+if ($frameworkcode eq 'FA'){
+    $userflags = 'fast_cataloging';
+}
 
 $frameworkcode = &GetFrameworkCode($biblionumber)
   if ( $biblionumber and not($frameworkcode) and $op ne 'addbiblio' );
@@ -843,7 +847,7 @@ $frameworkcode = &GetFrameworkCode($biblionumber)
 $frameworkcode = '' if ( $frameworkcode eq 'Default' );
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
-        template_name   => "cataloguing/addbiblio.tmpl",
+        template_name   => "cataloguing/addbiblio.tt",
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
@@ -851,6 +855,15 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
+if ($frameworkcode eq 'FA'){
+    # We need to grab and set some variables in the template for use on the additems screen
+    $template->{VARS}->{'circborrowernumber'} = $input->param('borrowernumber');
+    $template->{VARS}->{'barcode'} = $input->param('barcode');
+    $template->{VARS}->{'branch'} = $input->param('branch');
+    $template->{VARS}->{'stickyduedate'} = $input->param('stickyduedate');
+    $template->{VARS}->{'duedatespec'} = $input->param('duedatespec');
+}
+
 # Getting the list of all frameworks
 # get framework list
 my $frameworks = getframeworks;
@@ -940,12 +953,25 @@ if ( $op eq "addbiblio" ) {
             ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
         }
         if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view")){
-            print $input->redirect(
+           if ($frameworkcode eq 'FA'){
+               my $borrowernumber = $input->param('circborrowernumber');
+               my $barcode = $input->param('barcode');
+               my $branch = $input->param('branch');
+               my $stickyduedate = $input->param('stickyduedate');
+               my $duedatespec = $input->param('duedatespec');
+               print $input->redirect(
+                "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&borrowernumber=$borrowernumber&branch=$branch&barcode=$barcode&stickyduedate=$stickyduedate&duedatespec=$duedatespec"
+               );
+               exit;
+           }
+           else {
+               print $input->redirect(
                 "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode"
-            );
-            exit;
+               );
+               exit;
+           }
         }
-               elsif($is_a_modif || $redirect eq "view"){
+       elsif($is_a_modif || $redirect eq "view"){
             my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
             my $views = { C4::Search::enabled_staff_search_views };
             if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
@@ -959,7 +985,8 @@ if ( $op eq "addbiblio" ) {
             }
             exit;
 
-               }else {
+       }
+       else {
           $template->param(
             biblionumber => $biblionumber,
             done         =>1,
index ff09e77..275e236 100755 (executable)
@@ -1,8 +1,8 @@
 #!/usr/bin/perl
 
-
 # Copyright 2000-2002 Katipo Communications
 # Copyright 2004-2010 BibLibre
+# Parts Copyright Catalyst IT 2011
 #
 # This file is part of Koha.
 #
@@ -34,6 +34,7 @@ use C4::Dates;
 use List::MoreUtils qw/any/;
 
 use MARC::File::XML;
+use URI::Escape;
 
 my $dbh = C4::Context->dbh;
 
@@ -99,7 +100,8 @@ sub _increment_barcode {
 
 sub generate_subfield_form {
         my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i) = @_;
-        
+  
+  my $frameworkcode = &GetFrameworkCode($biblionumber);
         my %subfield_data;
         my $dbh = C4::Context->dbh;        
         my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib");
@@ -143,6 +145,10 @@ sub generate_subfield_form {
             }
         }
         
+        if ($frameworkcode eq 'FA' && $subfieldlib->{kohafield} eq 'items.barcode'){
+           my $input = new CGI;
+           $value = $input->param('barcode');
+       }
         my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" );
         my $attributes          = qq($attributes_no_value value="$value" );
         
@@ -284,7 +290,7 @@ if (not defined $userflags) {
 }
 
 my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "cataloguing/additem.tmpl",
+    = get_template_and_user({template_name => "cataloguing/additem.tt",
                  query => $input,
                  type => "intranet",
                  authnotrequired => 0,
@@ -415,6 +421,14 @@ if ($op eq "additem") {
            }
            undef($itemrecord);
        }
+    }  
+    if ($frameworkcode eq 'FA'){
+       my $redirect_string = 'borrowernumber=' . uri_escape($input->param('borrowernumber')) .
+         '&barcode=' . uri_escape($input->param('barcode'));
+       $redirect_string .= '&duedatespec=' . uri_escape($input->param('duedatespec')) . 
+         '&stickyduedate=1';
+       print $input->redirect("/cgi-bin/koha/circ/circulation.pl?" . $redirect_string);
+       exit;
     }
 
 
@@ -574,7 +588,11 @@ my $onlymine = C4::Context->preference('IndependantBranches') &&
                C4::Context->userenv                           && 
                C4::Context->userenv->{flags}!=1               && 
                C4::Context->userenv->{branch};
-my $branches = GetBranchesLoop(C4::Context->userenv->{branch},$onlymine);  # build once ahead of time, instead of multiple times later.
+my $branch = C4::Context->userenv->{branch};
+if ($frameworkcode eq 'FA'){
+    $branch = $input->param('branch');
+}    
+my $branches = GetBranchesLoop($branch,$onlymine);  # build once ahead of time, instead of multiple times later.
 
 # We generate form, from actuel record
 @fields = ();
@@ -634,6 +652,14 @@ $template->param(
     opisadd => ($nextop eq "saveitem") ? 0 : 1,
     C4::Search::enabled_staff_search_views,
 );
+
+if ($frameworkcode eq 'FA'){
+    $template->{VARS}->{'borrowernumber'}=$input->param('borrowernumber');
+    $template->{VARS}->{'barcode'}=$input->param('barcode');
+    $template->{VARS}->{'stickyduedate'}=$input->param('stickduedate');
+    $template->{VARS}->{'duedatespec'}=$input->param('duedatespec');
+}    
+
 foreach my $error (@errors) {
     $template->param($error => 1);
 }
index fbee97d..e7b2a35 100644 (file)
@@ -479,3 +479,202 @@ YAHOO.util.ImageLoader.pngBgImgObj.prototype._applyUrl = function(el) {
        }
 };
 YAHOO.register("imageloader", YAHOO.util.ImageLoader, {version: "2.8.0r4", build: "2449"});
+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\8c¾@\1e,V"Ţѭ¡Á´¡\83tion(el) {
+};
+
+/**
+ * Background image object. A background image is one whose URL is specified by "background-image" in the element's style
+ * @class YAHOO.util.ImageLoader.bgImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ */
+YAHOO.util.ImageLoader.bgImgObj = function(domId, url) {
+       YAHOO.util.ImageLoader.bgImgObj.superclass.constructor.call(this, domId, url);
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.bgImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * Sets style.backgroundImage
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.bgImgObj.prototype._applyUrl = function(el) {
+       el.style.backgroundImage = "url('" + this.url + "')";
+};
+
+/**
+ * Source image object. A source image is one whose URL is specified by a src attribute in the DOM element
+ * @class YAHOO.util.ImageLoader.srcImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ * @param {Int}        width   pixel width of the image - defaults to image's natural size
+ * @param {Int}        height  pixel height of the image - defaults to image's natural size
+ */
+YAHOO.util.ImageLoader.srcImgObj = function(domId, url, width, height) {
+       YAHOO.util.ImageLoader.srcImgObj.superclass.constructor.call(this, domId, url);
+       this.width = width;
+       this.height = height;
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.srcImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * Sets src
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.srcImgObj.prototype._applyUrl = function(el) {
+       el.src = this.url;
+};
+
+/**
+ * PNG background image object. A PNG background image is one whose URL is specified through AlphaImageLoader or by "background-image" in the element's style
+ * @class YAHOO.util.ImageLoader.pngBgImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ * @param {Object}  ailProps The AlphaImageLoader properties to be set for the image
+ *                    Valid properties are 'sizingMethod' and 'enabled'
+ */
+YAHOO.util.ImageLoader.pngBgImgObj = function(domId, url, ailProps) {
+       YAHOO.util.ImageLoader.pngBgImgObj.superclass.constructor.call(this, domId, url);
+
+       /**
+        * AlphaImageLoader properties to be set for the image.
+        * Valid properties are "sizingMethod" and "enabled".
+        * @property props
+        * @type Object
+        */
+       this.props = ailProps || {};
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.pngBgImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * If the browser is determined to be IE6 (or older), sets the AlphaImageLoader src; otherwise sets style.backgroundImage
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.pngBgImgObj.prototype._applyUrl = function(el) {
+       if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+               var sizingMethod = (YAHOO.lang.isUndefined(this.props.sizingMethod)) ? 'scale' : this.props.sizingMethod;
+               var enabled = (YAHOO.lang.isUndefined(this.props.enabled)) ? 'true' : this.props.enabled;
+               el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.url + '", sizingMethod="' + sizingMethod + '", enabled="' + enabled + '")';
+       }
+       else {
+               el.style.backgroundImage = "url('" + this.url + "')";
+       }
+};
+YAHOO.register("imageloader", YAHOO.util.ImageLoader, {version: "2.8.0r4", build: "2449"});
+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07»Rê,d\81\95\92\83Ð\7ftion(el) {
+};
+
+/**
+ * Background image object. A background image is one whose URL is specified by "background-image" in the element's style
+ * @class YAHOO.util.ImageLoader.bgImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ */
+YAHOO.util.ImageLoader.bgImgObj = function(domId, url) {
+       YAHOO.util.ImageLoader.bgImgObj.superclass.constructor.call(this, domId, url);
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.bgImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * Sets style.backgroundImage
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.bgImgObj.prototype._applyUrl = function(el) {
+       el.style.backgroundImage = "url('" + this.url + "')";
+};
+
+/**
+ * Source image object. A source image is one whose URL is specified by a src attribute in the DOM element
+ * @class YAHOO.util.ImageLoader.srcImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ * @param {Int}        width   pixel width of the image - defaults to image's natural size
+ * @param {Int}        height  pixel height of the image - defaults to image's natural size
+ */
+YAHOO.util.ImageLoader.srcImgObj = function(domId, url, width, height) {
+       YAHOO.util.ImageLoader.srcImgObj.superclass.constructor.call(this, domId, url);
+       this.width = width;
+       this.height = height;
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.srcImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * Sets src
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.srcImgObj.prototype._applyUrl = function(el) {
+       el.src = this.url;
+};
+
+/**
+ * PNG background image object. A PNG background image is one whose URL is specified through AlphaImageLoader or by "background-image" in the element's style
+ * @class YAHOO.util.ImageLoader.pngBgImgObj
+ * @constructor
+ * @extends YAHOO.util.ImageLoader.imgObj
+ * @param {String}     domId   HTML DOM id of the image element
+ * @param {String}     url     URL for the image
+ * @param {Object}  ailProps The AlphaImageLoader properties to be set for the image
+ *                    Valid properties are 'sizingMethod' and 'enabled'
+ */
+YAHOO.util.ImageLoader.pngBgImgObj = function(domId, url, ailProps) {
+       YAHOO.util.ImageLoader.pngBgImgObj.superclass.constructor.call(this, domId, url);
+
+       /**
+        * AlphaImageLoader properties to be set for the image.
+        * Valid properties are "sizingMethod" and "enabled".
+        * @property props
+        * @type Object
+        */
+       this.props = ailProps || {};
+};
+
+YAHOO.lang.extend(YAHOO.util.ImageLoader.pngBgImgObj, YAHOO.util.ImageLoader.imgObj);
+
+/**
+ * Inserts the image URL into the DOM so that the image is displayed.
+ * If the browser is determined to be IE6 (or older), sets the AlphaImageLoader src; otherwise sets style.backgroundImage
+ * @method _applyUrl
+ * @param {Object}     el      HTML DOM element
+ * @private
+ */
+YAHOO.util.ImageLoader.pngBgImgObj.prototype._applyUrl = function(el) {
+       if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+               var sizingMethod = (YAHOO.lang.isUndefined(this.props.sizingMethod)) ? 'scale' : this.props.sizingMethod;
+               var enabled = (YAHOO.lang.isUndefined(this.props.enabled)) ? 'true' : this.props.enabled;
+               el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.url + '", sizingMethod="' + sizingMethod + '", enabled="' + enabled + '")';
+       }
+       else {
+               el.style.backgroundImage = "url('" + this.url + "')";
+       }
+};
+YAHOO.register("imageloader", YAHOO.util.ImageLoader, {version: "2.8.0r4", build: "2449"});
+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\ No newline at end of file
index 71e6133..173e0cf 100644 (file)
@@ -899,6 +899,13 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
     </div>
 [% END %]
 </div>
+<!-- Fields for fast add cataloguing -->
+<input type="hidden" name="barcode" value="[% barcode %]" />
+<input type="hidden" name="branch" value="[% branch %]" />
+<input type="hidden" name="circborrowernumber" value="[% circborrowernumber %]" />
+<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
+<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
+<!-- /End of fast add fields -->
 </form>
 
 </div>
index b000d85..2bd5ab5 100644 (file)
@@ -271,6 +271,12 @@ function set_to_today(id, force) {
     <input type="hidden" name="field_value" value="[% itemnumber %]" />
     <input type="submit" value="Save Changes" onclick="return Check(this.form)" />
     [% END %]</fieldset>
+    
+    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
+    <input type="hidden" name="stickyduedate"" value="[% stickyduedate %]" />
+    <input type="hidden" name="barcode" value="[% barcode %]" />
+    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
+
 
     </form>
 </div>
index 60c773f..fb69c51 100644 (file)
@@ -346,7 +346,7 @@ function refocus(calendar) {
             <li>The barcode was not found [% barcode %]</li>
            [% IF ( fast_cataloging ) %]
                [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
-                    <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA">Fast cataloging</a>
+                    <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&barcode=[% barcode %]&borrowernumber=[% borrowernumber %]&branch=[% branch %]&duedatespec=[% duedatespec %]&stickyduedate=[% stickyduedate %]">Fast cataloging</a>
                [% END %]
            [% END %]
         [% END %]