Esempio n. 1
0
 public function importCustomerTitle()
 {
     $con = Propel::getConnection(CustomerTitleTableMap::DATABASE_NAME);
     $con->beginTransaction();
     try {
         CustomerTitleQuery::create()->deleteAll();
         $hdl = $this->t1db->query("select * from raison order by classement");
         while ($hdl && ($raison = $this->t1db->fetch_object($hdl))) {
             $ct = new CustomerTitle();
             $descs = $this->t1db->query_list("select * from raisondesc where raison = ? order by lang asc", array($raison->id));
             foreach ($descs as $desc) {
                 $lang = $this->getT2Lang($desc->lang);
                 $ct->setLocale($lang->getLocale())->setByDefault($raison->defaut ? true : false)->setPosition($raison->classement)->setLong($desc->long)->setShort($desc->court)->save();
             }
         }
         $con->commit();
     } catch (\Exception $ex) {
         $con->rollBack();
         Tlog::getInstance()->error("Failed to import Thelia 1 customer titles (not a problem for Thelia 1.4.x). Cause: " . $ex->getMessage());
     }
 }