Commit 4c59b87e authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Possibilité de récupérer via OseAdmin l'ID de la source OSE

parent e2b2e06d
......@@ -29,6 +29,11 @@ class OseAdmin
*/
private $oseAppliId;
/**
* @var int
*/
private $sourceOseId;
/**
* @var string
*/
......@@ -350,11 +355,11 @@ class OseAdmin
public function getOseAppliId(): int
{
if (!$this->oseAppliId){
$u = $this->oseAdmin->getBdd()->select("SELECT id FROM UTILISATEUR WHERE USERNAME='oseappli'");
if (isset($u[0]['ID'])){
if (!$this->oseAppliId) {
$u = $this->getBdd()->select("SELECT id FROM UTILISATEUR WHERE USERNAME='oseappli'");
if (isset($u[0]['ID'])) {
$this->oseAppliId = (int)$u[0]['ID'];
}else{
} else {
throw new \Exception('Utilisateur système "oseappli" non trouvé!!');
}
}
......@@ -364,6 +369,22 @@ class OseAdmin
public function getSourceOseId(): int
{
if (!$this->sourceOseId) {
$src = $this->getBdd()->select("SELECT id FROM SOURCE WHERE CODE='OSE'");
if (isset($src[0]['ID'])) {
$this->sourceOseId = (int)$src[0]['ID'];
} else {
throw new \Exception('Source d\'import "OSE" non trouvée!!');
}
}
return $this->sourceOseId;
}
/**
* @return \BddAdmin\Bdd
*/
......@@ -397,7 +418,7 @@ class OseAdmin
*/
public function getConsole(): Console
{
if (!$this->console){
if (!$this->console) {
$this->console = new Console();
}
......@@ -431,7 +452,8 @@ class OseAdmin
$characterSet = 'AL32UTF8';
$conn = @oci_pconnect($bddConf['username'], $bddConf['password'], $cs, $characterSet);
if (!$conn) {
$msg = oci_error()['message'];
$msg = oci_error()['message'];
return false;
} else {
oci_close($conn);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment