Skip to content
Snippets Groups Projects
Verified Commit e2969555 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #6669 merge from 17_06_project_develop

parent bdfa16f1
No related branches found
No related tags found
No related merge requests found
......@@ -192,7 +192,6 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
|| ($mode == 'up' && !empty($_SESSION['m_admin']['templates']['current_style']))
|| $mode == 'add')
{
$storeInfos = array();
$storeInfos = $this->storeTemplateFile();
if (!$storeInfos) {
......@@ -533,12 +532,16 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
*/
public function getAllTemplatesForProcess($entityId)
{
include_once 'core/class/docservers_controler.php';
$db = new Database();
$stmt = $db->query(
'select * from ' . _TEMPLATES_TABLE_NAME . ' t, ' . _TEMPLATES_ASSOCIATION_TABLE_NAME . ' ta '
. 'where t.template_id = ta.template_id and ta.what = ? and ta.value_field = ? ORDER BY t.template_label',
['destination', $entityId]
);
$docservers_controler = new docservers_controler();
$docserverTemplate = $docservers_controler->get('TEMPLATES');
$templates = [];
while ($res = $stmt->fetchObject()) {
array_push(
......@@ -548,6 +551,7 @@ abstract class templates_controler_Abstract extends ObjectControler implements O
'TYPE' => $res->template_type,
'TARGET' => $res->template_target,
'ATTACHMENT_TYPE' => $res->template_attachment_type,
'FILE' => $docserverTemplate->path_template.str_replace('#','/',$res->template_path).$res->template_file_name
)
);
}
......
......@@ -18,10 +18,18 @@ if (isset($_SESSION['destination_entity']) && !empty($_SESSION['destination_enti
$frmStr ="";
$frmStr .= '<option value="">S&eacute;lectionnez le mod&egrave;le</option>';
for ($i=0;$i<count($templates);$i++) {
if (!file_exists($templates[$i]['FILE'])) {
$disabled = 'disabled="disabled"';
$title = "title=\""._FILE." ".$templates[$i]['FILE']." "._NOT_AVAILABLE."\"";
} else {
$disabled = '';
$title = "";
}
if ($templates[$i]['TYPE'] == 'OFFICE'
&& ($templates[$i]['TARGET'] == 'attachments' || $templates[$i]['TARGET'] == '')
&& ($templates[$i]['ATTACHMENT_TYPE'] == $_REQUEST['attachment_type'] || $templates[$i]['ATTACHMENT_TYPE'] == 'all')) {
$frmStr .= '<option value="'. functions::xssafe($templates[$i]['ID']).'">';
$frmStr .= '<option '.$title.' '. $disabled .' value="'. functions::xssafe($templates[$i]['ID']).'">';
$frmStr .= functions::xssafe($templates[$i]['LABEL']);
$frmStr .= '</option>';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment