Browse Source

fixed sql to remove Kontrahent from Group

Piotr Labudda 7 years ago
parent
commit
429712aab1
1 changed files with 5 additions and 5 deletions
  1. 5 5
      tools/Bocian.php

+ 5 - 5
tools/Bocian.php

@@ -1399,7 +1399,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 	public function removeKontrahenciFromGroupAjax($args) {
 		$idGroup = V::get('idGroup', 0, $args, "int");
 		$kontrahenciIds = V::get('kontrahenciIds', [], $args, 'array');
-		if ($idGroup === 0){
+		if ($idGroup === 0) {
 			foreach ($kontrahenciIds as $kontrahentIds) {
 				//TO DO sprawdzanie czy już DELETED
 				$affected = DB::getPDO()->update('BI_audit_ENERGA_RUM_KONTRAHENCI', 'ID', $kontrahentIds, [
@@ -1427,12 +1427,12 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 			$refGrupyToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group',
 				'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI');
 			foreach ($kontrahenciIds as $kontrahentIds) {
-				// DB::getPDO()->insert($refGrupyToKontrahenci, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $kontrahentIds]);
 				$id = (int)$kontrahentIds;
 				DBG::log("nazwa grupy {$refGrupyToKontrahenci}");
-				DB::getPDO()->execSql("delete from {$refGrupyToKontrahenci} where PRIMARY_KEY= {$idGroup} and  REMOTE_PRIMARY_KEY = {$id}");
-				//DB::
-
+				DB::getPDO()->execSql(" delete from `{$refGrupyToKontrahenci}` where PRIMARY_KEY = :pk and  REMOTE_PRIMARY_KEY = :remote_pk ", [
+					':pk' => $idGroup,
+					':remote_pk' => $id
+				]);
 			}
 
 			return [