<?php
$EASY_AUTHENTICATE=true; include("_config/addCfg.php"); include("_includes/addInc.php"); $orderFormHandler = \Modules\Orders\OrderForm\Model_Handler::getInstance(); $corporateOwnerEnt = \Entity\Corporate::select($orderFormHandler->getIdCorporateOwner()); $customerOwnerEnt = \Entity\Customer::select($orderFormHandler->getIdCustomerOwner()); $corporateTotalBalance = $corporateOwnerEnt->equivTotalBalance; $creditLimitStatus = $corporateOwnerEnt->creditLimitStatus; if ($creditLimitStatus=='notSet') { $displayCorporate="none"; } elseif ($creditLimitStatus=='ok') { $displayCorporate="normal"; } else { $displayCorporate=$creditLimitStatus; } if ($orderFormHandler->getIdCorporateOwner()) { $ownerCorporateOfficesListSQL="SELECT id, name, mainOffice, costCenters FROM `$DBTCorporatesOffices` WHERE idCorporate='{$orderFormHandler->getIdCorporateOwner()}' AND deleted=0"; $ownerCorporateOfficesList=$db->GetAll($ownerCorporateOfficesListSQL); if ($db->ErrorNo()) { writeLog("Could not get corporate owner offices.", 'events', 9); } } $corporateOwnerOfficeCcs = []; if (!$ownerCorporateOfficesList) { $R['idCorporateOwnerOffice']=0; } else { $officeFound=false; foreach($ownerCorporateOfficesList as $off) { if ($off['id']==$R['idCorporateOwnerOffice']) { $officeFound=true; if ($off['costCenters']) { $corporateOwnerOfficeCcs = array_map('trim', explode("\n", $off['costCenters'])); } break; } } if (!$officeFound) $R['idCorporateOwnerOffice']=0; } $smarty->assign('corporateOwnerEnt', $corporateOwnerEnt); $smarty->assign('idCorporateOwner', $orderFormHandler->getIdCorporateOwner()); $smarty->assign('corporateTotalBalance', $corporateTotalBalance); $smarty->assign('defaultCurrency', $CFG['currencies']['defaultCurrency']); $smarty->assign('displayCorporate', $displayCorporate); $smarty->assign('ownerCorporateOfficesList', $ownerCorporateOfficesList); $smarty->assign('idCorporateOwnerOffice', $R['idCorporateOwnerOffice']); $smarty->assign('officeFound', $officeFound); $smarty->assign('customerOwnerEnt', $customerOwnerEnt); $smarty->assign('idCustomerOwner', $orderFormHandler->getIdCustomerOwner()); $smarty->assign('corporateOwnerOfficeCcs', $corporateOwnerOfficeCcs); $smarty->assign('corporateOwnerOfficeCostCenter', $R['corporateOwnerOfficeCostCenter']); $smarty->display("showOrderOwnerRemote.tpl"); ?>