Commit 69dc6fd6 authored by Bastien Le Querrec's avatar Bastien Le Querrec

log file name and display it on returned message

parent 0e5d1215
......@@ -1165,12 +1165,12 @@ class Admin extends Controller
break;
case 'update':
if ($f3->get('POST.test')=='1') {
$datas = $this->banque_update($f3, $_FILES['file']['tmp_name']);
$result = $datas['update'] . " dons récurrents mis à jour sur un total de ". $datas['total']." dons récurrents.";
$datas = $this->banque_update($f3, $_FILES['file']);
$result = $datas['update'] . " dons récurrents mis à jour sur un total de ". $datas['total']." dons récurrents (fichier : \"" . htmlentities($_FILES['file']['name']) . "\").";
$message = "Il s'agit d'un <b>test</b><br />";
} else {
$datas = $this->banque_update($f3, $_FILES['file']['tmp_name'], false);
$result = $datas['update'] . " dons récurrents mis à jour sur un total de ". $datas['total']." dons récurrents.";
$datas = $this->banque_update($f3, $_FILES['file'], false);
$result = $datas['update'] . " dons récurrents mis à jour sur un total de ". $datas['total']." dons récurrents (fichier : \"" . htmlentities($_FILES['file']['name']) . "\").";
}
if (count($datas['comptabilise'])>0 or count($datas['sans_cumul'])>0) {
$error = count($datas['comptabilise']) . " dons récurrents déjà comptabilisés et ". count($datas['sans_cumul'])." dons récurrents sans cumul.";
......@@ -1376,10 +1376,11 @@ class Admin extends Controller
return $datas;
}
public function banque_update($f3, $filename, $testing=true)
public function banque_update($f3, $file, $testing=true)
{
$log = new \Log('/banque_update.log');
$log->write('Processing recurrent donations (testing: ' . ($testing ? 'true' : 'false') . ')');
$log->write('Processing recurrent donations on file "' . $file['name'] . '" (testing: ' . ($testing ? 'true' : 'false') . ')');
$filename = $file['tmp_name'];
$separator = ";";
$datas = array();
......@@ -1591,7 +1592,7 @@ class Admin extends Controller
$datas['update'] = $update; //! recurrent transactions remisées just added
$datas['comptabilise'] = $comptabilise; //! recurrent transactions remisées already added
$datas['sans_cumul'] = $sans_cumul; //! empty
$log->write('Processing recurrent donations finished.');
$log->write('Processing recurrent donations finished on file "' . $file['name'] . '"');
return $datas;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment