Files
crm.twinpol.com/modules/EcmInvoiceOuts/repairTransactions.php
2025-05-12 15:44:39 +00:00

19 lines
445 B
PHP
Executable File

<?php
global $current_user;
$db = $GLOBALS ['db'];
$inv = $db->query ( "SELECT * FROM ecminvoiceouts where parent_payer_nip!='' and deleted=0" );
while ( $i = $db->fetchByAssoc($inv) ) {
$a = new Account();
$a->retrieve_by_string_fields(['to_vatid'=>$i['parent_payer_nip']]);
$db->query ( "update ecmtransactions set parent_id='".$a->id."',parent_name='".$a->name."' where record_id='" . $i['id']. "'");
// echo '<br>";
}
echo 'e';
?>