2
0
forked from Wavyzz/dolibarr

NEW display when click on NEWS templateDrop down for model (#30332)

* New update for templateMail by creating files

* New updating for get php content

* Update html.formmail.class.php

* Fix updating content news

* Fix CTI Errors

* edit html file for news

* NEW display for news with option

* replace file in ajax folder

* fix multiselect news

* Fix phan errors and remove part of useless css

* Fix brakets needed in script

* Fix Phan errors

* Fix display multiselect and fix security injection

* cancel removing part of code for classe modelMail

* Fix phstan errors

* Fix space line

* Fix error phpStan

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
lamrani abdelwadoud
2024-09-17 15:37:34 +02:00
committed by GitHub
parent c15e2f888f
commit 5fcca27fc4
6 changed files with 189 additions and 34 deletions

View File

@@ -1528,3 +1528,29 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
}
}
}
/**
* Retrieves the details of a news post by its ID.
*
* @param string $postId The ID of the news post to retrieve.
* @return array|int Return array if OK, -1 if KO
*/
function getNewsDetailsById($postId)
{
global $db;
if (empty($postId)) {
return -1;
}
$sql = "SELECT p.title, p.description, p.date_creation, p.image
FROM ".MAIN_DB_PREFIX."website_page as p
WHERE p.rowid = ".(intval($postId));
$resql = $db->query($sql);
if ($resql) {
return $db->fetch_array($resql);
} else {
return -1;
}
}