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

in follow-up , add multiple cards to an event, an action More...

+ Collaboration diagram for Card_Multiple:

Public Member Functions

 __construct ()
 
 build_sql ($sql_array)
 
 count_sql ($sql_array)
 
 display_option ($p_action_person_id)
 @global type $g_user More...
 

Private Member Functions

 filter_enable_card ()
 

Private Attributes

 $sql
 SQL with the right column name. More...
 

Detailed Description

in follow-up , add multiple cards to an event, an action

Definition at line 31 of file card_multiple.class.php.

Constructor & Destructor Documentation

◆ __construct()

Card_Multiple::__construct ( )

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

35 {
36 $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description,
37 (select ad_value from fiche_detail fd where fd.f_id=vw_fiche_attr.f_id and fd.ad_id=25) as company
38 from vw_fiche_attr ";
39 }

Member Function Documentation

◆ build_sql()

Card_Multiple::build_sql (   $sql_array)
Parameters
type$sql_array
Returns
type

Definition at line 45 of file card_multiple.class.php.

46 {
48 $filter="";
49 if ( $sql_array["inactive_card"]==0) {
50 $filter=" and ".$this->filter_enable_card();
51 }
52 // By Cat of card
53 $sql_cat="";
54 if ( $sql_array['search_cat']!=-1) {
55 $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
56 }
58 if ( $sql_array['search_in'] == "-1")
59 {
60 $string_sql=$this->sql."
61 where
62 (vw_name ilike '%$query%'
63 or quick_code ilike '%$query%')
64 ".$filter.$sql_cat."
65 order by vw_name
66 limit
68 } else {
69 $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where
70 ad_id = '%s' and ad_value ilike '%%%s%%') %s %s"
71 , sql_string($sql_array["search_in"]),$query,$filter,$sql_cat);
72 }
73 return $string_sql;
74 }
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition: ac_common.php:511
$sql_array['query']
$filter
static connect()
const MAX_CARD_SEARCH
Definition: constant.php:136

References $cn, $filter, $query, $sql_array, Dossier\connect(), MAX_CARD_SEARCH, and sql_string().

+ Here is the call graph for this function:

◆ count_sql()

Card_Multiple::count_sql (   $sql_array)
Parameters
type$sql_array
Returns
type

Definition at line 80 of file card_multiple.class.php.

81 {
84 $filter="";
85 if ( $sql_array["inactive_card"]==0) {
86 $filter="and ".$this->filter_enable_card();
87 }
88 // By Cat of card
89 $sql_cat="";
90 if ( $sql_array['search_cat']!=-1) {
91 $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
92 }
93
94 $string_sql="select count(*)
95 from vw_fiche_attr
96 where
97 ( vw_name ilike '%$query%'
98 or quick_code ilike '%$query%')
99 ".$filter.$sql_cat;
100
101
102 return $cn->get_value($string_sql);
103 }

References $cn, $filter, $query, $sql_array, Dossier\connect(), and sql_string().

+ Here is the call graph for this function:

◆ display_option()

Card_Multiple::display_option (   $p_action_person_id)

@global type $g_user

Parameters
type$ap_id
Returns
type

Definition at line 119 of file card_multiple.class.php.

120 {
121 global $g_user;
123 // retrieve card id (fiche.f_id) and the ag_id (action_gestion.ag_id)
124 $tmp=$cn->get_row("select f_id,ag_id from action_person where ap_id=$1 ", [$p_action_person_id]);
125 if ($tmp==NULL)
126 {
127 record_log("CMDO.01nothing found ".var_export($_REQUEST, true));
128 return;
129 }
130 $fiche_id=$tmp['f_id'];
131 $ag_id=$tmp['ag_id'];
132 if ( ! $g_user->can_read_action($ag_id)) {
133 throw new Exception (_("CMCDO01"."Security"));
134 }
135 // Retrieve Name, first Name and QCODE
136 $aIdentity=$cn->get_row("select (select ad_value from fiche_detail where f_id=$1 and ad_id=1) as name ,
137 (select ad_value from fiche_detail where f_id=$1 and ad_id=32) as first_name ,
138 (select ad_value from fiche_detail where f_id=$1 and ad_id=23) as qcode ",[$fiche_id]);
139
140 // insert new , synchronized
141 $cn->exec_sql("insert into action_person_option (ap_value,contact_option_ref_id ,action_person_id )
142 select null,cor_id,$1
143 from contact_option_ref
144 where
145 cor_id not in (
146 select contact_option_ref_id
147 from action_person_option
148 join action_person a on (a.ap_id=action_person_id)
149 where f_id=$2 and ag_id=$3)",[$p_action_person_id,$fiche_id,$ag_id]);
150
151 // delete disable
152 $cn->exec_sql("delete
153 from action_person_option apo
154 where contact_option_ref_id not in
155 (select contact_option_ref_id from jnt_document_option_contact jdoc join action_gestion on
156 (ag_type=document_type_id)
157 where ag_id=$1 and jdoc_enable=1)",[$ag_id]);
158
159 // First select the option
160 $sql="select ap_id,cor_id,ap_value,cor_type ,cor_label,cor_value_select
161 from contact_option_ref cor
162 join action_person_option apo on (cor.cor_id=apo.contact_option_ref_id)
163 where action_person_id=$1 order by cor_label ";
164
165 $a_option=$cn->get_array($sql,[$p_action_person_id]);
166 require NOALYSS_TEMPLATE."/card_multiple_display_option.php";
167
168 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342
global $g_user
if no group available , then stop
$ag_id
Definition: action.inc.php:54
$_REQUEST['ac']
$sql
SQL with the right column name.

References $_REQUEST, $ag_id, $cn, $fiche_id, $g_user, $sql, $tmp, Dossier\connect(), and record_log().

+ Here is the call graph for this function:

◆ filter_enable_card()

Card_Multiple::filter_enable_card ( )
private
Returns
string

Definition at line 108 of file card_multiple.class.php.

109 {
110 $filter_enable_card=" f_enable='1' ";
111 return $filter_enable_card;
112 }

Field Documentation

◆ $sql

Card_Multiple::$sql
private

SQL with the right column name.

Definition at line 33 of file card_multiple.class.php.

Referenced by display_option().


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