22if (!defined(
'ALLOWED'))
23 die(
'Appel direct ne sont pas permis');
41 parent::__construct($p_cn,
$p_id);
60 $ret=parent::query_active_tag();
61 require_once NOALYSS_TEMPLATE.
'/tag_select.php';
73 $js=sprintf(
"onclick=\"new operation_tag('%s').select('%s','%s')\"", $p_div,
dossier::id(), $p_jr);
91 function update_search_cell($p_prefix)
93 $data=$this->get_data();
94 echo '<span id="sp_
'.$p_prefix.$data->t_id.'" class="tagcell
">';
96 echo HtmlInput::hidden($p_prefix.'tag[]', $data->t_id);
97 $js=sprintf("$(
'sp_".$p_prefix.$data->t_id."').remove();
");
98 echo Icon_Action::trash(uniqid(), $js);
106 function tag_add($p_tag_id)
108 if ($this->jrn_id==-1)
110 throw new Exception("TO99 jrn_id unset
");
112 $count=$this->cn->get_value('select count(*) from operation_tag'.
113 ' where jrn_id=$1 and tag_id=$2', array($this->jrn_id, $p_tag_id));
116 $sql=' insert into operation_tag (jrn_id,tag_id) values ($1,$2)';
117 $this->cn->exec_sql($sql, array($this->jrn_id, $p_tag_id));
125 function tag_cell($p_div)
128 $a_tag=$this->tag_get();
130 $ledger=$this->cn->get_value("
select jr_def_id
from jrn where
jr_id=$1
", [$this->jrn_id]);
131 $access=$g_user->get_ledger_access($ledger);
132 for ($e=0; $e<$c; $e++)
134 echo '<span class="tagcell tagcell-color
'.$a_tag[$e]['t_color
'].'">';
135 echo $a_tag[$e]['t_tag'];
138 $js_remove=sprintf("new operation_tag(
'%s').remove(
'%s',
'%s',
'%s')
", $p_div, dossier::id(),
139 $this->jrn_id, $a_tag[$e]['t_id']);
140 echo Icon_Action::trash(uniqid(), $js_remove);
154 if ($this->jrn_id==-1)
156 throw new Exception("TO01 jrn_id unset
");
158 $sql='select b.jrn_id,a.t_id,a.t_id,a.t_tag,a.t_color'
160 .' tags as a join operation_tag as b on (a.t_id=b.tag_id)'
162 .' order by a.t_tag';
163 $array=$this->cn->get_array($sql, array($this->jrn_id));
171 function tag_remove($p_tag_id)
173 if ($this->jrn_id==-1)
175 throw new Exception("TO01 jrn_id unset
");
177 $this->cn->exec_sql("delete from operation_tag where jrn_id=$1 and tag_id=$2
", [$this->jrn_id, $p_tag_id]);
183 function select_search($p_prefix)
186 $ret=$this->get_data()->seek(' order by t_tag');
187 require_once NOALYSS_TEMPLATE.'/tag_search_select.php';
188 return HtmlInput::title_box('Tag', $p_prefix.'tag_div').$res;
194 static function select_tag_search($p_prefix)
197 $r.=HtmlInput::button("choose_tag
", _("Etiquette
"),
198 'onclick="search_display_tag(
'.Dossier::id().',\
''.$p_prefix.
'\',\
'Tag_Operation\')"',
"smallbutton");
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static id()
return the 'gDossier' value after a check
concerns the tags linked to an accountancy writing
__construct($p_cn, $p_id=-1)
static add_clear_button($p_prefix)
clear the search cell
select($p_prefix="")
let select a tag to add
static button_search($p_jr, $p_div)
Show a button to select tag for Search.
Tag operations or actions to linked them together.