示例#1
0
    public function postActivation(ConnectionInterface $con = null)
    {
        $database = new Database($con);
        $database->insertSql(null, [__DIR__ . '/Config/insert.sql']);
        /* insert the images from image folder if first module activation */
        $module = $this->getModuleModel();
        if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
            $this->deployImageFolder($module, sprintf('%s/media', __DIR__), $con);
        }
        /* set module description */
        $enUSDescription = <<<US_DESC
            Discover delivery Predict:
            <ul>
                <li>You place your order and choose to have it delivered with Predict by Exapaq</li>
                <li>Once your order is prepared, we send you an SMS with several choices of dates and delivery slots</li>
                <li>You select the date and the time slot that suits you by answering directly by SMS (price of a standard SMS) or by going to the space available on <a href="http://destinataires.exapaq.com">http://destinataires.exapaq.com</a> Recipient</li>
                <li>The day of delivery, you will receive an SMS reminding you the time slot.</li>
            </ul>
US_DESC;
        $frFRDescription = <<<FR_DESC
            Découvrez la livraison Predict :
            <ul>
                <li>Vous faites votre commande et choisissez de vous faire livrer avec Predict par Exapaq</li>
                <li>Une fois votre commande préparée, nous vous envoyons un SMS avec plusieurs choix de dates et créneaux horaires de livraison</li>
                <li>Vous sélectionnez la date et le créneau qui vous conviennent le mieux en répondant directement par SMS (prix d’un SMS standard) ou en allant sur l’Espace Destinataire disponible sur <a href="http://destinataires.exapaq.com">http://destinataires.exapaq.com</a></li>
                <li>Le jour de la livraison, vous recevez un SMS vous rappelant le créneau horaire.</li>
            </ul>
FR_DESC;
        $this->getModuleModel()->setLocale()->setDescription($enUSDescription)->setLocale("fr_FR")->setDescription($frFRDescription)->save();
    }
示例#2
0
 public function postActivation(ConnectionInterface $con = null)
 {
     /* insert the images from image folder if first module activation */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
     }
     /* set module title */
     $this->setTitle($module, array("en_US" => "CB", "fr_FR" => "CB"));
 }
示例#3
0
 /**
  * @param ConnectionInterface $con
  */
 public function postActivation(ConnectionInterface $con = null)
 {
     /* insert the images from image folder if first module activation */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
     }
     /* set module title */
     $this->setTitle($module, array("en_US" => "Transfer", "fr_FR" => "Virement"));
     $database = new Database($con->getWrappedConnection());
     $database->insertSql(null, array(__DIR__ . "/Config/thelia.sql"));
 }
示例#4
0
 public function postActivation(ConnectionInterface $con = null)
 {
     // Once activated, create the module schema in the Thelia database.
     $database = new Database($con);
     $database->insertSql(null, array(__DIR__ . DS . 'Config' . DS . 'thelia.sql'));
     // Create payment confirmation message from templates, if not already defined
     $email_templates_dir = __DIR__ . DS . 'I18n' . DS . 'email-templates' . DS;
     if (null === MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)) {
         $message = new Message();
         $message->setName(self::CONFIRMATION_MESSAGE_NAME)->setLocale('en_US')->setTitle('Payzen payment confirmation')->setSubject('Payment of order {$order_ref}')->setHtmlMessage(file_get_contents($email_templates_dir . 'en.html'))->setTextMessage(file_get_contents($email_templates_dir . 'en.txt'))->setLocale('fr_FR')->setTitle('Confirmation de paiement par PayZen')->setSubject('Confirmation du paiement de votre commande {$order_ref}')->setHtmlMessage(file_get_contents($email_templates_dir . 'fr.html'))->setTextMessage(file_get_contents($email_templates_dir . 'fr.txt'))->save();
     }
     /* Deploy the module's image */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
     }
 }
示例#5
0
 /**
  * @inheritdoc
  */
 public function postActivation(ConnectionInterface $con = null)
 {
     // Create payment confirmation message from templates, if not already defined
     $email_templates_dir = __DIR__ . DS . 'I18n' . DS . 'email-templates' . DS;
     if (null === MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)) {
         $message = new Message();
         $message->setName(self::CONFIRMATION_MESSAGE_NAME)->setLocale('en_US')->setTitle('Paybox payment confirmation')->setSubject('Payment of order {$order_ref}')->setHtmlMessage(file_get_contents($email_templates_dir . 'en.html'))->setTextMessage(file_get_contents($email_templates_dir . 'en.txt'))->setLocale('fr_FR')->setTitle('Confirmation de paiement par PayBox')->setSubject('Confirmation du paiement de votre commande {$order_ref}')->setHtmlMessage(file_get_contents($email_templates_dir . 'fr.html'))->setTextMessage(file_get_contents($email_templates_dir . 'fr.txt'))->save();
     }
     if (null === MessageQuery::create()->findOneByName(self::NOTIFICATION_MESSAGE_NAME)) {
         $message = new Message();
         $message->setName(self::NOTIFICATION_MESSAGE_NAME)->setLocale('en_US')->setTitle('Paybox payment status notification')->setSubject('Paybox payment status for order {$order_ref}: {$paybox_payment_status}')->setHtmlMessage(file_get_contents($email_templates_dir . 'notification-en.html'))->setTextMessage(file_get_contents($email_templates_dir . 'notification-en.txt'))->setLocale('fr_FR')->setTitle('Notification du résultat d\'un paiement par Paybox')->setSubject('Résultats du paiement Paybox de la commande {$order_ref} : {$paybox_payment_status}')->setHtmlMessage(file_get_contents($email_templates_dir . 'notification-fr.html'))->setTextMessage(file_get_contents($email_templates_dir . 'notification-fr.txt'))->save();
     }
     /* Deploy the module's image */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s' . DS . 'images', __DIR__), $con);
     }
 }
示例#6
0
 public function postActivation(ConnectionInterface $con = null)
 {
     // Once activated, create the module schema in the Thelia database.
     $database = new Database($con);
     $database->insertSql(null, array(__DIR__ . DS . 'Config' . DS . 'thelia.sql'));
     $languages = LangQuery::create()->find();
     if (null === MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)) {
         $message = new Message();
         $message->setName(self::CONFIRMATION_MESSAGE_NAME)->setHtmlLayoutFileName('')->setHtmlTemplateFileName(self::CONFIRMATION_MESSAGE_NAME . '.html')->setTextLayoutFileName('')->setTextTemplateFileName(self::CONFIRMATION_MESSAGE_NAME . '.txt');
         foreach ($languages as $language) {
             /** @var Lang $language */
             $locale = $language->getLocale();
             $message->setLocale($locale);
             $message->setTitle($this->trans('Order payment confirmation', $locale));
             $message->setSubject($this->trans('Order {$order_ref} payment confirmation', $locale));
         }
         $message->save();
     }
     /* Deploy the module's image */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
     }
 }
示例#7
0
 /**
  * Performs an INSERT on the database, given a ModuleImage or Criteria object.
  *
  * @param mixed               $criteria Criteria or ModuleImage object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from ModuleImage object
     }
     if ($criteria->containsKey(ModuleImageTableMap::ID) && $criteria->keyContainsValue(ModuleImageTableMap::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModuleImageTableMap::ID . ')');
     }
     // Set the correct dbName
     $query = ModuleImageQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
示例#8
0
 /**
  * Get the associated ChildModuleImage object
  *
  * @param      ConnectionInterface $con Optional Connection object.
  * @return                 ChildModuleImage The associated ChildModuleImage object.
  * @throws PropelException
  */
 public function getModuleImage(ConnectionInterface $con = null)
 {
     if ($this->aModuleImage === null && $this->id !== null) {
         $this->aModuleImage = ChildModuleImageQuery::create()->findPk($this->id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aModuleImage->addModuleImageI18ns($this);
            */
     }
     return $this->aModuleImage;
 }
示例#9
0
 /**
  * Returns the number of related ModuleImage objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related ModuleImage objects.
  * @throws PropelException
  */
 public function countModuleImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collModuleImagesPartial && !$this->isNew();
     if (null === $this->collModuleImages || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collModuleImages) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getModuleImages());
         }
         $query = ChildModuleImageQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByModule($this)->count($con);
     }
     return count($this->collModuleImages);
 }
示例#10
0
 public function postActivation(ConnectionInterface $con = null)
 {
     $database = new Database($con);
     try {
         // Security to not erase user config on reactivation
         SocolissimoDeliveryModeQuery::create()->findOne();
     } catch (\Exception $e) {
         $database->insertSql(null, [__DIR__ . '/Config/thelia.sql', __DIR__ . '/Config/insert.sql']);
     }
     try {
         $deliveryModes = SocolissimoDeliveryModeQuery::create()->find();
         foreach ($deliveryModes as $deliveryMode) {
             self::importJsonPrice($deliveryMode, $con);
         }
     } catch (\Exception $e) {
         throw $e;
     }
     ConfigQuery::write('socolissimo_login', null, 1, 1);
     ConfigQuery::write('socolissimo_pwd', null, 1, 1);
     ConfigQuery::write('socolissimo_url_prod', "https://ws.colissimo.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl", 1, 1);
     ConfigQuery::write('socolissimo_url_test', "https://pfi.telintrans.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl", 1, 1);
     ConfigQuery::write('socolissimo_test_mode', 1, 1, 1);
     /* insert the images from image folder if first module activation */
     $module = $this->getModuleModel();
     if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
         $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
     }
 }
示例#11
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      ConnectionInterface $con
  * @return void
  * @throws PropelException
  * @see ModuleImage::setDeleted()
  * @see ModuleImage::isDeleted()
  */
 public function delete(ConnectionInterface $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = ChildModuleImageQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }