* SPDX-License-Identifier: AGPL-3.0-only ************************************/ require_once('include/utils/utils.php'); global $app_strings,$current_user,$theme,$adb,$current_language,$table_prefix; $image_path = 'themes/'.$theme.'/images/'; $language = VteSession::get('authenticated_user_language'); $pdf_strings = return_module_language($language, "PDFMaker"); $smarty=new VteSmarty(); $smarty->assign("MOD",$mod_strings); $smarty->assign("APP",$app_strings); $smarty->assign("PDF",$pdf_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH",$image_path); //crmv@26396 $status_sql="SELECT ".$table_prefix."_pdfmaker.templateid FROM ".$table_prefix."_pdfmaker_userstatus INNER JOIN ".$table_prefix."_pdfmaker ON ".$table_prefix."_pdfmaker.templateid = ".$table_prefix."_pdfmaker_userstatus.templateid WHERE userid=? AND is_active=0"; $status_res=$adb->pquery($status_sql,array($current_user->id)); while($status_row = $adb->fetchByAssoc($status_res)) { $inactive_arr[$status_row["templateid"]] = $status_row["templateid"]; } $default_sql="SELECT ".$table_prefix."_pdfmaker.templateid FROM ".$table_prefix."_pdfmaker_userstatus INNER JOIN ".$table_prefix."_pdfmaker ON ".$table_prefix."_pdfmaker.templateid = ".$table_prefix."_pdfmaker_userstatus.templateid WHERE userid=? AND is_default=1"; //crmv@26396e $default_res=$adb->pquery($default_sql,array($current_user->id)); while($default_row = $adb->fetchByAssoc($default_res)) { $default_template = $default_row["templateid"]; } $temp_sql = "SELECT templateid, filename AS templatename FROM ".$table_prefix."_pdfmaker WHERE module = '".$_REQUEST['return_module']."'"; if(isset($inactive_arr)){ $temp_sql.=" AND templateid NOT IN (".implode($inactive_arr,",").")"; } $temp_result = $adb->query($temp_sql); //TEMPLATES BLOCK $options=""; while($temp_row = $adb->fetchByAssoc($temp_result)){ if(isset($default_template) AND $default_template == $temp_row['templateid']){ $selected=' selected="selected" '; } else { $selected=""; } $options.=''; } $language_output=""; $generate_pdf=""; if($adb->num_rows($temp_result)>0) { $template_output='