Lines 61-237
$template->param(
Link Here
|
61 |
); |
61 |
); |
62 |
|
62 |
|
63 |
# Dashboard (If on in SysPref) |
63 |
# Dashboard (If on in SysPref) |
64 |
my $nofile = "Dashboard is set to \"ON\". However there is no XML file to read. Have you run it at least once?"; |
|
|
65 |
if ( C4::Context->preference('DashBoardDisplayed') ) |
64 |
if ( C4::Context->preference('DashBoardDisplayed') ) |
66 |
{ |
65 |
{ |
67 |
my $koha_conf = $ENV{'KOHA_CONF'}; |
66 |
my $koha_conf = $ENV{'KOHA_CONF'}; |
68 |
my ($base,$file) = $koha_conf =~ m|^(.*[/\\])([^/\\]+?)$|; |
67 |
my ($base,$file) = $koha_conf =~ m|^(.*[/\\])([^/\\]+?)$|; |
69 |
my $xml_read = "dashboard_xml.out"; |
68 |
my $xml_read = "dashboard_xml.out"; |
70 |
my $xml_file = "$base"."$xml_read"; |
69 |
my $xml_file = "$base"."$xml_read"; |
71 |
if (-e $xml_file) { |
70 |
if (-e $xml_file) { |
72 |
my $xml = new XML::Simple; |
71 |
my $xml = new XML::Simple; |
73 |
my $dash = $xml->XMLin($xml_file); |
72 |
my $dash = $xml->XMLin($xml_file); |
74 |
my $login_branch_name = $template->{VARS}{LoginBranchcode}; |
73 |
my $login_branch_name = $template->{VARS}{LoginBranchcode}; |
75 |
my $number_of_biblios; |
74 |
my $number_of_biblios; |
76 |
my $biblios_7days; |
75 |
my $biblios_7days; |
77 |
my $items_7days_system; |
76 |
my $items_7days_system; |
78 |
my $items_7days_library; |
77 |
my $items_7days_library; |
79 |
my $borrowers_system; |
78 |
my $borrowers_system; |
80 |
my $expired_borrowers_library; |
79 |
my $expired_borrowers_library; |
81 |
my $expired_borrowers_system; |
80 |
my $expired_borrowers_system; |
82 |
my $loan_history_system; |
81 |
my $loan_history_system; |
83 |
my $loan_history_library; |
82 |
my $loan_history_library; |
84 |
my $overdues_library; |
83 |
my $overdues_library; |
85 |
my $overdues_system; |
84 |
my $overdues_system; |
86 |
my $overdues_7days_library; |
85 |
my $overdues_7days_library; |
87 |
my $overdues_7days_system; |
86 |
my $overdues_7days_system; |
88 |
my $overdues_14days_library; |
87 |
my $overdues_14days_library; |
89 |
my $overdues_14days_system; |
88 |
my $overdues_14days_system; |
90 |
my $overdues_21days_library; |
89 |
my $overdues_21days_library; |
91 |
my $overdues_21days_system; |
90 |
my $overdues_21days_system; |
92 |
my $very_overdue_library; |
91 |
my $very_overdue_library; |
93 |
my $very_overdue_system; |
92 |
my $very_overdue_system; |
94 |
my $borrowers_library; |
93 |
my $borrowers_library; |
95 |
my $issues_library; |
94 |
my $issues_library; |
96 |
my $issues_system; |
95 |
my $issues_system; |
97 |
my $items_library; |
96 |
my $items_library; |
98 |
my $items_system; |
97 |
my $items_system; |
99 |
my $last_updated; |
98 |
my $last_updated; |
100 |
|
99 |
|
101 |
$number_of_biblios = $dash->{biblios}->{NumberOfBiblios}; |
100 |
$number_of_biblios = $dash->{biblios}->{NumberOfBiblios}; |
102 |
$biblios_7days = $dash->{biblio_7days}->{NumberOfBiblio7Days}; |
101 |
$biblios_7days = $dash->{biblio_7days}->{NumberOfBiblio7Days}; |
103 |
$items_7days_system = $dash->{items_7days_system}->{NumberOfItems7Days}; |
102 |
$items_7days_system = $dash->{items_7days_system}->{NumberOfItems7Days}; |
104 |
$borrowers_system = $dash->{number_of_borrowers_system}->{NumberofBorrowersSystem}; |
103 |
$borrowers_system = $dash->{number_of_borrowers_system}->{NumberofBorrowersSystem}; |
105 |
$loan_history_system = $dash->{loan_history_system}->{NumberOfLoans}; |
104 |
$loan_history_system = $dash->{loan_history_system}->{NumberOfLoans}; |
106 |
$items_system = $dash->{items_system}->{NumberOfItemsSystem}; |
105 |
$items_system = $dash->{items_system}->{NumberOfItemsSystem}; |
107 |
$expired_borrowers_system = $dash->{expired_borrowers_system}->{ExpiredBorrowers}; |
106 |
$expired_borrowers_system = $dash->{expired_borrowers_system}->{ExpiredBorrowers}; |
108 |
$issues_system = $dash->{issues_system}->{NumberOfIssuesSystem}; |
107 |
$issues_system = $dash->{issues_system}->{NumberOfIssuesSystem}; |
109 |
$overdues_system = $dash->{overdues_system}->{NumberOfOverdues}; |
108 |
$overdues_system = $dash->{overdues_system}->{NumberOfOverdues}; |
110 |
$overdues_7days_system = $dash->{overdues_7days_system}->{NumberOfOverdues}; |
109 |
$overdues_7days_system = $dash->{overdues_7days_system}->{NumberOfOverdues}; |
111 |
$overdues_14days_system = $dash->{overdues_14days_system}->{NumberOfOverdues14Days}; |
110 |
$overdues_14days_system = $dash->{overdues_14days_system}->{NumberOfOverdues14Days}; |
112 |
$overdues_21days_system = $dash->{overdues_21days_system}->{NumberOfOverdues21Days}; |
111 |
$overdues_21days_system = $dash->{overdues_21days_system}->{NumberOfOverdues21Days}; |
113 |
$very_overdue_system = $dash->{very_overdue_system}->{Overdues}; |
112 |
$very_overdue_system = $dash->{very_overdue_system}->{Overdues}; |
114 |
$last_updated = $dash->{last_updated}->{UpdatedTime}; |
113 |
$last_updated = $dash->{last_updated}->{UpdatedTime}; |
115 |
|
114 |
|
116 |
# Looping for "logged in branch" dependant data |
115 |
# Looping for "logged in branch" dependant data |
117 |
foreach my $numissl(@{$dash->{issues_library}}) |
116 |
foreach my $numissl(@{$dash->{issues_library}}) |
118 |
{ |
117 |
{ |
119 |
if($numissl->{BranchCode} eq $login_branch_name) |
118 |
if($numissl->{BranchCode} eq $login_branch_name) |
120 |
{ |
119 |
{ |
121 |
$issues_library = $numissl->{NumberOfIssues} |
120 |
$issues_library = $numissl->{NumberOfIssues} |
122 |
} |
121 |
} |
123 |
} |
122 |
} |
124 |
foreach my $numitm(@{$dash->{items_library}}) |
123 |
foreach my $numitm(@{$dash->{items_library}}) |
125 |
{ |
124 |
{ |
126 |
if($numitm->{BranchCode} eq $login_branch_name) |
125 |
if($numitm->{BranchCode} eq $login_branch_name) |
127 |
{ |
126 |
{ |
128 |
$items_library = $numitm->{NumberOfItems} |
127 |
$items_library = $numitm->{NumberOfItems} |
129 |
} |
128 |
} |
130 |
} |
129 |
} |
131 |
foreach my $numbor(@{$dash->{borrowers_library}}) |
130 |
foreach my $numbor(@{$dash->{borrowers_library}}) |
132 |
{ |
131 |
{ |
133 |
if($numbor->{BranchCode} eq $login_branch_name) |
132 |
if($numbor->{BranchCode} eq $login_branch_name) |
134 |
{ |
133 |
{ |
135 |
$borrowers_library = $numbor->{NumberOfBorrowers} |
134 |
$borrowers_library = $numbor->{NumberOfBorrowers} |
136 |
} |
135 |
} |
137 |
} |
136 |
} |
138 |
foreach my $numex(@{$dash->{expired_borrowers_library}}) |
137 |
foreach my $numex(@{$dash->{expired_borrowers_library}}) |
139 |
{ |
138 |
{ |
140 |
if($numex->{BranchCode} eq $login_branch_name) |
139 |
if($numex->{BranchCode} eq $login_branch_name) |
141 |
{ |
140 |
{ |
142 |
$expired_borrowers_library = $numex->{ExpiredBorrowers} |
141 |
$expired_borrowers_library = $numex->{ExpiredBorrowers} |
143 |
} |
142 |
} |
144 |
} |
143 |
} |
145 |
|
|
|
146 |
foreach my $numitm7(@{$dash->{items_7days_library}}) |
147 |
{ |
148 |
if($numitm7->{BranchCode} eq $login_branch_name) |
149 |
{ |
150 |
$items_7days_library = $numitm7->{NumberOfItems7DaysLibrary} |
151 |
} |
152 |
} |
153 |
|
154 |
foreach my $oldiss(@{$dash->{loan_history_library}}) |
155 |
{ |
156 |
if($oldiss->{BranchCode} eq $login_branch_name) |
157 |
{ |
158 |
$loan_history_library = $oldiss->{NumberOfLoans} |
159 |
} |
160 |
} |
161 |
|
162 |
foreach my $ovdlib(@{$dash->{overdues_library}}) |
163 |
{ |
164 |
if($ovdlib->{BranchCode} eq $login_branch_name) |
165 |
{ |
166 |
$overdues_library = $ovdlib->{NumberOfOverdues} |
167 |
} |
168 |
} |
169 |
|
170 |
foreach my $ovd7day(@{$dash->{overdues_7days_library}}) |
171 |
{ |
172 |
if($ovd7day->{BranchCode} eq $login_branch_name) |
173 |
{ |
174 |
$overdues_7days_library = $ovd7day->{NumberOfOverdues7Days} |
175 |
} |
176 |
} |
177 |
|
178 |
foreach my $ovd14day(@{$dash->{overdues_14days_library}}) |
179 |
{ |
180 |
if($ovd14day->{BranchCode} eq $login_branch_name) |
181 |
{ |
182 |
$overdues_14days_library = $ovd14day->{NumberOfOverdues14Days} |
183 |
} |
184 |
} |
185 |
|
186 |
foreach my $ovd21day(@{$dash->{overdues_21days_library}}) |
187 |
{ |
188 |
if($ovd21day->{BranchCode} eq $login_branch_name) |
189 |
{ |
190 |
$overdues_21days_library = $ovd21day->{NumberOfOverdues21Days} |
191 |
} |
192 |
} |
193 |
|
194 |
foreach my $vryod(@{$dash->{very_overdue_library}}) |
195 |
{ |
196 |
if($vryod->{BranchCode} eq $login_branch_name) |
197 |
{ |
198 |
$very_overdue_library = $vryod->{NumberOfVeryOverdue} |
199 |
} |
200 |
} |
201 |
|
202 |
$template->param('number_of_biblios' => $number_of_biblios, |
203 |
'biblios_7days' => $biblios_7days, |
204 |
'items_7days_system' => $items_7days_system, |
205 |
'items_7days_library' => $items_7days_library, |
206 |
'borrowers_system' => $borrowers_system, |
207 |
'expired_borrowers_library' => $expired_borrowers_library, |
208 |
'expired_borrowers_system' => $expired_borrowers_system, |
209 |
'overdues_library' => $overdues_library, |
210 |
'overdues_system' => $overdues_system, |
211 |
'overdues_7days_library' => $overdues_7days_library, |
212 |
'overdues_7days_system' => $overdues_7days_system, |
213 |
'overdues_14days_library' => $overdues_14days_library, |
214 |
'overdues_14days_system' => $overdues_14days_system, |
215 |
'overdues_21days_library' => $overdues_21days_library, |
216 |
'overdues_21days_system' => $overdues_21days_system, |
217 |
'very_overdue_library' => $very_overdue_library, |
218 |
'very_overdue_system' => $very_overdue_system, |
219 |
'loan_history_system' => $loan_history_system, |
220 |
'loan_history_library' => $loan_history_library, |
221 |
'issues_library' => $issues_library, |
222 |
'issues_system' => $issues_system, |
223 |
'items_library' => $items_library, |
224 |
'items_system' => $items_system, |
225 |
'borrowers_library' => $borrowers_library, |
226 |
'last_updated' => $last_updated |
227 |
|
228 |
); |
229 |
} |
230 |
|
144 |
|
231 |
elsif(!-e $xml_file) { |
145 |
foreach my $numitm7(@{$dash->{items_7days_library}}) |
232 |
$template->param('nofile' => $nofile,); |
146 |
{ |
|
|
147 |
if($numitm7->{BranchCode} eq $login_branch_name) |
148 |
{ |
149 |
$items_7days_library = $numitm7->{NumberOfItems7DaysLibrary} |
150 |
} |
233 |
} |
151 |
} |
234 |
|
152 |
|
|
|
153 |
foreach my $oldiss(@{$dash->{loan_history_library}}) |
154 |
{ |
155 |
if($oldiss->{BranchCode} eq $login_branch_name) |
156 |
{ |
157 |
$loan_history_library = $oldiss->{NumberOfLoans} |
158 |
} |
159 |
} |
160 |
|
161 |
foreach my $ovdlib(@{$dash->{overdues_library}}) |
162 |
{ |
163 |
if($ovdlib->{BranchCode} eq $login_branch_name) |
164 |
{ |
165 |
$overdues_library = $ovdlib->{NumberOfOverdues} |
166 |
} |
167 |
} |
168 |
|
169 |
foreach my $ovd7day(@{$dash->{overdues_7days_library}}) |
170 |
{ |
171 |
if($ovd7day->{BranchCode} eq $login_branch_name) |
172 |
{ |
173 |
$overdues_7days_library = $ovd7day->{NumberOfOverdues7Days} |
174 |
} |
175 |
} |
176 |
|
177 |
foreach my $ovd14day(@{$dash->{overdues_14days_library}}) |
178 |
{ |
179 |
if($ovd14day->{BranchCode} eq $login_branch_name) |
180 |
{ |
181 |
$overdues_14days_library = $ovd14day->{NumberOfOverdues14Days} |
182 |
} |
183 |
} |
184 |
|
185 |
foreach my $ovd21day(@{$dash->{overdues_21days_library}}) |
186 |
{ |
187 |
if($ovd21day->{BranchCode} eq $login_branch_name) |
188 |
{ |
189 |
$overdues_21days_library = $ovd21day->{NumberOfOverdues21Days} |
190 |
} |
191 |
} |
192 |
|
193 |
foreach my $vryod(@{$dash->{very_overdue_library}}) |
194 |
{ |
195 |
if($vryod->{BranchCode} eq $login_branch_name) |
196 |
{ |
197 |
$very_overdue_library = $vryod->{NumberOfVeryOverdue} |
198 |
} |
199 |
} |
200 |
|
201 |
$template->param('number_of_biblios' => $number_of_biblios, |
202 |
'biblios_7days' => $biblios_7days, |
203 |
'items_7days_system' => $items_7days_system, |
204 |
'items_7days_library' => $items_7days_library, |
205 |
'borrowers_system' => $borrowers_system, |
206 |
'expired_borrowers_library' => $expired_borrowers_library, |
207 |
'expired_borrowers_system' => $expired_borrowers_system, |
208 |
'overdues_library' => $overdues_library, |
209 |
'overdues_system' => $overdues_system, |
210 |
'overdues_7days_library' => $overdues_7days_library, |
211 |
'overdues_7days_system' => $overdues_7days_system, |
212 |
'overdues_14days_library' => $overdues_14days_library, |
213 |
'overdues_14days_system' => $overdues_14days_system, |
214 |
'overdues_21days_library' => $overdues_21days_library, |
215 |
'overdues_21days_system' => $overdues_21days_system, |
216 |
'very_overdue_library' => $very_overdue_library, |
217 |
'very_overdue_system' => $very_overdue_system, |
218 |
'loan_history_system' => $loan_history_system, |
219 |
'loan_history_library' => $loan_history_library, |
220 |
'issues_library' => $issues_library, |
221 |
'issues_system' => $issues_system, |
222 |
'items_library' => $items_library, |
223 |
'items_system' => $items_system, |
224 |
'borrowers_library' => $borrowers_library, |
225 |
'last_updated' => $last_updated |
226 |
); |
227 |
} else { |
228 |
$template->{VARS}->{'nofile'} = 1; |
229 |
} |
230 |
|
235 |
} |
231 |
} |
236 |
|
232 |
|
237 |
# Dashboard end |
233 |
# Dashboard end |
238 |
- |
|
|