/**
  * destroy
  */
 public function destroy()
 {
     $res = new Reponse();
     $rec = Object\Societe::getById($this->id);
     if ($rec) {
         $rec->delete();
         $res->success = true;
         $res->message = 'Destroyed';
     } else {
         $res->message = "Failed to destroy";
     }
     return $res;
 }
示例#2
0
 public function checkReferenceAction()
 {
     $reponse = new Reponse();
     if ($this->getRequest()->isGet() or $this->getRequest()->isPost()) {
         $ref = $this->getParam('reference');
         $societe = Object\Societe::getByReference($ref, 1);
         if ($societe instanceof Object\Societe) {
             $reponse->message = 'TXT_SOCIETE_EXIST';
             $reponse->success = true;
         } else {
             $reponse->message = 'TXT_SOCIETE_UNKNOWN';
             $reponse->success = false;
         }
     } else {
         $reponse->message = 'TXT_SOCIETE_NOTRECEIVED';
         $reponse->success = false;
     }
     $this->render($reponse, 'success');
 }