Add a button search_card

This commit is contained in:
sparkyx 2021-08-24 18:09:02 +02:00
parent 7df4ad0c0f
commit c6288ceaf1
9 changed files with 69 additions and 23 deletions

View file

@ -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;
}

View file

@ -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 )
{

View file

@ -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--');

View file

@ -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",

View file

@ -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';}

View file

@ -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';
?>

View file

@ -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 ;

View file

@ -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):
?>

View file

@ -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>