|
Lines 36-55
sub set_parameters {
Link Here
|
| 36 |
my $dbh = C4::Context->dbh; |
36 |
my $dbh = C4::Context->dbh; |
| 37 |
my $branches=GetBranches(); |
37 |
my $branches=GetBranches(); |
| 38 |
my @branches; |
38 |
my @branches; |
|
|
39 |
my $default; |
| 39 |
my @select_branch; |
40 |
my @select_branch; |
| 40 |
my %select_branches; |
41 |
my %select_branches; |
| 41 |
push @select_branch,""; |
42 |
push @select_branch,""; |
| 42 |
$select_branches{""} = ""; |
43 |
$select_branches{""} = ""; |
| 43 |
foreach my $branch (keys %$branches) { |
44 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
| 44 |
push @select_branch, $branch; |
45 |
push @select_branch, $branch; |
| 45 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
46 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
|
|
47 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
| 46 |
} |
48 |
} |
| 47 |
my $CGIbranch=CGI::scrolling_list( -name => 'value', |
49 |
my $CGIbranch=CGI::scrolling_list( -name => 'value', |
| 48 |
-id => 'value', |
50 |
-id => 'value', |
| 49 |
-values => \@select_branch, |
51 |
-values => \@select_branch, |
| 50 |
-labels => \%select_branches, |
52 |
-labels => \%select_branches, |
| 51 |
-size => 1, |
53 |
-size => 1, |
| 52 |
-multiple => 0 ); |
54 |
-multiple => 0, |
|
|
55 |
-default => $default, ); |
| 53 |
$template->param(CGIbranch => $CGIbranch); |
56 |
$template->param(CGIbranch => $CGIbranch); |
| 54 |
return $template; |
57 |
return $template; |
| 55 |
} |
58 |
} |
|
Lines 66-72
sub calculate {
Link Here
|
| 66 |
FROM itemtypes,items |
69 |
FROM itemtypes,items |
| 67 |
WHERE items.itype=itemtypes.itemtype |
70 |
WHERE items.itype=itemtypes.itemtype |
| 68 |
AND items.holdingbranch=? |
71 |
AND items.holdingbranch=? |
| 69 |
GROUP BY items.itype"); |
72 |
GROUP BY items.itype |
|
|
73 |
ORDER BY itemtypes.description"); |
| 70 |
|
74 |
|
| 71 |
} |
75 |
} |
| 72 |
else { |
76 |
else { |
|
Lines 76-82
sub calculate {
Link Here
|
| 76 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
80 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
| 77 |
AND items.biblioitemnumber=biblioitems.biblioitemnumber |
81 |
AND items.biblioitemnumber=biblioitems.biblioitemnumber |
| 78 |
AND items.holdingbranch=? |
82 |
AND items.holdingbranch=? |
| 79 |
GROUP BY biblioitems.itemtype"); |
83 |
GROUP BY biblioitems.itemtype |
|
|
84 |
ORDER BY itemtypes.description"); |
| 80 |
} |
85 |
} |
| 81 |
$sth->execute($branch); |
86 |
$sth->execute($branch); |
| 82 |
} else { |
87 |
} else { |
|
Lines 85-98
sub calculate {
Link Here
|
| 85 |
SELECT description,items.itype AS itemtype, COUNT(*) AS total |
90 |
SELECT description,items.itype AS itemtype, COUNT(*) AS total |
| 86 |
FROM itemtypes,items |
91 |
FROM itemtypes,items |
| 87 |
WHERE items.itype=itemtypes.itemtype |
92 |
WHERE items.itype=itemtypes.itemtype |
| 88 |
GROUP BY items.itype"); |
93 |
GROUP BY items.itype |
|
|
94 |
ORDER BY itemtypes.description"); |
| 89 |
} |
95 |
} |
| 90 |
else { |
96 |
else { |
| 91 |
$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total |
97 |
$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total |
| 92 |
FROM itemtypes, biblioitems,items |
98 |
FROM itemtypes, biblioitems,items |
| 93 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
99 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
| 94 |
AND biblioitems.biblioitemnumber = items.biblioitemnumber |
100 |
AND biblioitems.biblioitemnumber = items.biblioitemnumber |
| 95 |
GROUP BY biblioitems.itemtype"); |
101 |
GROUP BY biblioitems.itemtype |
|
|
102 |
ORDER BY itemtypes.description"); |
| 96 |
} |
103 |
} |
| 97 |
$sth->execute; |
104 |
$sth->execute; |
| 98 |
} |
105 |
} |
|
Lines 117-122
sub calculate {
Link Here
|
| 117 |
$globalline{loopitemtype} = \@results; |
124 |
$globalline{loopitemtype} = \@results; |
| 118 |
$globalline{total} = $grantotal; |
125 |
$globalline{total} = $grantotal; |
| 119 |
$globalline{branch} = $branch; |
126 |
$globalline{branch} = $branch; |
|
|
127 |
$globalline{branchname} = GetBranchName($branch); |
| 120 |
push @mainloop,\%globalline; |
128 |
push @mainloop,\%globalline; |
| 121 |
return \@mainloop; |
129 |
return \@mainloop; |
| 122 |
} |
130 |
} |
| 123 |
- |
|
|