diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php index 574d8ac29..3443c6a84 100644 --- a/include/class/action_document_type_mtable.class.php +++ b/include/class/action_document_type_mtable.class.php @@ -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]); diff --git a/include/class/document_option.class.php b/include/class/document_option.class.php index 30630b21d..d515a51ba 100644 --- a/include/class/document_option.class.php +++ b/include/class/document_option.class.php @@ -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; + } + +} diff --git a/include/constant.php b/include/constant.php index a76070aef..d4513b0f6 100644 --- a/include/constant.php +++ b/include/constant.php @@ -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/"); +} \ No newline at end of file diff --git a/include/sql/patch/upgrade152.sql b/include/sql/patch/upgrade152.sql new file mode 100644 index 000000000..5f93e8b60 --- /dev/null +++ b/include/sql/patch/upgrade152.sql @@ -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; \ No newline at end of file diff --git a/include/template/action_document_type_mtable_input.php b/include/template/action_document_type_mtable_input.php index 455036667..8a2ed0bc1 100644 --- a/include/template/action_document_type_mtable_input.php +++ b/include/template/action_document_type_mtable_input.php @@ -119,7 +119,19 @@ echo $select_comment_type->input(); ?> - +