noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 05/13: Add a button search_card


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 05/13: Add a button search_card
Date: Mon, 30 Aug 2021 10:11:59 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit c6288ceaf1e1e68e0036e4e73aea8dcba0d7a8ea
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Aug 24 18:09:02 2021 +0200

    Add a button search_card
---
 html/css/style-classic7.css            |  3 ++-
 include/ajax/ajax_get_profile.php      |  3 +++
 include/constant.php                   |  2 +-
 include/database/profile_sql.class.php |  2 ++
 include/fiche.inc.php                  | 13 ++++---------
 include/profile.inc.php                | 28 ++++++++++++++++------------
 include/sql/patch/upgrade167.sql       |  7 +++++++
 include/template/module.php            | 30 ++++++++++++++++++++++++++++++
 include/template/profile.php           |  4 ++++
 9 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css
index 8777cff..a40c327 100644
--- a/html/css/style-classic7.css
+++ b/html/css/style-classic7.css
@@ -1506,7 +1506,8 @@ div#modele_op_div{
 
 @media (min-width:1200px)  {
     div.name  {
-        display:block !important;/* position:absolute; */
+        display:block !important;
+        position:absolute;
         top:0px;
         left:0px;
     }   
diff --git a/include/ajax/ajax_get_profile.php 
b/include/ajax/ajax_get_profile.php
index 270978e..b093130 100644
--- a/include/ajax/ajax_get_profile.php
+++ b/include/ajax/ajax_get_profile.php
@@ -71,6 +71,9 @@ $with_calc->set_check($profile->with_calc);
 $with_direct_form=new ICheckBox("with_direct_form","t");
 $with_direct_form->set_check($profile->with_direct_form);
 
+$with_search_card=new ICheckBox("with_search_card",1);
+$with_search_card->set_check($profile->with_search_card);
+
 // If $p_id == -1 it is a new profile
 if ( $p_id > 0 )
 {
diff --git a/include/constant.php b/include/constant.php
index 474486e..819f8b5 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -116,7 +116,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
 if ( ! defined ("SYSINFO_DISPLAY")) {
     define ("SYSINFO_DISPLAY",TRUE);
 }
-define ("DBVERSION",167);
+define ("DBVERSION",168);
 define ("MONO_DATABASE",25);
 define ("DBVERSIONREPO",20);
 define ('NOTFOUND','--not found--');
diff --git a/include/database/profile_sql.class.php 
b/include/database/profile_sql.class.php
index 88c7c9b..55ea3ad 100644
--- a/include/database/profile_sql.class.php
+++ b/include/database/profile_sql.class.php
@@ -48,6 +48,7 @@ class Profile_sql extends Table_Data_SQL
                        , "p_desc" => "p_desc"
                        , "with_calc" => "with_calc"
                        , "with_direct_form" => "with_direct_form"
+                        ,'with_search_card'=>'with_search_card'
                );
                $this->type = array(
                        "p_id" => "numeric"
@@ -55,6 +56,7 @@ class Profile_sql extends Table_Data_SQL
                        , "p_desc" => "text"
                        , "with_calc" => "text"
                        , "with_direct_form" => "text"
+                        ,'with_search_card'=>"numeric"
                );
                $this->default = array(
                        "p_id" => "auto",
diff --git a/include/fiche.inc.php b/include/fiche.inc.php
index 318b461..44a7f94 100644
--- a/include/fiche.inc.php
+++ b/include/fiche.inc.php
@@ -75,22 +75,17 @@ $histo->javascript = 'onchange="if (this.value==3 || 
this.value==-1) {
 
 $histo->selected =  $http->get('histo',"number", -1);
 $str_histo = $histo->input();
-echo '<div class="content">';
+?>
+<div class="content">
+
+<?php
 echo '<FORM method="GET">';
 echo dossier::hidden();
 echo HtmlInput::hidden('ac', $ac);
 require_once NOALYSS_TEMPLATE.'/impress_cat_card.php';
 echo HtmlInput::submit('cat_display', _('Recherche'));
 echo '</FORM>';
-$search_card=new IText('card_search');
-$search_card_js=sprintf('onclick="boxsearch_card(\'%d\')"',dossier::id());
-?>
-<div id="box_search_card">
 
-               <?php echo _('Recherche de fiche')?> <?php echo 
Icon_Action::infobulle(18)?> :<?php echo $search_card->input()?>
-               <?php echo 
HtmlInput::button_anchor(_("Chercher"),"javascript:void(0)","",$search_card_js,'smallbutton')?>
-</div>
-<?php
 echo '</div>';
 $str = "if (g('histo').value==3 || g('histo').value== -1 ) {
      
g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';}
diff --git a/include/profile.inc.php b/include/profile.inc.php
index 41d0bc8..b68d67c 100644
--- a/include/profile.inc.php
+++ b/include/profile.inc.php
@@ -107,31 +107,35 @@ if (isset($_POST['change_stock']))
 
 if (isset($_POST['save_name']))
 {
-
-    extract($_POST, EXTR_SKIP);
+    $http=new HttpInput();
+    $p_name=$http->post("p_name");
+    $p_id=$http->post("p_id");
+    $with_calc=$http->post("with_calc","string",'f');
+    $with_direct_form=$http->post("with_direct_form","string",'f');
+    $with_search_card=$http->post("with_search_card","string",0);
+    $p_desc=$http->post('p_desc');
     try
     {
         if (strlen(trim($p_name))==0)
             throw new Exception("Nom ne peut être vide");
         if (isNumber($p_id)==0)
             throw new Exception("profile Invalide");
-        $wc=(isset($with_calc))?1:0;
-        $wd=(isset($with_direct_form))?1:0;
         $p_desc=(strlen(trim($p_desc))==0)?null:trim($p_desc);
         if ($p_id!=-1)
         {
             $cn->exec_sql("update profile set p_name=$1,p_desc=$2,
-                                       with_calc=$3, with_direct_form=$4 where 
p_id=$5",
+                                       with_calc=$3, with_direct_form=$4 
,with_search_card=$6
+                                        where p_id=$5",
                     array($p_name,
-                $p_desc, $wc, $wd, $p_id));
+                $p_desc, $with_calc, $with_direct_form, 
$p_id,$with_search_card));
         }
         else
         {
             $p_id=$cn->get_value("insert into profile (p_name,
-                               p_desc,with_calc,with_direct_form) values
-                               ($1,$2,$3,$4) returning p_id",
+                               
p_desc,with_calc,with_direct_form,with_search_card) values
+                               ($1,$2,$3,$4,$5) returning p_id",
                     array(
-                $p_name, $p_desc, $wc, $wd
+                $p_name, $p_desc, $with_calc, 
$with_direct_form,$with_search_card
             ));
         }
     }
@@ -150,9 +154,9 @@ if (isset($_POST['clone']))
         $p_id = $http->post("p_id","number", 0);
         $cn->start();
         $new_id=$cn->get_value("insert into profile(p_name,p_desc,with_calc,
-                       with_direct_form)
+                       with_direct_form,with_search_card)
                        select 'copie de '||p_name,p_desc,with_calc,
-                       with_direct_form from profile where p_id=$1 returning 
p_id", array($p_id));
+                       with_direct_form , with_search_card from profile where 
p_id=$1 returning p_id", array($p_id));
         $cn->exec_sql("
                         insert into profile_menu 
(p_id,me_code,me_code_dep,p_order,p_type_display,pm_default)
                         select 
$1,me_code,me_code_dep,p_order,p_type_display,pm_default from profile_menu
@@ -406,7 +410,7 @@ $profile_mobile->create_js_script();
 // Show details of the selected profile
 //*******************************************************
 echo '<div id="detail_profile" class="content">';
-if (isset($_POST['p_id']))
+if (isset($_POST['p_id']) && $_POST['p_id'] != -1 )
 {
     require_once NOALYSS_INCLUDE.'/ajax/ajax_get_profile.php';
     ?>
diff --git a/include/sql/patch/upgrade167.sql b/include/sql/patch/upgrade167.sql
new file mode 100644
index 0000000..d79e335
--- /dev/null
+++ b/include/sql/patch/upgrade167.sql
@@ -0,0 +1,7 @@
+begin;
+alter table profile add column with_search_card integer;
+comment on column profile.with_search_card is 'Display a icon for searching 
card : 1 display, 0 not displaid';
+
+update profile set with_search_card =1;
+insert into version (val,v_description) values (168,'Button search card');
+commit ;
diff --git a/include/template/module.php b/include/template/module.php
index d25416d..264bb07 100644
--- a/include/template/module.php
+++ b/include/template/module.php
@@ -18,6 +18,36 @@ if ( $cn->get_value("select count(*) from profile join 
profile_user using (p_id)
 echo '</div>';
 endif;
 
+// show search card 
+if ( $cn->get_value("select count(*) from profile join profile_user using 
(p_id)
+               where user_name=$1 and 
with_search_card=1",array($_SESSION[SESSION_KEY.'g_user'])) ==1):
+    $search_card=new IText('card_search');
+    $search_card_js=sprintf('onclick="boxsearch_card(\'%d\')"',dossier::id());
+    echo Icon_Action::button_magnifier(uniqid(), 
"$('box_search_card').show()");
+    echo '<div id="box_search_card" style="display:none" class="inner_box">';
+    echo HtmlInput::title_box(_("recherche"), "box_search_card","hide");
+    echo _('Recherche de fiche');
+    echo '<p class="info">';
+   echo _("Donnez une partie du nom, prénom, de la description, du poste 
comptable, du n° de TVA,quick code ... "
+           . " de la fiche" )    ;
+    echo '</p>';
+    echo '<p class="ml-1">';
+    echo $search_card->input();
+    echo '</p>';
+    echo '<ul class="aligned-block">';
+    
+    echo    '<li>'.
+            
HtmlInput::button_anchor(_("Chercher"),"javascript:void(0)","",$search_card_js,'button').
+            '</li>';
+            
+    echo    '<li>'. 
+            HtmlInput::button_hide("box_search_card").
+            '</li>';
+    echo '</ul>';
+    echo '</div>';
+endif;
+
+
 if ( $cn->get_value("select count(*) from profile join profile_user using 
(p_id)
                where user_name=$1 and 
with_direct_form=true",array($_SESSION[SESSION_KEY.'g_user'])) ==1):
 ?>
diff --git a/include/template/profile.php b/include/template/profile.php
index 39a78ff..5d65295 100644
--- a/include/template/profile.php
+++ b/include/template/profile.php
@@ -45,4 +45,8 @@
        <td><?php echo _("Avec  Accès Direct ")?></td>
        <td><?php echo $with_direct_form->input()?></td>
 </tr>
+<tr>
+       <td><?php echo _("Recherche de fiche")?></td>
+       <td><?php echo $with_search_card->input()?></td>
+</tr>
 </table>
\ No newline at end of file



reply via email to

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