Files
crm.e5.pl/modules/EcmPriceKopias/update_accounts_ecmproducts.php
2024-04-27 09:23:34 +02:00

11 lines
738 B
PHP

<?php
$w=$GLOBALS['db']->query("select id,account_id from ecmpricekopias where deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$ww=$GLOBALS['db']->query("select ecmproduct_id from ecmpricekopias_ecmproducts where deleted='0' and ecmpricekopia_id='".$r['id']."'");
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
if(mysql_num_rows($GLOBALS['db']->query("select id from accounts_ecmproducts where account_id='".$r['account_id']."' and ecmproduct_id='".$rr['ecmproduct_id']."' and deleted='0'"))==0){
$GLOBALS['db']->query("insert into accounts_ecmproducts set id='".create_guid()."',account_id='".$r['account_id']."',ecmproduct_id='".$rr['ecmproduct_id']."',date_modified='".date("Y-m-d H:i:s")."',deleted='0'");
}
}
}
?>