mirror of https://github.com/itflow-org/itflow
Created Sanitize file name function to fix issues with exporting PDF Documentation with clients having ' in the name ex ben's
This commit is contained in:
parent
ca5ba0c6d2
commit
ba57078810
|
|
@ -405,4 +405,17 @@ function getDomainExpirationDate($name){
|
|||
return '0000-00-00';
|
||||
}
|
||||
|
||||
|
||||
function clean_file_name($string){
|
||||
$string = strtolower($string);
|
||||
|
||||
// Gets rid of spaces
|
||||
$clean_file_name = preg_replace('/\s/', '', $string);
|
||||
|
||||
// Gets rid of non-alphanumerics
|
||||
$clean_file_name = preg_replace( '/[^A-Za-z0-9_]/', '', $string );
|
||||
|
||||
return $clean_file_name;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
4
post.php
4
post.php
|
|
@ -7552,7 +7552,7 @@ if(isset($_GET['export_client_pdf'])){
|
|||
|
||||
var docDefinition = {
|
||||
info: {
|
||||
title: '<?php echo $client_name; ?>- IT Documentation',
|
||||
title: '<?php echo clean_file_name($client_name); ?>- IT Documentation',
|
||||
author: <?php echo json_encode($session_company_name); ?>
|
||||
},
|
||||
|
||||
|
|
@ -8734,7 +8734,7 @@ if(isset($_GET['export_client_pdf'])){
|
|||
};
|
||||
|
||||
|
||||
pdfMake.createPdf(docDefinition).download('<?php echo $client_name; ?>-IT_Documentation-<?php echo date('Y-m-d'); ?>.pdf');
|
||||
pdfMake.createPdf(docDefinition).download('<?php echo clean_file_name($client_name); ?>-IT_Documentation-<?php echo date('Y-m-d'); ?>.pdf');
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue