Пример #1
0
 /**
  *
  * @param \Tip\Repository\IzbirneOpcije $rep
  * @param string $object
  * @param array $vals
  */
 public function populateOseba($manager, $v)
 {
     $rep = $manager->getRepository('App\\Entity\\Oseba');
     $o = $rep->findOneBySifra(trim($v[0]));
     $nov = false;
     if (!$o) {
         $o = new \App\Entity\Oseba();
         $o->setSifra(trim($v[0]));
         $nov = true;
     }
     $o->setNaziv($v[1]);
     $o->setIme($v[2]);
     $o->setPriimek($v[3]);
     $o->setFunkcija($v[4]);
     $o->setSrednjeIme($v[5]);
     $o->setPolnoIme(sprintf('%s %s %s', $v[2], $v[5], $v[3]));
     $o->setPsevdonim($v[6]);
     $o->setEmail($v[7]);
     $date = empty($v[8]) ? null : date_create($v[8]);
     // polje mora biti v php-jevi PHP-jevem datetime  tipu
     $o->setDatumRojstva($date);
     $o->setEmso($v[9]);
     $o->setDavcna($v[10]);
     $o->setSpol($v[11]);
     $o->setOpombe($v[12]);
     $o->setDrzavljanstvo($v[13]);
     $o->setDrzavaRojstva($v[14]);
     $o->setKrajRojstva($v[15]);
     if ($v[16]) {
         // $$ še ni implementirano
         $getref = $this->getReference($v[16]);
         $o->setUser($getref);
     }
     if ($nov) {
         $rep->create($o);
     } else {
         $rep->update($o);
     }
     $referenca = 'Oseba-' . $v[0];
     //var_dump($referenca);
     $this->addReference($referenca, $o);
 }
Пример #2
0
 public function loadSodelavci()
 {
     $this->loadOznakeRef();
     $sodelavci = $this->src->fetchAll('select * from dbo."tblSodelavci" ');
     $or = $this->em->getRepository('App\\Entity\\Oseba');
     $or->setServiceLocator($this->getServiceLocator());
     foreach ($sodelavci as $sodelavec) {
         $oseba = new \App\Entity\Oseba();
         $oseba->setIme(trim($sodelavec['ime']));
         $oseba->setPriimek(trim($sodelavec['priimek']));
         if (!($oseba->getPriimek() && $oseba->getIme())) {
             continue;
         }
         $oseba->setPsevdonim(trim($sodelavec['psevdonim']));
         $oseba->setEmail(trim($sodelavec['eposta']));
         $oseba->setPolnoIme(trim($sodelavec['ime']) . " " . trim($sodelavec['priimek']));
         $oseba->setEmso($sodelavec['EMSO']);
         $oseba->setDavcna(trim($sodelavec['davcna']));
         $oseba->setDatumRojstva($sodelavec['datumRojstva'] ? new \DateTime($sodelavec['datumRojstva']) : null);
         $oseba->setDrzavljanstvo(trim($sodelavec['drzavljanstvo']));
         $oseba->setKrajRojstva(trim($sodelavec['krajRojstva']));
         $oseba->setSpol($sodelavec['spol'] == 'M' ? 'M' : 'Z');
         $oseba->setNaziv($this->getRef('oznaka', $sodelavec['IDoznake']));
         $oseba->delovnoMesto = trim($sodelavec['delovnoMesto']);
         if (trim($sodelavec['GSM'])) {
             $t = new \App\Entity\Telefonska();
             $t->setOseba($oseba);
             $t->setVrsta('mobilna');
             $t->setPrivzeta(true);
             $t->setStevilka(trim($sodelavec['GSM']));
             $this->em->persist($t);
             $oseba->getTelefonske()->add($t);
         }
         if (trim($sodelavec['telefon'])) {
             $t = new \App\Entity\Telefonska();
             $t->setOseba($oseba);
             $t->setVrsta('fiksna');
             $t->setPrivzeta(true);
             $t->setStevilka(trim($sodelavec['telefon']));
             $this->em->persist($t);
             $oseba->getTelefonske()->add($t);
         }
         if (trim($sodelavec['TRR'])) {
             $r = new \App\Entity\Trr();
             $r->setOseba($oseba);
             $r->setStevilka(trim($sodelavec['TRR']));
             $r->setSwift(trim($sodelavec['opombeOsebni']));
             $this->em->persist($r);
             $r->setBanka(trim($sodelavec['TRRbanka']));
         }
         if (trim($sodelavec['naslov'])) {
             $n = new \App\Entity\PostniNaslov();
             $n->setNaziv($sodelavec['naslovZaPosto'] === 1 ? "Naslov za pošto" : "Naslov");
             $n->setPrivzeti($sodelavec['naslovZaPosto'] === 1);
             $n->setOseba($oseba);
             $n->setUlica(trim($sodelavec['naslov']));
             $n->setPosta($this->getRef('posta', $sodelavec['postaSt']));
             $n->setPostaNaziv($this->getRef('postaIme', $sodelavec['postaSt']));
             $this->em->persist($n);
         }
         if (trim($sodelavec['naslovZ'])) {
             $n = new \App\Entity\PostniNaslov();
             $n->setNaziv($sodelavec['naslovZaPosto'] === 2 ? "Naslov za pošto" : "Naslov");
             $n->setOseba($oseba);
             $n->setPrivzeti($sodelavec['naslovZaPosto'] === 2);
             $n->setUlica(trim($sodelavec['naslovZ']));
             $n->setPosta($this->getRef('postaSt', $sodelavec['postaStZ']));
             $n->setPostaNaziv($this->getRef('postaIme', $sodelavec['postaStZ']));
             $this->em->persist($n);
         }
         $or->create($oseba);
         $this->em->persist($oseba);
         $this->addRef('sodelavec', $sodelavec['IDsodelavca'], $oseba);
     }
     $this->loadZaposlitve();
 }