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"; $log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel'); $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel');
if (!empty($projectid)) { if (!empty($projectid)) {
$sql = 'SELECT t.ref FROM '.MAIN_DB_PREFIX.'projet as t'; $project = new Project($db);
$sql .= ' WHERE t.rowid = '.((int) $db->sanitize($projectid)); $project->fetch($projectid);
$resql = $db->query($sql); if ($project->ref) {
if ($resql) { $zipname .= '_'.$project->ref;
$obj = $db->fetch_object($resql);
$zipname .= '_'.$obj->ref;
} else {
dol_print_error($db);
} }
} }
$zipname .='_export.zip'; $zipname .='_export.zip';