View | Details | Raw Unified | Return to bug 8836
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 1899-1905 sub AddReturn { Link Here
1899
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1899
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1900
1900
1901
    # if we have a transfer to do, we update the line of transfers with the datearrived
1901
    # if we have a transfer to do, we update the line of transfers with the datearrived
1902
    my $is_in_rotating_collection = 1 if C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} );
1902
    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} );
1903
    if ($datesent) {
1903
    if ($datesent) {
1904
        if ( $tobranch eq $branch ) {
1904
        if ( $tobranch eq $branch ) {
1905
            my $sth = C4::Context->dbh->prepare(
1905
            my $sth = C4::Context->dbh->prepare(
(-)a/C4/RotatingCollections.pm (-19 / +18 lines)
Lines 26-32 use Modern::Perl; Link Here
26
26
27
use C4::Context;
27
use C4::Context;
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Reserves qw(GetReserveStatus);
29
use C4::Reserves qw(CheckReserves);
30
30
31
use DBI;
31
use DBI;
32
32
Lines 86-95 sub CreateCollection { Link Here
86
86
87
    ## Check for all neccessary parameters
87
    ## Check for all neccessary parameters
88
    if ( !$title ) {
88
    if ( !$title ) {
89
        return ( 0, 1, "No Title Given" );
89
        return ( 0, 1, "NO_TITLE" );
90
    }
90
    }
91
    if ( !$description ) {
91
    if ( !$description ) {
92
        return ( 0, 2, "No Description Given" );
92
        return ( 0, 2, "NO_DESCRIPTION" );
93
    }
93
    }
94
94
95
    my $success = 1;
95
    my $success = 1;
Lines 130-142 sub UpdateCollection { Link Here
130
130
131
    ## Check for all neccessary parameters
131
    ## Check for all neccessary parameters
132
    if ( !$colId ) {
132
    if ( !$colId ) {
133
        return ( 0, 1, "No Id Given" );
133
        return ( 0, 1, "NO_ID" );
134
    }
134
    }
135
    if ( !$title ) {
135
    if ( !$title ) {
136
        return ( 0, 2, "No Title Given" );
136
        return ( 0, 2, "NO_TITLE" );
137
    }
137
    }
138
    if ( !$description ) {
138
    if ( !$description ) {
139
        return ( 0, 3, "No Description Given" );
139
        return ( 0, 3, "NO_DESCRIPTION" );
140
    }
140
    }
141
141
142
    my $dbh = C4::Context->dbh;
142
    my $dbh = C4::Context->dbh;
Lines 175-181 sub DeleteCollection { Link Here
175
175
176
    ## Paramter check
176
    ## Paramter check
177
    if ( !$colId ) {
177
    if ( !$colId ) {
178
        return ( 0, 1, "No Collection Id Given" );
178
        return ( 0, 1, "NO_ID" );
179
    }
179
    }
180
180
181
    my $dbh = C4::Context->dbh;
181
    my $dbh = C4::Context->dbh;
Lines 239-245 sub GetItemsInCollection { Link Here
239
239
240
    ## Paramter check
240
    ## Paramter check
241
    if ( !$colId ) {
241
    if ( !$colId ) {
242
        return ( 0, 0, 1, "No Collection Id Given" );
242
        return ( 0, 0, 1, "NO_ID" );
243
    }
243
    }
244
244
245
    my $dbh = C4::Context->dbh;
245
    my $dbh = C4::Context->dbh;
Lines 317-333 sub AddItemToCollection { Link Here
317
317
318
    ## Check for all neccessary parameters
318
    ## Check for all neccessary parameters
319
    if ( !$colId ) {
319
    if ( !$colId ) {
320
        return ( 0, 1, "No Collection Given" );
320
        return ( 0, 1, "NO_ID" );
321
    }
321
    }
322
    if ( !$itemnumber ) {
322
    if ( !$itemnumber ) {
323
        return ( 0, 2, "No Itemnumber Given" );
323
        return ( 0, 2, "NO_ITEM" );
324
    }
324
    }
325
325
326
    if ( isItemInThisCollection( $itemnumber, $colId ) ) {
326
    if ( isItemInThisCollection( $itemnumber, $colId ) ) {
327
        return ( 0, 2, "Item is already in the collection!" );
327
        return ( 0, 2, "IN_COLLECTION" );
328
    }
328
    }
329
    elsif ( isItemInAnyCollection($itemnumber) ) {
329
    elsif ( isItemInAnyCollection($itemnumber) ) {
330
        return ( 0, 3, "Item is already in a different collection!" );
330
        return ( 0, 3, "IN_COLLECTION_OTHER" );
331
    }
331
    }
332
332
333
    my $dbh = C4::Context->dbh;
333
    my $dbh = C4::Context->dbh;
Lines 367-377 sub RemoveItemFromCollection { Link Here
367
367
368
    ## Check for all neccessary parameters
368
    ## Check for all neccessary parameters
369
    if ( !$itemnumber ) {
369
    if ( !$itemnumber ) {
370
        return ( 0, 2, "No Itemnumber Given" );
370
        return ( 0, 2, "NO_ITEM" );
371
    }
371
    }
372
372
373
    if ( !isItemInThisCollection( $itemnumber, $colId ) ) {
373
    if ( !isItemInThisCollection( $itemnumber, $colId ) ) {
374
        return ( 0, 2, "Item is not in the collection!" );
374
        return ( 0, 2, "NOT_IN_COLLECTION" );
375
    }
375
    }
376
376
377
    my $dbh = C4::Context->dbh;
377
    my $dbh = C4::Context->dbh;
Lines 408-417 sub TransferCollection { Link Here
408
408
409
    ## Check for all neccessary parameters
409
    ## Check for all neccessary parameters
410
    if ( !$colId ) {
410
    if ( !$colId ) {
411
        return ( 0, 1, "No Id Given" );
411
        return ( 0, 1, "NO_ID" );
412
    }
412
    }
413
    if ( !$colBranchcode ) {
413
    if ( !$colBranchcode ) {
414
        return ( 0, 2, "No Branchcode Given" );
414
        return ( 0, 2, "NO_BRANCHCODE" );
415
    }
415
    }
416
416
417
    my $dbh = C4::Context->dbh;
417
    my $dbh = C4::Context->dbh;
Lines 435-443 sub TransferCollection { Link Here
435
    $sth->execute($colId) or return ( 0, 4, $sth->errstr );
435
    $sth->execute($colId) or return ( 0, 4, $sth->errstr );
436
    my @results;
436
    my @results;
437
    while ( my $item = $sth->fetchrow_hashref ) {
437
    while ( my $item = $sth->fetchrow_hashref ) {
438
        transferbook( $colBranchcode, $item->{barcode},
438
        my ($status) = CheckReserves( $item->{itemnumber} );
439
            my $ignore_reserves = 1 )
439
        transferbook( $colBranchcode, $item->{barcode}, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' );
440
          unless ( GetReserveStatus( $item->{itemnumber} ) eq "Waiting" );
441
    }
440
    }
442
441
443
    return 1;
442
    return 1;
(-)a/installer/data/mysql/updatedatabase.pl (-6 / +2 lines)
Lines 8955-8967 if ( CheckVersion($DBversion) ) { Link Here
8955
$DBversion = "3.17.00.XXX";
8955
$DBversion = "3.17.00.XXX";
8956
if ( CheckVersion($DBversion) ) {
8956
if ( CheckVersion($DBversion) ) {
8957
    $dbh->do(q{
8957
    $dbh->do(q{
8958
        ALTER TABLE collections CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL
8959
    });
8960
    $dbh->do(q{
8961
        ALTER TABLE collections ADD INDEX ( colBranchcode )
8962
    });
8963
    $dbh->do(q{
8964
        ALTER TABLE collections
8958
        ALTER TABLE collections
8959
            CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL,
8960
            ADD INDEX ( colBranchcode ),
8965
            ADD CONSTRAINT collections_ibfk_1 FOREIGN KEY (colBranchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
8961
            ADD CONSTRAINT collections_ibfk_1 FOREIGN KEY (colBranchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
8966
    });
8962
    });
8967
    print "Upgrade to $DBversion done (Bug 8836 - Resurrect Rotating Collections)\n";
8963
    print "Upgrade to $DBversion done (Bug 8836 - Resurrect Rotating Collections)\n";
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (-2 lines)
Lines 66-76 Link Here
66
	<li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
66
	<li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
67
	<li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
67
	<li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
68
    [% END %]
68
    [% END %]
69
<!--
70
    [% IF ( CAN_user_tools_rotating_collections ) %]
69
    [% IF ( CAN_user_tools_rotating_collections ) %]
71
    <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
70
    <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
72
    [% END %]
71
    [% END %]
73
-->
74
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
72
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
75
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
73
        <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
76
    [% END %]
74
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt (-70 / +94 lines)
Lines 15-97 Link Here
15
15
16
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Add/Remove items</div>
16
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Add/Remove items</div>
17
17
18
<div id="doc3">
18
<div id="doc3" class="yui-t2">
19
<div id="bd">
19
    <div id="bd">
20
        <div class="yui-gb">
20
        <div class="yui-b">
21
            [% INCLUDE 'tools-menu.inc' %]
22
        </div>
21
23
22
      <h1>Rotating collections: Add/Remove items</h1>
24
        <div class="yui-main">
25
            <div class="yui-db">
23
26
24
      <div>
27
              <h1>Rotating collections: Add/Remove items</h1>
25
          <br />
26
          [% IF ( previousActionAdd ) %]
27
            [% IF ( addSuccess ) %]
28
              <div>Item with barcode '[% addedBarcode %]' Added successfully!</div>
29
            [% ELSE %]
30
              <div>Failed to add item with barcode '[% addedBarcode %]'!</div>
31
              <div>Reason: <strong>[% failureMessage %]</strong></div>
32
            [% END %]
33
          [% END %]
34
28
35
          [% IF ( previousActionRemove ) %]
29
              <div>
36
            [% IF ( removeSuccess ) %]
30
                  <br />
37
              <div>Item with barcode '[% addedBarcode %]' Removed successfully!</div>
31
                  [% IF ( previousActionAdd ) %]
38
            [% ELSE %]
32
                    [% IF ( addSuccess ) %]
39
              <div>Failed to remove item with barcode '[% removedBarcode %]'!</div>
33
                      <div class="alert">Item with barcode '[% barcode %]' added successfully!</div>
40
              <div>Reason: <strong>[% failureMessage %]</strong></div>
34
                    [% ELSE %]
41
            [% END %]
35
                      <div class="alert">
42
          [% END %]
36
                        <p>Failed to add item with barcode <i>[% barcode %]</i>:
37
                        <p>
38
                            [% IF failureMessage == "NO_ITEM" %]
39
                                No item with matching barcode found!
40
                            [% ELSIF failureMessage == "IN_COLLECTION_OTHER" %]
41
                                Item is already in a different rotating collection!
42
                            [% ELSE %]
43
                                [% failureMessage %]
44
                            [% END %]
45
                        </p>
46
                    </div>
47
                    [% END %]
48
                  [% END %]
43
49
44
          <h3>Add item to <i>[% colTitle %]</i></h3>
50
                  [% IF ( previousActionRemove ) %]
45
      </div>
51
                    [% IF ( removeSuccess ) %]
52
                      <div class="alert">Item with barcode <i>[% barcode %]</i> removed successfully!</div>
53
                    [% ELSE %]
54
                      <div class="alert">
55
                        Failed to remove item with barcode <i>[% barcode %]</i>:
56
                        <p>
57
                            [% IF failureMessage == "NO_ITEM" %]
58
                                No item with matching barcode found!
59
                            [% ELSE %]
60
                                [% failureMessage %]
61
                            [% END %]
62
                        </p>
63
                    </div>
64
                    [% END %]
65
                  [% END %]
46
66
47
      <div>
67
                  <h3>Add item to <i>[% colTitle %]</i></h3>
48
        <form action="addItems.pl" method="post">
68
              </div>
49
        <table>
50
          <tr>
51
            <th><label for="barcode">Barcode: </label></td>
52
            <td><input type="text" id="barcode" name="barcode" /></td>
53
            <td>
54
              [% IF ( removeChecked ) %]<input type="checkbox" name="removeItem" checked="checked" />
55
              [% ELSE %]<input type="checkbox" name="removeItem" />[% END %]
56
              <label for="removeItem">Remove item from collection</label>
57
            </td>
58
          </tr>
59
69
60
          <input type="hidden" id="colId" name="colId" value="[% colId %]" />
70
              <div>
61
          <input type="hidden" name="action" value="addItem" />
71
                <form action="addItems.pl" method="post">
62
          <tr><td align="right" colspan="99"><input type="submit" value="Submit" /></td></tr>
72
                <table>
63
        </table>
73
                  <tr>
64
        </form>
74
                    <th><label for="barcode">Barcode: </label></td>
65
      </div>
75
                    <td><input type="text" id="barcode" name="barcode" /></td>
76
                    <td>
77
                      [% IF ( removeChecked ) %]<input type="checkbox" name="removeItem" checked="checked" />
78
                      [% ELSE %]<input type="checkbox" name="removeItem" />[% END %]
79
                      <label for="removeItem">Remove item from collection</label>
80
                    </td>
81
                  </tr>
66
82
67
      <div>
83
                  <input type="hidden" id="colId" name="colId" value="[% colId %]" />
68
        <h2>Items in this collection</h2>
84
                  <input type="hidden" name="action" value="addItem" />
69
        [% IF ( collectionItemsLoop ) %]
85
                  <tr><td align="right" colspan="99"><input class="btn" type="submit" value="Submit" /></td></tr>
70
          <table>
86
                </table>
71
            <tr>
87
                </form>
72
              <th>Title</th>
88
              </div>
73
              <th>Call number</th>
74
              <th>Barcode</th>
75
            </tr>
76
            [% FOREACH collectionItemsLoo IN collectionItemsLoop %]
77
              <tr>
78
                <td>[% collectionItemsLoo.title |html %]</td>
79
                <td>[% collectionItemsLoo.itemcallnumber %]</td>
80
                <td>[% collectionItemsLoo.barcode %]</td>
81
              </tr>
82
            [% END %]
83
          </table>
84
        [% ELSE %]
85
          There are no items in this collection.
86
        [% END %]
87
      </div>
88
89
89
      <div>
90
              <div>
90
        <br/>
91
                <h2>Items in this collection</h2>
91
        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
92
                [% IF ( collectionItemsLoop ) %]
92
      </div>
93
                  <table>
94
                    <tr>
95
                      <th>Title</th>
96
                      <th>Call number</th>
97
                      <th>Barcode</th>
98
                    </tr>
99
                    [% FOREACH collectionItemsLoo IN collectionItemsLoop %]
100
                      <tr>
101
                        <td>[% collectionItemsLoo.title |html %]</td>
102
                        <td>[% collectionItemsLoo.itemcallnumber %]</td>
103
                        <td>[% collectionItemsLoo.barcode %]</td>
104
                      </tr>
105
                    [% END %]
106
                  </table>
107
                [% ELSE %]
108
                  There are no items in this collection.
109
                [% END %]
110
              </div>
93
111
94
</div>
112
              <div>
95
</div>
113
                <br/>
96
[% INCLUDE 'intranet-bottom.inc' %]
114
                <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
115
              </div>
116
117
            </div>
118
        </div>
119
    </div>
97
120
121
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt (-108 / +101 lines)
Lines 8-132 Link Here
8
8
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Edit collections</div>
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Edit collections</div>
10
10
11
<div id="doc3">
11
<div id="doc3" class="yui-t2">
12
<div id="bd">
12
    <div id="bd">
13
        <div class="yui-gb">
13
        <div class="yui-b">
14
      <h1>Rotating collections: Edit collections</h1>
14
           [% INCLUDE 'tools-menu.inc' %]
15
        </div>
15
16
16
<!--
17
        <div class="yui-main">
17
      [% IF ( previousActionCreate ) %]
18
            <div class="yui-bd">
18
        [% IF ( createSuccess ) %]
19
          <div>Collection '[% createdTitle %]' Created successfully!</div>
20
        [% ELSE %]
21
          <div>Collection '[% createdTitle %]' Failed to be created!</div>
22
          <div>Reason: <strong>[% failureMessage %]</strong></div>
23
        [% END %]
24
      [% END %]
25
19
26
      [% IF ( previousActionDelete ) %]
20
              [% IF ( previousActionCreate ) %]
27
        [% IF ( DeleteSuccess ) %]
21
                [% IF ( createSuccess ) %]
28
          <div>Collection Deleted successfully!</div>
22
                  <div class="alert">Collection <i>[% createdTitle %]</i> created successfully!</div>
29
        [% ELSE %]
23
                [% ELSE %]
30
          <div>Collection Failed to be deleted!</div>
24
                  <div class="alert">
31
        [% END %]
25
                    <p>Collection <i>[% createdTitle %]</i> failed to be created!</p>
32
      [% END %]
26
                    <p>
33
-->
27
                        [% IF failureMessage == "NO_TITLE" %]
28
                            No title entered.
29
                        [% ELSIF failureMessage == "NO_DESCRIPTION" %]
30
                            No description entered.
31
                        [% ELSE %]
32
                            [% failureMessage %]
33
                        [% END %]
34
                    </p>
35
                  </div>
36
                [% END %]
37
              [% END %]
38
39
              [% IF ( previousActionDelete ) %]
40
                [% IF ( deleteSuccess ) %]
41
                  <div class="alert">Collection deleted successfully!</div>
42
                [% ELSE %]
43
                  <div class="alert">Collection failed to be deleted!</div>
44
                [% END %]
45
              [% END %]
34
46
35
      [% IF ( previousActionUpdate ) %]
47
              [% IF ( previousActionUpdate ) %]
36
        [% IF ( updateSuccess ) %]
48
                [% IF ( updateSuccess ) %]
37
          <div>Collection '[% updatedTitle %]' Updated successfully!</div>
49
                  <div class="alert">Collection <i>[% updatedTitle %]</i> updated successfully!</div>
38
        [% ELSE %]
50
                [% ELSE %]
39
          <div>Collection '[% updatedTitle %]' Failed to be updated!</div>
51
                  <div class="alert">
40
          <div>Reason: <strong>[% failureMessage %]</strong></div>
52
                    <p>Collection <i>[% updatedTitle %]</i> failed to be updated!</p>
41
        [% END %]
53
                    <p>
42
      [% END %]
54
                        [% IF failureMessage == "NO_ID" %]
55
                            No collection id given.
56
                        [% ELSE %]
57
                            [% failureMessage %]
58
                        [% END %]
59
                    </p>
60
                </div>
61
                [% END %]
62
              [% END %]
43
63
44
      <div>
64
              <div>
45
        [% IF ( collectionsLoop ) %]
65
                <br />
46
          <table>
47
           <thead>
48
            <tr>
49
              <th>Title</th>
50
              <th>Description</th>
51
              <th>Holding library</th>
52
              <th>&nbsp;</th>
53
              <th>&nbsp;</th>
54
            </tr>
55
           <thead>
56
           <tbody>
57
            [% FOREACH collectionsLoo IN collectionsLoop %]
58
              <tr>
59
                <td>[% collectionsLoo.colTitle %]</td>
60
                <td>[% collectionsLoo.colDesc %]</td>
61
                <td>[% collectionsLoo.colBranchcode %]</td>
62
                <td><a href="editCollections.pl?action=edit&amp;colId=[% collectionsLoo.colId %]">Edit</a></td>
63
                <td><a href="editCollections.pl?action=delete&amp;colId=[% collectionsLoo.colId %]">Delete</a></td>
64
              </tr>
65
            [% END %]
66
           </tbody>
67
          </table>
68
        [% ELSE %]
69
          There are no collections currently defined.
70
        [% END %]
71
      </div>    
72
66
73
      <div>
67
                [% IF action == "new" || action == "edit" %]
74
        <br />
68
                    [% IF ( previousActionEdit ) %]
69
                      <h1>Edit collection <i>[% editColTitle %]</i></h1>
70
                    [% ELSE %]
71
                      <h1>Create new collection</h1>
72
                    [% END %]
75
73
76
        [% IF ( previousActionEdit ) %]
74
                    <form action="editCollections.pl" method="post">
77
          <h1>Edit Collection</h1>
75
                      [% IF ( previousActionEdit ) %]
78
        [% ELSE %]
76
                        <input type="hidden" name="action" value="update" />
79
          <h1>Create new collection</h1>
77
                        <input type="hidden" name="colId" value="[% editColId %]" />
80
        [% END %]
78
                      [% ELSE %]
79
                        <input type="hidden" name="action" value="create" />
80
                      [% END %]
81
81
82
        <form action="editCollections.pl" method="post">
82
                      <table>
83
          [% IF ( previousActionEdit ) %]
83
                        <tr>
84
            <input type="hidden" name="action" value="update" />
84
                          <td>
85
            <input type="hidden" name="colId" value="[% editColId %]" />
85
                            <label class="required" for="title">Title: </label>
86
          [% ELSE %]
86
                          </td>
87
            <input type="hidden" name="action" value="create" />
87
                          <td>
88
          [% END %]
88
                            [% IF ( editColTitle ) %]<input type="text" name="title" value="[% editColTitle %]" />
89
                            [% ELSE %]<input type="text" name="title" />[% END %]
90
                          </td>
91
                        </tr>
89
92
90
          <table>
93
                        <tr>
91
            <tr>
94
                          <td>
92
              <td>
95
                            <label class="required" for="description">Description: </label>
93
                <label for="title">Title: </label>
96
                          </td>
94
              </td>
97
                          <td>
95
              <td>
98
                            [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
96
                [% IF ( editColTitle ) %]<input type="text" name="title" value="[% editColTitle %]" />
99
                            [% ELSE %]<input type="text" size="50" name="description" />[% END %]
97
                [% ELSE %]<input type="text" name="title" />[% END %]
100
                          </td>
98
              </td>
101
                        </tr>
99
            </tr>
100
        
101
            <tr>
102
              <td>
103
                <label for="description">Description: </label>
104
              </td>
105
              <td>
106
                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
107
                [% ELSE %]<input type="text" size="50" name="description" />[% END %]
108
              </td>
109
            </tr>
110
102
111
            <tr>
103
                        <tr>
112
              <td colspan="2">
104
                          <td colspan="2">
113
                [% IF ( previousActionEdit ) %]
105
                            [% IF ( previousActionEdit ) %]
114
                  <input type="submit" value="Update" />
106
                              <input class="btn" type="submit" value="Update" />
115
                [% ELSE %]
107
                            [% ELSE %]
116
                  <input type="submit" value="Create" />
108
                              <input class="btn" type="submit" value="Create" />
109
                            [% END %]
110
                          </td>
111
                        </tr>
112
                      </table>
113
                    </form>
117
                [% END %]
114
                [% END %]
118
              </td>
115
              </div>
119
            </tr>
120
          </table>
121
        </form>
122
      </div>
123
116
124
      <div>
117
              <p>
125
        <br/>
118
                <a class="btn" href="rotatingCollections.pl">Return to rotating collections home</a>
126
        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
119
              </p>
127
      </div>
128
120
129
</div>
121
            </div>
130
</div>
122
        </div>
123
    </div>
131
[% INCLUDE 'intranet-bottom.inc' %]
124
[% INCLUDE 'intranet-bottom.inc' %]
132
125
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt (-35 / +46 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections</title>
3
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 8-47 Link Here
8
9
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Rotating collections</div>
10
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Rotating collections</div>
10
11
11
<div id="doc3">
12
<div id="doc3" class="yui-t2">
12
<div id="bd">
13
    <div id="bd">
13
        <div class="yui-gb">
14
        <div class="yui-b">
15
            [% INCLUDE 'tools-menu.inc' %]
16
        </div>
14
17
15
      <h1>Rotating collections</h1>
18
        <div class="yui-main">
16
      <div>
19
            <div class="yui-bd">
17
        [% IF ( collectionsLoop ) %]
18
          <table>
19
            <tr>
20
              <th><strong>Title</strong></th>
21
              <th>Description</strong></th>
22
              <th>Current location</th>
23
              <th>Add/Remove items</th>
24
              <th>Transfer collection</th>
25
            </tr>
26
            [% FOREACH collectionsLoo IN collectionsLoop %]
27
              <tr>
28
                <td>[% collectionsLoo.colTitle %]</td>
29
                <td>[% collectionsLoo.colDesc %]</td>
30
                <td>[% collectionsLoo.colBranchcode %]</td>
31
                <td><a href="addItems.pl?colId=[% collectionsLoo.colId %]">Add/Remove Items</a></td>
32
                <td><a href="transferCollection.pl?colId=[% collectionsLoo.colId %]">Transfer Collection</a></td>
33
              </tr>
34
            [% END %]
35
          </table>
36
        [% ELSE %]
37
          There are no collections currently defined.
38
        [% END %]
39
      </div>
40
20
41
      <div>
21
                <h1>Rotating collections</h1>
42
	<br/>
22
                <div>
43
    <input type="button" value="Edit collections" onclick="window.location.href='editCollections.pl'">
23
                    [% IF ( collectionsLoop ) %]
44
      </div>    
24
                        <table>
45
</div>
25
                            <tr>
46
</div>
26
                                <th><strong>Title</strong></th>
47
[% INCLUDE 'intranet-bottom.inc' %]
27
                                <th>Description</strong></th>
28
                                <th>Current location</th>
29
                                <th>&nbsp;</th>
30
                                <th>&nbsp;</th>
31
                                <th>&nbsp;</th>
32
                                <th>&nbsp;</th>
33
                            </tr>
34
35
                            [% FOREACH collectionsLoo IN collectionsLoop %]
36
                                <tr>
37
                                    <td>[% collectionsLoo.colTitle %]</td>
38
                                    <td>[% collectionsLoo.colDesc %]</td>
39
                                    <td>[% Branches.GetName( collectionsLoo.colBranchcode ) %]</td>
40
                                    <td><a href="addItems.pl?colId=[% collectionsLoo.colId %]">Add/remove items</a></td>
41
                                    <td><a href="transferCollection.pl?colId=[% collectionsLoo.colId %]">Transfer</a></td>
42
                                    <td><a href="editCollections.pl?action=edit&colId=[% collectionsLoo.colId %]">Edit</a></td>
43
                                    <td><a href="editCollections.pl?action=delete&colId=[% collectionsLoo.colId %]">Delete</a></td>
44
                                </tr>
45
                            [% END %]
46
                        </table>
47
                    [% ELSE %]
48
                        There are no collections currently defined.
49
                    [% END %]
50
                </div>
51
52
                <p>
53
                    <a class="btn" href="editCollections.pl?action=new">Create collection</a>
54
                </p>
55
            </div>
56
        </div>
57
    </div>
58
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt (-35 / +43 lines)
Lines 7-48 Link Here
7
[% INCLUDE 'cat-search.inc' %]
7
[% INCLUDE 'cat-search.inc' %]
8
8
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Transfer collection</div>
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Transfer collection</div>
10
<div id="doc3">
10
11
<div id="bd">
11
<div id="doc3" class="yui-t2">
12
        <div class="yui-gb">
12
    <div id="bd">
13
      <h1>Rotating collections: Transfer collection</h1>
13
        <div class="yui-b">
14
    <br />
14
            [% INCLUDE 'tools-menu.inc' %]
15
      [% IF ( transferSuccess ) %]
16
        <div>Collection transferred successfully</div>
17
      [% END %]
18
19
      [% IF ( transferFailure ) %]
20
        <div>Failed to transfer collection!</div>
21
        <div>Reason: <strong>[% errorMessage %]</strong></div>
22
      [% END %]
23
24
      [% IF ( transferSuccess ) %]
25
      [% ELSE %]
26
        <div>
27
          <form action="transferCollection.pl" method="post">
28
            <input type="hidden" name="colId" value="[% colId %]">
29
  
30
            <label for="toBranch">Choose your library:</label>
31
            <select name="toBranch">
32
              [% FOREACH branchoptionloo IN branchoptionloop %]
33
                [% IF ( branchoptionloo.selected ) %]<option value="[% branchoptionloo.code %]" selected="selected">[% branchoptionloo.name %]</option>[% ELSE %]<option value="[% branchoptionloo.code %]">[% branchoptionloo.name %]</option>[% END %]
34
              [% END %]
35
            </select>
36
            <INPUT type="submit" value="Transfer collection">
37
          </form>
38
        </div>
15
        </div>
39
      [% END %]
40
16
41
      <div>
17
        <div class="yui-main">
42
        <br/>
18
            <div class="yui-bd">
43
        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
19
                <h1>Rotating collections: Transfer collection</h1>
44
      </div>
20
21
                [% IF ( transferSuccess ) %]
22
                    <div class="alert">Collection transferred successfully</div>
23
                [% ELSIF ( transferFailure ) %]
24
                    <div class="alert">Failed to transfer collection!</div>
25
                [% END %]
26
27
                [% IF ( transferSuccess ) %]
28
                [% ELSE %]
29
                    <div>
30
                        <form action="transferCollection.pl" method="post">
31
                            <input type="hidden" name="colId" value="[% colId %]">
32
33
                            <label for="toBranch">Choose your library:</label>
34
                            <select name="toBranch">
35
                                [% FOREACH branchoptionloo IN branchoptionloop %]
36
                                    [% IF ( branchoptionloo.selected ) %]
37
                                        <option value="[% branchoptionloo.code %]" selected="selected">[% branchoptionloo.name %]</option>
38
                                    [% ELSE %]
39
                                        <option value="[% branchoptionloo.code %]">[% branchoptionloo.name %]</option>
40
                                    [% END %]
41
                                [% END %]
42
                            </select>
45
43
46
</div>
44
                            <input class="btn" type="submit" value="Transfer collection">
47
</div>
45
                        </form>
46
                    </div>
47
                [% END %]
48
49
                <p>
50
                    <a class="btn" href="rotatingCollections.pl">Return to rotating collections home</a>
51
                </p>
52
53
            </div>
54
        </div>
55
    </div>
48
[% INCLUDE 'intranet-bottom.inc' %]
56
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/rotating_collections/addItems.pl (-2 / +2 lines)
Lines 48-60 if ( $query->param('action') eq 'addItem' ) { Link Here
48
48
49
    my ( $success, $errorCode, $errorMessage );
49
    my ( $success, $errorCode, $errorMessage );
50
50
51
    $template->param( barcode => $barcode );
52
51
    if ( !$removeItem ) {
53
    if ( !$removeItem ) {
52
        ( $success, $errorCode, $errorMessage ) =
54
        ( $success, $errorCode, $errorMessage ) =
53
          AddItemToCollection( $colId, $itemnumber );
55
          AddItemToCollection( $colId, $itemnumber );
54
56
55
        $template->param(
57
        $template->param(
56
            previousActionAdd => 1,
58
            previousActionAdd => 1,
57
            addedBarcode      => $barcode,
58
        );
59
        );
59
60
60
        if ($success) {
61
        if ($success) {
Lines 72-78 if ( $query->param('action') eq 'addItem' ) { Link Here
72
73
73
        $template->param(
74
        $template->param(
74
            previousActionRemove => 1,
75
            previousActionRemove => 1,
75
            removedBarcode       => $barcode,
76
            removeChecked        => 1,
76
            removeChecked        => 1,
77
        );
77
        );
78
78
(-)a/rotating_collections/editCollections.pl (-11 / +8 lines)
Lines 39-46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
39
    }
39
    }
40
);
40
);
41
41
42
my $action = $query->param('action');
43
$template->param( action => $action );
44
42
# Create new Collection
45
# Create new Collection
43
if ( $query->param('action') eq 'create' ) {
46
if ( $action eq 'create' ) {
44
    my $title       = $query->param('title');
47
    my $title       = $query->param('title');
45
    my $description = $query->param('description');
48
    my $description = $query->param('description');
46
49
Lines 62-68 if ( $query->param('action') eq 'create' ) { Link Here
62
}
65
}
63
66
64
## Delete a club or service
67
## Delete a club or service
65
elsif ( $query->param('action') eq 'delete' ) {
68
elsif ( $action eq 'delete' ) {
66
    my $colId = $query->param('colId');
69
    my $colId = $query->param('colId');
67
    my ( $success, $errorCode, $errorMessage ) = DeleteCollection($colId);
70
    my ( $success, $errorCode, $errorMessage ) = DeleteCollection($colId);
68
71
Lines 77-85 elsif ( $query->param('action') eq 'delete' ) { Link Here
77
}
80
}
78
81
79
## Edit a club or service: grab data, put in form.
82
## Edit a club or service: grab data, put in form.
80
elsif ( $query->param('action') eq 'edit' ) {
83
elsif ( $action eq 'edit' ) {
81
    my $colId = $query->param('colId');
84
    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $query->param('colId') );
82
    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
83
85
84
    $template->param(
86
    $template->param(
85
        previousActionEdit => 1,
87
        previousActionEdit => 1,
Lines 90-96 elsif ( $query->param('action') eq 'edit' ) { Link Here
90
}
92
}
91
93
92
# Update a Club or Service
94
# Update a Club or Service
93
elsif ( $query->param('action') eq 'update' ) {
95
elsif ( $action eq 'update' ) {
94
    my $colId       = $query->param('colId');
96
    my $colId       = $query->param('colId');
95
    my $title       = $query->param('title');
97
    my $title       = $query->param('title');
96
    my $description = $query->param('description');
98
    my $description = $query->param('description');
Lines 112-126 elsif ( $query->param('action') eq 'update' ) { Link Here
112
    }
114
    }
113
}
115
}
114
116
115
my $collections = GetCollections();
116
117
$template->param(
117
$template->param(
118
    intranetcolorstylesheet =>
118
    intranetcolorstylesheet =>
119
      C4::Context->preference("intranetcolorstylesheet"),
119
      C4::Context->preference("intranetcolorstylesheet"),
120
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
120
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
121
    IntranetNav        => C4::Context->preference("IntranetNav"),
121
    IntranetNav        => C4::Context->preference("IntranetNav"),
122
123
    collectionsLoop => $collections,
124
);
122
);
125
123
126
output_html_with_http_headers $query, $cookie, $template->output;
124
output_html_with_http_headers $query, $cookie, $template->output;
127
- 

Return to bug 8836