giant: suppr getArray

This commit is contained in:
Sebastien BEAUGRAND 2011-01-10 13:19:26 +00:00
parent 5505eff6ef
commit 4cc09db792
3 changed files with 108 additions and 62 deletions

View File

@ -50,7 +50,8 @@ function getClient($pays, $service)
array('soap_version' => SOAP_1_1,
'login' => '006',
'password' => 'ClaudeMonet',
'trace' => true));
'trace' => true,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$soap_client->__setSoapHeaders($soap_header);
return $soap_client;
@ -74,8 +75,8 @@ function giantErreurSoap(&$gclient, &$faute, $debug = false)
htmlspecialchars($gclient->__getLastRequest()).
'\n\nReponse: '.
htmlspecialchars($gclient->__getLastResponse()));
print 'Une erreur s\'est produite';
print 'Un courriel a été envoyé à l\'administrateur.';
print 'Une erreur s\'est produite. ';
print 'Un courriel a été envoyé à l\'administrateur. ';
print 'Veuillez essayer ultérieurement.';
}
}

View File

@ -136,6 +136,40 @@ if ($action == 'Supprimer') {
->execute();
}
// -------------------------------------------------------------------------- //
// Recharge
// -------------------------------------------------------------------------- //
if ($action == 'Recharger') {
require_once 'giant/config.php';
require_once 'giant/client.php';
$c = Doctrine_Query::create()
->from('Commandes')
->where('OrderId = ?', $commande_id)
->fetchOne();
if ($c->ProviderOrderId != 0 ||
$c->InternalOrderId != 0) {
$o = new StdClass;
$o->ProviderOrderId = $c->ProviderOrderId;
$o->InternalOrderId = $c->InternalOrderId;
$soap_client = getClient($c->CountryCode, 'credit-data');
try {
$O = $soap_client->__call('RetrieveDataSet', array($o));
$r = Doctrine_Query::create()
->from('Rapports')
->where('ReportId = ?', $c->ReportId)
->execute();
$r->DataSet = serialize($O->DataSet);
$r->save();
} catch (SoapFault $f) {
giantErreurSoap($soap_client, $f);
}
}
}
// -------------------------------------------------------------------------- //
// Choix de l'etat des commandes a afficher
// -------------------------------------------------------------------------- //
@ -296,6 +330,10 @@ foreach ($tabCommandes as $commande) {
if (count($reports) > 0) {
boutonPost('Supprimer', 'commande_id',
$commande->OrderId, $etat_enq);
if ($_SESSION['tabInfo']['login'] == 'sbeaugrand') {
boutonPost('Recharger', 'commande_id',
$commande->OrderId, $etat_enq);
}
} else {
$delivree = false;
}

View File

@ -41,18 +41,6 @@ function dRow2($lib, $data, $id)
print $html;
}
// -------------------------------------------------------------------------- //
// getArray
// -------------------------------------------------------------------------- //
function getArray($obj)
{
if (is_array($obj) == false) {
return array($obj);
} else {
return $obj;
}
}
// -------------------------------------------------------------------------- //
// printObj
// -------------------------------------------------------------------------- //
@ -125,7 +113,7 @@ function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '')
if (isset($item->AccountItem) == true ||
isset($item->GroupTotalAmount) == true) {
if (isset($item->AccountItem) == true) {
foreach (getArray($item->AccountItem) as $it) {
foreach ($item->AccountItem as $it) {
if (isset($item->Description->_) == true) {
fillAccountItem($tab, $num, $it, $year,
$level + 1, $desPrec.$item->Description->_);
@ -153,9 +141,9 @@ function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '')
$obj->des = $item->Description->_;
$obj->val[$year] = $item->GroupTotalAmount->_;
if (isset($item->Description->code) == true) {
$obj->cde = $item->Description->code;
$obj->cde = $item->Description->code;
} else {
$obj->cde = $desPrec.$item->Description->_;
$obj->cde = $desPrec.$item->Description->_;
}
$obj->niv = $level;
$tab = arrayInsert($tab, $num, $obj);
@ -164,9 +152,9 @@ function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '')
$obj->des = $item->Description->_;
$obj->val[$year] = $item->GroupTotalAmount->_;
if (isset($item->Description->code) == true) {
$obj->cde = $item->Description->code;
$obj->cde = $item->Description->code;
} else {
$obj->cde = $desPrec.$item->Description->_;
$obj->cde = $desPrec.$item->Description->_;
}
$obj->niv = $level;
$tab[$num] = $obj;
@ -191,9 +179,9 @@ function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '')
$obj->des = $item->Description->_;
$obj->val[$year] = $item->Value->_;
if (isset($item->Description->code) == true) {
$obj->cde = $item->Description->code;
$obj->cde = $item->Description->code;
} else {
$obj->cde = $desPrec.$item->Description->_;
$obj->cde = $desPrec.$item->Description->_;
}
$obj->niv = $level;
$tab = arrayInsert($tab, $num, $obj);
@ -202,9 +190,9 @@ function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '')
$obj->des = $item->Description->_;
$obj->val[$year] = $item->Value->_;
if (isset($item->Description->code) == true) {
$obj->cde = $item->Description->code;
$obj->cde = $item->Description->code;
} else {
$obj->cde = $desPrec.$item->Description->_;
$obj->cde = $desPrec.$item->Description->_;
}
$obj->niv = $level;
$tab[$num] = $obj;
@ -223,12 +211,10 @@ function printAccountItem(&$company, $title)
foreach ($company->AnnualAccounts as $a) {
switch ($title) {
case 'ACTIF':
$account = $a->OriginalAnnualAccounts
->BalanceSheet->Assets;
$account = $a->OriginalAnnualAccounts->BalanceSheet->Assets[0];
break;
case 'PASSIF':
$account = $a->OriginalAnnualAccounts
->BalanceSheet->Liabilities;
$account = $a->OriginalAnnualAccounts->BalanceSheet->Liabilities[0];
break;
default:
$account = $a->OriginalAnnualAccounts->ProfitAndLoss;
@ -276,7 +262,7 @@ function printAccountItem(&$company, $title)
// -------------------------------------------------------------------------- //
function printLiensFinanciers(&$company, $type)
{
foreach (getArray($company->Associated) as $t) {
foreach ($company->Associated as $t) {
if ($t->RelationShip == $type) {
$libelle = '';
if (isset($t->Shares) == true) {
@ -291,7 +277,9 @@ function printLiensFinanciers(&$company, $type)
}
$name = '';
if (isset($t->Company->CompanyName) == true) {
$name .= ' '.$t->Company->CompanyName->_;
foreach ($t->Company->CompanyName as $n) {
$name .= ' '.$n->_;
}
}
dRow2($libelle, $name, $id);
}
@ -328,7 +316,17 @@ case 'CreditRecommendation':
}
$d = unserialize($r->DataSet);
$c = $d->Company;
print '<p id="rsynthese">SOCI&Eacute;T&Eacute; : '.$c->CompanyName->_.'</p>';
print '<p id="rsynthese">SOCI&Eacute;T&Eacute; : ';
if (count($c->CompanyName) > 1) {
foreach ($c->CompanyName as $name) {
print '<br/>'.$name;
}
} else if (is_array($c->CompanyName) == true) {
print $c->CompanyName[0]->_;
} else {
print $c->CompanyName->_;
}
print '</p>';
// -------------------------------------------------------------------------- //
// Identite de l'entreprise
@ -343,7 +341,8 @@ if (isset($c->SocialSecurityNumber) == true) {
dRow('Numéro de Securité Sociale', $c->SocialSecurityNumber);
}
if (isset($c->CompanyStatus) == true) {
dRow('Etablissement actif', ($c->CompanyStatus == 'Active') ? 'Oui' : 'Non');
dRow('Etablissement actif',
($c->CompanyStatus == 'Active') ? 'Oui' : 'Non');
}
print '</table>';
@ -352,10 +351,12 @@ print '</table>';
// -------------------------------------------------------------------------- //
print '<h2>Raison sociale &amp; Coordonnées</h2>';
print '<table>';
dRow('Raison Sociale', $c->CompanyName->_);
foreach ($c->CompanyName as $name) {
dRow('Raison Sociale', $name->_);
}
if (isset($c->TradeName) == true) {
$libelle = 'Enseigne(s)';
foreach (getArray($c->TradeName) as $t) {
foreach ($c->TradeName as $t) {
dRow($libelle, $t->_);
$libelle = '';
}
@ -365,15 +366,17 @@ if (isset($c->LegalForm->CountryLegalForm) == true) {
$c->LegalForm->CountryLegalForm->code.' : '.
$c->LegalForm->CountryLegalForm->_);
}
dRow('Adresse',
$c->CompanyAddress->HouseNumber.' '.
$c->CompanyAddress->Street.' '.
$c->CompanyAddress->PostCode.' '.
$c->CompanyAddress->City.' '.
$c->CompanyAddress->Country);
foreach ($c->CompanyAddress as $address) {
dRow('Adresse',
$address->HouseNumber.' '.
$address->Street.' '.
$address->PostCode.' '.
$address->City.' '.
$address->Country);
}
if (isset($c->TelephoneNumber) == true) {
$libelle = 'Téléphone(s)';
foreach (getArray($c->TelephoneNumber) as $t) {
foreach ($c->TelephoneNumber as $t) {
$mobile = (isset($t->isMobile) == true &&
$t->isMobile == 1) ? ' (mobile)' : '';
dRow($libelle, $t->_.$mobile);
@ -400,7 +403,7 @@ print '</table>';
if (isset($c->Bank) == true) {
print '<h2>Banques</h2>';
print '<table>';
foreach (getArray($c->Bank) as $t) {
foreach ($c->Bank as $t) {
$libelle = $t->BankName;
if (isset($t->BankIdentifierCode) == true) {
dRow($libelle, 'BIC: '.$t->BankIdentifierCode);
@ -446,7 +449,7 @@ if (isset($c->Operations->IndustryCode) == true ||
print '<table>';
if (isset($c->Operations->IndustryCode) == true) {
$libelle = 'Activité(s)';
foreach (getArray($c->Operations->IndustryCode) as $t) {
foreach ($c->Operations->IndustryCode as $t) {
$desc = 'Nace '.$t->NaceCode;
if ( isset($t->Description->_) == true) {
$desc .= ' '.$t->Description->_;
@ -456,7 +459,7 @@ if (isset($c->Operations->IndustryCode) == true ||
}
}
if (isset($c->FinancialSummary) == true) {
$tab = getArray($c->FinancialSummary);
$tab = $c->FinancialSummary;
$date = 0;
foreach ($tab as $t) {
if ($t->SummaryDate->_ > $date &&
@ -478,7 +481,7 @@ if (isset($c->Operations->IndustryCode) == true ||
if (isset($c->Employees) == true) {
$annee = 0;
$total = 0;
foreach (getArray($c->Employees) as $t) {
foreach ($c->Employees as $t) {
if (isset($t->Period) == true) {
if (isset($t->Period->StartDate->_) == true &&
$t->Period->StartDate->_ > $annee) {
@ -511,7 +514,7 @@ if (isset($c->Operations->IndustryCode) == true ||
if (isset($c->Event) == true) {
print '<h1>ANNONCES LÉGALES</h1>';
print '<table>';
$tab = getArray($c->Event);
$tab = $c->Event;
usort($tab, 'cmp');
foreach ($tab as $t) {
if (isset($t->Value) == true) {
@ -535,7 +538,7 @@ if (isset($c->Event) == true) {
if (isset($c->Position) == true) {
print '<h1>DIRIGEANTS</h1>';
print '<table>';
foreach (getArray($c->Position) as $t) {
foreach ($c->Position as $t) {
if (isset($t->Person) == false) {
continue;
}
@ -562,7 +565,7 @@ if (isset($c->Position) == true) {
if (isset($c->Employees) == true) {
print '<h1>EMPLOYÉS</h1>';
print '<table>';
foreach (getArray($c->Employees) as $t) {
foreach ($c->Employees as $t) {
if (isset($t->Period) == true) {
if (isset($t->Period->StartDate) == true) {
dRow(pdate($t->Period->StartDate),
@ -585,7 +588,7 @@ if (isset($c->FinancialSummary) == true) {
print '<h1>Synthèse</h1>';
print '<center>';
print '<table cellpadding="4">';
$tab = getArray($c->FinancialSummary);
$tab = $c->FinancialSummary;
print '<tr><td></td>';
foreach ($tab as $t) {
print '<td align="right"><b>'.substr($t->SummaryDate->_, 0, 4).
@ -640,7 +643,7 @@ if (isset($c->AnnualAccounts) == true) {
if (isset($c->Branch) == true) {
print '<h1>Établissements</h1>';
print '<table>';
foreach (getArray($c->Branch) as $t) {
foreach ($c->Branch as $t) {
if (isset($t->BranchName->_) == true) {
$libelle = $t->BranchName->_;
} else if (isset($t->BranchName) == true) {
@ -648,12 +651,14 @@ if (isset($c->Branch) == true) {
} else if (isset($t->BranchId) == true) {
$libelle = $t->BranchId;
}
dRow($libelle,
$c->CompanyAddress->HouseNumber.' '.
$c->CompanyAddress->Street.' '.
$c->CompanyAddress->PostCode.' '.
$c->CompanyAddress->City.' '.
$c->CompanyAddress->Country);
foreach ($c->CompanyAddress as $address) {
dRow($libelle,
$address->HouseNumber.' '.
$address->Street.' '.
$address->PostCode.' '.
$address->City.' '.
$address->Country);
}
}
print '</table>';
}
@ -723,7 +728,7 @@ if (isset($c->PaymentBehaviour) == true) {
pdate($cat->Period->EndDate);
$total = 0;
if (isset($cat->DueDateExceeds) == true) {
foreach (getArray($cat->DueDateExceeds) as $e) {
foreach ($cat->DueDateExceeds as $e) {
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
$total += $e->Percentage;
} else {
@ -778,7 +783,7 @@ if (isset($c->PaymentBehaviour) == true) {
}
$total = 0;
if (isset($cat->DueDateExceeds) == true) {
foreach (getArray($cat->DueDateExceeds) as $e) {
foreach ($cat->DueDateExceeds as $e) {
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
$total += $e->Percentage;
} else {
@ -835,8 +840,7 @@ if (isset($c->CreditRecommendation->Date) == true) {
dRow('Date', pdate($c->CreditRecommendation->Date));
}
if (isset($c->CreditRecommendation->RiskClasses) == true) {
foreach (getArray($c->CreditRecommendation
->RiskClasses->ProviderRiskClass) as $t) {
foreach ($c->CreditRecommendation->RiskClasses->ProviderRiskClass as $t) {
if (isset($t->Description->_) == true) {
$desc = '&nbsp;&nbsp;&nbsp;&nbsp;'.
'<img src="img/info.gif"'.
@ -858,8 +862,11 @@ if (isset($c->CreditRecommendation->RiskClasses) == true) {
}
dRow($t->RatingName->_.$desc, $t->RatingValue);
}
dRow('AmountAdvised', $c->CreditRecommendation->AmountAdvised->_.' '.
$c->CreditRecommendation->AmountAdvised->currency);
foreach ($c->CreditRecommendation as $item) {
dRow('AmountAdvised',
$item->AmountAdvised->_.' '.
$item->AmountAdvised->currency);
}
print '</table>';
// -------------------------------------------------------------------------- //