From c6288ceaf1e1e68e0036e4e73aea8dcba0d7a8ea Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 24 Aug 2021 18:09:02 +0200 Subject: [PATCH] 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(-) create mode 100644 include/sql/patch/upgrade167.sql diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index 8777cff3b..a40c32769 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 270978e55..b093130da 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 474486e7b..819f8b528 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 88c7c9b02..55ea3ad4d 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 318b4615c..44a7f9446 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 '
'; +?> +
+ +'; echo dossier::hidden(); echo HtmlInput::hidden('ac', $ac); require_once NOALYSS_TEMPLATE.'/impress_cat_card.php'; echo HtmlInput::submit('cat_display', _('Recherche')); echo ''; -$search_card=new IText('card_search'); -$search_card_js=sprintf('onclick="boxsearch_card(\'%d\')"',dossier::id()); -?> -
- :input()?> - -
-'; $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 41d0bc8b2..b68d67c52 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 '
'; -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 000000000..d79e3353d --- /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 d25416d9f..264bb074d 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 '
'; 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 ''; +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 39a78ffb5..5d6529555 100644 --- a/include/template/profile.php +++ b/include/template/profile.php @@ -45,4 +45,8 @@ input()?> + + + input()?> + \ No newline at end of file