Prechádzať zdrojové kódy

Merge branch 'master' of biuro.biall-net.pl:plabudda/se

Mariusz Muszyński 9 rokov pred
rodič
commit
4dfde42e3f

+ 114 - 18
SE/se-lib/Route/UrlAction/ProjektyProNetMediaBudget.php

@@ -4,7 +4,16 @@ Lib::loadClass('RouteBase');
 Lib::loadClass('TypespecialVariable');
 Lib::loadClass('Request');
 Lib::loadClass('Response');
+Lib::loadClass('UI');
 
+// TODO: Typepsecial do Koresp.ORDER_NR
+// TODO: widoki zamówień wg statusu - ustalić dostępy za pomocą procesów
+/*
+DBG:
+	&DBG_M_DIST_COST_PROJECT=10000
+	&DBG_KONIEC_BUDOWY=2016-08-01
+
+*/
 class Route_UrlAction_ProjektyProNetMediaBudget extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
 
 	public function handleAuth() {
@@ -31,13 +40,17 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 
 	public function defaultAction() {
 		SE_Layout::gora();
-		if (1 != V::get('_print', '', $_GET)) SE_Layout::menu();
 		try {
+			$viewParams = array();
+			$viewParams['print_mode'] = (1 == V::get('_print', '', $_GET));
+			if (!$viewParams['print_mode']) SE_Layout::menu();
+
 			$data = array();
 			$data['id_project'] = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
 			if (!$data['id_project']) throw new Exception("Error: Brak nr projektu!");
 			$data = $this->setProps($data);
-			$this->budgetView($data);
+
+			$this->budgetView($data, $viewParams);
 		} catch (Exception $e) {
 			SE_Layout::alert('danger', "Error #" . $e->getCode() .  "|" . $e->getLine() .  ": " . $e->getMessage());
 		}
@@ -57,6 +70,10 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 					, p.M_DIST_DESC
 					, p.M_DIST_DEALNUM
 					, p.M_DIST_COST_PROJECT
+					, p.POCZATEK_UMOWY
+					, p.KONIEC_BUDOWY
+					, p.COST_OSPRZET
+					, p.COST_MATERIALY
 			from IN7_MK_BAZA_DYSTRYBUCJI p
 			where p.A_STATUS not in('DELETED')
 				and p.ID = {$idProj}
@@ -65,7 +82,19 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 		$data['projectInfo'] = $rows[0];
 		$data['budget'] = V::get('M_DIST_COST_PROJECT', 0, $data['projectInfo']);
 		$data['projectLabel'] = $data['projectInfo']['M_DIST_DESC'];
+		$data['POCZATEK_UMOWY'] = V::get('POCZATEK_UMOWY', 0, $data['projectInfo']);
+		$data['KONIEC_BUDOWY'] = V::get('KONIEC_BUDOWY', 0, $data['projectInfo']);
+		$data['days_to_finish'] = 0; // pozostało dni - // ilość dni wyliczana z różnicy dat [13513] KONIEC_BUDOWY - [13512] POCZATEK_UMOWY (raczej today)
 		$data['budget'] = V::get('DBG_M_DIST_COST_PROJECT', $data['budget'], $_GET);// TODO: TEST
+		$data['KONIEC_BUDOWY'] = V::get('DBG_KONIEC_BUDOWY', $data['KONIEC_BUDOWY'], $_GET);// TODO: TEST
+		if ($data['KONIEC_BUDOWY']) {
+			$dStart = new DateTime(date('Y-m-d'));
+			$dEnd = new DateTime($data['KONIEC_BUDOWY']);
+			$dDiff = $dStart->diff($dEnd);
+			$data['days_to_finish'] = ('-' == $dDiff->format('%R')) ? -1 * $dDiff->days : $dDiff->days;
+		}
+		$data['COST_OSPRZET'] = V::get('COST_OSPRZET', 0, $data['projectInfo']);
+		$data['COST_MATERIALY'] = V::get('COST_MATERIALY', 0, $data['projectInfo']);
 
 		$data['ordersRaw'] = DB::getPDO()->fetchAll("
 			select r.ID
@@ -81,13 +110,18 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 			group by r.ID
 		");
 
-		// $data['costs'] = array();
+		$toFindKoresp = array();// Order.ID => Order.label
 		{
 			$idx = 0;
 			foreach ($data['ordersRaw'] as $idxOrders => $order) {
+				$idOrder = $order['ID'];
+				$labelOrder = $order['ORDER_LABEL'];
+				$toFindKoresp[$idOrder] = $labelOrder;
 				if (count($data['costs']) < $idxOrders + 1) {
 					$data['costs'][] = array(
 						'cost_zamowienia'=>$order['SUM_NETTO'],
+						'nr_zamowienia'=>$labelOrder,
+						'nr_fv_do_zamowienia'=>array(),
 						'cost_zaliczki'=>0,
 						'cost_pracownicy'=>0,
 						'cost_wynajem'=>0,
@@ -100,8 +134,36 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 					);
 				}
 			}
+			if (!empty($toFindKoresp)) {// TODO: find fv nr - from Koresp. (nr_fv_do_zamowienia) - Koresp.ORDER_NR
+				$sqlOrderLabels = array();
+				foreach ($toFindKoresp as $idOrder => $labelOrder) {
+					$sqlOrderLabels[] = "'{$labelOrder}'";
+				}
+				$sqlOrderLabels = implode(",", $sqlOrderLabels);
+				// TODO: tylko określone typy z Koresp?
+				// TODO: co jeśli brakuje obcy_nr_koresp(`K_NR_OTRZYM_KORESP`) - ID?
+				$data['fvToOrdersRaw'] = DB::getPDO()->fetchAll("
+					select k.ID
+								, k.ORDER_NR
+								, k.K_NR_OTRZYM_KORESP as obcy_nr_koresp
+					from IN7_DZIENNIK_KORESP k
+					where k.ORDER_NR in({$sqlOrderLabels})
+				");
+				foreach ($data['fvToOrdersRaw'] as $fv) {
+					$labelOrder = $fv['ORDER_NR'];
+					foreach ($data['costs'] as $cost) {
+						if ($isOrder && $labelOrder == $cost['nr_zamowienia']) {
+							$idKoresp = $fv['ID'];
+							$cost['nr_fv_do_zamowienia'][$idKoresp] = $fv['obcy_nr_koresp'];
+						}
+					}
+				}
+			}
+
 			$budget = $data['budget'];
 			foreach ($data['costs'] as $idx => $cost) {
+				// TODO: fix - `cost_wynajem` pewnie będzie częścią z zamówienia - minus od project COST_OSPRZET
+				// TODO: fix - `cost_materialy` pewnie będzie częścią z zamówienia - minus od project COST_MATERIALY
 				$sum = $cost['cost_zamowienia']
 				 	+ $cost['cost_zaliczki']
 				 	+ $cost['cost_pracownicy']
@@ -119,20 +181,42 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 		return $data;
 	}
 
-	public function budgetView($data) {
+	public function budgetView($data, $viewParams) {
 		?>
 <div class="container">
-	<h1>Projekt: <?php echo $data['projectLabel']; ?></h1>
+	<div class="row">
+		<div class="col-md-6">
+			<?php if (!$viewParams['print_mode']) : ?>
+				<a class="btn btn-primary"
+					 href="index.php?_route=UrlAction_ProjektyProNetMediaBudget&ID_PROJECT=<?php echo $data['id_project']; ?>&_print=1"
+					 target="_blank">drukuj</a>
+			<?php endif; ?>
+		</div>
+		<div class="col-md-6" style="text-align:right">
+			<?php echo date("Y-m-d"); ?>
+		</div>
+	</div>
+	<h3>Projekt: <?php echo $data['projectLabel']; ?></h3>
+	<blockquote style="font-size:1em">
+		Data rozpoczęcia umowy: <?php echo $data['POCZATEK_UMOWY']; ?>
+		<br>Data zakończenia umowy: <?php echo $data['KONIEC_BUDOWY']; ?>
+		<!-- <br>Kwota Umowy (netto): <?php echo $data['M_DIST_COST_PROJECT']; ?> ? == $data['budget'] -->
+		<br>Pozostało dni: <?php echo $data['days_to_finish']; ?>
+	</blockquote>
 	<table class="table table-bordered">
 		<thead>
 			<tr>
-				<th>Kwota planowana<br><?php echo number_format($data['budget'], 2, ',', ' '); ?></th>
+				<th title="Kwota Umowy (netto)">Kwota planowana<br><?php echo UI::price($data['budget']); ?></th>
 				<th>Zamówienie</th>
 				<th>zaliczki</th>
 				<th>ilość pracowników / koszty pracownicze: powiązanie z raportami X współczynnik</th>
-				<th>koszty sprzętu/ wynajmowany na budowie: rozdział na różne rodzaj sprzętu: koparka itp.</th>
+				<th>koszty sprzętu / wynajmowany na budowie: rozdział na różne rodzaj sprzętu: koparka itp.
+					<br><?php echo UI::price($data['COST_OSPRZET']); ?>
+				</th>
 				<th>koszty własne: naprawy sprzętu</th>
-				<th>koszty materiałów</th>
+				<th>koszty materiałów
+					<br><?php echo UI::price($data['COST_MATERIALY']); ?>
+				</th>
 				<th>osprzet</th>
 				<th>dodatkowe koszty związane z nadwyżkami - rozbieżności odnośnie ustaleń</th>
 			</tr>
@@ -140,22 +224,34 @@ dostęp dla zarządu i os. odp.	kwota końcowa
 		<tbody>
 			<?php foreach ($data['costs'] as $cost) : ?>
 				<tr>
-					<td><?php echo $cost['budget_minus_sum']; ?></td>
-					<td><?php echo $cost['cost_zamowienia']; ?></td>
-					<td><?php echo $cost['cost_zaliczki']; ?></td>
-					<td><?php echo $cost['cost_pracownicy']; ?></td>
-					<td><?php echo $cost['cost_wynajem']; ?></td>
-					<td><?php echo $cost['cost_serwis']; ?></td>
-					<td><?php echo $cost['cost_materialy']; ?></td>
-					<td><?php echo $cost['cost_osprzet']; ?></td>
-					<td><?php echo $cost['cost_dodatkowe']; ?></td>
+					<td><?php echo UI::price($cost['budget_minus_sum']); ?></td>
+					<td style="color:<?php echo ($cost['cost_zamowienia']) ? 'black' : 'silver'; ?>">
+						<?php echo UI::price($cost['cost_zamowienia']); ?>
+						<div style="white-space:nowrap; color:silver">nr: <?php echo $cost['nr_zamowienia']; ?></div>
+						<?php if (!empty($cost['nr_fv_do_zamowienia'])) : ?>
+							<?php foreach ($cost['nr_fv_do_zamowienia'] as $idKoresp => $obcyNrFV) : ?>
+								<?php // TODO: link do edycji koresp by $idKoresp ?>
+								<div style="white-space:nowrap; color:silver">fv: <?php echo ($obcyNrFV) ? $obcyNrFV : " nr {$idKoresp}"; ?></div>
+							<?php endforeach; ?>
+						<?php endif; ?>
+					</td>
+					<td style="color:<?php echo ($cost['cost_zaliczki']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_zaliczki']); ?></td>
+					<td style="color:<?php echo ($cost['cost_pracownicy']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_pracownicy']); ?></td>
+					<td style="color:<?php echo ($cost['cost_wynajem']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_wynajem']); ?></td>
+					<td style="color:<?php echo ($cost['cost_serwis']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_serwis']); ?></td>
+					<td style="color:<?php echo ($cost['cost_materialy']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_materialy']); ?></td>
+					<td style="color:<?php echo ($cost['cost_osprzet']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_osprzet']); ?></td>
+					<td style="color:<?php echo ($cost['cost_dodatkowe']) ? 'black' : 'silver'; ?>"><?php echo UI::price($cost['cost_dodatkowe']); ?></td>
 				</tr>
 			<?php endforeach; ?>
 		</tbody>
 	</table>
 </div>
+<?php if ($viewParams['print_mode']) : ?>
+<script>window.print();</script>
+<?php endif; ?>
 		<?php
-		//DBG::_(true, true, 'data', $data, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::_('DBG', '>2', 'data', $data, __CLASS__, __FUNCTION__, __LINE__);
 	}
 
 }

+ 118 - 95
SE/se-lib/TableAjax.php

@@ -419,6 +419,34 @@ class TableAjax extends ViewAjax {
 		</div>
 		<script>
 
+var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
+	var defaultsProps = {
+				ico: true,
+				label: false
+			},
+			props = $.extend({}, defaultsProps, props);
+			funcNode = $('<a href="#" style="margin:0 2px;"></a>')
+	;
+	if ('href' in funObj) funcNode.attr('href', funObj.href.f(rowPK));
+	if (props.ico) {
+		if ('ico' in funObj) funcNode.append('<span class="' + funObj.ico + '"></span>');
+	}
+	if ('onclick' in funObj) funcNode.attr('onclick', funObj.onclick.f(rowPK));
+	if ('title' in funObj) funcNode.attr('title', funObj.title);
+	if ('target' in funObj) funcNode.attr('target', funObj.target);
+
+	if (props.label) {
+		if ('label' in funObj) {
+			funcNode.append(' ' + funObj.label);
+		} else if ('title' in funObj) {
+			funcNode.append(' ' + funObj.title);
+		}
+	}
+
+	return funcNode;
+};
+
+
 (function($) {
 	var TableAjaxGeomField = function() {
 		var priv = {}; //private api
@@ -1147,7 +1175,7 @@ class TableAjax extends ViewAjax {
 			moreFunctions = keys.splice(3);
 			keys.forEach(function(key) {
 				var funObj = rowFunctions[key],
-						funcNode = priv.generateFunctionNode(funObj, rowPK, {ico: true, label: false})
+						funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: false})
 				;
 				funcNode.appendTo(cellNode);
 			});
@@ -1185,7 +1213,7 @@ class TableAjax extends ViewAjax {
 					moreFunctions.forEach(function(funcName) {
 						var funcItemNode = $('<li></li>').appendTo(funcListNode),
 								funObj = rowFunctions[funcName],
-								funcNode = priv.generateFunctionNode(funObj, rowPK, {ico: true, label: true})
+								funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
 						;
 						funcNode.addClass('func_name-' + funcName);
 						funcItemNode.append(funcNode);
@@ -1237,33 +1265,6 @@ class TableAjax extends ViewAjax {
 			return;
 		};
 
-		priv.generateFunctionNode = function(funObj, rowPK, props) {
-			var defaultsProps = {
-						ico: true,
-						label: false
-					},
-					props = $.extend({}, defaultsProps, props);
-					funcNode = $('<a href="#" style="margin:0 2px;"></a>')
-			;
-			if ('href' in funObj) funcNode.attr('href', funObj.href.f(rowPK));
-			if (props.ico) {
-				if ('ico' in funObj) funcNode.append('<span class="' + funObj.ico + '"></span>');
-			}
-			if ('onclick' in funObj) funcNode.attr('onclick', funObj.onclick.f(rowPK));
-			if ('title' in funObj) funcNode.attr('title', funObj.title);
-			if ('target' in funObj) funcNode.attr('target', funObj.target);
-
-			if (props.label) {
-				if ('label' in funObj) {
-					funcNode.append(' ' + funObj.label);
-				} else if ('title' in funObj) {
-					funcNode.append(' ' + funObj.title);
-				}
-			}
-
-			return funcNode;
-		};
-
 		priv.ajaxLoadMoreFunctionsCell = function(rowPK) {
 			var dbg = priv.options.debug;
 			if (_popoverCellAjaxXhr) {
@@ -1289,7 +1290,7 @@ class TableAjax extends ViewAjax {
 					if (rowFunctions.length > 0) {
 						var popoverCellContent = $('<ul class="list-unstyled"></ul>');
 						rowFunctions.forEach(function(funObj) {
-							var funcNode = priv.generateFunctionNode(funObj, rowPK, {ico: true, label: true});
+							var funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true});
 							if (funObj.id) {
 								funcNodesToUpdate.push({id: funObj.id, node: funcNode});
 							} else {
@@ -4079,24 +4080,17 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		$primaryKeyField = $this->_acl->getPrimaryKeyField();
 		$primaryKey = V::get($primaryKeyField, 0, $args, 'int');
 		$fieldName = V::get('col', '', $_REQUEST);
-		if (empty($primaryKey) || empty($fieldName)) {
-			throw new HttpException("Wrong param id or col!", 400);
-		}
+		if (empty($primaryKey)) throw new HttpException("Wrong param id!", 400);
+		if (empty($fieldName)) throw new HttpException("Wrong param col!", 400);
 
 		$fieldID = $this->_acl->getFieldIdByName($fieldName);
-		if (!$fieldID) {
-			throw new HttpException("Field not exists!", 404);
-		}
+		if (!$fieldID) throw new HttpException("Field not exists!", 404);
 
 		$item = $this->_acl->getItem($primaryKey);
-		if (!$item) {
-			throw new HttpException("Item not exists!", 404);
-		}
+		if (!$item) throw new HttpException("Item not exists!", 404);
 
 		$itemFromUser = $this->_acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
-		if (!isset($itemFromUser[$fieldName])) {
-			throw new HttpException("Field not set!", 400);
-		}
+		if (!isset($itemFromUser[$fieldName])) throw new HttpException("Field not set!", 400);
 
 		$itemPatch = array();
 		$itemPatch[$fieldName] = V::get($fieldName, null, $itemFromUser);
@@ -4283,17 +4277,41 @@ jQuery(document).ready(function(){
 			url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=EDIT_SAVE&ID=<?php echo $record->ID; ?>',
 		})
 		.done(function(data, textStatus, jqXHR){
-				var outMsg = notifyAjaxCallback(data);
-				alertCntWrap.removeClass('AjaxTable-loading');
-				//console.log('request finished L.<?php echo __LINE__; ?>');
-				alertCnt.empty();
-				var out = '';
-				out += outMsg;
-				out += '<div class="breadcrumb">' +
-						' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
-						' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
-					'</div>';
-				jQuery(out).appendTo(alertCnt);
+			var outMsg = notifyAjaxCallback(data);
+			alertCntWrap.removeClass('AjaxTable-loading');
+			//console.log('request finished L.<?php echo __LINE__; ?>');
+			alertCnt.empty();
+			var out = '';
+			out += outMsg;
+			out += '<div class="breadcrumb">' +
+					' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
+					' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
+				'</div>';
+			jQuery(out).appendTo(alertCnt);
+
+			// add rowFunctions from response
+			if (data && data.rowFunctions && data.primaryKey) {
+				// cellNode = priv.renderCellRowFunctions(data.rowFunctions, data.primaryKey);
+				var rowFunWrapNode = $('<div class="container"></div>').insertAfter(alertCnt);
+				var rowFunListNode = $('<ul></ul>').appendTo(rowFunWrapNode);
+				var rowPK = '<?php echo $id; ?>';
+				var keys = Object.keys(data.rowFunctions),
+						total = keys.length,
+						moreFuncBtnNode,
+						moreFunctions = [],
+						idx
+				;
+				// if (priv.options.debug) console.log('TableAjax::renderCellRowFunctions: rowFunctions', data.rowFunctions);
+				moreFunctions = keys.splice(3);
+				keys.forEach(function(key) {
+					var cellNode = $('<li></li>');
+					var funObj = data.rowFunctions[key],
+							funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
+					;
+					funcNode.appendTo(cellNode);
+					cellNode.appendTo(rowFunListNode);
+				});
+			}
 		})
 		.fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
 			if (jqXHR.responseJSON) {
@@ -4357,23 +4375,21 @@ jQuery(document).ready(function(){
 	}
 
 	private function ajaxEditSave($args) {
-		$primaryKeyField = $this->_acl->getPrimaryKeyField();
+		$acl = $this->_acl;
+		$primaryKeyField = $acl->getPrimaryKeyField();
 		$primaryKey = V::get($primaryKeyField, 0, $args, 'int');
-		if (empty($primaryKey)) {
-			throw new HttpException("Wrong param id!", 400);
-		}
+		if (empty($primaryKey)) throw new HttpException("Wrong param id!", 400);
 
-		$item = $this->_acl->getItem($primaryKey);
-		if (!$item) {
-			throw new HttpException("Item not exists!", 404);
-		}
+		$item = $acl->getItem($primaryKey);
+		if (!$item) throw new HttpException("Item not exists!", 404);
 
-		$itemFromUser = $this->_acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
+		$itemFromUser = $acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
 
 		$response = new stdClass();
+		$response->primaryKey = $primaryKey;
 		try {
 			$itemFromUser[$primaryKeyField] = $primaryKey;
-			$affected = $this->_acl->updateItem($itemFromUser);
+			$affected = $acl->updateItem($itemFromUser);
 
 			if ($affected > 0) {
 				$response->type = 'success';
@@ -4382,13 +4398,17 @@ jQuery(document).ready(function(){
 				$response->type = 'info';
 				$response->msg = "Nie wprowadzono żadnych zmian";
 			}
-			$response->record = $this->_acl->getItem($primaryKey);
+			$response->record = $acl->getItem($primaryKey);
 		}
 		catch (Exception $e) {
 			$response->type = 'error';
 			$response->msg = "Wystąpiły błędy!";
 			$response->msg .= $e->getMessage();
 		}
+
+		$rowFunList = $this->getMoreFunctionsCell(array('primary_key'=>$primaryKey, 'record'=>$response->record));
+		if (!empty($rowFunList)) $response->rowFunctions = $rowFunList;
+
 		return $response;
 	}
 
@@ -6183,15 +6203,15 @@ jQuery(document).ready(function(){
 		return $response;
 	}
 
-	function ajaxMoreFunctionsCell($args) {// ajax task 'MORE_FUNCTIONS_CELL'
-		$id = V::get('ID', 0, $args, 'int');
+	public function getMoreFunctionsCell($args) {
+		$id = V::get('primary_key', 0, $args, 'int');
 		if ($id <= 0) throw new HttpException("404", 404);
+		$record = V::get('record', null, $args);
 
-		$response = new stdClass();
-		$response->type = 'success';
-		$response->msg = 'Funkcje';
-		$response->rowFunctions = [];
-		$tableName = $this->_acl->getName();
+		$rowFunList = array();
+		$acl = $this->_acl;
+		$tableName = $acl->getName();
+		$record = ($record)? $record : $acl->getItem($id);
 
 		if(1){// TODO: fetch $totalMsgs from TableMsgs
 			$msgs = Router::getRoute('Msgs');
@@ -6203,18 +6223,16 @@ jQuery(document).ready(function(){
 			$rowFunc->href = 'index.php?_route=TableMsgs&_task=tableRow&idTable=' . $this->_zasobID . '&idRow=' . $id;
 			$rowFunc->title = "Wiadomości ({$totalMsgs})";
 			$rowFunc->label = "Wiadomości <span class=\"badge\">{$totalMsgs}</span>";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 		}
 
-		if ('CRM_PROCES' == $this->_acl->getName()) {// TODO: mv to table gui xml or php class
-			$record = $this->_acl->getItem($id);
-
+		if ('CRM_PROCES' == $acl->getName()) {// TODO: mv to table gui xml or php class
 			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
 			$rowFunc = new stdClass();
 			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
 			$rowFunc->href = "procesy5.php?task=CRM_PROCES&filtr_id={$id}";
 			$rowFunc->title = "Zobacz na drzewie procesów {{$id}}";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 
 			$wskazniki = ProcesHelper::get_wskazniki($id);
 			$connectedZasobyTotal = count($wskazniki);
@@ -6222,32 +6240,30 @@ jQuery(document).ready(function(){
 			$rowFunc->ico = 'glyphicon glyphicon-random';
 			$rowFunc->href = "index.php?MENU_INIT=PROCES_ADD_ZASOB&procesID={$id}";
 			$rowFunc->title = "Powiązane zasoby <span class=\"badge\">{$connectedZasobyTotal}</span>";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 		}
 
-		if ('CRM_LISTA_ZASOBOW' == $this->_acl->getName()) {// TODO: mv to table gui xml or php class
-			$record = $this->_acl->getItem($id);
-
+		if ('CRM_LISTA_ZASOBOW' == $acl->getName()) {// TODO: mv to table gui xml or php class
 			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
 			$rowFunc = new stdClass();
 			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
 			$rowFunc->href = "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$id}";
 			$rowFunc->title = "Zobacz na drzewie zasobów [{$id}]";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 
 			// index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob=22001
 			$rowFunc = new stdClass();
 			$rowFunc->ico = 'glyphicon glyphicon-random';
 			$rowFunc->href = "index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob={$id}";
 			$rowFunc->title = "Powiązane procesy (OB)";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 
 			// index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob=22001
 			$rowFunc = new stdClass();
 			$rowFunc->ico = 'glyphicon glyphicon-random';
 			$rowFunc->href = "index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob={$id}";
 			$rowFunc->title = "Powiązane dane (IDS)";
-			$response->rowFunctions[] = $rowFunc;
+			$rowFunList[] = $rowFunc;
 
 			$groupTypeList = array();
 			$groupTypeList[] = 'STANOWISKO';
@@ -6258,17 +6274,16 @@ jQuery(document).ready(function(){
 				$rowFunc->ico = 'glyphicon glyphicon-retweet';
 				$rowFunc->href = "index.php?_route=Users&_task=syncGroup&idGroup={$id}";
 				$rowFunc->title = "Synchronizuj do LDAP";
-				$response->rowFunctions[] = $rowFunc;
+				$rowFunList[] = $rowFunc;
 			}
 		}
 
-		if ('ADMIN_USERS' == $this->_acl->getName()) {// TODO: mv to table gui xml
-			$record = $this->_acl->getItem($id);
+		if ('ADMIN_USERS' == $acl->getName()) {// TODO: mv to table gui xml
 			$isAllowedoReadUserLogin = false;
-			if ($this->_acl->canReadRecord($record)) {
-				$idFieldUserLogin = $this->_acl->getFieldIdByName('ADM_ACCOUNT');
+			if ($acl->canReadRecord($record)) {
+				$idFieldUserLogin = $acl->getFieldIdByName('ADM_ACCOUNT');
 				if ($idFieldUserLogin) {
-					if ($this->_acl->isAllowed($idFieldUserLogin, 'R', $record)) {
+					if ($acl->isAllowed($idFieldUserLogin, 'R', $record)) {
 						$isAllowedoReadUserLogin = true;
 					}
 				}
@@ -6278,23 +6293,22 @@ jQuery(document).ready(function(){
 				$rowFunc->ico = 'glyphicon glyphicon-user';
 				$rowFunc->href = 'index.php?_route=Users&_task=userGroups&usrLogin=' . $record->ADM_ACCOUNT;
 				$rowFunc->title = "Ustal stanowisko";
-				$response->rowFunctions[] = $rowFunc;
+				$rowFunList[] = $rowFunc;
 
 				$rowFunc = new stdClass();
 				$rowFunc->ico = 'glyphicon glyphicon-retweet';
 				$rowFunc->href = 'index.php?_route=Users&_task=syncUser&usrLogin=' . $record->ADM_ACCOUNT;
 				$rowFunc->title = "Synchronizuj do LDAP";
-				$response->rowFunctions[] = $rowFunc;
+				$rowFunList[] = $rowFunc;
 
 				$rowFunc = new stdClass();
 				$rowFunc->ico = 'glyphicon glyphicon-minus';
 				$rowFunc->href = 'index.php?MENU_INIT=USER_OCENA_PRACOWNIKA&usrLogin=' . $record->ADM_ACCOUNT;
 				$rowFunc->title = "Ocena pracownika";
-				$response->rowFunctions[] = $rowFunc;
+				$rowFunList[] = $rowFunc;
 			}
 		}
 
-		$acl = $this->_acl;
 		if ($urlFunctions = Route_UrlAction::getTableFunctions($acl->getID(), $id, $acl->getName(), User::getLogin())) {
 			foreach ($urlFunctions as $urlFunction) {
 				// TODO: is allowed to view - test by Router::getRoute('UrlAction')->isFunctionAllowedForRecord($routeName = $urlFunction['name'], $acl->getID(), $id);
@@ -6305,7 +6319,6 @@ jQuery(document).ready(function(){
 				$rowFunction['title'] = V::get('title', $urlFunction['label'], $urlFunction);
 				if (!empty($urlFunction['link_target'])) $rowFunction['target'] = $urlFunction['link_target'];
 				if (!empty($urlFunction['cell_id_params'])) {
-					$record = $acl->getItem($id);
 					$urlParams = array();// [ "{$urlParamName}={$paramValue}" ]
 					foreach ($urlFunction['cell_id_params'] as $idField => $urlParamName) {
 						$paramValue = '';
@@ -6318,10 +6331,20 @@ jQuery(document).ready(function(){
 					}
 					if (!empty($urlParams)) $rowFunction['href'] .= "&" . implode("&", $urlParams);
 				}
-				$response->rowFunctions[] = $rowFunction;
+				$rowFunList[] = $rowFunction;
 			}
 		}
+		return $rowFunList;
+	}
+
+	public function ajaxMoreFunctionsCell($args) {// ajax task 'MORE_FUNCTIONS_CELL'
+		$id = V::get('ID', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
 
+		$response = new stdClass();
+		$response->type = 'success';
+		$response->msg = 'Funkcje';
+		$response->rowFunctions = $this->getMoreFunctionsCell(array('primary_key' => $id));
 		return $response;
 	}
 

+ 21 - 27
SE/se-lib/TableAjaxMap.php

@@ -2,14 +2,14 @@
 
 /**
  * usage:
- * 
+ *
 <script>
 jQuery('#TreeTableMap').TableAjaxMap({
 	wpsUrl: 'http://biuro.biall-net.pl/wps',
 	wfsUrl: 'http://biuro.biall-net.pl/wps'
 });
 </script>
- * 
+ *
  */
 class TableAjaxMap {
 
@@ -452,7 +452,7 @@ var myOpenLayers_Control_ManageLayers = OpenLayers.Class(OpenLayers.Control, {
 					trigger: function() {
 						if (navigator.geolocation) {
 							navigator.geolocation.getCurrentPosition(drawFromUserLocation);
-						} else { 
+						} else {
 							alert("Geolocation is not supported by this browser.");
 						}
 						function drawFromUserLocation(position) {
@@ -520,7 +520,7 @@ var myOpenLayers_Control_ManageLayers = OpenLayers.Class(OpenLayers.Control, {
 						var prevMultiple = this.multiple;
 						this.multiple = true;
 						var layers = this.layers || [this.layer];
-						this.events.triggerEvent("boxselectionstart", {layers: layers}); 
+						this.events.triggerEvent("boxselectionstart", {layers: layers});
 						var layer;
 						for(var l=0; l<layers.length; ++l) {
 							layer = layers[l];
@@ -542,7 +542,7 @@ var myOpenLayers_Control_ManageLayers = OpenLayers.Class(OpenLayers.Control, {
 							}
 						}
 						this.multiple = prevMultiple;
-						this.events.triggerEvent("boxselectionend", {layers: layers, bounds: bounds}); 
+						this.events.triggerEvent("boxselectionend", {layers: layers, bounds: bounds});
 					}
 				}
 			});
@@ -859,7 +859,7 @@ var myOpenLayers_Control_ManageLayers = OpenLayers.Class(OpenLayers.Control, {
 					_nodeInput.append(document.createTextNode("* "));
 				}
 			}
-			
+
 			if (supported) {
 				var executeButton = document.createElement("button");
 				executeButton.innerHTML = "Execute";
@@ -1349,7 +1349,7 @@ class TableAjaxMapWfsAction {
 		$wktParts = explode('(', $wkt, 2);
 		ob_start();
 		switch ($wktParts[0]) {
-			case 'MULTIPOLYGON':
+			// case 'MULTIPOLYGON':
 			case 'POLYGON': {
 				$points = trim($wktParts[1], '() ');
 				$points = str_replace(',', "\n", $points);
@@ -1361,25 +1361,19 @@ class TableAjaxMapWfsAction {
 						</gml:Envelope>
 					</gml:boundedBy>
 					<og:the_geom>
-						<gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
-							<gml:surfaceMember>
-								<gml:Polygon srsDimension="2">
-									<gml:exterior>
-										<gml:LinearRing srsDimension="2">
-											<gml:posList>
-												<?php echo $points; ?>
-											</gml:posList>
-										</gml:LinearRing>
-									</gml:exterior>
-								</gml:Polygon>
-							</gml:surfaceMember>
-						</gml:MultiSurface>
+						<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
+						    <gml:exterior>
+						        <gml:LinearRing>
+						            <gml:posList><?php echo $points; ?></gml:posList>
+						        </gml:LinearRing>
+						    </gml:exterior>
+						</gml:Polygon>
 					</og:the_geom>
 				<?php
 				}
 				break;
-			case 'POINT':
-			case 'MULTIPOINT': {
+			// case 'MULTIPOINT':
+			case 'POINT': {
 				$points = trim($wktParts[1], '() ');
 				$points = str_replace(',', "\n", $points);
 				//	<gml:pos>45.67 88.56</gml:pos>
@@ -1427,7 +1421,7 @@ class TableAjaxMapWfsAction {
 	public function execute($args) {
 		/*
 		 * Mapa odczytywanie punktów: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
-		 * 
+		 *
 		 * CI50:
 					18.613243103027344 54.33614429135817
 					18.613243103027344 54.33634445792519
@@ -1458,9 +1452,9 @@ class TableAjaxMapWfsAction {
 		/**
 		 * <og:recordId><?php echo $kId; ?></og:recordId>
 		 * <og:tblId><?php echo $tblId; ?></og:tblId>
-		 * 
+		 *
 		 * goes to js: @see priv.addWKTInput _layer.selectedFeatures[0]
-		 * 
+		 *
 		 *	attributes: Object
 					recordId: "1130"
 					tblId: "16"
@@ -1578,7 +1572,7 @@ class TableAjaxMapWpsServer {
 			}
 
 			if ($corners) {
-				$lowerCorner = (string) $corners->lowerCorner;	
+				$lowerCorner = (string) $corners->lowerCorner;
 				$upperCorner = (string) $corners->upperCorner;
 				$lowerCorner = explode(" ", trim($lowerCorner));
 				$upperCorner = explode(" ", trim($upperCorner));
@@ -1618,7 +1612,7 @@ class TableAjaxMapWpsServer {
 								$data[$inputIdentifier] = (string)$input->children('wps', TRUE)->Data->ComplexData;
 								break;
 							default:
-								
+
 						}
 					} else {
 						// brak zdefiniowanego inputa

+ 6 - 1
SE/se-lib/UI.php

@@ -154,7 +154,12 @@ class UI {
 	}
 
 	public static function jsAjaxTable($params) {
-		
+
+	}
+
+	public static function price($value) {
+		// TODO: if not number type - string wwith wrong format - try to convert?
+		return number_format($value, 2, ',', ' ');
 	}
 
 }

+ 3 - 3
SE/se-lib/tmpl/apple-menu.php

@@ -12,9 +12,9 @@
 		<?php endif; ?>
 		| <a href="/changepassword" target="_blank" title="Change Password">Zmiana hasła</a>
 		| <a href="/profilemanager" target="_blank" title="Profile Manager">Profile Manager</a>
-		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w programie przestrzennym np. QGIS i dodaj jako serwis WFS: Ctrl+C, Enter','https://'+location.hostname+location.pathname+'/wfs-qgis.php/default_db/')">Serwis WFS QGis</a>		
-		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w systemach integracji/wymiany danych i dodaj jako serwis WFS: Ctrl+C, Enter','https://'+window.location.hostname+location.pathname+'/wfs-qgis.php/default_db/')">Serwis API WFS</a>		
-		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w programie przestrzennym np. QGIS i dodaj jako serwis WMS: Ctrl+C, Enter','https://'+location.hostname+location.pathname+'/wms/rastry')">Serwis WMS rastry</a>		
+		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w programie przestrzennym np. QGIS i dodaj jako serwis WFS: Ctrl+C, Enter','https://'+location.hostname+location.pathname+'wfs-qgis.php/default_db/')">Serwis WFS QGis</a>		
+		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w systemach integracji/wymiany danych i dodaj jako serwis WFS: Ctrl+C, Enter','https://'+window.location.hostname+location.pathname+'wfs-qgis.php/default_db/')">Serwis API WFS</a>		
+		| <a onclick="copyToClipboard('Skopiuj do schowka w celu użycia w programie przestrzennym np. QGIS i dodaj jako serwis WMS: Ctrl+C, Enter','https://'+location.hostname+location.pathname+'wms/rastry')">Serwis WMS rastry</a>		
 
 
 

BIN
SE/stuff/p5_BeeCtrl.zip


+ 46 - 7
SE/superedit-INSTALL_SES_PROCESY_A.php

@@ -810,6 +810,16 @@ $cmd[]['rsh']='sed -i.bak "s/\\\'extra_login_security\\\'\].*=.*true/\\\'extra_l
 return $cmd;
 }
 
+//@2016-07-17 TODO
+function INSTALL_GETCOMMANDS_UNINSTALL_WORDPRESS($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_PASSWD,$SERVER_MOUNT_POINT_ROOT,$SERVER_ADDRESS,$SERVER_ADDRESS_LDAP_DC,$SERVER_ADDRESS_SHORT,$INSTALL_ROOT,$REMOTE_FOLDER_ROOT,$ADMIN_USERNAME_L1,$ADMIN_USERNAME_L1_PASS,$ADMIN_USERNAME_DIRECTORY,$ADMIN_USERNAME_INITIAL_PASSWD,$BACKUP_USB_DEVICE,$SERVER_VERSION,$OPTIONS) {
+$cmd[]['rsh']='which mysqladmin && mysqladmin  -f -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' drop '.$REMOTE_FOLDER_ROOT.'_wordpress || echo PASSED ';
+$cmd[]['rsh']="rm -Rf /Library/Server/Web/Data/Sites/Default/wordpress || echo PASSED";
+
+
+
+return $cmd;
+		  }
+
 function INSTALL_GETCOMMANDS_WORDPRESS($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_PASSWD,$SERVER_MOUNT_POINT_ROOT,$SERVER_ADDRESS,$SERVER_ADDRESS_LDAP_DC,$SERVER_ADDRESS_SHORT,$INSTALL_ROOT,$REMOTE_FOLDER_ROOT,$ADMIN_USERNAME_L1,$ADMIN_USERNAME_L1_PASS,$ADMIN_USERNAME_DIRECTORY,$ADMIN_USERNAME_INITIAL_PASSWD,$BACKUP_USB_DEVICE,$SERVER_VERSION,$OPTIONS) {
 //@2016-05- bindera: dodajemy instalke wordpressa
 
@@ -817,8 +827,8 @@ $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default && rm wordpress.tar.gz
 $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default && wget https://wordpress.org/latest.tar.gz -O wordpress.tar.gz";
 $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default && tar -zxpvf wordpress.tar.gz";
 
-$cmd[]['rsh']='which mysqladmin && mysqladmin  -f -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' drop '.$REMOTE_FOLDER_ROOT.'_wordpress || echo PASSED ';
-$cmd[]['rsh']='mysqladmin -h 127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' create '.$REMOTE_FOLDER_ROOT.'_wordpress';
+// moved to UNINSTALL $cmd[]['rsh']='which mysqladmin && mysqladmin  -f -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' drop '.$REMOTE_FOLDER_ROOT.'_wordpress || echo PASSED ';
+$cmd[]['rsh']='mysqladmin -h 127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' create '.$REMOTE_FOLDER_ROOT.'_wordpress || echo PASSE';
 $cmd[]['rsh']='echo "GRANT ALL PRIVILEGES ON '.$REMOTE_FOLDER_ROOT.'_wordpress.* to \'wordpress\'@\'127.0.0.1\' IDENTIFIED BY \''.md5($ADMIN_USERNAME_PASSWD).'\'  WITH GRANT OPTION; flush privileges;" |mysql -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\'';
 $cmd[]['rsh']='echo "GRANT ALL PRIVILEGES ON '.$REMOTE_FOLDER_ROOT.'_wordpress.* to \'wordpress\'@\'localhost\' IDENTIFIED BY \''.md5($ADMIN_USERNAME_PASSWD).'\'  WITH GRANT OPTION; flush privileges;" |mysql -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\'';
 
@@ -960,9 +970,9 @@ $cmd[]['rsh']='mv /tmp/wp-cli.phar /opt/local/wordpress/bin/wp';
 
 
 
-$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin install ldap-login-password-and-role-manager --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
+$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin is-installed ldap-login-password-and-role-manager --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress || /opt/local/wordpress/bin/wp plugin install ldap-login-password-and-role-manager --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
 //17:
-$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin activate ldap-login-password-and-role-manager --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
+$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin activate ldap-login-password-and-role-manager --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress || echo PASSED';
 $cmd[]['rsh']='/opt/local/wordpress/bin/wp option update ldap_login_password_and_role_manager_base_dn "cn=users,'.$SERVER_ADDRESS_LDAP_DC.'" --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
 $cmd[]['rsh']='/opt/local/wordpress/bin/wp option update ldap_login_password_and_role_manager_domain_controllers "'.$SERVER_ADDRESS_SHORT.'" --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
 $cmd[]['rsh']='/opt/local/wordpress/bin/wp option update ldap_login_password_and_role_manager_loginattr "uid" --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
@@ -973,8 +983,8 @@ $cmd[]['rsh']='/opt/local/wordpress/bin/wp option update ldap_login_password_and
 //@2016-05 TODO póki nie ma danych z clone repo - tutaj wrzucamy wersje aktualna modulu do wordpressa
 $cmd[]['rsh']='unzip -o /Library/Server/Web/Data/Sites/Default/SE/stuff/p5_BeeCtrl.zip -d /Library/Server/Web/Data/Sites/Default/wordpress/wp-content/plugins';
 
-
-$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin activate p5_BeeCtrl --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
+//is-installed
+$cmd[]['rsh']='/opt/local/wordpress/bin/wp plugin is-installed p5_BeeCtrl --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress || /opt/local/wordpress/bin/wp plugin activate p5_BeeCtrl --allow-root --path=/Library/Server/Web/Data/Sites/Default/wordpress';
 
 
 
@@ -1512,6 +1522,12 @@ $cmd[]['rsh']=' test -f /Library/Server/Web/Data/Sites/Default/SE/config/.cnf--d
   $cmd[]['rsh']=' touch /Library/Server/Web/Data/Sites/Default/PLIKI/'.$REMOTE_FOLDER_ROOT.'/SKANY/index.html';
  $cmd[]['rsh']=' mkdir -p /Library/Server/Web/Data/Sites/Default/PLIKI/'.$REMOTE_FOLDER_ROOT.'/WMS_LAYERS';
   $cmd[]['rsh']=' touch /Library/Server/Web/Data/Sites/Default/PLIKI/'.$REMOTE_FOLDER_ROOT.'/WMS_LAYERS/index.html';
+  
+   $cmd[]['rsh']=' mkdir -p /Library/Server/Web/Data/Sites/Default/PLIKI/'.$REMOTE_FOLDER_ROOT.'/WIZJE_LOKALNE';
+  $cmd[]['rsh']=' touch /Library/Server/Web/Data/Sites/Default/PLIKI/'.$REMOTE_FOLDER_ROOT.'/WIZJE_LOKALNE/index.html';
+
+  
+  
  $cmd[]['rsh']=' chmod 0755 /Library/Server/Web/Data/Sites/Default/PLIKI/';
  $cmd[]['rsh']=' chmod -R +a "_www allow writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,add_file,add_subdirectory,delete_child,list,search,file_inherit,directory_inherit" /Library/Server/Web/Data/Sites/Default/PLIKI';
 //! TODO te komendy nie działają @2013-10-15 - trzeba ruszyc recznie z GUI
@@ -1720,6 +1736,18 @@ DEST_FOLDER_VARNAME1=\"ID\"
 DEST_FOLDER_VARNAME2=\"T_PRODUCER\"
 DEST_FOLDER_VARNAME3=\"S_HW\"
 
+
+[WIZJE_LOKALNE_COLUMN]
+mount_point=\"WIZJE_LOKALNE\"
+share_point=\"WIZJE_LOKALNE\"
+www_share_point=\"WIZJE_LOKALNE\"
+LOOKAT_FOLDER_LOOK_GLOB=\"<VARNAME>.*\"
+LOOKAT_FOLDER_VARNAME=\"ID\"
+DEST_FOLDER_FORMAT=\"<VARNAME1>.<VARNAME2>\"
+DEST_FOLDER_VARNAME1=\"ID\"
+DEST_FOLDER_VARNAME2=\"A_RECORD_CREATE_DATE\"
+
+
 [SCANS_COLUMN]
 mount_point=\"SKANY\"
 share_point=\"SKANY\"
@@ -2404,8 +2432,19 @@ function INSTALL_SES_PROCESY_A() {
 		$packages['pl.procesy5.MYADMIN']['xml_choice']['description']='Component located at /garbage URL, to manage database';
 		$packages['pl.procesy5.MYADMIN']['xml_choice']['start_selected']='true';
 
+//! pakiet: INSTALL_GETCOMMANDS_UNINSTALL_WORDPRESS
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['exit_file']=str_replace('.', '_', $h->ID.".UNINSTALL_WORDPRESS".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['installer_dir_name']=$h->ID.".UNINSTALL_WORDPRESS".$h->SERVER_ADDRESS; //nazwa katalogu w jakim jest przygotowywany pkg
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['installer_tmp']="/tmp/pl.procesy5_UNINSTALL_WORDPRESS".$h->ID.".".$h->SERVER_ADDRESS;  //miejsce do ktorego installer odpakuje wszystko instalator
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['CMD_FUNCTION']="INSTALL_GETCOMMANDS_UNINSTALL_WORDPRESS"; //miejsce do ktorego installer odpakuje wszystko instalator
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['xml_choice']['visible']='true';
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['xml_choice']['title']='uninstall wordpress current';
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['xml_choice']['description']='Warning - it drops database for Wordpress- do not use for upgrade!';
+		$packages['pl.procesy5.UNINSTALL_WORDPRESS']['xml_choice']['start_selected']='false';
+
+
 //! pakiet: INSTALL_GETCOMMANDS_WORDPRESS
-		$packages['pl.procesy5.WORDPRESS']['exit_file']=str_replace('.', '_', $h->ID.".POSTGIS_".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg
+		$packages['pl.procesy5.WORDPRESS']['exit_file']=str_replace('.', '_', $h->ID.".WORDPRESS_".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg
 		$packages['pl.procesy5.WORDPRESS']['installer_dir_name']=$h->ID.".WORDPRESS_".$h->SERVER_ADDRESS; //nazwa katalogu w jakim jest przygotowywany pkg
 		$packages['pl.procesy5.WORDPRESS']['installer_tmp']="/tmp/pl.procesy5_WORDPRESS_".$h->ID.".".$h->SERVER_ADDRESS;  //miejsce do ktorego installer odpakuje wszystko instalator
 		$packages['pl.procesy5.WORDPRESS']['CMD_FUNCTION']="INSTALL_GETCOMMANDS_WORDPRESS"; //miejsce do ktorego installer odpakuje wszystko instalator

+ 12 - 3
SE/superedit-STATYSTYKA_TABELE.php

@@ -14,7 +14,7 @@
  * 
  */
 function STATYSTYKA_TABELE() {
-
+	global $$A_STATUS_L2_SQL;
 	$db = DB::getDB();
 	if (!$db) {
 		echo '<div class="alert alert-danger">' . "Database Error" . '</div>';
@@ -38,7 +38,11 @@ function STATYSTYKA_TABELE() {
 
 
 			//TODO zastapic to czyms Piotrowym @2016-06-11
-			$A_STATUS_L2_SQL="if(SV.HANGUP_STATUS=SV.A_STATUS,coalesce(SV.A_STATUS),
+			if(!isset($A_STATUS_L2_SQL)) {
+				
+				echo "<br> WARNING variable A_STATUS_L2_SQL is not set globally to emulate correct active client status.";
+				
+				$A_STATUS_L2_SQL="if(SV.HANGUP_STATUS=SV.A_STATUS,coalesce(SV.A_STATUS),
     if( ( unix_timestamp(NOW()) > unix_timestamp(SV.HANGUP_FROM) and  ( SV.HANGUP_TILL='0000-00-00' or SV.HANGUP_TILL is NULL )
     and ( SV.HANGUP_FROM<>'0000-00-00' and SV.HANGUP_FROM is not null )) , coalesce(SV.HANGUP_STATUS), 
     if( ( unix_timestamp(NOW()) < unix_timestamp(SV.HANGUP_FROM) and  ( SV.HANGUP_TILL='0000-00-00' or SV.HANGUP_TILL is NULL )
@@ -69,6 +73,7 @@ function STATYSTYKA_TABELE() {
     )
    )
  "; 
+ }
 
 
 
@@ -334,6 +339,7 @@ function STATYSTYKA_TABELE() {
 						or USERS2_MARKETING.TV_OPER='BN'
 					), 1, 0) ) / count(USERS2_MARKETING.S_ADDRESS_STREET) * 100), 2) as ANKIET_I
 				, BUILDINGS.A_ADM_COMPANY
+				, BUILDINGS.the_geom, BUILDINGS.A_STATUS
 			";
 			foreach ($COLSFORSTATS as $FFS) {
 				$sql .= " , round((sum(if( USERS2_MARKETING.`{$FFS}_OPER`='BN',1,0) ) / count(USERS2_MARKETING.S_ADDRESS_STREET) * 100), 2) as `NAS_{$FFS}` ";
@@ -429,6 +435,8 @@ function STATYSTYKA_TABELE() {
 						or USERS2_MARKETING.TV_OPER='BN'), 1, 0)
 					) / count(USERS2_MARKETING.S_ADDRESS_STREET) * 100), 2) as ANKIET_I
 				, BUILDINGS.A_ADM_COMPANY
+				, MK_Rewiry.the_geom , MK_Rewiry.A_STATUS
+				, count(BUILDINGS.ID) as BUDYNKOW
 			";
 			foreach ($COLSFORSTATS as $FFS) {
 				foreach ($COLSFORSTATS_OPERS as $FFFS) {
@@ -468,6 +476,7 @@ function STATYSTYKA_TABELE() {
 			$sql .= "
 				from USERS2_MARKETING as USERS2_MARKETING
 					left join BUILDINGS on BUILDINGS.S_ADDRESS_STREET=USERS2_MARKETING.T_TELBOX_BUILDING_IN
+					left join MK_Rewiry on MK_Rewiry.NAZWA_REWI=BUILDINGS.M_REWIR
 				where USERS2_MARKETING.A_STATUS!='DELETED' and BUILDINGS.A_STATUS!='DELETED'
 				group by USERS2_MARKETING.M_REWIR
 				order by USERS2_MARKETING.M_REWIR DESC ,USERS2_MARKETING.T_TELBOX_BUILDING_IN 
@@ -523,7 +532,7 @@ function STATYSTYKA_TABELE() {
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_PROBLEM enum('', 'WARNING', 'PROBLEM', 'SERIOUS', 'UNVERIFIED')  ; ";
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_PROBLEM_DESC varchar(255) not null  ; ";
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_PROBLEM_DATE varchar(30) not null  ; ";
-			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_STATUS enum('WAITING', 'NORMAL', 'MONITOR', 'WARNING', 'OFF_SOFT', 'OFF_HARD', 'DELETED')  ; ";
+			//$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_STATUS enum('WAITING', 'NORMAL', 'MONITOR', 'WARNING', 'OFF_SOFT', 'OFF_HARD', 'DELETED')  ; ";
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_STATUS_INFO varchar(255) not null  ; ";
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add A_CLASSIFIED varchar(100) not null  ; ";
 			$sqlList[] = " alter table USERS2_MARKETING_OVERWIEV add T_WORKPOINTS varchar(100) not null  ; ";