79 lines
2.0 KiB
PHP
79 lines
2.0 KiB
PHP
<?php
|
|
require_once __DIR__ . '/Types.php';
|
|
|
|
class Order extends Scores_Ws_Server
|
|
{
|
|
/**
|
|
* Financial account : Place an order to have number enter in database
|
|
* @param string $siren
|
|
* @param string $date
|
|
* @param string $type N:Normal, S:Simplifié, C:Consolidé
|
|
* @param string $source
|
|
* @param integer $private
|
|
* @throws SoapFault
|
|
* @return string
|
|
*/
|
|
public function setBilanInput($siren, $date, $type, $source, $private = 0)
|
|
{
|
|
$this->authenticate();
|
|
$this->permission('UPLOADBILAN');
|
|
|
|
//Check siren
|
|
|
|
$refCommande = uniqid();
|
|
|
|
$data = array(
|
|
'refCommande' => $refCommande,
|
|
'siren' => $siren,
|
|
'userId' => $this->User->id,
|
|
'bilanConfidentiel' => $private,
|
|
'bilanSource' => $source,
|
|
'bilanCloture' => $date,
|
|
'bilanType' => $type,
|
|
'dateInsert' => date('YmdHis'),
|
|
);
|
|
try {
|
|
$commandeM = new Application_Model_Sdv1OrderBilanInput();
|
|
$commandeM->insert($data);
|
|
return $refCommande;
|
|
} catch (Zend_Db_Exception $e) {
|
|
if ($this->User->idClient==1) {
|
|
throw new SoapFault('ERR', $e->getMessage());
|
|
} else {
|
|
throw new SoapFault('ERR', "Application error");
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Financial account : Tag file is sent
|
|
* @param string $ref
|
|
* @param string $filename
|
|
* @throws SoapFault
|
|
* @return boolean
|
|
*/
|
|
public function setBilanInputFile($ref, $filename)
|
|
{
|
|
$this->authenticate();
|
|
$this->permission('UPLOADBILAN');
|
|
|
|
$data = array(
|
|
'bilanFileSent' => date('YmdHis'),
|
|
'bilanFile' => $filename,
|
|
);
|
|
try {
|
|
$commandeM = new Application_Model_Sdv1OrderBilanInput();
|
|
$commandeM->update($data, "refCommande=$ref");
|
|
return true;
|
|
} catch (Zend_Db_Exception $e) {
|
|
if ($this->User->idClient==1) {
|
|
throw new SoapFault('ERR', $e->getMessage());
|
|
} else {
|
|
throw new SoapFault('ERR', "Application error");
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} |