Odyssey
aPromoList.prg
1 <?php
2 /**
3  * @package UserFlags
4  * @author MGHandy
5  *
6  * @uses view list of credit union pop-up/promotions, reset promotions flag for
7  * all users for the creditu union, suppress promotions for specified users
8  * in the credit union.
9  *
10  * @param operation string operation to perform
11  * @param promos json json array of promo document ids to reset
12  * @param accounts json json array of account number to suppress promos
13  *
14  * @return aryReply json updated data set
15  */
16 try {
17  $admVars = array();
18  $admOk = array(
19  "operation" => array("filter" => FILTER_SANITIZE_STRING),
20  "promos" => array("filter" => FILTER_SANITIZE_STRING),
21  "accounts" => array("filter" => FILTER_SANITIZE_STRING)
22  );
23  HCU_ImportVars($admVars, "USERFLAGS", $admOk);
24 
25  $pOperation = isset($admVars['USERFLAGS']['operation']) ? $admVars['USERFLAGS']['operation'] : null;
26  $pPromo = isset($admVars['USERFLAGS']['promos']) ? $admVars['USERFLAGS']['promos'] : null;
27  $pAccounts = isset($admVars['USERFLAGS']['accounts']) ? $admVars['USERFLAGS']['accounts'] : null;
28 
29  $aryResult = array();
30  $aryReply = array();
31 
32  switch ($pOperation) {
33  case "":
34  PrintPromoListContent();
35  PromoRead($SYSENV, $dbh, $Cu);
36  break;
37  case "promoRead":
38  header('Content-type: application/json');
39 
40  $rPromoList = PromoRead($SYSENV, $dbh, $Cu);
41  if (HCU_array_key_exists("error", $rPromoList)) {
42  $aryResult['error'] = $rPromoList['error'];
43  } else {
44  $aryResult['data']['promos'] = $rPromoList['promos'];
45  }
46 
47  PromoReply($aryResult, $aryReply, $pOperation);
48  break;
49  case "promoReset":
50  header('Content-type: application/json');
51 
52  $rPromoReset = PromoReset($SYSENV, $dbh, $Cu, $pPromo);
53  if (HCU_array_key_exists("error", $rPromoReset)) {
54  $aryResult['error'] = $rPromoReset['error'];
55  } else {
56  $aryResult['info'] = $rPromoReset['info'];
57  }
58 
59  $rPromoList = PromoRead($SYSENV, $dbh, $Cu);
60  if (HCU_array_key_exists("error", $rPromoList)) {
61  $aryResult['error'] = $rPromoList['error'];
62  } else {
63  $aryResult['data']['promos'] = $rPromoList['promos'];
64  }
65 
66  PromoReply($aryResult, $aryReply, $pOperation);
67  break;
68  case "promoSuppress":
69  header('Content-type: application/json');
70 
71  $rAccountSet = PromoSuppress($SYSENV, $dbh, $Cu, $pAccounts);
72  if (HCU_array_key_exists("error", $rAccountSet)) {
73  $aryResult['error'] = $rAccountSet['error'];
74  } else{
75  $aryResult['info'] = $rAccountSet['info'];
76  }
77 
78  $rPromoList = PromoRead($SYSENV, $dbh, $Cu);
79  if (HCU_array_key_exists("error", $rPromoList)) {
80  $aryResult['error'] = $rPromoList['error'];
81  } else {
82  $aryResult['data']['promos'] = $rPromoList['promos'];
83  }
84 
85  PromoReply($aryResult, $aryReply, $pOperation);
86  break;
87  default:
88  throw new Exception("Unknown server request: " . $pOperation);
89  break;
90  }
91 
92 } catch (Exception $e) {
93  $aryReply['errors'][] = $e->getMessage();
94  $aryResult['data'] = array();
95  $aryResult['info'] = array();
96 
97  PromoReply($aryResult, $aryReply, $pOperation);
98 }
99 
100 /**
101  * function GetTypeMap()
102  * @return map of what is saved in the database and the display text.
103  */
104 function GetTypeMap() {
105  return array("N" => "None", "T" => "Terms of Use", "D" => "Notice/Disclaimer", "A" => "Promo/All Members", "E" => "Promo/No eStatements", "P" => "Promo/Persistent");
106 }
107 
108 /**
109  * PromoReply
110  * @uses return json data to client via ajax
111  *
112  * @param pResult array array of updated data/info or errors
113  * @param pReply array array of necessary data returning to client
114  * @param pOperation string operation performed on the server
115  *
116  * @return pReply json json encoded data
117  */
118 function PromoReply($pResult, $pReply, $pOperation) {
119  $pReply['operation'] = $pOperation;
120  if (isset($pResult['error']) && count($pResult['error'])) $pReply['error'] = $pResult['error'];
121  if (isset($pResult['data']) && count($pResult['data'])) $pReply['data'] = $pResult['data'];
122  if (isset($pResult['info']) && count($pResult['info'])) $pReply['info'] = $pResult['info'];
123 
124  print HCU_JsonEncode(array("Results" => $pReply));
125 }
126 
127 /**
128  * PromoRead
129  * @uses read list of pop-up promotions for the credit union
130  * and the number of users using each promotion.
131  *
132  * @param pEnv array environment variable
133  * @param pDbh array database access
134  * @param pCu string credit union code
135  *
136  * @return sqlReturn array promotion list
137  */
138 function PromoRead($pEnv, $pDbh, $pCu) {
139  $sqlReturn = array();
140  $sqlColumns = "
141  d.docsid AS did,
142  d.docsname AS dname,
143  d.docstitle AS dtitle,
144  d.docsdesc AS ddesc,
145  d.docsresponsetype AS dresponse";
146  $sqlSub = "
147  SELECT COUNT(*)
148  FROM cucmsresponse r
149  WHERE r.docsid = d.docsid
150  AND r.cu = '{$pCu}'
151  AND r.responseon IS NOT NULL";
152  $sqlSelect = "
153  SELECT $sqlColumns, ($sqlSub) AS dcount
154  FROM cucmsdocs d
155  LEFT JOIN cucmsfrags f
156  ON f.docsid = d.docsid
157  AND f.cu = '{$pCu}'
158  WHERE d.docsresponsetype IN ('D', 'A', 'E', 'P', 'T')
159  ORDER BY array_position(array['D', 'A', 'E', 'P', 'T'], d.docsresponsetype::text), d.docsdesc";
160 
161  $sqlSelectRs = db_query($sqlSelect, $pDbh);
162  if (!$sqlSelectRs) {
163  $pEnv['logger']->error(db_last_error());
164  $sqlReturn['error'][] = "Failed to read promos list.";
165  return $sqlReturn;
166  }
167 
168  $promos = db_fetch_all($sqlSelectRs);
169  $promos = $promos === false ? array() : $promos;
170 
171  for($i = 0, $count = count($promos); $i != $count; $i++) {
172  $type = trim($promos[$i]["dresponse"]);
173  $typeText = HCU_array_key_value($type, GetTypeMap());
174  $typeText = $typeText === false ? "" : $typeText;
175  $promos[$i]["typeText"] = $typeText;
176  }
177 
178  $sqlReturn['promos'] = $promos;
179  return $sqlReturn;
180 }
181 
182 /**
183  * PromoReset
184  * @uses reset a the promo flag for a given list of promos
185  * for each user in the credit union.
186  *
187  * @param pEnv array environment variable
188  * @param pDbh array database access
189  * @param pCu string credit union code
190  * @param pPromo string list of promos to reset
191  *
192  * @return sqlReturn array information/updated data
193  */
194 function PromoReset($pEnv, $pDbh, $pCu, $pPromo) {
195  // decode html codes
196  // replace square brackets with empty
197  // replace double quotes with single quotes
198  $promos = html_entity_decode($pPromo, ENT_QUOTES);
199  $promos = str_replace(array('[', ']'), "", $promos);
200  $promos = str_replace('"', "'", $promos);
201 
202  $sqlReturn = array();
203  $sqlUpdate = "
204  UPDATE cucmsresponse
205  SET responseon = NULL
206  WHERE cu = '{$pCu}'
207  AND docsid IN ($promos)";
208  $sqlUpdateRs = db_query($sqlUpdate, $pDbh);
209  if (!$sqlUpdateRs) {
210  $pEnv['logger']->error(db_last_error());
211  $sqlReturn['error'][] = "Failed to reset selected promos.";
212  return $sqlReturn;
213  }
214 
215  $sqlReturn['info'][] = "Reset was successful.";
216  $sqlReturn['promos'] = db_fetch_all($sqlUpdateRs);
217  return $sqlReturn;
218 }
219 
220 /**
221  * PromoSuppress
222  * @uses suppress pop-up promos for a given list of users
223  * in the credit union.
224  *
225  * @param pEnv array environment variable
226  * @param pDbh array database access
227  * @param pCu string credit union code
228  * @param pPromo string list of user accounts to suppress
229  *
230  * @return sqlReturn array information/updated data
231  */
232 function PromoSuppress($pEnv, $pDbh, $pCu, $pAccounts) {
233  // decode html codes
234  // replace square brackets with empty
235  // replace double quotes with single quotes
236  $accountsList = html_entity_decode($pAccounts, ENT_QUOTES);
237  $accountsList = HCU_JsonDecode($accountsList);
238  foreach ($accountsList as $key => $value) {
239  $accountsList[$key] = trim($value);
240  }
241  $accounts = HCU_JsonEncode($accountsList);
242  $accounts = str_replace(array('[', ']'), "", $accounts);
243  $accounts = str_replace('"', "'", $accounts);
244 
245  $users = array();
246  $accts = array();
247  $docs = array();
248 
249  $sqlReturn = array();
250 
251  // check if user accounts exist
252  $sql = "select distinct u.user_id, uc.accountnumber from {$pCu}user u
253  inner join {$pCu}useraccounts uc on u.user_id = uc.user_id
254  where uc.accountnumber in ($accounts)";
255  $sqlRs = db_query($sql, $pDbh);
256  if (!$sqlRs) {
257  $pEnv['logger']->error(db_last_error());
258  $sqlReturn['error'][] = "Failed to read user accounts.";
259  return $sqlReturn;
260  }
261  $users = db_fetch_all($sqlRs);
262  foreach ($accountsList as $key => $value) {
263  $acct = trim($value);
264  $found = false;
265 
266  $i = 0;
267  while ($row = db_fetch_assoc($sqlRs, $i)) {
268  $prim = trim($row['accountnumber']);
269  if ($prim == $acct) {
270  $found = true;
271  break;
272  }
273  $i ++;
274  }
275 
276  if (!$found) {
277  $sqlReturn["error"][] = "Account number: $acct does not exist";
278  }
279  }
280 
281  if (HCU_array_key_exists("error", $sqlReturn)) {
282  return $sqlReturn;
283  }
284 
285  // check if any persistent promos exist
286  $sqlColumns = "
287  d.docsid";
288  $sql = "
289  SELECT $sqlColumns
290  FROM cucmsdocs d
291  LEFT JOIN cucmsfrags f
292  ON f.docsid = d.docsid
293  AND f.cu = '{$pCu}'
294  WHERE d.docsresponsetype = 'P'";
295  $sqlRs = db_query($sql, $pDbh);
296  if (!$sqlRs) {
297  $pEnv['logger']->error(db_last_error());
298  $sqlReturn['error'][] = "Failed to read promos list.";
299  return $sqlReturn;
300  }
301  $docs = db_fetch_all($sqlRs);
302  if (db_num_rows($sqlRs) == 0) {
303  $sqlReturn['error'][] = "No persistent promos currently exist.";
304  return $sqlReturn;
305  }
306 
307  // update tables
308  $cu = prep_save($pCu);
309 
310  // multiple users can have the same primary account
311  // this array is used to determine if the primary
312  // account has already been suppressed.
313  $sqlSuccess = array();
314  for ($i = 0; $i < count($users); $i++) {
315  $userId = intval($users[$i]['user_id']);
316  $userAccount = prep_save($users[$i]['accountnumber']);
317  $userFailed = false;
318 
319  for ($j = 0; $j < count($docs); $j++) {
320  $docId = intval($docs[$j]['docsid']);
321 
322  $sqlColumns = "
323  docsid, cu, accountnumber, responseon, user_id";
324  $sqlValues = "
325  $docId, '{$cu}', '$userAccount', current_date, $userId";
326  $sql = "
327  INSERT INTO cucmsresponse
328  ($sqlColumns)
329  (SELECT $sqlValues
330  WHERE NOT EXISTS
331  (SELECT $sqlColumns
332  FROM cucmsresponse r
333  WHERE r.docsid = $docId
334  AND r.accountnumber = '$userAccount'
335  AND r.cu = '{$cu}'))";
336 
337  $sqlRs = db_query($sql, $pDbh);
338  if (!$sqlRs) {
339  $pEnv['logger']->error(db_last_error());
340  $userFailed = true;
341  }
342 
343  if (db_affected_rows($sqlRs) == 0) {
344  $sql = "
345  UPDATE cucmsresponse
346  SET responseon = current_date
347  WHERE docsid = $docId
348  AND user_id = $userId
349  AND cu = '{$cu}'";
350  $sqlRs = db_query($sql, $pDbh);
351  if (!$sqlRs) {
352  $pEnv['logger']->error(db_last_error());
353  $userFailed = true;
354  }
355  }
356  }
357 
358  if ($userFailed) {
359  $sqlReturn['error'][] = "User account: $userAccount could not be excluded.";
360  } else {
361  if (!in_array($userAccount, $sqlSuccess)) {
362  $sqlSuccess[] = $userAccount;
363  $sqlReturn['info'][] = "User account: $userAccount excluded successfully.";
364  }
365  }
366  }
367 
368  return $sqlReturn;
369 }
370 ?>
371 
372 <?php
373 /**
374  * PrintPromoListContent
375  * @uses print all styles, html and javascript needed to
376  * display and interact with the page.
377  */
378 ?>
379 <?php function PrintPromoListContent() { ?>
380 <style type="text/css">
381  .k-grid tbody tr,
382  .k-grid tbody tr input[type="checkbox"],
383  .k-grid thead tr input[type="checkbox"] {
384  cursor: pointer;
385  }
386 </style>
387 
388 <div class="col-sm-12">
389  <div class="well well-sm col-sm-12">
390  <h2>Reset Pop-Ups and Promos</h2>
391 
392  <div class="hcu-secondary">
393  <div class="vsgSecondary">
394  <p>By default, Pop-up messages and User-Dismissible Login Promos are shown to all users. Users may dismiss the message or promo by specifying "Don't Tell Me Again".</p>
395  <p>When you reset these flags, all users will see the related message or promo again, even if they previously checked "Don't Tell Me Again".</p>
396  </div>
397  <div class="small vsgSecondary">
398  <span>Disabled rows indicate a pop-up message or promo that is not currently dismissed for any users.</span>
399  </div>
400  </div>
401 
402  <div class="" id="rfTable"></div>
403  <div class="" style="margin-top: 7.5px; margin-bottom: 7.5px;">
404  <button class="k-button k-primary" id="rfBtnReset">Reset Flags</button>
405  </div>
406  </div>
407 
408  <div class="well well-sm col-sm-12">
409  <h3>Exclude From CU-Dismissible Login Promo</h3>
410  <div class="hcu-secondary">
411  <div class="vsgSecondary">
412  <p>By default, the CU-Dismissible Login Promo is shown to all users. If you wish to exclude certain users from this promo, use the box below to enter their accounts. </p>
413  <p>Insert the account numbers into this entry field, separated by a space or new line. <br>If the record does not exist or cannot be updated, an error will be displayed.</p>
414  </div>
415  </div>
416 
417  <div class="" >
418  <textarea class="k-textbox hcu-all-100" id="rfExclude" rows="3"></textarea>
419  </div>
420  <div class="" style="margin-top: 7.5px; margin-bottom: 7.5px;">
421  <button class="k-button k-primary" id="rfBtnSet">Set Flags</button>
422  </div>
423 
424  </div>
425 </div>
426 
427 <script type="text/javascript">
428 <?php getShowWaitFunctions(); ?>
429  var rfDataSource = null;
430  var rfTable = null;
431  var rfTableData = null;
432  var rfTooltip = null;
433 
434  var InitDataSources = function() {
435  rfTableData = [];
436  rfDataSource = new kendo.data.DataSource({
437  transport: {
438  read: {
439  url: "main.prg",
440  dataType: "json",
441  contentType: "application/x-www-form-urlencoded",
442  type: "GET",
443  data: {
444  ft: "24"
445  },
446  cache: false
447  }
448  },
449  requestStart: function(request) {
450  showWaitWindow();
451  },
452  requestEnd: function(response) {
453  hideWaitWindow();
454 
455  if (response.hasOwnProperty("response")) {
456  if (response.response.hasOwnProperty("Results")) {
457  var results = response.response.Results;
458 
459  if (results.hasOwnProperty("error")) {
460  $.homecuValidator.homecuResetMessage = true;
461  $.homecuValidator.displayMessage(results.error, $.homecuValidator.settings.statusError);
462  } else if (results.hasOwnProperty("info")) {
463  $.homecuValidator.homecuResetMessage = true;
464  $.homecuValidator.displayMessage(results.info, $.homecuValidator.settings.statusSuccess);
465  }
466  } else {
467  $.homecuValidator.displayMessage("Error Parsing Server", $.homecuValidator.settings.statusError);
468  }
469  } else {
470  $.homecuValidator.displayMessage("Error Parsing Server", $.homecuValidator.settings.statusError);
471  }
472  },
473  schema: {
474  parse: function(response) {
475  var results = null;
476  var resultData = null;
477  var resultOperation = null;
478 
479  if (response.hasOwnProperty("Results")) {
480  results = response.Results;
481  resultData = results.data;
482  resultOperation = results.operation;
483  }
484 
485  if (results.hasOwnProperty("error")) {
486  hideWaitWindow();
487  return [];
488  }
489 
490  if (resultData == undefined || resultData == null) {
491  hideWaitWindow();
492  return [];
493  }
494 
495  rfTableData = resultData.promos;
496  rfTable.dataSource.data(rfTableData);
497 
498  return [];
499  }
500  }
501  });
502  }
503 
504  var InitDataViews = function() {
505  rfTable = $("#rfTable").kendoGrid({
506  autoBind: false,
507  selectable: "row",
508  dataSource: {
509  data: []
510  },
511  noRecords: {
512  template: "<span class=\"hcu-secondary\"><span class=\"vsgSecondary\">No Records Found</span></span>"
513  },
514  columns: [
515  { title: "", width: "35px",
516  template: "<input type=\"checkbox\" id=\"#=did#\" name=\"resetCheck\">",
517  headerTemplate: "<input type=\"checkbox\" id=\"0\" name=\"resetCheck\">" },
518  { field: "ddesc", title: "Description",
519  attributes: { "class": "showEllipsis" } },
520  { field: "typeText", title: "Type" , width: "200px", attributes: { "class": "hidden-xs" }, headerAttributes: { "class": "hidden-xs" } },
521  { field: "dcount", title: "User Count", width: "100px" }
522  ],
523  change: function(e) {
524  var row = this.select();
525  var rowBox = row.find("input[type=\"checkbox\"]");
526  rowBox.trigger("click");
527 
528  $(this.select()).removeClass('k-state-selected');
529  },
530  dataBound: function(e) {
531 
532  <?php // Also need to hide the col in the colgroup. Otherwise, it wouldn't be hidden. ?>
533  $("#rfTable colgroup").each(function() {
534  $(this).find("col:eq(2)").addClass("hidden-xs");
535  });
536 
537  // disable checkboxes if count is 0
538  $("#rfTable tbody tr").each(function() {
539  var dataItem = rfTable.dataItem(this);
540  var count = dataItem.dcount;
541  if (count == 0) {
542  $(this).addClass("vsgDisabled");
543  $(this).find("input[type=\"checkbox\"]").prop("disabled", true);
544  }
545  });
546 
547  // reset check all checkbox
548  $("#rfTable input[id=\"0\"]").prop("checked", false);
549 
550  // add checkbox event
551  $("#rfTable input[type=\"checkbox\"]").off();
552  $("#rfTable input[type=\"checkbox\"]").on("click", function() {
553  // if id = 0, select or deselect all other checkboxes
554  // else, if all other boxes are checked, check the select all box
555  var id = $(this).attr("id");
556  var checked = $(this).prop("checked");
557 
558 
559  if (id == 0) {
560  $("#rfTable input[id!=\"0\"]:not(:disabled)").prop("checked", checked);
561  } else {
562  var disabled = $("#rfTable input[id!=\"0\"]:disabled");
563  var enabled = $("#rfTable input[id!=\"0\"]:not(disabled)");
564  var checked = $("#rfTable input[id!=\"0\"]:checked:not(disabled)");
565 
566  // must account for difference in having disabled checkboxes
567  // length of grid data will be greater the the number of
568  // enabled checkboxes if any are disabled.
569  if (checked.length == rfTableData.length - disabled.length) {
570  $("#rfTable input[id=\"0\"]").prop("checked", true);
571  } else {
572  $("#rfTable input[id=\"0\"]").prop("checked", false);
573  }
574  }
575  });
576  }
577  }).data("kendoGrid");
578 
579  $("#rfBtnReset").on("click", function() {
580  var boxes = $("#rfTable input:checked[id!=\"0\"]");
581  var count = boxes.length;
582  var grid = $("#rfTable").data("kendoGrid");
583  var tosDisclosures = 0;
584  var hasSignupDisclosure = false;
585 
586  if (count > 0) {
587  var ids = [];
588  boxes.each(function() {
589  var row = $(this).closest("tr");
590  var dataItem = grid.dataItem($(row));
591  ids.push(dataItem.did);
592  if (dataItem.dresponse == "T") {
593  tosDisclosures++;
594  }
595  hasSignupDisclosure = hasSignupDisclosure || dataItem.dname == "signupDisclosure";
596  });
597 
598  if (tosDisclosures > 0 || hasSignupDisclosure) {
599 
600  var message = "";
601 
602  if (tosDisclosures > 0) {
603  var thisOrThese = count == 1 ? "this" : "these";
604  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
605  message += "Be aware that resetting " + thisOrThese + " Terms of Use will erase all previous dates of acceptance by users.";
606  message += "</div></div>";
607  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
608  message += "Before resetting " + thisOrThese + " Terms of Use, HomeCU recommends that you download and retain the current \"Terms Accepted\" report in your admin site under ";
609  message += "<a href='main.prg?ft=41&report=termsAccepted'>Reports &gt; User Settings Reports</a>.";
610  message += "</div></div>";
611  }
612 
613  if (hasSignupDisclosure) {
614  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>&nbsp;</div></div>";
615  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
616  message += "Resetting the <b>Digital Banking Disclosure</b> will not show this disclosure to the user on their next login. ";
617  message += "To show users an updated disclosure we recommend using a marketing message with a link to the new disclosure.";
618  message += "</div></div>";
619  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
620  message += "To set up a marketing message in your admin site, go to "
621  message += "<a href='main.prg?ft=37&page=edit'>Member Communications &gt; Marketing Messages &gt; New Marketing Message</a>.";
622  message += "</div></div>";
623  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
624  message += "If you have questions on setting on a marketing message, please contact HomeCU support for assistance.";
625  message += "</div></div>";
626  }
627 
628  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>&nbsp;</div></div>";
629  message += "<div class='row'><div class='col-xs-12 hcuSpacer'>";
630  message += "Do you want to continue?";
631  message += "</div></div>";
632 
633  var tosDialog = $("#tosDialog").data("kendoDialog");
634  if (!tosDialog) {
635  tosDialog = $("<div id='tosDialog'></div>").appendTo("body").kendoDialog({
636  title: "Warning",
637  maxWidth: 800,
638  actions: [
639  {text: "Cancel"},
640  {text: "Confirm Reset", primary: true, action: function() {
641  var ids = $("#tosDialog").data("ids");
642  rfDataSource.transport.options.read.type = "POST";
643  rfDataSource.read({
644  operation: "promoReset",
645  promos: JSON.stringify(ids)
646  });
647  }}
648  ],
649  visible: false
650  }).data("kendoDialog");
651  }
652 
653  $("#tosDialog").data("ids", ids);
654  tosDialog.content(message).open();
655  } else {
656  rfDataSource.transport.options.read.type = "POST";
657  rfDataSource.read({
658  operation: "promoReset",
659  promos: JSON.stringify(ids)
660  });
661  }
662 
663  }
664  });
665 
666  $("#rfBtnSet").on("click", function() {
667  var input = $("#rfExclude");
668  var text = input.val();
669  text = text.trim();
670 
671  if (text.trim().length > 0) {
672  var accts = text.split(/\s+/);
673 
674  rfDataSource.transport.options.read.type = "POST";
675  rfDataSource.read({
676  operation: "promoSuppress",
677  accounts: JSON.stringify(accts)
678  });
679  }
680  });
681 
682  // USE THIS TO SELECT OVERFLOW IN JQUERY SELECTORS FOR TOOLTIP BELOW
683  jQuery.extend(jQuery.expr[':'], {
684  overflown: function (el) {
685  return el.offsetHeight < el.scrollHeight || el.offsetWidth < el.scrollWidth;
686  }
687  });
688 
689  rfTooltip = homecuTooltip.defaults;
690  rfTooltip.filter = ".showEllipsis:overflown";
691  rfTooltip.content = function(e) {
692  return $(e.target).text().trim();
693  }
694  $("#rfTable").kendoTooltip(rfTooltip);
695  }
696 
697  $(document).ready(function() {
698  InitDataSources();
699  InitDataViews();
700 
701  rfDataSource.transport.options.read.type = "POST";
702  rfDataSource.read({
703  operation: "promoRead"
704  });
705  });
706 </script>
707 <?php }
Definition: User.php:7