Exemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     static $list = array('CyberPC' => ['systName' => 'cyberpc', 'description' => 'CyberPC est un site de vente de matériel informatique, accessoires, drones... Basé au Taillan Medoc, à 30min du centre de Bordeaux, CyberPC se déplace pour tout dépannage informatique dans un secteur de 2h autour de son siège social.'], 'Société Générale' => ['systName' => 'sogen', 'description' => ''], 'CGI' => ['systName' => 'cgi', 'description' => ''], 'Université de Bordeaux' => ['systName' => 'universite', 'description' => ''], 'Fonds de Solidarité et Développement des Initiatives Etudiantes' => ['systName' => 'fsdie', 'description' => '']);
     foreach ($list as $name => $systname) {
         $partner = new Partner();
         $partner->setName($name);
         $partner->setSystName($systname['systName']);
         $partner->setDescription($systname['description']);
         $manager->persist($partner);
         $manager->flush();
     }
 }
Exemplo n.º 2
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
     //    $locale = $this->getConfigurationPool()->getContainer()->get('request_stack')->getCurrentRequest()->getLocale();
     //    $formMapper->add('translations', 'a2lix_translations');
     /*    $formMapper
                 ->add('productCategory', 'entity', array(
                   'required' => true,
                   'class' => "AppBundle\Entity\ProductCategory",
                   'query_builder' => function(EntityRepository $er) use ($locale) {
                     return $er->createQueryBuilder('u')
                       ->join('u.translations', 'ctr')
                       ->where('ctr.locale = :locale')
                       ->orderBy('ctr.name', 'asc')
                       ->setParameter('locale',$locale)
                       ;
                   },
                 ));
           */
     $formMapper->setAdminCode("app.partner");
     $formMapper->tab('general')->with('options', array('class' => 'col-md-2'))->add('active', null, array('required' => false), array('admin-code' => 'app.partner'))->add('company', null, array('required' => false))->add('customer', null, array('required' => false, 'attr' => array('class' => 'selling')))->add('supplier', null, array('required' => false, 'attr' => array('class' => 'purchase')))->add('isEmployee', null, array('required' => false, 'attr' => array('class' => 'employee')))->end()->with('name.and.address', array('class' => 'col-md-5'))->add('address', 'text', array('required' => false, 'label' => false, 'mapped' => false, 'attr' => array('class' => 'geocomplete')))->add('name', null, array('attr' => array('data-geo' => 'name')))->add('parent', null, array('label' => 'Company'))->add('addressType', 'choice', array('required' => false, 'choices' => Partner::getAddressTypeChoices()))->add('street', null, array('attr' => array('class' => 'street')))->add('street2', null, array('required' => false, 'attr' => array('class' => 'street2')))->add('zip', null, array('attr' => array('data-geo' => 'postal_code')))->add('city', null, array('attr' => array('data-geo' => 'locality')))->add('state', null, array('attr' => array('data-geo' => 'administrative_area_level_1')))->add('country', 'country', array('label' => 'country', 'attr' => array('class' => 'country')))->end()->with('further.information', array('class' => 'col-md-5'))->add('language', 'locale', array('preferred_choices' => array('de_CH')))->add('phone', null, array('required' => false, 'attr' => array('data-geo' => 'international_phone_number')))->add('fax', null, array('required' => false))->add('mobile', null, array('required' => false))->add('email', null, array('required' => false))->add('website', null, array('required' => false, 'attr' => array('data-geo' => 'website')))->add('optOut', null, array('required' => false))->add('partnerCategory')->end()->end()->tab('selling')->with('selling')->add('deliveryMethod', 'sonata_type_model')->add('creditLimit', null, array('required' => false))->end()->end()->tab('purchase')->with('selling')->add('debitLimit', null, array('required' => false))->end()->end()->tab('employee')->with('employee')->add('employee', 'sonata_type_admin', array('required' => false, 'btn_add' => false, 'btn_delete' => false), array('admin_code' => 'app.employee'))->end()->end()->tab('comments')->with('comments')->add('comment', null, array('required' => false, 'label' => false))->end()->end();
 }
Exemplo n.º 3
0
 /**
  * Creates a form to delete a Partner entity.
  *
  * @param Partner $partner The Partner entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Partner $partner)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('partner_delete', array('id' => $partner->getId())))->setMethod('DELETE')->getForm();
 }
Exemplo n.º 4
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     //        $formMapper->setAdminCode("app.customer");
     $formMapper->tab('general')->with('options', array('class' => 'col-md-2'))->add('active', null, array('required' => false), array('admin_code' => 'app.customer'))->add('company', null, array('required' => false), array('admin_code' => 'app.customer'))->add('customer', null, array('required' => false, 'attr' => array('class' => 'selling')), array('admin_code' => 'app.customer'))->add('supplier', null, array('required' => false, 'attr' => array('class' => 'purchase')), array('admin_code' => 'app.customer'))->end()->with('name.and.address', array('class' => 'col-md-5'))->add('address', 'text', array('required' => false, 'label' => false, 'mapped' => false, 'attr' => array('class' => 'geocomplete')), array('admin_code' => 'app.customer'))->add('name', null, array('attr' => array('data-geo' => 'name')), array('admin_code' => 'app.customer'))->add('parent', 'sonata_type_model_autocomplete', array('label' => 'parent_partner', 'property' => 'name', 'required' => false, 'placeholder' => 'Keiner'), array('admin_code' => 'app.customer'))->add('addressType', 'choice', array('required' => false, 'choices' => Partner::getAddressTypeChoices()), array('admin_code' => 'app.customer'))->add('street', null, array('attr' => array('class' => 'street')), array('admin_code' => 'app.customer'))->add('street2', null, array('required' => false, 'attr' => array('class' => 'street2')), array('admin_code' => 'app.customer'))->add('zip', null, array('attr' => array('data-geo' => 'postal_code')), array('admin_code' => 'app.customer'))->add('city', null, array('attr' => array('data-geo' => 'locality')), array('admin_code' => 'app.customer'))->add('state', null, array('label' => 'geo_state', 'attr' => array('data-geo' => 'administrative_area_level_1')), array('admin_code' => 'app.customer'))->add('country', 'country', array('label' => 'country', 'attr' => array('class' => 'country')), array('admin_code' => 'app.customer'))->end()->with('further.information', array('class' => 'col-md-5'))->add('language', 'locale', array('preferred_choices' => array('de_CH')), array('admin_code' => 'app.customer'))->add('phone', null, array('required' => false, 'attr' => array('data-geo' => 'international_phone_number')), array('admin_code' => 'app.customer'))->add('fax', null, array('required' => false), array('admin_code' => 'app.customer'))->add('mobile', null, array('required' => false), array('admin_code' => 'app.customer'))->add('email', null, array('required' => false), array('admin_code' => 'app.customer'))->add('website', null, array('required' => false, 'attr' => array('data-geo' => 'website')), array('admin_code' => 'app.customer'))->add('optOut', null, array('required' => false), array('admin_code' => 'app.customer'))->add('partnerCategory', null, array(), array('admin_code' => 'app.customer'))->end()->end()->tab('selling')->with('selling')->add('shippingMethod', 'sonata_type_model', array(), array('admin_code' => 'app.shipping.method'), array('admin_code' => 'app.customer'))->add('shippingTerm', 'sonata_type_model', array(), array('admin_code' => 'app.shipping.term'), array('admin_code' => 'app.customer'))->add('paymentTerm', 'sonata_type_model', array(), array('admin_code' => 'app.payment.term'), array('admin_code' => 'app.customer'))->add('creditLimit', null, array('required' => false), array('admin_code' => 'app.customer'))->add('netInvoice', null, array('required' => false), array('admin_code' => 'app.customer'))->add('ustIdNr', null, array('required' => false), array('admin_code' => 'app.customer'))->end()->end()->tab('purchase')->with('selling')->add('debitLimit', null, array('required' => false), array('admin_code' => 'app.customer'))->end()->end()->tab('comments')->with('comments')->add('comment', null, array('required' => false, 'label' => false), array('admin_code' => 'app.customer'))->end()->end();
 }
Exemplo n.º 5
0
    /**
     * @Route("/{partnerName}", name="partner")
     */
    public function partnerAction($partnerName, Request $request)
    {
        $logger = $this->get('logger');
        $partnervarvalue = '';
        /* We get this value if it's persist in DB and request. It's should be because it is in Twig template */
        $em = $this->getDoctrine()->getManager();
        $query = $em->createQuery('
			SELECT p
			FROM AppBundle:Partner p
			WHERE p.name = :name
			')->setParameter('name', $partnerName);
        $partner = new Partner($query->getResult());
        $logger->info("REFERER: " . $this->getRequest()->headers->get('referer'));
        if ($partner->getIsactive() != 'dbActive') {
            $response = new Response();
            $response->setStatusCode(Response::HTTP_LOCKED);
            $response->headers->set('Content-Type', 'text/html');
            $response->send();
            die("This partner is blocked by administrator");
        }
        if ($partner->getPartnervars()) {
            $partnerVars = $partner->getPartnervars();
            $logger->info($request->query->get($partner['partnerVars']));
            $partnervarvalue = $request->query->get($partner->getPartnervars());
        }
        $query = $em->createQuery('
			SELECT img
			FROM AppBundle:ImageSet img
			WHERE img.name = :name')->setParameter('name', $partner->getImageset());
        $imageset = new ImageSet($query->getResult());
        return $this->render('base.html.twig', array('partner' => $partner, 'images' => $imageset, 'partnervarvalue' => $partnervarvalue));
    }