Bugzilla – Attachment 65726 Details for
Bug 11897
Stock Rotation for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11897: Interface for rota items from biblio
Bug-11897-Interface-for-rota-items-from-biblio.patch (text/plain), 13.66 KB, created by
Alex Sassmannshausen
on 2017-08-09 14:49:07 UTC
(
hide
)
Description:
Bug 11897: Interface for rota items from biblio
Filename:
MIME Type:
Creator:
Alex Sassmannshausen
Created:
2017-08-09 14:49:07 UTC
Size:
13.66 KB
patch
obsolete
>From 884a13f9c7b09e91be9730cbb3560afc001c8a29 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Wed, 14 Dec 2016 10:52:12 +0000 >Subject: [PATCH] Bug 11897: Interface for rota items from biblio > >* catalogue/stockrotation.pl: New file >* koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt: >New file >--- > catalogue/stockrotation.pl | 169 +++++++++++++++++++++ > .../prog/en/modules/catalogue/stockrotation.tt | 157 +++++++++++++++++++ > 2 files changed, 326 insertions(+) > create mode 100755 catalogue/stockrotation.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt > >diff --git a/catalogue/stockrotation.pl b/catalogue/stockrotation.pl >new file mode 100755 >index 0000000000..d12b17c62a >--- /dev/null >+++ b/catalogue/stockrotation.pl >@@ -0,0 +1,169 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 PTFS-Europe Ltd >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 stockrotation.pl >+ >+ Script to manage item assignments to stock rotation rotas. Including their >+ assiciated stages >+ >+=cut >+ >+use Modern::Perl; >+use CGI; >+ >+use C4::Auth; >+use C4::Output; >+use C4::Search; >+ >+use Koha::Biblio; >+use Koha::Item; >+use Koha::Stockrotationrotas; >+use Koha::Stockrotationstages; >+use Koha::Util::Stockrotation qw(:ALL); >+ >+my $input = new CGI; >+ >+my %params = $input->Vars(); >+ >+my $op = $params{op}; >+ >+my $biblionumber = $input->param('biblionumber'); >+ >+my ($template, $loggedinuser, $cookie) = get_template_and_user( >+ { >+ template_name => 'catalogue/stockrotation.tt', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { catalogue => 1 } >+ } >+); >+ >+if (!defined $op) { >+ >+ # List all items along with their associated rotas >+ my $biblio = Koha::Biblios->find($biblionumber); >+ >+ my $items = $biblio->items; >+ >+ # Get only rotas with stages >+ my $rotas = Koha::Stockrotationrotas->search( >+ { >+ 'stockrotationstages.stage_id' => { '!=', undef } >+ }, >+ { >+ join => 'stockrotationstages', >+ collapse => 1 >+ } >+ ); >+ >+ # Construct a model to pass to the view >+ my @item_data = (); >+ >+ while (my $item = $items->next) { >+ >+ my $item_hashref = { >+ bib_item => $item >+ }; >+ >+ my $stockrotationitem = $item->stockrotationitem; >+ >+ # If this item is on a rota >+ if ($stockrotationitem != 0) { >+ >+ # This item's rota >+ my $rota = $stockrotationitem->stage->rota; >+ >+ # This rota's stages >+ my $stages = get_stages($rota); >+ >+ $item_hashref->{rota} = $rota; >+ >+ $item_hashref->{stockrotationitem} = $stockrotationitem; >+ >+ $item_hashref->{stages} = $stages; >+ >+ } >+ >+ push @item_data, $item_hashref; >+ >+ } >+ >+ $template->param( >+ no_op_set => 1, >+ rotas => $rotas, >+ items => \@item_data, >+ branches => get_branches(), >+ biblio => $biblio, >+ biblionumber => $biblio->biblionumber, >+ stockrotationview => 1, >+ C4::Search::enabled_staff_search_views >+ ); >+ >+} elsif ($op eq "toggle_in_demand") { >+ >+ # Toggle in demand >+ toggle_indemand($params{item_id}, $params{stage_id}); >+ >+ # Return to items list >+ print $input->redirect("?biblionumber=$biblionumber"); >+ >+} elsif ($op eq "remove_item_from_stage") { >+ >+ # Remove from the stage >+ remove_from_stage($params{item_id}, $params{stage_id}); >+ >+ # Return to items list >+ print $input->redirect("?biblionumber=$biblionumber"); >+ >+} elsif ($op eq "move_to_next_stage") { >+ >+ move_to_next_stage($params{item_id}, $params{stage_id}); >+ >+ # Return to items list >+ print $input->redirect("?biblionumber=" . $params{biblionumber}); >+ >+} elsif ($op eq "add_item_to_rota") { >+ >+ my $item = Koha::Items->find($params{item_id}); >+ >+ $item->add_to_rota($params{rota_id}); >+ >+ print $input->redirect("?biblionumber=" . $params{biblionumber}); >+ >+} elsif ($op eq "confirm_remove_from_rota") { >+ >+ $template->param( >+ op => $params{op}, >+ stage_id => $params{stage_id}, >+ item_id => $params{item_id}, >+ biblionumber => $params{biblionumber}, >+ stockrotationview => 1, >+ C4::Search::enabled_staff_search_views >+ ); >+ >+} >+ >+output_html_with_http_headers $input, $cookie, $template->output; >+ >+=head1 AUTHOR >+ >+Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >+ >+=cut >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt >new file mode 100644 >index 0000000000..e4ead12837 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt >@@ -0,0 +1,157 @@ >+[% USE Koha %] >+[% USE Branches %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Catalog › Stock rotation details for [% biblio.title %]</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'browser-strings.inc' %] >+<!--[if lt IE 9]> >+<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >+<![endif]--> >+<script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+<script type="text/javascript"> >+//<![CDATA[ >+ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >+ browser.show(); >+//]]> >+</script> >+</head> >+<body id="catalog_stockrotation" class="catalog"> >+[% USE KohaDates %] >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'cat-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Stock rotation details for <i>[% biblio.title | html %][% FOREACH subtitle IN biblio.subtitles %][% subtitle.subfield %][% END %]</i></div> >+ >+<div id="doc3" class="yui-t2"> >+ >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ >+<div id="catalogue_detail_biblio"> >+ >+ [% IF no_op_set %] >+ <h1 class="title">Stock rotation details for [% biblio.title | html %]</h1> >+ [% IF rotas.count > 0 && items.size > 0 %] >+ >+ <table class="items_table dataTable no-footer" role="grid"> >+ <thead> >+ <tr> >+ <th>Barcode</th> >+ <th>Shelfmark</th> >+ <th>Rota</th> >+ <th>Rota status</th> >+ <th>In transit</th> >+ <th>Stages & duration in days<br>(current stage highlighted)</th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH item IN items %] >+ <tr> >+ <td>[% item.bib_item.barcode %]</td> >+ <td>[% item.bib_item.itemcallnumber %]</td> >+ <td> >+ [% item.rota.title %] >+ </td> >+ <td> >+ [% IF item.rota %] >+ [% IF !item.rota.active %] >+ <span class="highlighted-row"> >+ [% END %] >+ [% item.rota.active ? 'Active' : 'Inactive' %] >+ >+ [% IF !item.rota.active %] >+ </span> >+ [% END %] >+ [% END %] >+ </td> >+ <td> >+ [% item.bib_item.get_transfer ? 'Yes' : 'No' %] >+ </td> >+ <td> >+ [% FOREACH this_stage IN item.stages %] >+ [% IF this_stage.stage_id == item.stockrotationitem.stage.stage_id %] >+ <span class="stage highlight_stage"> >+ [% ELSE %] >+ <span class="stage"> >+ [% END %] >+ [% Branches.GetName(this_stage.branchcode_id) %] ([% this_stage.duration %]) >+ </span> >+ » >+ [% END %] >+ [% IF item.stages.size > 0 %] >+ <span class="stage">[% item.rota.cyclical ? 'START' : 'END' %]</span> >+ [% END %] >+ </td> >+ <td class="actions"> >+ [% IF item.stockrotationitem %] >+ [% in_transit = item.bib_item.get_transfer %] >+ [% IF !in_transit && item.stages.size > 1 %] >+ <a class="btn btn-mini" href="?op=move_to_next_stage&stage_id=[% item.stockrotationitem.stage.stage_id %]&item_id=[% item.bib_item.id %]&biblionumber=[% biblionumber %]"> >+ [% ELSE %] >+ <a class="btn btn-mini" disabled> >+ [% END %] >+ <i class="fa fa-arrow-right"></i> >+ Move to next stage >+ </a> >+ [% IF !in_transit %] >+ <a class="btn btn-mini" href="?op=toggle_in_demand&stage_id=[% item.stockrotationitem.stage.stage_id %]&item_id=[% item.bib_item.id %]&biblionumber=[% biblionumber %]"> >+ [% ELSE %] >+ <a class="btn btn-mini" disabled> >+ [% END %] >+ <i class="fa fa-fire"></i> >+ [% item.stockrotationitem.indemand ? 'Remove "In demand"' : 'Add "In demand"' %] >+ </a> >+ [% IF !in_transit %] >+ <a class="btn btn-mini" href="?op=confirm_remove_from_rota&stage_id=[% item.stockrotationitem.stage.stage_id %]&item_id=[% item.bib_item.id %]&biblionumber=[% biblionumber %]"> >+ [% ELSE %] >+ <a class="btn btn-mini" disabled> >+ [% END %] >+ <i class="fa fa-trash"></i> >+ Remove from rota >+ </a> >+ [% ELSE %] >+ <form class="rota_select_form" method="post" enctype="multipart/form-data"> >+ <select class="item_select_rota" name="rota_id"> >+ [% FOREACH rota IN rotas %] >+ <option value="[% rota.rota_id %]">[% rota.title %]</option> >+ [% END %] >+ </select> >+ <button class="btn btn-mini" type="submit"><i class="fa fa-plus"></i> Add to rota</button> >+ <input type="hidden" name="op" value="add_item_to_rota"></input> >+ <input type="hidden" name="item_id" value="[% item.bib_item.id %]"></input> >+ <input type="hidden" name="biblionumber" value="[% biblionumber %]"></input> >+ </form> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] >+ [% IF !items || items.size == 0 %] >+ <h1>No physical items for this record</h1> >+ [% END %] >+ [% IF !rotas || rotas.count == 0 %] >+ <h1>There are no rotas with stages assigned</h1> >+ [% END %] >+ [% ELSIF op == 'confirm_remove_from_rota' %] >+ <div class="dialog alert"> >+ <h3>Are you sure you want to remove this item from it's rota?</h3> >+ <p> >+ <a class="btn approve" href="?op=remove_item_from_stage&stage_id=[% stage_id %]&item_id=[% item_id %]&biblionumber=[% biblionumber %]"><i class="fa fa-fw fa-check"></i>Yes</a> >+ <a class="btn deny" href="?biblionumber=[% biblionumber %]"><i class="fa fa-fw fa-remove"></i>No</a> >+ </p> >+ </div> >+ [% END %] >+ >+</div> >+ >+</div> >+</div> >+<div class="yui-b"> >+[% INCLUDE 'biblio-view-menu.inc' %] >+</div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.11.0
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 11897
:
25887
|
58207
|
58208
|
58209
|
58210
|
58211
|
58212
|
58213
|
58214
|
58215
|
58216
|
58217
|
58218
|
58219
|
58280
|
58281
|
58687
|
58692
|
58693
|
58694
|
58695
|
58696
|
60175
|
60715
|
61825
|
61826
|
61827
|
61828
|
61829
|
61830
|
61831
|
61832
|
61833
|
61834
|
61835
|
61836
|
61837
|
61838
|
61839
|
61885
|
62730
|
62750
|
62751
|
62752
|
62753
|
62754
|
62755
|
62756
|
62757
|
62758
|
62759
|
62760
|
62761
|
62762
|
62763
|
62764
|
62765
|
62766
|
62767
|
63063
|
63064
|
63065
|
63066
|
63067
|
63068
|
63069
|
63070
|
63071
|
63072
|
63073
|
63074
|
63075
|
63076
|
63077
|
63078
|
63079
|
63080
|
63114
|
64850
|
64851
|
65715
|
65716
|
65717
|
65718
|
65719
|
65720
|
65721
|
65722
|
65723
|
65724
|
65725
|
65726
|
65727
|
65728
|
65729
|
65730
|
65731
|
65732
|
65733
|
65734
|
65735
|
65736
|
65737
|
65738
|
65739
|
65740
|
65741
|
65742
|
65743
|
65744
|
65745
|
65746
|
65747
|
65748
|
65749
|
65750
|
65751
|
65752
|
65753
|
65754
|
65755
|
65756
|
65757
|
65758
|
66381
|
70496
|
70497
|
70498
|
70499
|
70500
|
70501
|
70502
|
70503
|
70504
|
70505
|
70506
|
70507
|
70508
|
70509
|
70510
|
70511
|
70512
|
70513
|
70514
|
70515
|
70516
|
70517
|
70518
|
70519
|
70520
|
70521
|
70522
|
70523
|
70524
|
72124
|
72125
|
72126
|
72127
|
72128
|
74003
|
74004
|
74005
|
74006
|
74007
|
74008
|
74010
|
74011
|
74012
|
74013
|
74014
|
74015
|
74016
|
74017
|
74197
|
74198
|
74199
|
74200
|
74201
|
74202
|
74203
|
74204
|
74205
|
74206
|
74319
|
74320
|
74360
|
74459
|
74460
|
74461
|
74462
|
74463
|
74464
|
74465
|
74466
|
74467
|
74468
|
74469
|
74470
|
75409
|
75410
|
75411
|
75412
|
75413
|
75414
|
75415
|
75416
|
75417
|
75418
|
75419
|
75420
|
76121
|
76122
|
76123
|
76124
|
76125
|
76126
|
76127
|
76128
|
76129
|
76130
|
76131
|
76132
|
76133
|
76134
|
76135
|
76144
|
76706
|
76707
|
76708
|
76709
|
76710
|
77623
|
77624
|
77625
|
77626
|
78387
|
78388
|
78389
|
78390
|
78391
|
78392
|
78393
|
78394
|
78404
|
78405
|
78406
|
78407
|
78408
|
79040
|
79041
|
79042
|
79043
|
79044
|
79738
|
79739
|
79740
|
79741
|
79742
|
79746
|
79747
|
79748
|
79749
|
79750
|
79964
|
79965
|
79966
|
79967
|
79968
|
79969
|
79970
|
79971
|
79972
|
79973
|
79974
|
79975
|
80068
|
80087
|
80088
|
80089
|
80090
|
80091
|
80092
|
80093
|
80094
|
80095
|
80096
|
80097
|
80098
|
80099
|
80100
|
80118
|
80260
|
80261
|
80262
|
80263
|
80264
|
80265
|
80266
|
80267
|
80268
|
80269
|
80270
|
80271
|
80272
|
80273
|
80274
|
80275
|
80289
|
80298
|
80299
|
80300