PEEL Shopping
Open source ecommerce : PEEL Shopping
fonctions.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: fonctions.php 46935 2015-09-18 08:49:48Z gboussin $
14 if (!defined('IN_PEEL')) {
15  die();
16 }
17 
25  $result['menu_items']['users_sales'][$GLOBALS['wwwroot_in_admin'] . '/modules/commerciale/administrer/list_admin_contact_planified.php'] = $GLOBALS["STR_ADMIN_MENU_USERS_CLIENTS_TO_CONTACT"];
26  $result['menu_items']['users_sales'][$GLOBALS['administrer_url'] . '/utilisateurs.php?mode=search&commercial=' . $_SESSION['session_utilisateur']['id_utilisateur']] = sprintf($GLOBALS["STR_ADMIN_MENU_USERS_CLIENTS_PER_SALESMAN"], vb($_SESSION['session_utilisateur']['pseudo']));
27  return $result;
28 }
29 
37 function affiche_list_admin_contact($recherche = null, $return_mode = false)
38 {
39  $output = '';
40  $sql_cond = array();
41  if (!empty($recherche)) {
42  if (!empty($recherche['login_to_contact'])) {
43  // Gestion de la personne à contacter : login
44  $sql_cond[] = ' u.pseudo LIKE "' . nohtml_real_escape_string(vb($recherche['login_to_contact'])) . '%" ';
45  }
46 
47  if (!empty($recherche['nom_to_contact'])) {
48  // Gestion de la personne à contacter : nom
49  $sql_cond[] = ' u.nom_famille LIKE "' . nohtml_real_escape_string(vb($recherche['nom_to_contact'])) . '%" ';
50  }
51 
52  if (!empty($recherche['account_type'])) {
53  // Gestion en fonction du type de compte
54  $sql_cond[] = ' u.priv = "' . nohtml_real_escape_string(vb($recherche['account_type'])) . '" ';
55  }
56 
57  if (!empty($recherche['admin_id'])) {
58  // Gestion en fonction de l'admin
59  $sql_cond[] = ' c.admin_id = "' . intval(vn($recherche['admin_id'])) . '" ';
60  }
61 
62  if (!empty($recherche['ad_date'])) {
63  // Gestion en fonction de la date
64  $sql_cond[] = ' timestamp LIKE "' . nohtml_real_escape_string(get_mysql_date_from_user_input(vb($recherche['ad_date']))) . '%" ';
65  }
66 
67  if (!empty($recherche['form_contact_planified_reason'])) {
68  // Gestion de la personne à contacter : nom
69  $sql_cond[] = ' c.reason="' . nohtml_real_escape_string(vb($recherche['form_contact_planified_reason'])) . '" ';
70  }
71 
72  if (!empty($recherche['form_contact_planified_actif'])) {
73  // Gestion de la planification actif
74  $sql_cond [] = ' c.actif="' . nohtml_real_escape_string(vb($recherche['form_contact_planified_actif'])) . '"';
75  }
76  }
77 
78  $query_contact = 'SELECT u.id_utilisateur AS contact_id, u.nom_famille AS contact_name, u.prenom AS contact_firstname, u.pseudo AS contact_login, u.etat AS contact_valid, u_admin.pseudo AS pseudo_admin, c.*
79  FROM peel_admins_contacts_planified c
80  LEFT JOIN peel_utilisateurs u_admin ON u_admin.id_utilisateur = c.admin_id AND ' . get_filter_site_cond('utilisateurs', 'u_admin') . '
81  LEFT JOIN peel_utilisateurs u ON u.id_utilisateur = c.user_id AND ' . get_filter_site_cond('utilisateurs', 'u') . '
82  ' . (!empty($sql_cond)?'WHERE ' . implode(' AND ', $sql_cond):'');
83 
84  $Links = new Multipage($query_contact, 'liste_contact');
85  $HeaderTitlesArray = array(' ', $GLOBALS["STR_BY"], $GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_FORECASTED_DATE"], $GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_LAST_CONTACT"], $GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_PERSON_TO_CONTACT"], $GLOBALS["STR_ADMIN_REASON"], $GLOBALS["STR_STATUS"], $GLOBALS["STR_COMMENTS"], $GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_TAKE_CONTACT"]);
86  $Links->HeaderTitlesArray = $HeaderTitlesArray;
87  $results_array = $Links->Query();
88 
89  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/commercialeAdmin_list_contact.tpl');
90  $tpl->assign('action', get_current_url(false));
91  $tpl->assign('login_to_contact', vb($recherche['login_to_contact']));
92  $tpl->assign('nom_to_contact', vb($recherche['nom_to_contact']));
93 
94  $tpl_account_type_options = array();
95  $sql = "SELECT *, name_".$_SESSION['session_langue']." AS name
96  FROM peel_profil
97  WHERE " . get_filter_site_cond('profil') . "";
98  $res = query($sql);
99  // Recherche des profils utilisateur disponible
100  while ($account_type = fetch_assoc($res)) {
101  $tpl_account_type_options[] = array('value' => $account_type['priv'],
102  'issel' => $account_type['priv'] == vb($recherche['account_type']),
103  'name' => vb($account_type['name'])
104  );
105  }
106  $tpl->assign('account_type_options', $tpl_account_type_options);
107 
108  $tpl_admin_options = array();
109  $sql = "SELECT *
110  FROM peel_utilisateurs
111  WHERE priv LIKE 'admin%' AND " . get_filter_site_cond('utilisateurs') . "";
112  $res = query($sql);
113  // Recherche des profils administrateur
114  while ($account_admin = fetch_assoc($res)) {
115  $tpl_admin_options[] = array('value' => $account_admin['id_utilisateur'],
116  'issel' => $account_admin['id_utilisateur'] == vn($recherche['admin_id']),
117  'name' => vb($account_admin['pseudo'])
118  );
119  }
120  $tpl->assign('admin_options', $tpl_admin_options);
121  $tpl->assign('form_contact_planified_reason', vb($recherche['form_contact_planified_reason']));
122  $tpl->assign('form_contact_planified_actif', vb($recherche['form_contact_planified_actif']));
123 
124  $tpl->assign('ad_date', vb($recherche['ad_date']));
125 
126  if (empty($results_array)) {
127  $tpl->assign('empty_results', true);
128  } else {
129  $tpl->assign('empty_results', false);
130  $tpl->assign('links_multipage', $Links->GetMultipage());
131  $tpl->assign('links_header_row', $Links->getHeaderRow());
132 
133  $tpl_results = array();
134  $i = 0;
135  foreach ($results_array as $contact) {
136  $tpl_last_date = null;
137  $tpl_last_date_color = null;
138  // On vérifie si il y a déjà eu des actions sur l'utilisateur
139  $query = query('SELECT UNIX_TIMESTAMP(MAX(date)) AS last_contact_timestamp
140  FROM peel_admins_actions
141  WHERE id_membre = "' . intval(vn($contact['user_id'])) . '" AND action IN ("PHONE_EMITTED", "PHONE_RECEIVED", "SEND_EMAIL") AND ' . get_filter_site_cond('admins_actions', null, true) . '');
142  $rep_query = fetch_assoc($query);
143  if (!empty($rep_query['last_contact_timestamp'])) {
144  if (($contact['timestamp'] > time()) && ($contact['timestamp'] > $rep_query['last_contact_timestamp'])) {
145  $tpl_last_date_color = '#000000';
146  } elseif (($contact['timestamp'] <= time()) && ($contact['timestamp'] < $rep_query['last_contact_timestamp'])) {
147  $tpl_last_date_color = '#009900';
148  } elseif (($contact['timestamp'] <= time()) && ($contact['timestamp'] > $rep_query['last_contact_timestamp'])) {
149  $tpl_last_date_color = '#FF0000';
150  }
151  $tpl_last_date = get_formatted_date($rep_query['last_contact_timestamp']);
152  }
153  $tpl_results[] = array('tr_rollover' => tr_rollover($i, true),
154  'id' => intval(vn($contact['id'])),
155  'contact_login' => $contact['contact_login'],
156  'pseudo_admin' => $contact['pseudo_admin'],
157  'date' => get_formatted_date($contact['timestamp']),
158  'last_date' => $tpl_last_date,
159  'last_date_color' => $tpl_last_date_color,
160  'contact_name' => vb($contact['contact_name']),
161  'contact_firstname' => vb($contact['contact_firstname']),
162  'edit_href' => $GLOBALS['administrer_url'] . '/utilisateurs.php?mode=modif&id_utilisateur=' . intval(vn($contact['contact_id'])) . '&start=0',
163  'contact_id' => intval(vn($contact['contact_id'])),
164  'reason' => $contact['reason'],
165  'etat_onclick' => 'change_status("contact", "' . $contact['id'] . '", this, "'.$GLOBALS['administrer_url'] . '")',
166  'etat_src' => $GLOBALS['administrer_url'] . '/images/' . (!empty($contact['actif']) && $contact['actif'] == 'FALSE' ? 'puce-blanche.gif' : 'puce-verte.gif'),
167  'comments' => $contact['comments'],
168  'email_send_href' => (check_if_module_active('webmail')?$GLOBALS['wwwroot_in_admin'] . '/modules/webmail/administrer/webmail_send.php?id_utilisateur=' . intval(vn($contact['contact_id'])):''),
169  'appeler_href' => $GLOBALS['administrer_url'] . '/utilisateurs.php?mode=modif&id_utilisateur=' . intval(vn($contact['contact_id'])) . '&start=0#phone_event',
170  );
171  $i++;
172  }
173  $tpl->assign('results', $tpl_results);
174  }
175  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS['STR_BEFORE_TWO_POINTS']);
176  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_LIST_TITLE', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_LIST_TITLE']);
177  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_LIST_EXPLAIN', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_LIST_EXPLAIN']);
178  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_LOGIN_TO_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_LOGIN_TO_CONTACT']);
179  $tpl->assign('STR_ADMIN_INPUT_SEARCH', $GLOBALS['STR_ADMIN_INPUT_SEARCH']);
180  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_ACCOUNT_TYPE', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_ACCOUNT_TYPE']);
181  $tpl->assign('STR_ADMIN_ANY', $GLOBALS['STR_ADMIN_ANY']);
182  $tpl->assign('STR_ADMIN_ADMINISTRATOR', $GLOBALS['STR_ADMIN_ADMINISTRATOR']);
183  $tpl->assign('STR_ADMIN_DATE', $GLOBALS['STR_ADMIN_DATE']);
184  $tpl->assign('STR_ADMIN_INPUT_SEARCH', $GLOBALS['STR_ADMIN_INPUT_SEARCH']);
185  $tpl->assign('STR_ADMIN_REASON', $GLOBALS['STR_ADMIN_REASON']);
186  $tpl->assign('STR_ADMIN_ANY', $GLOBALS['STR_ADMIN_ANY']);
187  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTING_PROFILE', $GLOBALS['STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTING_PROFILE']);
188  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTED_BY_PRODUCT', $GLOBALS['STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTED_BY_PRODUCT']);
189  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_PAYMENT_EXPECTED', $GLOBALS['STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_PAYMENT_EXPECTED']);
190  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_FOLLOW_UP', $GLOBALS['STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_FOLLOW_UP']);
191  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_ACTIVE_TASK', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_ACTIVE_TASK']);
192  $tpl->assign('STR_ADMIN_TO_DO', $GLOBALS['STR_ADMIN_TO_DO']);
193  $tpl->assign('STR_ADMIN_DONE_OR_CANCELED', $GLOBALS['STR_ADMIN_DONE_OR_CANCELED']);
194  $tpl->assign('STR_SEARCH', $GLOBALS['STR_SEARCH']);
195  $tpl->assign('STR_MODULE_WEBMAIL_ADMIN_COLORS_EXPLAIN', $GLOBALS['STR_MODULE_WEBMAIL_ADMIN_COLORS_EXPLAIN']);
196  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_NOBODY_TO_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_NOBODY_TO_CONTACT']);
197  $tpl->assign('STR_ADMIN_CHECK_ALL', $GLOBALS['STR_ADMIN_CHECK_ALL']);
198  $tpl->assign('STR_ADMIN_UNCHECK_ALL', $GLOBALS['STR_ADMIN_UNCHECK_ALL']);
199  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_DELETE_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_DELETE_CONTACT']);
200  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_NO_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_NO_CONTACT']);
201  $tpl->assign('STR_ADMIN_NAME', $GLOBALS['STR_ADMIN_NAME']);
202  $tpl->assign('STR_FIRST_NAME', $GLOBALS['STR_FIRST_NAME']);
203  $tpl->assign('STR_ADMIN_LOGIN', $GLOBALS['STR_ADMIN_LOGIN']);
204  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_EDIT_ACCOUNT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_EDIT_ACCOUNT']);
205  $tpl->assign('STR_NUMBER', $GLOBALS['STR_NUMBER']);
206  $tpl->assign('STR_ADMIN_UTILISATEURS_SEND_EMAIL', $GLOBALS['STR_ADMIN_UTILISATEURS_SEND_EMAIL']);
207  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_CALL_CLIENT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_CALL_CLIENT']);
208  $tpl->assign('STR_ADMIN_CHECK_ALL', $GLOBALS['STR_ADMIN_CHECK_ALL']);
209  $tpl->assign('STR_ADMIN_UNCHECK_ALL', $GLOBALS['STR_ADMIN_UNCHECK_ALL']);
210  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_DELETE_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_DELETE_CONTACT']);
211  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_NAME_TO_CONTACT', $GLOBALS['STR_MODULE_COMMERCIAL_ADMIN_NAME_TO_CONTACT']);
212  $output .= $tpl->fetch();
213  if ($return_mode) {
214  return $output;
215  } elseif (!empty($output)) {
216  echo $output;
217  } else {
218  return false;
219  }
220 }
221 
229 {
230  if (!empty($frm['id']) && !empty($frm['etat'])) {
231  query("UPDATE peel_admins_contacts_planified
232  SET actif ='" . (nohtml_real_escape_string($frm['etat']) == 'TRUE'?'FALSE':'TRUE') . "'
233  WHERE id='" . intval(vn($frm['id'])) . "'");
234  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_ADMIN_COMMERCIALE_MSG_STATUS_OK']))->fetch();
235  }
236 }
237 
245 {
246  if (!empty($id)) {
247  query("DELETE FROM peel_admins_contacts_planified
248  WHERE id='" . intval(vn($id)) . "'");
249  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS['STR_ADMIN_COMMERCIALE_MSG_DELETED_OK'], intval(vn($id)))))->fetch();
250  }
251 }
252 
260 function affiche_form_contact_user($id_user, $return_mode = false)
261 {
262  $output = '';
263  $query = query("SELECT u.pseudo AS pseudo_user
264  FROM peel_utilisateurs u
265  WHERE u.id_utilisateur='" . intval(vn($id_user)) . "' AND " . get_filter_site_cond('utilisateurs', 'u') . "");
266  $rep_query = fetch_assoc($query);
267 
268  $query_contact = 'SELECT acp.*, u.pseudo, u.id_utilisateur
269  FROM peel_admins_contacts_planified acp
270  LEFT JOIN peel_utilisateurs u ON u.id_utilisateur = acp.admin_id AND ' . get_filter_site_cond('utilisateurs', 'u') . '
271  WHERE user_id="' . intval(vn($id_user)) . '"';
272  $Links = new Multipage($query_contact, 'liste_contact');
273  $HeaderTitlesArray = array(' ', $GLOBALS["STR_ADMIN_ADMINISTRATOR"], $GLOBALS["STR_DATE"], $GLOBALS["STR_ADMIN_REASON"], $GLOBALS["STR_COMMENTS"]);
274  $Links->HeaderTitlesArray = $HeaderTitlesArray;
275  $Links->OrderDefault = 'timestamp';
276  $Links->SortDefault = 'ASC';
277  $Links->allow_get_sort = false;
278  $results_array = $Links->Query();
279 
280  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/commercialeAdmin_form_contact_user.tpl');
281  $tpl->assign('action', get_current_url(false));
282  $tpl->assign('id_user', intval(vn($id_user)));
283  $tpl->assign('edit_src', $GLOBALS['administrer_url'] . '/images/b_edit.png');
284  $tpl->assign('are_results', !empty($results_array));
285  if (!empty($results_array)) {
286  $tpl->assign('modif_action', get_current_url(false) . '?mode=modif&id_utilisateur=' . intval(vn($id_user)) . '&start=' . (isset($_GET['start']) ? $_GET['start'] : 0));
287  $tpl->assign('links_header_row', $Links->getHeaderRow());
288  $tpl_results = array();
289  $i = 0;
290  foreach ($results_array as $contact) {
291  $tpl_results[] = array('tr_rollover' => tr_rollover($i, true),
292  'id' => intval(vn($contact['id'])),
293  'href' => get_current_url(false) . '?id_utilisateur=' . intval(vn($id_user)) . '&id_contact_planified=' . intval(vn($contact['id'])) . '&mode=modif#contact_planified',
294  'pseudo' => vb($contact['pseudo']),
295  'date' => date(('Y-m-d'), $contact['timestamp']),
296  'reason' => vb($contact['reason']),
297  'comments' => vb($contact['comments']),
298  );
299  $i++;
300  }
301  $tpl->assign('results', $tpl_results);
302  }
303  // Si id_contact_planified contact existe, cela signifie qu'il y a une demande de contact à modifier, donc nous l'affichons
304  if (!empty($_GET['id_contact_planified'])) {
305  $q_contact_edit = query('SELECT acp.*, u.pseudo
306  FROM peel_admins_contacts_planified acp
307  INNER JOIN peel_utilisateurs u ON u.id_utilisateur = acp.user_id AND ' . get_filter_site_cond('utilisateurs', 'u') . '
308  WHERE acp.id="' . intval(vn($_GET['id_contact_planified'])) . '"
309  LIMIT 1');
310  if ($r_contact_edit = fetch_assoc($q_contact_edit)) {
311  $tpl->assign('id_contact_planified', intval(vn($_GET['id_contact_planified'])));
312  $tpl->assign('rce', array('date' => get_formatted_date($r_contact_edit['timestamp']),
313  'reason' => $r_contact_edit['reason'],
314  'comments' => vb($r_contact_edit['comments']),
315  ));
316  }
317  }
318  $tpl->assign('STR_BEFORE_TWO_POINTS', $GLOBALS["STR_BEFORE_TWO_POINTS"]);
319  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_CONTACT_TITLE', sprintf($GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_CONTACT_TITLE"], vb($rep_query['pseudo_user'])));
320  $tpl->assign('STR_COMMENTS', $GLOBALS["STR_COMMENTS"]);
321  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_FOLLOW_UP', $GLOBALS["STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_FOLLOW_UP"]);
322  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_PAYMENT_EXPECTED', $GLOBALS["STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_PAYMENT_EXPECTED"]);
323  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTED_BY_PRODUCT', $GLOBALS["STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTED_BY_PRODUCT"]);
324  $tpl->assign('STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTING_PROFILE', $GLOBALS["STR_ADMIN_UTILISATEURS_FOLLOWED_REASON_INTERESTING_PROFILE"]);
325  $tpl->assign('STR_ADMIN_REASON', $GLOBALS["STR_ADMIN_REASON"]);
326  $tpl->assign('STR_VALIDATE', $GLOBALS["STR_VALIDATE"]);
327  $tpl->assign('STR_DELETE', $GLOBALS["STR_DELETE"]);
328  $tpl->assign('STR_CHOOSE', $GLOBALS["STR_CHOOSE"]);
329  $tpl->assign('STR_MODULE_COMMERCIAL_ADMIN_EDIT_PLANIFIED_CONTACT', $GLOBALS["STR_MODULE_COMMERCIAL_ADMIN_EDIT_PLANIFIED_CONTACT"]);
330 
331  $output .= $tpl->fetch();
332  if ($return_mode) {
333  return $output;
334  } elseif (!empty($output)) {
335  echo $output;
336  } else {
337  return false;
338  }
339 }
340 
348 {
349  // Si $frm['form_edit_contact_planified_id'] existe, cela signifie que nous sommes en mode mise à jour
350 
351  if (!empty($frm['form_edit_contact_planified_id'])) {
352  if(empty($frm['form_edit_contact_planified_date'])) {
353  $frm['form_edit_contact_planified_date'] = date('d-m-Y', time());
354  }
355  $timestamp_planified_contact = mktime(0, 0, 0, intval(String::substr($frm['form_edit_contact_planified_date'], 3, 2)), intval(String::substr($frm['form_edit_contact_planified_date'], 0, 2)), intval(String::substr($frm['form_edit_contact_planified_date'], 6, 4)));
356  query('UPDATE peel_admins_contacts_planified
357  SET `timestamp` = "' . nohtml_real_escape_string(vb($timestamp_planified_contact)) . '",
358  reason = "' . nohtml_real_escape_string(vb($frm['form_edit_contact_planified_reason'])) . '",
359  comments = "' . nohtml_real_escape_string(vb($frm['form_edit_contact_planified_comment'])) . '"
360  WHERE id = "' . intval($frm['form_edit_contact_planified_id']) . '"');
361  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => sprintf($GLOBALS['STR_ADMIN_COMMERCIALE_MSG_CONTACT_PLANIFIED_UPDATED_OK'], intval(vn($_GET['id_contact_planified'])))))->fetch();
362  } elseif ($frm['form_edit_contact_user_id']) {
363  if(empty($frm['form_contact_planified_date'])) {
364  $frm['form_contact_planified_date'] = date('d-m-Y', time());
365  }
366  $timestamp_planified_contact = mktime(0, 0, 0, intval(String::substr($frm['form_contact_planified_date'], 3, 2)), intval(String::substr($frm['form_contact_planified_date'], 0, 2)), intval(String::substr($frm['form_contact_planified_date'], 6, 4)));
367  query('INSERT INTO peel_admins_contacts_planified (user_id, admin_id, timestamp, reason, comments)
368  VALUES(
369  ' . intval($frm['form_edit_contact_user_id']) . ',
370  ' . intval($_SESSION['session_utilisateur']['id_utilisateur']) . ',
371  "' . nohtml_real_escape_string(vb($timestamp_planified_contact)) . '",
372  "' . nohtml_real_escape_string(vb($frm['form_contact_planified_reason'])) . '",
373  "' . nohtml_real_escape_string(vb($frm['form_contact_planified_comment']))
374  . '")');
375  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_ADMIN_COMMERCIALE_MSG_CONTACT_PLANIFIED_CREATED_OK']))->fetch();
376  }
377 }
378 
385 function delete_contact_planified($form_edit_contact_planified_id)
386 {
387  if (!empty($form_edit_contact_planified_id)) {
388  query('DELETE FROM peel_admins_contacts_planified
389  WHERE id = "' . intval(vn($form_edit_contact_planified_id)) . '"');
390  echo $GLOBALS['tplEngine']->createTemplate('global_success.tpl', array('message' => $GLOBALS['STR_ADMIN_COMMERCIALE_MSG_CONTACT_PLANIFIED_DELETED_OK']))->fetch();
391  }
392 }
393 
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
$result
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
affiche_list_admin_contact($recherche=null, $return_mode=false)
Affiche la liste des clients à contacter par les administrateurs.
Definition: fonctions.php:37
affiche_form_contact_user($id_user, $return_mode=false)
Affiche dans la fiche utilisateur la partie du formulaire de contact.
Definition: fonctions.php:260
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
Definition: database.php:400
$results_array
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
Definition: fonctions.php:19
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
Definition: fonctions.php:4643
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
Definition: database.php:158
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
delete_contact($id)
Supprime l'action de contact de la personne à contacter.
Definition: fonctions.php:244
if(!defined('IN_PEEL')) commerciale_hook_admin_menu_items($params)
Renvoie les éléments de menu affichables.
Definition: fonctions.php:24
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
create_or_update_contact_planified($frm)
Fonction d'insertion et de mise à jour des dates de contact.
Definition: fonctions.php:347
get_formatted_date($datetime_or_timestamp=null, $mode= 'short', $hour_minute=false)
Afficher une date formatée, en évitant les problèmes liés aux noms de mois sur les serveurs qui ne so...
Definition: format.php:440
get_mysql_date_from_user_input($string, $use_current_hour_min_sec_if_missing=false)
Transforme une date formattée par get_formatted_date() en date MySQL Si la date est vide...
Definition: format.php:496
delete_contact_planified($form_edit_contact_planified_id)
Fonction de suppression d'une planification de contact client.
Definition: fonctions.php:385
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
$id
Definition: articles.php:22
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112
update_state_contact($frm)
Mise à jour de l'état d'une personne à contacter.
Definition: fonctions.php:228
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:30:58 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.