extranet/includes/giant/modulesGiants/FonctionDivers.php

192 lines
3.9 KiB
PHP
Raw Normal View History

<?php
2011-04-06 13:13:14 +00:00
// --------------------------------------------------------------------------- //
// dRow
// --------------------------------------------------------------------------- //
function dRow($lib, $data, $title = '')
{
$html = '<tr>'."\n";
$html .= ' <td width="30">&nbsp;</td>'."\n";
$html .= ' <td width="200" class="StyleInfoLib">'.$lib.'</td>'."\n";
if ($title != '') {
$title = ' title="'.$title.'"';
}
$html .= ' <td width="350" class="StyleInfoData"'.
$title.'>'.$data.'</td>'."\n";
$html .= '</tr>'."\n";
print $html;
}
// --------------------------------------------------------------------------- //
// dRow2
// --------------------------------------------------------------------------- //
function dRow2($lib, $data, $id)
{
$html = '<tr>'."\n";
$html .= ' <td width="30">&nbsp;</td>'."\n";
$html .= ' <td width="100" class="StyleInfoLib" >'.$lib .'</td>'."\n";
$html .= ' <td width="350" class="StyleInfoData">'.$data.'</td>'."\n";
$html .= ' <td width="100" class="StyleInfoData">'.$id .'</td>'."\n";
$html .= '</tr>'."\n";
print $html;
}
function AdvencedSearch($siret)
{
if (!empty($siret))
return ($siret);
return (false);
}
2011-04-06 13:13:14 +00:00
/**
* Verifie l'existance d'un objet
* @param $var
*/
function IssetObject($var)
{
if (isset($var))
return ($var);
}
2011-04-06 13:13:14 +00:00
/**
* Permet une verification sur un foreach.
*
* @param $information
* @param $object
*/
function InformationChecked($information, $object)
{
switch($information)
{
case 'VatNumber':
IssetObject($object);
break;
case 'IssetStreet':
return IssetObject($object);
break;
case 'PostCode':
return(IssetObject($object));
break;
case 'City' :
return (IssetObject($object));
break;
default:
return(FALSE);
}
}
2011-04-06 13:13:14 +00:00
/**
* Permet de savoir si une position existe sinon 0
*
* @param $position
*/
function setPosition($position)
{
if (isset($position) == true) {
return ($position);
} else {
return (0);
}
}
2011-04-06 13:13:14 +00:00
/**
* Permet un formatage de l'adresse.
*
* @param $formulaire
*/
function SerialForm($formulaire)
{
if(is_array($formulaire))
{
$CpVille = explode(' ',$formulaire['cpVille']);
$query = $formulaire['raisonSociale'] .' '.
$formulaire['numVoie'] . ' '.
$formulaire['voie'] . ' '.
$CpVille[0] . ' '.
$CpVille[1];
}
return ($query);
}
/**
*
* @param $pays retourne le bon code pays.
*/
function getProviderId($pays)
{
switch ($pays)
{
case 'BE':
return '001';
case 'NL':
return '003';
default:
echo 'Erreur sur le CODE pays';
exit (EXIT_SUCCESS);
}
}
2011-04-06 13:13:14 +00:00
/**
* Envoi de notification email.
* @param $sujet
* @param $texte
*/
function envoieCourriel($sujet, $texte)
{
// Desactivation de l'envoi de mail pour les tests.
/*require_once 'sendmail/mail.php';
sendMail("[Giant] ".$sujet , $texte,
// From
array('email' => CONF_MEL_FROM,
'name' => 'Client Giant'),
// To
array(0 => array('email' => CONF_MEL_TO,
'name' => 'Support')));*/
}
2011-04-06 13:13:14 +00:00
/**
* Permet de verifier le type de rapport.
*
* @param $object
*/
function checkTypeFormatRapport($object)
{
switch($object)
{
case 'Full':
return ('Rapport Complet');
break;
case 'Compact':
return ('Rapport Semi-Complet');
break;
case 'CreditRecommendation' :
return ('Solvabilité');
break;
default:
return (TRUE);
}
}
2011-04-06 13:13:14 +00:00
/**
* Permet de verifier le degret du rapport
*
* @param $object
*/
function checkTypeUrgenceRapport($object)
{
switch($object)
{
case 'Normal':
return ('green');
break;
case 'Urgent':
return ('red');
break;
case 'Flash' :
return ('purple');
break;
default:
return (TRUE);
}
}