noalyss Version-9
Public Member Functions | Private Attributes
Follow_Up_Other_Concerned Class Reference

Others concerned card in an action. More...

+ Collaboration diagram for Follow_Up_Other_Concerned:

Public Member Functions

 __construct ($p_database, $p_action_gestion_id)
 
 button_action_add_concerned_card ()
 Return a HTML string with a button for adding other cards. More...
 
 display_linked_count ()
 Display the count of other concerned card (tiers, supplier...) in button which call. More...
 
 display_row ($p_fid, $p_row, $pa_Column)
 Display one row for all the option of a card. More...
 
 display_table ()
 Display all the person with option in a html table. More...
 
 get_ag_id ()
 
 get_db ()
 
 get_option ()
 Get Available options. More...
 
 insert_linked_card ($p_fiche_id)
 Add another concerned (tiers, supplier...) More...
 
 remove_linked_card ($p_fiche_id)
 Remove another concerned (tiers, supplier...) More...
 
 set_ag_id ($ag_id)
 
 set_db ($cn)
 

Private Attributes

 $ag_id
 
 $db
 

Detailed Description

Others concerned card in an action.

See also
Follow_Up

Definition at line 34 of file follow_up_other_concerned.class.php.

Constructor & Destructor Documentation

◆ __construct()

Follow_Up_Other_Concerned::__construct (   $p_database,
  $p_action_gestion_id 
)

Definition at line 40 of file follow_up_other_concerned.class.php.

41 {
42 $this->db=$p_database;
43 $this->ag_id=$p_action_gestion_id;
44 }
$fl ag_id
$SecUser db

References ag_id, and db.

Member Function Documentation

◆ button_action_add_concerned_card()

Follow_Up_Other_Concerned::button_action_add_concerned_card ( )

Return a HTML string with a button for adding other cards.

Returns
type

Definition at line 129 of file follow_up_other_concerned.class.php.

130 {
132 $javascript=<<<EOF
133 var obj={dossier:$dossier,ag_id:$this->ag_id};action_concerned_search_card(obj);
134EOF;
135 $js=HtmlInput::button_action(_('Ajout autres'), $javascript, 'xx', 'smallbutton');
136 return $js;
137 }
$dossier
static id()
return the 'gDossier' value after a check
static button_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
button Html with javascript

References $dossier, $js, ag_id, HtmlInput\button_action(), and Dossier\id().

+ Here is the call graph for this function:

◆ display_linked_count()

Follow_Up_Other_Concerned::display_linked_count ( )

Display the count of other concerned card (tiers, supplier...) in button which call.

Returns
string

Definition at line 90 of file follow_up_other_concerned.class.php.

91 {
92 $a_linked=$this->db->get_array('select ap_id,f_id from action_person where ag_id=$1', array($this->ag_id));
93 if (count($a_linked)==0)
94 return "0";
96 $javascript=<<<EOF
97 var obj={dossier:$dossier_id,ag_id:$this->ag_id};action_concerned_list(obj);
98EOF;
99 echo HtmlInput::anchor_action(count($a_linked), $javascript, 'linked_card_bt', "button");
100 }
$dossier_id
Definition: ajax_poste.php:43
static anchor_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
Anchor Html with javascript.

References $dossier_id, ag_id, HtmlInput\anchor_action(), db, and Dossier\id().

+ Here is the call graph for this function:

◆ display_row()

Follow_Up_Other_Concerned::display_row (   $p_fid,
  $p_row,
  $pa_Column 
)

Display one row for all the option of a card.

Parameters
int$p_fidcard if (fiche.f_id)
int$p_rowindex of the row used for alternate the color of the rows
array$aOtherColumn of the options

Definition at line 145 of file follow_up_other_concerned.class.php.

146 {
147 static $dossier_id;
149
150 $action_person_id=$this->db->get_value("select ap_id from action_person where f_id=$1 and ag_id=$2",
151 [$p_fid, $this->ag_id]);
152
153 // Name , first & quick code from fiche
154 $row=$this->db->get_row("select
155 (select ad_value from fiche_detail fd2 where fd2.f_id=ap.f_id and fd2.ad_id = 1) as xname,
156 (select ad_value from fiche_detail fd2 where fd2.f_id=ap.f_id and fd2.ad_id = 32) as xfirst_name,
157 (select ad_value from fiche_detail fd2 where fd2.f_id=ap.f_id and fd2.ad_id = 23) as xqcode
158 from fiche ap
159 where ap.f_id=$1
160 ", [$p_fid]);
161
162
163 // Detail for this one
164 $detail=HtmlInput::anchor($row['xqcode'], "",
165 sprintf("onclick=\"linked_card_option('%s','%s')\"", $action_person_id, $dossier_id),
166 'class="line"', _("Options"));
167 // remove card
168 $js_remove=sprintf("action_remove_concerned('%s','%s','%s')", dossier::id(), $p_fid, $this->ag_id);
169 $remove=Icon_Action::trash(uniqid(), $js_remove);
170 $r=<<<EOF
171 <tr id="other_{$action_person_id}">
172
173 <td>
174 {$detail}
175 </td>
176 <td>
177 {$row['xname']}
178 </td>
179 <td>
180 {$row['xfirst_name']}
181 </td>
182EOF;
183 $nb_other=count($pa_Column);
184 for ($i=0; $i<$nb_other; $i++)
185 {
186 $value=$this->db->get_value("
187 select apo2.ap_value
188 from action_person_option apo2
189 join action_person ap on (apo2.action_person_id=ap.ap_id)
190 where
191 apo2.contact_option_ref_id =$1
192 and ap.f_id=$2
193 and ap.ag_id=$3
194 ", array($pa_Column[$i]['cor_id'], $p_fid, $this->ag_id));
195 $r.=td($value);
196 }
197 $r.='<td>'.$remove.'</td>';
198 $r.='</tr>';
199 return $r;
200 }
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$input_from id
Definition: balance.inc.php:63
static anchor($p_text, $p_url="", $p_js="", $p_style=' class="line" ', $p_title="click", array $p_attribute=[])
Return a simple anchor with a url or a javascript if $p_js is not null then p_url will be javascript:...
static trash($p_id, $p_javascript)
Display the icon of a trashbin.

References $action_person_id, $detail, $dossier_id, $i, $nb_other, $r, $row, $value, ag_id, HtmlInput\anchor(), db, id, Dossier\id(), td(), tr(), and Icon_Action\trash().

+ Here is the call graph for this function:

◆ display_table()

Follow_Up_Other_Concerned::display_table ( )

Display all the person with option in a html table.

Definition at line 205 of file follow_up_other_concerned.class.php.

206 {
207 require_once NOALYSS_TEMPLATE."/follow_up_other_concerned_display_table.php";
208 }

◆ get_ag_id()

Follow_Up_Other_Concerned::get_ag_id ( )

Definition at line 46 of file follow_up_other_concerned.class.php.

References $ag_id.

◆ get_db()

Follow_Up_Other_Concerned::get_db ( )

Definition at line 57 of file follow_up_other_concerned.class.php.

References $db.

◆ get_option()

Follow_Up_Other_Concerned::get_option ( )

Get Available options.

Definition at line 213 of file follow_up_other_concerned.class.php.

214 {
215 $aColumn=$this->db->get_array("select cor_id,cor_label,jdoc.jdoc_enable
216 from contact_option_ref cor
217 join jnt_document_option_contact jdoc on (cor.cor_id=jdoc.contact_option_ref_id )
218 join action_gestion ag on (ag.ag_type=jdoc.document_type_id )
219 where ag_id=$1 and jdoc.jdoc_enable=1
220 order by upper(cor_label)", [$this->ag_id]);
221 return $aColumn;
222 }

References $aColumn, ag_id, and db.

◆ insert_linked_card()

Follow_Up_Other_Concerned::insert_linked_card (   $p_fiche_id)

Add another concerned (tiers, supplier...)

Remarks
type $g_user
Parameters
type$p_fiche_id

insert into action_person

Definition at line 107 of file follow_up_other_concerned.class.php.

108 {
109 global $g_user;
110 if ($g_user->can_write_action($this->ag_id))
111 {
112 /**
113 * insert into action_person
114 */
115 $count=$this->db->get_value('select count(*) from action_person where f_id=$1 and ag_id=$2',
116 array($p_fiche_id, $this->ag_id));
117 if ($count==0)
118 {
119 $this->db->exec_sql('insert into action_person (ag_id,f_id) values ($1,$2)',
120 array($this->ag_id, $p_fiche_id));
121 }
122 }
123 }
global $g_user
if no group available , then stop
$count

References $count, $g_user, ag_id, and db.

◆ remove_linked_card()

Follow_Up_Other_Concerned::remove_linked_card (   $p_fiche_id)

Remove another concerned (tiers, supplier...)

Remarks
type $g_user
Parameters
type$p_fiche_id

Definition at line 73 of file follow_up_other_concerned.class.php.

74 {
75 global $g_user;
76 if ($g_user->can_write_action($this->ag_id))
77 {
78 $this->db->exec_sql('delete from action_person where ag_id = $1 and f_id = $2',
79 array($this->ag_id, $p_fiche_id));
80 return true;
81 }
82 return false;
83 }

References $g_user, ag_id, and db.

◆ set_ag_id()

Follow_Up_Other_Concerned::set_ag_id (   $ag_id)

Definition at line 51 of file follow_up_other_concerned.class.php.

52 {
53 $this->ag_id=$ag_id;
54 return $this;
55 }

References $ag_id, and ag_id.

◆ set_db()

Follow_Up_Other_Concerned::set_db (   $cn)

Definition at line 62 of file follow_up_other_concerned.class.php.

63 {
64 $this->db=$cn;
65 return $this;
66 }

References $cn, and db.

Field Documentation

◆ $ag_id

Follow_Up_Other_Concerned::$ag_id
private

Definition at line 37 of file follow_up_other_concerned.class.php.

Referenced by get_ag_id(), and set_ag_id().

◆ $db

Follow_Up_Other_Concerned::$db
private

Definition at line 38 of file follow_up_other_concerned.class.php.

Referenced by get_db().


The documentation for this class was generated from the following file: