extranet/library/Giant/RequestDatabase.lib.php

152 lines
4.6 KiB
PHP
Raw Normal View History

<?php
2013-03-11 14:41:59 +01:00
/*
* To change this template, choose Tools | Templates
2013-05-23 15:42:00 +02:00
* and open the template in the editor.
*/
Class Commandes
{
protected $enumerations = array('Full' => 'FU', 'Compact' => 'CO', 'CreditRecommendation' => 'CR');
2013-05-23 15:42:00 +02:00
public function __construct()
{
}
2013-05-23 15:42:00 +02:00
public function setCommandes($parametres)
{
$commandes = new Application_Model_CommandesGiants();
$data = array( 'login' => $parametres->login,
'date' => $parametres->date,
'typeReport' => $parametres->typeReport,
'price' => $parametres->price,
'pays' => $parametres->pays,
'rapportId' => $parametres->rapportId,
//'lang' => $parametres->lang
);
$commandes->insert($data);
}
2013-07-30 10:24:34 +02:00
public function setMonitoring($parametres)
{
$commandes = new Application_Model_MonitoringGiants();
$data = array( 'login' => $parametres->login,
'CompanyId' => $parametres->CompanyId,
'CompanyName' => $parametres->CompanyName,
'Category' => $parametres->CategorieName,
'EventType' => $parametres->EventType,
'Pays' => $parametres->Pays,
'Language' => $parametres->Language,
'PreferredStartDate' => $parametres->PreferredStartDate,
'PreferredEndDate' => $parametres->PreferredEndDate,
'Version' => $parametres->Version,
'TestIndication' => $parametres->TestIndication,
'ActualStartDate' => $parametres->ActualStartDate,
'ActualEndDate' => $parametres->ActualEndDate,
'InternalOrderId' => $parametres->InternalOrderId,
2013-08-20 15:48:53 +02:00
'ProviderOrderId' => $parametres->ProviderOrderId,
2013-07-30 10:24:34 +02:00
);
$commandes->insert($data);
}
2013-09-16 17:41:31 +02:00
public function updateMonitoring($parametres)
{
$commandes = new Application_Model_MonitoringGiants();
$data = array(
'Category' => $parametres->CategorieName,
'EventType' => $parametres->EventType,
'Language' => $parametres->Language,
'PreferredStartDate' => $parametres->PreferredStartDate,
'PreferredEndDate' => $parametres->PreferredEndDate,
'Version' => $parametres->Version,
'ActualStartDate' => $parametres->PreferredStartDate,
'ActualEndDate' => $parametres->PreferredEndDate,
);
foreach ($data as $key=>$val){
if (empty($val)) {
unset($data[$key]);
}
}
$where['InternalOrderId = ?'] = $parametres->InternalOrderId;
$commandes->update($data,$where);
}
2013-07-30 10:24:34 +02:00
public function setRetrive($parametres)
{
$commandes = new Application_Model_RetriveGiants();
$data = array( 'login' => $parametres->login,
'CompanyId' => $parametres->CompanyId,
'CompanyName' => $parametres->CompanyName,
'Pays' => $parametres->Pays,
'TestIndication' => $parametres->TestIndication,
'InternalOrderId' => $parametres->InternalOrderId,
'Type' => $parametres->Type,
'StartFrom' => $parametres->StartFrom,
);
$commandes->insert($data);
}
2013-05-23 15:42:00 +02:00
public function getCommandesByLogin($login)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLogin($login));
}
2013-05-23 15:42:00 +02:00
public function getCommandesByDate($date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByDate($date));
}
2013-05-23 15:42:00 +02:00
public function getCommandesByLoginAndDate($login, $date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLoginAndDate($login, $date));
}
2013-05-23 15:42:00 +02:00
public function getCommandeExistToday($login, $date, $type, $pays)
{
$commande = new Application_Model_CommandesGiants();
$result = $commande->getCommandesGiantLoginDateReportType($login, $date, $type, $pays);
if(!empty($result))
return (true);
return (false);
}
}
Class Rapports
{
2013-05-23 15:42:00 +02:00
protected $enumerations = array('Full' => 'FU', 'Compact' => 'CO', 'CreditRecommendation' => 'CR');
2013-05-23 15:42:00 +02:00
public function __construct($countryCode, $TestIndication)
{
}
2013-05-23 15:42:00 +02:00
public function setReport($companyId, $type, $pays, $reportSerial, $Language)
{
$report = new Application_Model_RapportsGiants();
$datas = array('companyId' => $companyId,
2013-05-23 15:42:00 +02:00
'date' => date('Y-m-d'),
'pays' => $pays,
'type' => $this->enumerations[$type],
'report' => $reportSerial,
'lang' => $Language
);
$report->insert($datas);
return ($reportSerial);
}
public function getRapportExist($companyId, $type, $Language)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportByIdAndType($companyId, $this->enumerations[$type], $Language);
return ($id);
}
public function getRapportExistId($companyId, $Language)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportById($companyId, $Language);
return ($id);
}
2013-09-16 17:41:31 +02:00
public function getRetrive($date_st)
{
$rapports = new Application_Model_MonitoringGiants();
$id = $rapports->getRetrive($date_st);
return ($id);
}
}
?>