Use class instance instead of SQL req

This commit is contained in:
Yoan Mollard 2022-06-25 00:11:40 +02:00
parent 4e2bacb039
commit 6b421823f5

View File

@ -474,14 +474,10 @@ if ($result && $action == "dl" && !$error) {
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel');
if (!empty($projectid)) {
$sql = 'SELECT t.ref FROM '.MAIN_DB_PREFIX.'projet as t';
$sql .= ' WHERE t.rowid = '.((int) $db->sanitize($projectid));
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$zipname .= '_'.$obj->ref;
} else {
dol_print_error($db);
$project = new Project($db);
$project->fetch($projectid);
if ($project->ref) {
$zipname .= '_'.$project->ref;
}
}
$zipname .='_export.zip';