22if (!defined(
'ALLOWED'))
23 die(
'Appel direct ne sont pas permis');
25$cn=Dossier::connect();
37if (
$op==
'save_filter')
47 $new->setp(
"login",
$g_user->login);
48 $new->setp(
"nb_jrn",
$http->post(
"nb_jrn",
'number'));
49 $new->setp(
"date_start",
$http->post(
"date_start",
'string', NULL));
50 $new->setp(
"date_end",
$http->post(
"date_end",
'string', NULL));
51 $new->setp(
"description",
$http->post(
"desc",
'string', NULL));
52 $new->setp(
"amount_min",
$http->post(
"amount_min",
'number', NULL));
53 $new->setp(
"amount_max",
$http->post(
"amount_max",
'number', NULL));
54 $new->setp(
"qcode",
$http->post(
"qcode",
'string', NULL));
55 $new->setp(
"accounting",
$http->post(
"accounting",
'string', NULL));
56 $new->setp(
"uf_tag_option",
$http->post(
"tag_option",
"string",
null));
57 $new->setp(
"date_paid_start",
58 $http->post(
"date_paid_start",
'string', NULL));
59 $new->setp(
"date_paid_end",
$http->post(
"date_paid_end",
'string', NULL));
60 $new->setp(
"ledger_type",
$http->post(
"ledger_type",
'string'));
61 $new->setp(
"operation_filter",
$http->post(
"operation_filter",
'string', NULL));
62 $new->setp(
"filter_name",
h(
$http->post(
"filter_name",
'string')));
63 $new->setp(
"uf_currency_code",
h(
$http->post(
"p_currency_code",
'number',-1)));
65 $tva_id=($acc_tva->tva_id===-1)?
null:$acc_tva->tva_id;
66 $new->setp(
"tva_id_search",$tva_id);
70 $new->setp(
"uf_tag",join(
',',
$tag));
72 $new->setp(
"uf_tag",
null);
77 $aJrn[]=
$http->post(
"r_jrn".
$i,
"number");
79 $new->setp(
"r_jrn", join(
',', $aJrn));
80 if (strlen($new->getp(
"filter_name"))==0)
82 throw new Exception(
_(
"Nom ne peut être vide"));
85 $rmAction=sprintf(
"delete_filter('%s','%s','%s')", trim(
$http->post(
'div')),
$dossier_id,
88 $answer[
'filter_name'].=sprintf(
"<a class=\"line\" style=\"display:inline;text-decoration:underline\" onclick=\"load_filter('%s','%s','%s')\">%s</a>",
90 $new->getp(
"filter_name"));
91 $answer[
'filter_name'].=
'<span id="'.uniqid().
'" onclick="'.$rmAction.
'" class="icon" style="display:inline;margin-left:2em"></span>';;
92 $answer[
'filter_id']=$new->getp(
"id");
100 header(
'Content-Type: application/json;charset=utf-8');
107if (
$op==
"load_filter")
109 $filter_id=
$http->get(
"filter_id",
"number");
120 header(
'Content-Type: application/json;charset=utf-8');
128if (
$op==
"display_search_filter")
130 $p_div=
$http->get(
"div");
140 select id, filter_name,ledger_type
148 printf(
'<ul class="select_table" id="manage%s">', $p_div);
152 echo $search_filter->build_name_filter();
156 echo
HtmlInput::anchor(
_(
"Remise à zéro"),
"",
"style=\"text-decoration:underline\" onclick=\"reset_filter('$p_div');removeDiv('boxfilter{$p_div}')\"");
160 for (
$i=0;
$i<$nb_result;
$i++)
162 printf(
' <li id="manageli%s_%d">', $p_div,
$result[
$i][
"id"]);
163 $rmAction=sprintf(
"delete_filter('%s','%s','%s')", $p_div,
$dossier_id,
165 printf(
"<a href=\"javascript:void(0)\" style=\"display:inline;text-decoration:underline\" onclick=\"load_filter('%s','%s','%s');removeDiv('boxfilter%s')\">",
169 echo
'<span id="'.uniqid().
'" onclick="'.$rmAction.
'" class="icon" style="display:inline;margin-left:2em"></span>';
181if (
$op==
"delete_search_operation")
190 $p_div=
$http->post(
"div");
191 $filter_id=
$http->post(
"filter_id",
"number");
195 $cn->exec_sql(
"delete from user_filter where id=$1 and login=$2",[$filter_id,
$g_user->login]);
197 $answer[
'filter_id']=$filter_id;
200 catch (Exception
$ex)
204 header(
'Content-Type: application/json;charset=utf-8');
211if (
$op==
'display_filter_tag')
214 if ( trim(
$tag)==
"") {
return;}
219 $nb_tag=count(
$aTag);
220 for ($j=0; $j<$nb_tag; $j++)
231if (
$op==
'display_list_filter')
233 echo \HtmlInput::title_box(
"Recherches sauvées",
'display_list_filter_div');
236 $ledger_search->display_list_filter();
240 <ul
class=
"aligned-block">
242 <?=\HtmlInput::button_close(
"display_list_filter_div")?>
global $g_user
if no group available , then stop
h( $row[ 'oa_description'])
_("actif, passif,charge,...")
static build_array(User_Filter_SQL $user_filter_sql)
use a user_filter row and turns it into an array for javascript purpose
static build($db, $p_code)
retrieve TVA rate thanks the code that could be the tva_id or tva_code.
concerns the tags linked to an accountancy writing
ORM abstract of the table public.user_filter.