Files
crm.e5.pl/modules/Accounts/test.php

36 lines
878 B
PHP
Raw Normal View History

2024-04-27 09:23:34 +02:00
<?php
$query="select parent_id from ecminvoiceouts where deleted=0";
$res=$GLOBALS['db']->query($query);
$accounts=[];
while($dane=$GLOBALS['db']->fetchByAssoc($res)){
$accounts[$dane['parent_id']]['inv']=1;
$accounts[$dane['parent_id']]['id']=$dane['parent_id'];
}
$query="select parent_id from documents_accounts where parent_type='Account'";
$res=$GLOBALS['db']->query($query);
while($dane=$GLOBALS['db']->fetchByAssoc($res)){
$accounts[$dane['parent_id']]['doc']=1;
$accounts[$dane['parent_id']]['id']=$dane['parent_id'];
}
foreach ($accounts as $ac){
if($ac['doc']==1 && $ac['inv']==1){
echo "update accounts set account_type='rs' where id='".$ac['id']."';<br>";
}
}
foreach ($accounts as $ac){
if($ac['doc']==1 && $ac['inv']==1){
$acc = new Account();
$acc->retrieve($ac['id']);
echo $acc->name.'<br>';
}
}
?>