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

(-)a/C4/RotatingCollections.pm (-32 lines)
Lines 53-59 BEGIN { Link Here
53
53
54
      GetItemsInCollection
54
      GetItemsInCollection
55
55
56
      GetCollection
57
      GetCollections
56
      GetCollections
58
57
59
      AddItemToCollection
58
      AddItemToCollection
Lines 240-276 sub GetItemsInCollection { Link Here
240
    return \@results;
239
    return \@results;
241
}
240
}
242
241
243
=head2 GetCollection
244
245
 ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
246
247
Returns information about a collection
248
249
 Input:
250
   $colId: Id of the collection
251
 Output:
252
   $colId, $colTitle, $colDesc, $colBranchcode
253
254
=cut
255
256
sub GetCollection {
257
    my ($colId) = @_;
258
259
    my $dbh = C4::Context->dbh;
260
261
    my ( $sth, @results );
262
    $sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?");
263
    $sth->execute($colId) or return 0;
264
265
    my $row = $sth->fetchrow_hashref;
266
267
    return (
268
        $$row{'colId'},   $$row{'colTitle'},
269
        $$row{'colDesc'}, $$row{'colBranchcode'}
270
    );
271
272
}
273
274
=head2 AddItemToCollection
242
=head2 AddItemToCollection
275
243
276
 ( $success, $errorcode, $errormessage ) = AddItemToCollection( $colId, $itemnumber );
244
 ( $success, $errorcode, $errormessage ) = AddItemToCollection( $colId, $itemnumber );
(-)a/rotating_collections/addItems.pl (-6 / +9 lines)
Lines 24-29 use C4::Context; Link Here
24
use C4::RotatingCollections;
24
use C4::RotatingCollections;
25
use C4::Items;
25
use C4::Items;
26
26
27
use Koha::RotatingCollections;
28
27
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
28
30
29
my $query = new CGI;
31
my $query = new CGI;
Lines 87-104 if ( $query->param('action') eq 'addItem' ) { Link Here
87
    }
89
    }
88
}
90
}
89
91
90
my ( $colId, $colTitle, $colDescription, $colBranchcode ) =
92
my $colId = $query->param('colId');
91
  GetCollection( $query->param('colId') );
93
my $collection = Koha::RotatingCollections->find($colId);
94
92
my $collectionItems = GetItemsInCollection($colId);
95
my $collectionItems = GetItemsInCollection($colId);
93
if ($collectionItems) {
96
if ($collectionItems) {
94
    $template->param( collectionItemsLoop => $collectionItems );
97
    $template->param( collectionItemsLoop => $collectionItems );
95
}
98
}
96
99
97
$template->param(
100
$template->param(
98
    colId          => $colId,
101
    colId          => $collection->colId,
99
    colTitle       => $colTitle,
102
    colTitle       => $collection->colTitle,
100
    colDescription => $colDescription,
103
    colDescription => $collection->colDesc,
101
    colBranchcode  => $colBranchcode,
104
    colBranchcode  => $collection->colBranchcode,
102
);
105
);
103
106
104
output_html_with_http_headers $query, $cookie, $template->output;
107
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/rotating_collections/editCollections.pl (-4 / +4 lines)
Lines 77-89 if ( $action eq 'create' ) { Link Here
77
77
78
## Edit a club or service: grab data, put in form.
78
## Edit a club or service: grab data, put in form.
79
elsif ( $action eq 'edit' ) {
79
elsif ( $action eq 'edit' ) {
80
    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $query->param('colId') );
80
    my $collection = Koha::RotatingCollections->find($query->param('colId'));
81
81
82
    $template->param(
82
    $template->param(
83
        previousActionEdit => 1,
83
        previousActionEdit => 1,
84
        editColId          => $colId,
84
        editColId          => $collection->{colId},
85
        editColTitle       => $colTitle,
85
        editColTitle       => $collection->{colTitle},
86
        editColDescription => $colDesc,
86
        editColDescription => $collection->{colDesc},
87
    );
87
    );
88
}
88
}
89
89
(-)a/rotating_collections/transferCollection.pl (-7 / +8 lines)
Lines 23-28 use C4::Auth; Link Here
23
use C4::Context;
23
use C4::Context;
24
use C4::RotatingCollections;
24
use C4::RotatingCollections;
25
25
26
use Koha::RotatingCollections;
27
26
use CGI qw ( -utf8 );
28
use CGI qw ( -utf8 );
27
29
28
my $query = new CGI;
30
my $query = new CGI;
Lines 60-72 if ($toBranch) { Link Here
60
}
62
}
61
63
62
## Get data about collection
64
## Get data about collection
63
my ( $colTitle, $colDesc, $colBranchcode );
65
my $collection = Koha::RotatingCollections->find($colId);
64
( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
66
65
$template->param(
67
$template->param(
66
    colId            => $colId,
68
    colId            => $collection->colId,
67
    colTitle         => $colTitle,
69
    colTitle         => $collection->colTitle,
68
    colDesc          => $colDesc,
70
    colDesc          => $collection->colDesc,
69
    colBranchcode    => $colBranchcode,
71
    colBranchcode    => $collection->colBranchcode,
70
);
72
);
71
73
72
output_html_with_http_headers $query, $cookie, $template->output;
74
output_html_with_http_headers $query, $cookie, $template->output;
73
- 

Return to bug 18606