|
|
@@ -738,28 +738,38 @@ function validate() {
|
|
|
?>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
- <div class="containter" style="text-align:center">
|
|
|
- <button type="submit" class="btn btn-primary" name="subaction" value="addKrsToKontrahenci"<?=($kontrahentExists ? " disabled" : "")?>>Dodaj firmę do tabeli kontrahentów</button>
|
|
|
- <button type="submit" class="btn btn-primary" name="subaction" value="addKrsPersonToPracownicy" onClick="return validatePerson(this)">Dodaj zaznaczone osoby do tabeli pracowników</button>
|
|
|
- <input type="hidden" name="krsId" value="<?=$krsId?>"/>
|
|
|
- <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+<!-- <div class="form-group">
|
|
|
+ <div class="col-sm-12">
|
|
|
+ <label class="col-sm-4 control-label">Opis/źródło</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
+ <input type="text" class="form-control" name="source" placeholder="KRS"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>-->
|
|
|
+ <div class="form-group">
|
|
|
+ <div class="col-sm-12" style="text-align: center;">
|
|
|
+ <button type="submit" class="btn btn-primary" name="subaction" value="addKrsToKontrahenci"<?=($kontrahentExists ? " disabled" : "")?>>Dodaj firmę do tabeli kontrahentów</button>
|
|
|
+ <button type="submit" class="btn btn-primary" name="subaction" value="addKrsPersonToPracownicy" onClick="return validatePerson(this)">Dodaj zaznaczone osoby do tabeli pracowników</button>
|
|
|
+ <input type="hidden" name="krsId" value="<?=$krsId?>"/>
|
|
|
+ <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
|
|
|
<?php
|
|
|
if (V::get('back', '', $_POST) == 'search') {
|
|
|
foreach (array_keys($formItems) as $item) {
|
|
|
?>
|
|
|
- <input type="hidden" name="<?=$item?>" value="<?=V::get($item, '', $_POST)?>"/>
|
|
|
+ <input type="hidden" name="<?=$item?>" value="<?=V::get($item, '', $_POST)?>"/>
|
|
|
<?php
|
|
|
}
|
|
|
?>
|
|
|
- <button type="submit" class="btn btn-default" name="action" value="search">Powrót</button>
|
|
|
+ <button type="submit" class="btn btn-default" name="action" value="search">Powrót</button>
|
|
|
<?php
|
|
|
} else {
|
|
|
?>
|
|
|
- <a href="<?=$this->REFERER?>" class="btn btn-default">Powrót</a>
|
|
|
+ <a href="<?=$this->REFERER?>" class="btn btn-default">Powrót</a>
|
|
|
<?php
|
|
|
}
|
|
|
?>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<?php
|
|
|
@@ -1475,6 +1485,8 @@ Router::getRoute("UrlAction_BiAuditGenerate")->' . $function . ';
|
|
|
],
|
|
|
];
|
|
|
|
|
|
+ $sourceTables = ['BI_audit_ENERGA_PRACOWNICY'];
|
|
|
+
|
|
|
if ($full) {
|
|
|
foreach ($tablesConf as $table => $tableConf) if (!$tableConf['base']) $queries[] = "update `{$table}` set `cached` = 0";
|
|
|
$queries[] = "delete from BI_audit_ALL where BASE = 0";
|
|
|
@@ -1519,11 +1531,9 @@ Router::getRoute("UrlAction_BiAuditGenerate")->' . $function . ';
|
|
|
foreach ($refTableConf['refTablesTo'] as $refTableTo) {
|
|
|
$refTable = ACL::getRefTable("default_db/{$refTableFrom}/{$refTableFrom}", "default_db__x3A__{$refTableTo}:{$refTableTo}");
|
|
|
// $queries[] = "lock tables `{$refTable}` write";
|
|
|
- $joins = "`BI_audit_ALL` as `all1` join `{$refTable}` as `ref` on `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all1`.`REMOTE_ID` = `ref`.`PRIMARY_KEY` and `ref`.`A_STATUS` = 'WAITING' join `BI_audit_ALL` as `all2` on `all2`.`REMOTE_TABLE` = '{$refTableTo}' and `ref`.`REMOTE_PRIMARY_KEY` = `all2`.`REMOTE_ID` join `BI_audit_ALL_ref_RELATIONS` `rel` on `all1`.`REMOTE_TABLE` = `rel`.`RELATION`";
|
|
|
-
|
|
|
- $queries[] = "insert ignore into `BI_audit_ALL_ref` (`ID1`, `ID2`, `RELATION_ID`, `BASE`) select `all1`.`ID`, `all2`.`ID`, `rel`.`ID`, {$refTableConf['base']} from {$joins}";
|
|
|
- $queries[] = "insert ignore into `BI_audit_ALL_ref` (`ID1`, `ID2`, `RELATION_ID`, `BASE`) select `all2`.`ID`, `all1`.`ID`, `rel`.`ID`, {$refTableConf['base']} from {$joins}";
|
|
|
- $queries[] = "update {$joins} set `ref`.`A_STATUS` = 'NORMAL'";
|
|
|
+ $queries[] = "insert into `BI_audit_ALL_ref` (`ID1`, `ID2`, `RELATION_ID`, `BASE`) select `all1`.`ID`, `all2`.`ID`, `rel`.`ID`, {$refTableConf['base']} from `BI_audit_ALL` as `all1` join `{$refTable}` as `ref` on `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all1`.`REMOTE_ID` = `ref`.`PRIMARY_KEY` and `ref`.`A_STATUS` = 'WAITING' join `BI_audit_ALL` as `all2` on `all2`.`REMOTE_TABLE` = '{$refTableTo}' and `ref`.`REMOTE_PRIMARY_KEY` = `all2`.`REMOTE_ID` join `BI_audit_ALL_ref_RELATIONS` `rel` on `all1`.`REMOTE_TABLE` = `rel`.`RELATION`";
|
|
|
+ if (!in_array($refTableFrom, $sourceTables)) $queries[] = "insert into `BI_audit_ALL_ref` (`ID1`, `ID2`, `RELATION_ID`, `BASE`) select `all2`.`ID`, `all1`.`ID`, `rel`.`ID`, {$refTableConf['base']} from `BI_audit_ALL` as `all1` join `{$refTable}` as `ref` on `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all1`.`REMOTE_ID` = `ref`.`PRIMARY_KEY` and `ref`.`A_STATUS` = 'WAITING' join `BI_audit_ALL` as `all2` on `all2`.`REMOTE_TABLE` = '{$refTableTo}' and `ref`.`REMOTE_PRIMARY_KEY` = `all2`.`REMOTE_ID` join `BI_audit_ALL_ref_RELATIONS` `rel` on `all2`.`REMOTE_TABLE` = `rel`.`RELATION`";
|
|
|
+ $queries[] = "update `BI_audit_ALL` as `all1` join `{$refTable}` as `ref` on `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all1`.`REMOTE_ID` = `ref`.`PRIMARY_KEY` and `ref`.`A_STATUS` = 'WAITING' join `BI_audit_ALL` as `all2` on `all2`.`REMOTE_TABLE` = '{$refTableTo}' and `ref`.`REMOTE_PRIMARY_KEY` = `all2`.`REMOTE_ID` set `ref`.`A_STATUS` = 'NORMAL'";
|
|
|
// $queries[] = "unlock tables";
|
|
|
}
|
|
|
}
|