Prechádzať zdrojové kódy

fix przypomnij link to new version; add missing TypespecialVariable for user login

Piotr Labudda 10 rokov pred
rodič
commit
37922eab3c

+ 1 - 1
SE/se-lib/ProcesMenu.php

@@ -717,7 +717,7 @@ jQuery(document).ready(function() {
 					<li<?php if ($active == 'testy_wyniki') echo ' class="active"'; ?>><a href="procesy5.php?task=CRM_TESTY_WYNIKI" title="Wyswietlenie wyników testów">Wyniki</a></li>
 				<?php endif; ?>
 				<li<?php if ($active == 'kontakty') echo ' class="active"'; ?>><a href="index.php?MENU_INIT=VIEWTABLE_KONTAKTY" title="Kontakty">Kontakty</a></li>
-				<li<?php if ($active == 'przypomnij') echo ' class="active"'; ?>><a href="index.php?MENU_INIT=PRZYPOMNIJ&KTO=<?php echo User::getLogin(); ?>" title="Przypomnij">Przypomnij</a></li>
+				<li<?php if ($active == 'przypomnij') echo ' class="active"'; ?>><a href="index.php?_route=Przypomnij&KTO=<?php echo User::getLogin(); ?>" title="Przypomnij">Przypomnij</a></li>
 			</ul>
 			<form class="navbar-form navbar-left" role="search" action="procesy5.php?task=CRM_SEARCH" method="post">
 				<div class="input-group">

+ 39 - 0
SE/se-lib/TypespecialVariable.php

@@ -32,6 +32,7 @@ class TypespecialVariable extends TypespecialBase {
 			case 'DEFAULT_ACL_GROUP':
 			case 'VERSION_GIT':
 			case '__USER_ID':
+			case '__USER_LOGIN':
 			case 'A_EXEC_GROUP':
 				return new TypespecialVariable($fldID, $fldName);
 				break;
@@ -71,6 +72,7 @@ class TypespecialVariable extends TypespecialBase {
 			case 'DEFAULT_ACL_GROUP':
 			case 'VERSION_GIT':
 			case '__USER_ID':
+			case '__USER_LOGIN':
 				$jsonAllowCreate = 'false';
 				break;
 			default:
@@ -700,6 +702,43 @@ jQuery(document).ready(function(){
 				if(V::get('DBG_TS', 0, $_GET) > 2){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">values (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($values);echo'</pre>';}
 				break;
 			}
+			case '__USER_LOGIN': {
+				$db = DB::getDB();
+				$query = trim($query, ' %');
+				$query = $db->_($query);
+				$sqlLimit = 20;
+				$sqlSelectLabel = array();
+				$sqlSelectLabel[] = 'u.`ADM_NAME`';
+				$sqlSelectLabel[] = "' ('";
+				$sqlSelectLabel[] = 'u.`ADM_ACCOUNT`';
+				$sqlSelectLabel[] = "', '";
+				$sqlSelectLabel[] = 'u.`EMAIL`';
+				$sqlSelectLabel[] = "', '";
+				$sqlSelectLabel[] = 'u.`ADM_PHONE`';
+				$sqlSelectLabel[] = "')'";
+				$sqlSelectLabel = "concat(" . implode(", ", $sqlSelectLabel) . ")";
+
+				$sql = "select u.`ADM_ACCOUNT` as ID
+						, {$sqlSelectLabel} as `LABEL`
+					from `ADMIN_USERS` as u
+					where u.`A_STATUS` in('NORMAL', 'WAITING','MONITOR','WARNING')
+						and u.`EMPLOYEE_TYPE` in('Pracownik','Partner')
+						and (u.`ID` like '%{$query}%'
+							or u.`ADM_ACCOUNT` like '%{$query}%'
+							or u.`ADM_NAME` like '%{$query}%'
+							or u.`ADM_PHONE` like '%{$query}%'
+							or u.`EMAIL` like '%{$query}%'
+						)
+					limit {$sqlLimit}
+				";
+				if(V::get('DBG_TS', 0, $_GET) > 2){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">sql (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($sql);echo'</pre>';}
+				$res = $db->query($sql);
+				while ($r = $db->fetch($res)) {
+					$values[] = (object)array('id'=>$r->ID, 'param_out'=>$r->LABEL);
+				}
+				if(V::get('DBG_TS', 0, $_GET) > 2){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">values (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($values);echo'</pre>';}
+				break;
+			}
 			default:
 				
 		}