New : Task #1894: Gestion : ajout un champs paramétrable pour videoconf

This commit is contained in:
sparkyx 2021-02-03 17:13:50 +01:00
parent cd6ddfc78e
commit ce18adbf49
6 changed files with 89 additions and 4 deletions

View file

@ -85,6 +85,8 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$this->other['seq']=$http->request("seq", "string", 0);
$this->other['select_option_operation']=$http->request("select_option_operation", "string", null);
$this->other['select_comment']=$http->request("select_comment", "string", null);
$this->other['videoconf_server']=$http->request('videoconf_server',"string",0);
$this->other['videoconf_server_url']=$http->request('videoconf_server_url',"string",DEFAULT_SERVER_VIDEO_CONF);
$this->other["cor_id"]=$http->request("cor_id","array",[]);
$nb_corid=count($this->other["cor_id"]);
$http->set_empty(0);
@ -126,7 +128,9 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$error++;
}
if ($error>0)
{
return false;
}
return true;
}
@ -278,6 +282,19 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$this->other['followup_comment'],
$this->other['select_comment']
]);
// Save videoconf setting
if ( $this->other['videoconf_server'] == 1 && trim($this->other['videoconf_server_url'])=="") {
$this->other['videoconf_server_url']=DEFAULT_SERVER_VIDEO_CONF;
}
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
on conflict on constraint document_option_un
do update set do_enable=$3,do_option=$4 ",
[ "videoconf_server",
$object_sql->dt_id,
$this->other['videoconf_server'],
$this->other['videoconf_server_url']
]);
// Option contact to save
$cn->exec_sql("delete from jnt_document_option_contact where document_type_id=$1",[$object_sql->dt_id]);

View file

@ -162,5 +162,38 @@ class Document_Option
}
return $return;
}
/**
* returns true there is a videoconf enable
*
* @param int $p_document_type Document_Type.dt_id
* @return boolean
*/
static function is_enable_video_conf ($p_document_type)
{
$return=false;
$cn=Dossier::connect();
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
[$p_document_type, 'videoconf_server'])=='1')
{
$return=true;
}
return $return;
}
/**
* returns the videoconf server
*
* @param int $p_document_type Document_Type.dt_id
* @return string with url to videoconf server
*/
static function option_video_conf($p_document_type)
{
$cn=Dossier::connect();
$option_operation = $cn->get_value("select do_option from document_option where document_type_id=$1 "
. " and do_code = $2",
[$p_document_type, 'videoconf_server']);
return $option_operation;
}
}

View file

@ -109,7 +109,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
define ("DBVERSION",152);
define ("DBVERSION",153);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",19);
define ('NOTFOUND','--not found--');
@ -334,3 +334,6 @@ if ( ! defined ("NOALYSS_URL")) {
dirname($_SERVER['PHP_SELF']);
define ("NOALYSS_URL",$base);
}
if (!defined ("DEFAULT_SERVER_VIDEO_CONF")) {
define ("DEFAULT_SERVER_VIDEO_CONF","https://www.free-solutions.org/");
}

View file

@ -0,0 +1,7 @@
begin;
insert into document_option (do_code,document_type_id,do_enable,do_option)
select 'videoconf_server',dt_id,'1','https://www.free-solutions.org/'
from
document_type;
insert into version (val,v_description) values (153,'Add videoconf server');
commit;

View file

@ -119,7 +119,19 @@ echo $select_comment_type->input();
?>
</li>
</ul>
<li>
<?php
$i=new ICheckBox("videoconf_server",1);
$checked = (Document_Option::is_enable_video_conf($table->dt_id)==true) ?1:0;
$i->set_check($checked);
echo $i->input();
echo _("Serveur de videoconf");
$itVideoconfServer=new IText("videoconf_server_url");
$itVideoconfServer->value=Document_Option::option_video_conf($table->dt_id);
echo $itVideoconfServer->input();
?>
</li>
</div>
<div>
<h3 class="info" sytle="margin-block: 4px"><?php echo _("Options contact") ?></h3>

View file

@ -62,12 +62,25 @@ $uniq=uniqid("tab",TRUE);
?>
</td>
</Tr>
<?php
//----------------------- Video Conf --------------------------------------------------------------------------------
if (Document_Option::is_enable_video_conf($this->dt_id)):?>
<tr>
<td><?=_("VideoConf")?></td>
<td><A href="<?=Document_Option::option_video_conf($this->dt_id)?>" target="_blank">
<?=_("Salle de réunion")?>
</a>
</tr>
<?php endif;?>
<tr>
<TD colspan="2">
<?php echo $spcontact->input(); ?>
</td>
</Tr>
<?php if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)): ?>
<?php
//----------------------- Contact Multiple ----------------------------------------------------------------------------
if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)):
?>
<tr>
<td>
<?php echo _('Autres concernés')?>