Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main catalyst updated #2

Merged
merged 17 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing file exists checks, allow to work if no records returned
  • Loading branch information
Tim Price committed Oct 19, 2015
commit 1148946ada7bb4acfa438e49dc96887e858b544e
23 changes: 11 additions & 12 deletions locallib.php
Original file line number Diff line number Diff line change
@@ -127,13 +127,14 @@ function report_customsql_generate_csv($report, $timenow) {
if (!empty($report->emailto)) {
report_customsql_email_report($report, $csvfilename);
}
report_customsql_copy_csv_to_customdir($report, $timenow, $csvfilename);
if (!empty($report->customdir)) {
report_customsql_copy_csv_to_customdir($report, $timenow, $csvfilename);
}
}
} else { // If there is no data.
if (!empty($report->emailto)) {
report_customsql_email_report($report);
}
report_customsql_copy_csv_to_customdir($report, $timenow);
}
}
return $csvtimestamp;
@@ -657,14 +658,12 @@ function report_customsql_category_options() {
*/
function report_customsql_copy_csv_to_customdir($report, $timenow, $csvfilename = null) {
// Copy the file to the custom directory.
if (!empty($report->customdir)) {
if (!$csvfilename) {
list($csvfilename, $csvtimestamp) = report_customsql_csv_filename($report, $timenow);
}
$filename = $report->id . '-' . basename($csvfilename);
// Make sure we always have a working path.
$filepath = rtrim($report->customdir, '/');
$filepath = $filepath . '/' . $filename;
copy($csvfilename, $filepath);
}
if (!$csvfilename) {
list($csvfilename, $csvtimestamp) = report_customsql_csv_filename($report, $timenow);
}
$filename = $report->id . '-' . basename($csvfilename);
// Make sure we always have a working path.
$filepath = rtrim($report->customdir, '/');
$filepath = $filepath . '/' . $filename;
copy($csvfilename, $filepath);
}