noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 08/15: New : Task #1894: Gestion : ajout un c


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 08/15: New : Task #1894: Gestion : ajout un champs paramétrable pour videoconf
Date: Fri, 5 Feb 2021 11:38:30 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit ce18adbf491417b33feb91e6feacdf1cae587fad
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Feb 3 17:13:50 2021 +0100

    New : Task #1894: Gestion : ajout un champs paramétrable pour videoconf
---
 .../class/action_document_type_mtable.class.php    | 17 +++++++++++
 include/class/document_option.class.php            | 35 +++++++++++++++++++++-
 include/constant.php                               |  5 +++-
 include/sql/patch/upgrade152.sql                   |  7 +++++
 .../template/action_document_type_mtable_input.php | 14 ++++++++-
 include/template/detail-action.php                 | 15 +++++++++-
 6 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/include/class/action_document_type_mtable.class.php 
b/include/class/action_document_type_mtable.class.php
index 574d8ac..3443c6a 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 30630b2..d515a51 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 a76070a..d4513b0 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 0000000..5f93e8b
--- /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 4550366..8a2ed0b 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();
 ?>
         </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>
diff --git a/include/template/detail-action.php 
b/include/template/detail-action.php
index 78453a0..9d59d68 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -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')?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]