|
@@ -192,9 +192,11 @@ TODO: dodać możliwość wysyłania maila używajac mail()
|
|
|
'URL_CREATE_PRACOWNICY_GROUP' => $this->getLink('createPracownicyGroupAjax'),
|
|
|
'URL_CREATE_KONTRAHENCI_GROUP' => $this->getLink('createKontrahenciGroupAjax'),
|
|
|
'URL_ADD_PRACOWNICY_TO_GROUP' => $this->getLink('addPracownicyToGroupAjax'),
|
|
|
+ 'URL_REMOVE_PRACOWNICY_FROM_GROUP' => $this->getLink('removwPracownicyFromGroupAjax'),
|
|
|
'URL_CREATE_PRACOWNICY' => $this->getLink('createPracownikAjax'),
|
|
|
'URL_CREATE_KONTRAHENCI' => $this->getLink('createKontrahentAjax'),
|
|
|
'URL_ADD_KONTRAHENCI_TO_GROUP' => $this->getLink('addKontrahenciToGroupAjax'),
|
|
|
+ 'URL_REMOVE_KONTRAHENCI_FROM_GROUP' => $this->getLink('removeKontrahenciFromGroupAjax'),
|
|
|
'URL_FETCH_GROUP_PRACOWNICY' => $this->getLink('fetchGroupPracownicyAjax'),
|
|
|
'URL_FETCH_GROUP_KONTRAHENCI' => $this->getLink('fetchGroupKontrahenciAjax'),
|
|
|
'URL_GENERATE_BI_AUDIT_RAPORT_AJAX' => $this->getLink('generateBiAuditRaportAjax'),
|
|
@@ -1031,7 +1033,6 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
} break;
|
|
|
default: throw new Exception("Missing type");
|
|
|
}
|
|
|
-
|
|
|
$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group')->buildQuery([
|
|
|
'cols' => [ // TODO:? propertyName = []
|
|
|
'ID',
|
|
@@ -1114,6 +1115,40 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public function removeKontrahenciFromGroupAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'removeKontrahenciFromGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
|
|
|
+ }
|
|
|
+ public function removeKontrahenciFromGroupAjax() {
|
|
|
+ $idGroup = V::get('idGroup', '', $args);
|
|
|
+ $kontrahenciIds = V::get('kontrahenciIds', '', $args);
|
|
|
+ $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group')->buildQuery([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'ID',
|
|
|
+ 'ID_USER',
|
|
|
+ 'NAZWA',
|
|
|
+ ],
|
|
|
+ // 'f_ID_USER' => User::getID()
|
|
|
+ ])->getItem($idGroup);
|
|
|
+ //if (!$group) throw new Exception("Grupa nie istnieje");
|
|
|
+ //if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
+ if ($idGroup === "0"){
|
|
|
+ foreach ($kontrahenciIds as $kontrahentIds) {
|
|
|
+ DB::getPDO()->update('BI_audit_ENERGA_RUM_KONTRAHENCI', 'ID',
|
|
|
+ $kontrahentIds, ['A_STATUS' => 'DELETED']);
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ 'msg' => "Usunięto kontrahentów z systemu",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ return [
|
|
|
+ 'msg' => "Usunięto kontrahentów z grupy {$idGroup}",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function fetchGroupKontrahenciAjaxAction() {
|
|
|
Response::sendTryCatchJson(array($this, 'fetchGroupKontrahenciAjax'));
|
|
|
}
|