Beispiel #1
0
 /**
  *
  */
 public function reactivateAction()
 {
     $id = $this->getRequest()->getParam('id');
     $contact = ContactQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Contact with id {$id}"));
     try {
         $this->getContactCatalog()->beginTransaction();
         $this->getContactCatalog()->update($contact);
         $this->getContactCatalog()->commit();
         $this->setFlash('ok', $this->i18n->_("Se reactivo correctamente el Contact"));
     } catch (Exception $e) {
         $this->getContactCatalog()->rollBack();
         $this->setFlash('error', $this->i18n->_($e->getMessage()));
     }
     $this->_redirect('contact/list');
 }
Beispiel #2
0
 /**
  * 
  */
 public function getContactsAction()
 {
     $id = $this->getRequest()->getParam('id');
     $contactQuery = ContactQuery::create()->whereAdd(Contact::ID_COMPANY, $id);
 }
 /**
  * This action get all forwarder's contacts without courtyard
  *
  * @author Erick Guevara Martínez
  * @return json
  */
 public function forwardercontactsAction()
 {
     // Get the forwarder and courtyard ids
     $idForwarder = $this->getRequest()->getParam("idForwarder");
     $idCourtyard = $this->getRequest()->getParam("idCourtyard");
     // Get the forwarder info
     $forwarder = ForwarderQuery::create()->findByPKOrThrow($idForwarder, $this->i18n->_("The forward with id {$idForwarder} does not exist"));
     if (!($idCourtyard > 0)) {
         $idCourtyard == null;
     }
     // Get all forwarder's contacts
     $contacts = ContactQuery::create()->whereAdd(Contact::ID_COMPANY, $forwarder->getIdCompany())->find()->toCombo();
     // Get all courtyards with forwarder's contact assign and exclude the courtyard param id
     $courtyards = CourtyardQuery::create()->whereAdd(Courtyard::ID_FORWARDER, $forwarder->getIdForwarder())->whereAdd(Courtyard::ID_COURTYARD, $idCourtyard, "<>")->find();
     // Unset the forwarder's contacts with courtyard assign
     foreach ($courtyards as $courtyard) {
         unset($contacts[$courtyard->getIdContact()]);
     }
     die(Zend_Json::encode(array("response" => $contacts)));
 }