|
|
@@ -706,20 +706,25 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
|
|
|
while($h=mysql_fetch_object($result)) {
|
|
|
|
|
|
if (false !== strpos($h->DESC, 'VIEWTABLE_AJAX')) {
|
|
|
- $id_zas_oryg_h_DESC = $h->DESC;// oryginalna wartosc opisu
|
|
|
+ $id_zas_new_h_DESC = $h->DESC;
|
|
|
$matches = array();
|
|
|
- if (preg_match('/&ZASOB_ID=([0-9]+)/', $h->DESC, $matches)) {
|
|
|
- if (count($matches) >= 2) {
|
|
|
- $paramOutLinkZasobId = $matches[1];
|
|
|
- $sql_to_find_parent="select DST_TABLE_ID from CRM_IMPORT_TRANSLATE where REM_TABLE='CRM_LISTA_ZASOBOW' and SRC_TABLE_ID='{$paramOutLinkZasobId}' ;" ;
|
|
|
+ if (preg_match_all('/&ZASOB_ID=([0-9]+)/', $id_zas_new_h_DESC, $matches)) {
|
|
|
+ if (count($matches) >= 2 && !empty($matches[1])) {
|
|
|
+ $sqlIds = implode(",", $matches[1]);
|
|
|
+ $sql_to_find_parent="select `DST_TABLE_ID`, `SRC_TABLE_ID`
|
|
|
+ from `CRM_IMPORT_TRANSLATE`
|
|
|
+ where `REM_TABLE` = 'CRM_LISTA_ZASOBOW'
|
|
|
+ and `SRC_TABLE_ID` in({$sqlIds})
|
|
|
+ ";
|
|
|
$res_to_find_parent_param=$CONNREMOTE->query($sql_to_find_parent) or DEBUG_S(-3,'Problem ze sql ',$sql_to_find_parent,__FILE__, __FUNCTION__, __LINE__) or die1('');
|
|
|
- if($h_res_to_find_TS=mysql_fetch_object($res_to_find_parent_param)) {
|
|
|
+ while($h_res_to_find_TS=mysql_fetch_object($res_to_find_parent_param)) {
|
|
|
+ $paramOutLinkZasobId = $h_res_to_find_TS->SRC_TABLE_ID;
|
|
|
$newLinkZasobId = $h_res_to_find_TS->DST_TABLE_ID;
|
|
|
- $h->DESC = preg_replace('/&ZASOB_ID='.$paramOutLinkZasobId.'/', '&ZASOB_ID='.$newLinkZasobId, $id_zas_oryg_h_DESC);
|
|
|
- if(strlen($h->DESC)>0) { $sql_upd="update CRM_LISTA_ZASOBOW set `DESC`='".$CONNREMOTE->_($h->DESC)."' where ID=".$h->ID." ; ";
|
|
|
- $CONNREMOTE->query($sql_upd) or die('Error with upd TYPESPECIAL PARAM_OUT line: 709 ');
|
|
|
- DEBUG_S(-3,'Nadpisuje TYPESPECIAL PARAM_OUT, ktory ma uzyty URL z ID_ZASOB',$sql_upd,__FILE__,__FUNCTION__,__LINE__);
|
|
|
- }
|
|
|
+ $id_zas_new_h_DESC = preg_replace('/&ZASOB_ID='.$paramOutLinkZasobId.'/', '&ZASOB_ID='.$newLinkZasobId, $id_zas_new_h_DESC);
|
|
|
+ }
|
|
|
+ if($id_zas_new_h_DESC != $h->DESC) { $sql_upd="update CRM_LISTA_ZASOBOW set `DESC`='".$CONNREMOTE->_($id_zas_new_h_DESC)."' where ID=".$h->ID." ; ";
|
|
|
+ $CONNREMOTE->query($sql_upd) or die('Error with upd TYPESPECIAL PARAM_OUT line: 709 ');
|
|
|
+ DEBUG_S(-3,'Nadpisuje TYPESPECIAL PARAM_OUT, ktory ma uzyty URL z ID_ZASOB',$sql_upd,__FILE__,__FUNCTION__,__LINE__);
|
|
|
}
|
|
|
}
|
|
|
}
|