|
|
@@ -379,6 +379,15 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
|
|
|
<input type="number" class="form-control" name="maxDepth" id="maxDepth" data-bind="value:replyNumber" min="1" max="9" value="6" required/>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-4 control-label">Czy zwracać tylko wyniki ze znalezionymi obiektami docelowymi (z tabeli kontrahentów)?</label>
|
|
|
+ <div class="col-sm-1">
|
|
|
+ <select name="onlyTargets" class="form-control">
|
|
|
+ <option value="Y" selected>Tak</option>
|
|
|
+ <option value="N">Nie</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-4 control-label">Adnotacje</label>
|
|
|
<div class="col-sm-4">
|
|
|
@@ -415,7 +424,6 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
|
|
|
<input type="hidden" name="prID[]" value="<?=$pracownik['ID']?>">
|
|
|
</form>
|
|
|
</div>
|
|
|
-DUPA
|
|
|
<script language="JavaScript">
|
|
|
<!--
|
|
|
function validate() {
|
|
|
@@ -551,7 +559,10 @@ function validate() {
|
|
|
case "addKrsToKontrahenci":
|
|
|
$krsId = V::get('krsId', 0, $_POST, int);
|
|
|
if (!$krsId) throw new Exception("Błąd formularza");
|
|
|
- $query = "insert into BI_audit_ENERGA_RUM_KONTRAHENCI (uwagi, Pelna_nazwa_kontrahenta, REGON, NIP, KRS) select 'import z KRS', nazwa, regon, nip, krs from BI_audit_KRS where ID = ".$krsId." ";
|
|
|
+ $query = "select count(*) from BI_audit_ENERGA_RUM_KONTRAHENCI kh join BI_audit_KRS krs on (kh.NIP = krs.nip or kh.REGON = krs.regon or kh.KRS = krs.krs) where krs.ID = '{$krsId}'";
|
|
|
+ $kontrahentExists = DB::getPDO()->fetchValue($query);
|
|
|
+ if ($kontrahentExists) throw new Exception("Podmiot znajduje się już w tabeli kontrahentów");
|
|
|
+ $query = "insert into BI_audit_ENERGA_RUM_KONTRAHENCI (Tytul_dokumentu, Pelna_nazwa_kontrahenta, REGON, NIP, KRS) select 'ZaImportowano z KRS', nazwa, regon, nip, krs from BI_audit_KRS where ID = ".$krsId." ";
|
|
|
DB::getPDO()->query($query);
|
|
|
SE_Layout::alert('success', "Pomyślnie zaimportowano kontrahenta");
|
|
|
break;
|
|
|
@@ -643,7 +654,7 @@ function validate() {
|
|
|
if (count($result) > 1) {
|
|
|
?>
|
|
|
<td align="center">
|
|
|
- <input type="radio" name="krsId" id="krsId" value="<?=$row['ID']?>"/>
|
|
|
+ <input type="radio" name="krsId" value="<?=$row['ID']?>"/>
|
|
|
</td>
|
|
|
<?php
|
|
|
}
|
|
|
@@ -780,7 +791,9 @@ function validatePerson(source) {
|
|
|
return checked;
|
|
|
}
|
|
|
function validateCompany(source) {
|
|
|
- checked = document.getElementById('krsId').checked;
|
|
|
+ radios = document.getElementsByName('krsId');
|
|
|
+ checked = false;
|
|
|
+ for(var i=0, n=radios.length;i<n;i++) if(radios[i].checked) checked = true;
|
|
|
if (!checked) alert('Nie wybrano żadnej firmy!');
|
|
|
return checked;
|
|
|
}
|
|
|
@@ -1590,6 +1603,7 @@ class BiAuditPowiazania {
|
|
|
|
|
|
private $minDepth;
|
|
|
private $maxDepth;
|
|
|
+ private $onlyTargets;
|
|
|
private $ID;
|
|
|
private $endNodes;
|
|
|
private $path = [];
|
|
|
@@ -1600,11 +1614,14 @@ class BiAuditPowiazania {
|
|
|
|
|
|
public function __construct($ID = 0) {
|
|
|
if (!$ID) throw new Exception("Wrong ID parameter");
|
|
|
- $query = "select BI_analiza_minDepth, BI_analiza_maxDepth from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$ID}' and FILE_STATUS = 'IN_PROGRESS' and BI_analiza_reloadCache not in ('Full', 'Part')";
|
|
|
+ $query = "select BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$ID}' and FILE_STATUS = 'IN_PROGRESS' and BI_analiza_reloadCache not in ('Full', 'Part')";
|
|
|
$result = DB::getPDO()->fetchAll($query);
|
|
|
if (!$result) throw new Exception("Błąd danych");
|
|
|
$this->minDepth = (int) $result[0]['BI_analiza_minDepth'];
|
|
|
$this->maxDepth = (int) $result[0]['BI_analiza_maxDepth'];
|
|
|
+ $this->onlyTargets = (!($result[0]['BI_analiza_onlyTargets'] != 'N'));
|
|
|
+ if (!$this->minDepth) $this->minDepth = 1;
|
|
|
+ if (!$this->maxDepth) throw new Exception("Błąd danych - nieokreślono maksymalnej głębokości analizy");
|
|
|
if ($this->minDepth > $this->maxDepth) throw new Exception("Wartość minimalnej głębokości analizy jest większa od wartości maksymalnej głębokości analizy");
|
|
|
$this->ID = $ID;
|
|
|
|
|
|
@@ -1633,12 +1650,13 @@ class BiAuditPowiazania {
|
|
|
if (!$relation) $relation = 0;
|
|
|
|
|
|
if ($end) {
|
|
|
- if (in_array($ID, $this->endNodes) && count($this->path) >= $this->minDepth) $this->results[] = $this->path;
|
|
|
+ if (in_array($ID, $this->endNodes) && count($this->path) > $this->minDepth) $this->results[] = $this->path;
|
|
|
array_pop($this->path);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
if (count($this->path) > $this->maxDepth) {
|
|
|
+ if (!$this->onlyTarges) $this->results[] = $this->path;
|
|
|
array_pop($this->path);
|
|
|
return false;
|
|
|
}
|