www_archline_hu/cadline/backend/maintenance/sync_states.php
LÁZÁR Imre AI Agent c2cf6dab13 feat(cadline): add common_cadline_libraries + maintenance backend
common_cadline_libraries (CRM hardlock/db/users classes; upstream cadline_web/cadcommonlib), maintenance/ (ARCHLine.XP license backend; upstream cadline_web/maintenance), maintenance2/. Vetted live files (byte-truth); upstream repos in PROVENANCE.md. NOTE: could be git submodules — kept as live files for byte-fidelity.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
2026-07-16 11:34:30 +02:00

27 lines
1.0 KiB
PHP

<?php
/*******************************************************************************
* Mo-i megyék kitöltése
******************************************************************************/
if (!isset($config)) {
require_once('config.php');
}
if (!isset($jmdb)) {
$jmdb = ((isset($_GET['jmdb']) && in_array($_GET['jmdb'], array('jml', 'eng'))) ? $_GET['jmdb'] : 'jml');
}
$msh->query("SELECT * FROM cl_hlusers.users WHERE nCtrID=36 AND (nStateID IS NULL OR nStateID<=0);");
$res = $msh->fetchAssoc();
foreach ($res as $key => $row) {
$msh->query("SELECT * FROM " . CRMADATBAZIS . ".u_cities WHERE strCity='" . trim($row['strCity']) . "' LIMIT 1;");
$city = $msh->fetchAssoc();
if (!empty($city)) {
$city = $city[0];
$msh->query("UPDATE " . CRMADATBAZIS . ".users SET nStateID=" . ((int)$city['nStateID'] > 0 ? (int)$city['nStateID'] : 0) . " WHERE nUserID=" . $row['nUserID'] . " LIMIT 1");
// print $row['nUserID']." ".$row['strName']." ".$row['strCity']." ".$city['nStateID']."<br />";
}
}