Exemplo n.º 1
0
 protected function traceEntity(SecondaryVat $cloneSecondaryVat, SecondaryVat $secondaryVat)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($secondaryVat->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($secondaryVat->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_SECONDARYVAT);
     $trace->setActionId2($secondaryVat->getSale()->getMonthlyBalance()->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $trace->setActionId3($secondaryVat->getSale()->getMonthlyBalance()->getId());
     $trace->setActionEntity2(Trace::AE_MBSALE);
     $trace->setActionId3($secondaryVat->getSale()->getId());
     $trace->setActionEntity2(Trace::AE_SALE);
     $msg = '';
     if ($cloneSecondaryVat->getVatInfo() != $secondaryVat->getVatInfo()) {
         $msg .= '<tr><td>' . $this->translate('SecondaryVat.vatInfo.label') . '</td><td>';
         if ($cloneSecondaryVat->getVatInfo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('SecondaryVat.vatInfo.' . $cloneSecondaryVat->getVatInfo());
         }
         $msg .= '</td><td>';
         if ($secondaryVat->getVatInfo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('SecondaryVat.vatInfo.' . $secondaryVat->getVatInfo());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneSecondaryVat->getBalanceNet() != $secondaryVat->getBalanceNet()) {
         $msg .= '<tr><td>' . $this->translate('SecondaryVat.balanceNet.label') . '</td><td>';
         if ($cloneSecondaryVat->getBalanceNet() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneSecondaryVat->getBalanceNet();
         }
         $msg .= '</td><td>';
         if ($secondaryVat->getBalanceNet() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $secondaryVat->getBalanceNet();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneSecondaryVat->getBalanceTtc() != $secondaryVat->getBalanceTtc()) {
         $msg .= '<tr><td>' . $this->translate('SecondaryVat.balanceTtc.label') . '</td><td>';
         if ($cloneSecondaryVat->getBalanceTtc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneSecondaryVat->getBalanceTtc();
         }
         $msg .= '</td><td>';
         if ($secondaryVat->getBalanceTtc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $secondaryVat->getBalanceTtc();
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('SecondaryVat.traceEdit', array('%secondaryVat%' => $this->translate('SecondaryVat.vatInfo.' . $secondaryVat->getVatInfo()), '%sale%' => $secondaryVat->getSale()->getLabel(), '%mbsale%' => $secondaryVat->getSale()->getMonthlyBalance()->getRef(), '%company%' => $secondaryVat->getSale()->getMonthlyBalance()->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 2
0
 protected function traceEntity(Pilot $clonePilot, Pilot $pilot)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($pilot->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($pilot->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_PILOT);
     $trace->setActionId2($pilot->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($clonePilot->getRef() != $pilot->getRef()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.ref.label') . '</td><td>';
         if ($clonePilot->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getRef();
         }
         $msg .= '</td><td>';
         if ($pilot->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getRef();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getMission() != $pilot->getMission()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.mission.label') . '</td><td>';
         if ($clonePilot->getMission() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getMission();
         }
         $msg .= '</td><td>';
         if ($pilot->getMission() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getMission();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNatureMission() != $pilot->getNatureMission()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.natureMission.label') . '</td><td>';
         if ($clonePilot->getNatureMission() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNatureMission();
         }
         $msg .= '</td><td>';
         if ($pilot->getNatureMission() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNatureMission();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getPrestataire() != $pilot->getPrestataire()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.prestataire.label') . '</td><td>';
         if ($clonePilot->getPrestataire() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getPrestataire();
         }
         $msg .= '</td><td>';
         if ($pilot->getPrestataire() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getPrestataire();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getPinAnce() != $pilot->getPinAnce()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.pinAnce.label') . '</td><td>';
         if ($clonePilot->getPinAnce() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getPinAnce();
         }
         $msg .= '</td><td>';
         if ($pilot->getPinAnce() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getPinAnce();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getExpirationAnce() != $pilot->getExpirationAnce()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.expirationAnce.label') . '</td><td>';
         if ($clonePilot->getExpirationAnce() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getExpirationAnce();
         }
         $msg .= '</td><td>';
         if ($pilot->getExpirationAnce() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getExpirationAnce();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getMpImpots() != $pilot->getMpImpots()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.mpImpots.label') . '</td><td>';
         if ($clonePilot->getMpImpots() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getMpImpots();
         }
         $msg .= '</td><td>';
         if ($pilot->getMpImpots() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getMpImpots();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getIdCnss() != $pilot->getIdCnss()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.idCnss.label') . '</td><td>';
         if ($clonePilot->getIdCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getIdCnss();
         }
         $msg .= '</td><td>';
         if ($pilot->getIdCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getIdCnss();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getMpCnss() != $pilot->getMpCnss()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.mpCnss.label') . '</td><td>';
         if ($clonePilot->getMpCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getMpCnss();
         }
         $msg .= '</td><td>';
         if ($pilot->getMpCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getMpCnss();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getRecetteFinance() != $pilot->getRecetteFinance()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.recetteFinance.label') . '</td><td>';
         if ($clonePilot->getRecetteFinance() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getRecetteFinance();
         }
         $msg .= '</td><td>';
         if ($pilot->getRecetteFinance() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getRecetteFinance();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNomCac() != $pilot->getNomCac()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.nomCac.label') . '</td><td>';
         if ($clonePilot->getNomCac() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNomCac();
         }
         $msg .= '</td><td>';
         if ($pilot->getNomCac() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNomCac();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getDureeMandat() != $pilot->getDureeMandat()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.dureeMandat.label') . '</td><td>';
         if ($clonePilot->getDureeMandat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getDureeMandat();
         }
         $msg .= '</td><td>';
         if ($pilot->getDureeMandat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getDureeMandat();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNumMandat() != $pilot->getNumMandat()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.numMandat.label') . '</td><td>';
         if ($clonePilot->getNumMandat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNumMandat();
         }
         $msg .= '</td><td>';
         if ($pilot->getNumMandat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNumMandat();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getRapportCac() != $pilot->getRapportCac()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.rapportCac.label') . '</td><td>';
         if ($clonePilot->getRapportCac() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getRapportCac();
         }
         $msg .= '</td><td>';
         if ($pilot->getRapportCac() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getRapportCac();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getDeclEmpl() != $pilot->getDeclEmpl()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.declEmpl.label') . '</td><td>';
         if ($clonePilot->getDeclEmpl() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getDeclEmpl();
         }
         $msg .= '</td><td>';
         if ($pilot->getDeclEmpl() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getDeclEmpl();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getIsDur() != $pilot->getIsDur()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.isDur.label') . '</td><td>';
         if ($clonePilot->getIsDur() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getIsDur();
         }
         $msg .= '</td><td>';
         if ($pilot->getIsDur() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getIsDur();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getPvCa() != $pilot->getPvCa()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.pvCa.label') . '</td><td>';
         if ($clonePilot->getPvCa() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getPvCa();
         }
         $msg .= '</td><td>';
         if ($pilot->getPvCa() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getPvCa();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getRapportGerance() != $pilot->getRapportGerance()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.rapportGerance.label') . '</td><td>';
         if ($clonePilot->getRapportGerance() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getRapportGerance();
         }
         $msg .= '</td><td>';
         if ($pilot->getRapportGerance() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getRapportGerance();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getPvAgo() != $pilot->getPvAgo()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.pvAgo.label') . '</td><td>';
         if ($clonePilot->getPvAgo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getPvAgo();
         }
         $msg .= '</td><td>';
         if ($pilot->getPvAgo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getPvAgo();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getPvAge() != $pilot->getPvAge()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.pvAge.label') . '</td><td>';
         if ($clonePilot->getPvAge() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getPvAge();
         }
         $msg .= '</td><td>';
         if ($pilot->getPvAge() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getPvAge();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getLivresCotes() != $pilot->getLivresCotes()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.livresCotes.label') . '</td><td>';
         if ($clonePilot->getLivresCotes() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getLivresCotes();
         }
         $msg .= '</td><td>';
         if ($pilot->getLivresCotes() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getLivresCotes();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getHonTeorAnn() != $pilot->getHonTeorAnn()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.honTeorAnn.label') . '</td><td>';
         if ($clonePilot->getHonTeorAnn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getHonTeorAnn();
         }
         $msg .= '</td><td>';
         if ($pilot->getHonTeorAnn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getHonTeorAnn();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getModeFact() != $pilot->getModeFact()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.modeFact.label') . '</td><td>';
         if ($clonePilot->getModeFact() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getModeFact();
         }
         $msg .= '</td><td>';
         if ($pilot->getModeFact() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getModeFact();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNonFactMont() != $pilot->getNonFactMont()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.nonFactMont.label') . '</td><td>';
         if ($clonePilot->getNonFactMont() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNonFactMont();
         }
         $msg .= '</td><td>';
         if ($pilot->getNonFactMont() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNonFactMont();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNonFactDesc() != $pilot->getNonFactDesc()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.nonFactDesc.label') . '</td><td>';
         if ($clonePilot->getNonFactDesc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNonFactDesc();
         }
         $msg .= '</td><td>';
         if ($pilot->getNonFactDesc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNonFactDesc();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNonEncMont() != $pilot->getNonEncMont()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.nonEncMont.label') . '</td><td>';
         if ($clonePilot->getNonEncMont() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNonEncMont();
         }
         $msg .= '</td><td>';
         if ($pilot->getNonEncMont() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNonEncMont();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getNonEncDesc() != $pilot->getNonEncDesc()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.nonEncDesc.label') . '</td><td>';
         if ($clonePilot->getNonEncDesc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getNonEncDesc();
         }
         $msg .= '</td><td>';
         if ($pilot->getNonEncDesc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getNonEncDesc();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getCommentQuit() != $pilot->getCommentQuit()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.commentQuit.label') . '</td><td>';
         if ($clonePilot->getCommentQuit() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getCommentQuit();
         }
         $msg .= '</td><td>';
         if ($pilot->getCommentQuit() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getCommentQuit();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getMqQuitImpots() != $pilot->getMqQuitImpots()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.mqQuitImpots.label') . '</td><td>';
         if ($clonePilot->getMqQuitImpots() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getMqQuitImpots();
         }
         $msg .= '</td><td>';
         if ($pilot->getMqQuitImpots() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getMqQuitImpots();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getMqQuitCnss() != $pilot->getMqQuitCnss()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.mqQuitCnss.label') . '</td><td>';
         if ($clonePilot->getMqQuitCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getMqQuitCnss();
         }
         $msg .= '</td><td>';
         if ($pilot->getMqQuitCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getMqQuitCnss();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePilot->getComments() != $pilot->getComments()) {
         $msg .= '<tr><td>' . $this->translate('Pilot.comments.label') . '</td><td>';
         if ($clonePilot->getComments() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePilot->getComments();
         }
         $msg .= '</td><td>';
         if ($pilot->getComments() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $pilot->getComments();
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Pilot.traceEdit', array('%pilot%' => $pilot->getRef(), '%company%' => $pilot->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 3
0
 protected function traceEntity(Address $cloneAddress, Address $address)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($address->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($address->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_ADDRESS);
     $trace->setActionId2($address->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneAddress->getLabel() != $address->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('Address.label.label') . '</td><td>';
         if ($cloneAddress->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getLabel();
         }
         $msg .= '</td><td>';
         if ($address->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getStreetNum() != $address->getStreetNum()) {
         $msg .= '<tr><td>' . $this->translate('Address.streetNum.label') . '</td><td>';
         if ($cloneAddress->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getStreetNum();
         }
         $msg .= '</td><td>';
         if ($address->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getStreetNum();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getAddress() != $address->getAddress()) {
         $msg .= '<tr><td>' . $this->translate('Address.address.label') . '</td><td>';
         if ($cloneAddress->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getAddress();
         }
         $msg .= '</td><td>';
         if ($address->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getAddress();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getAddress2() != $address->getAddress2()) {
         $msg .= '<tr><td>' . $this->translate('Address.address2.label') . '</td><td>';
         if ($cloneAddress->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getAddress2();
         }
         $msg .= '</td><td>';
         if ($address->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getAddress2();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getTown() != $address->getTown()) {
         $msg .= '<tr><td>' . $this->translate('Address.town.label') . '</td><td>';
         if ($cloneAddress->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getTown();
         }
         $msg .= '</td><td>';
         if ($address->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getTown();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getZipCode() != $address->getZipCode()) {
         $msg .= '<tr><td>' . $this->translate('Address.zipCode.label') . '</td><td>';
         if ($cloneAddress->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getZipCode();
         }
         $msg .= '</td><td>';
         if ($address->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getZipCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getCountry() != $address->getCountry()) {
         $msg .= '<tr><td>' . $this->translate('Address.country.label') . '</td><td>';
         if ($cloneAddress->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getCountry();
         }
         $msg .= '</td><td>';
         if ($address->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getCountry();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getPhone() != $address->getPhone()) {
         $msg .= '<tr><td>' . $this->translate('Address.phone.label') . '</td><td>';
         if ($cloneAddress->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getPhone();
         }
         $msg .= '</td><td>';
         if ($address->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getPhone();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getMobile() != $address->getMobile()) {
         $msg .= '<tr><td>' . $this->translate('Address.mobile.label') . '</td><td>';
         if ($cloneAddress->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getMobile();
         }
         $msg .= '</td><td>';
         if ($address->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getMobile();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getFax() != $address->getFax()) {
         $msg .= '<tr><td>' . $this->translate('Address.fax.label') . '</td><td>';
         if ($cloneAddress->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getFax();
         }
         $msg .= '</td><td>';
         if ($address->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getFax();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getEmail() != $address->getEmail()) {
         $msg .= '<tr><td>' . $this->translate('Address.email.label') . '</td><td>';
         if ($cloneAddress->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getEmail();
         }
         $msg .= '</td><td>';
         if ($address->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getEmail();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneAddress->getOtherInfos() != $address->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Address.otherInfos.label') . '</td><td>';
         if ($cloneAddress->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneAddress->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($address->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $address->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Address.traceEdit', array('%address%' => $address->getFullAddress(), '%company%' => $address->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 4
0
 protected function traceEntity(Docgroup $cloneDocgroup, Docgroup $docgroup)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($docgroup->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($docgroup->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_DOCGROUP);
     $trace->setActionId2($docgroup->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneDocgroup->getLabel() != $docgroup->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('Docgroup.label.label') . '</td><td>';
         if ($cloneDocgroup->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneDocgroup->getLabel();
         }
         $msg .= '</td><td>';
         if ($docgroup->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $docgroup->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneDocgroup->getParent() != $docgroup->getParent() && ($cloneDocgroup->getParent() == null && $docgroup->getParent() != null || $cloneDocgroup->getParent() != null && $docgroup->getParent() == null || $docgroup->getParent() != null && $cloneDocgroup->getParent() != null && $cloneDocgroup->getParent()->getPageUrlFull() != $docgroup->getParent()->getPageUrlFull())) {
         $msg .= '<tr><td>' . $this->translate('Docgroup.parent.label') . '</td><td>';
         if ($cloneDocgroup->getParent() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneDocgroup->getParent()->getLabel();
         }
         $msg .= '</td><td>';
         if ($docgroup->getParent() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $docgroup->getParent()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneDocgroup->getOtherInfos() != $docgroup->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Docgroup.otherInfos.label') . '</td><td>';
         if ($cloneDocgroup->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneDocgroup->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($docgroup->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $docgroup->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if (\count(\array_diff($docgroup->getDocs()->toArray(), $cloneDocgroup->getDocs()->toArray())) != 0 || \count(\array_diff($cloneDocgroup->getDocs()->toArray(), $docgroup->getDocs()->toArray())) != 0) {
         $msg .= '<tr><td>' . $this->translate('Docgroup.docs.label') . '</td><td>';
         if (\count($cloneDocgroup->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($cloneDocgroup->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td><td>';
         if (\count($docgroup->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($docgroup->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Docgroup.traceEdit', array('%docgroup%' => $docgroup->getLabel(), '%company%' => $docgroup->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 5
0
 protected function traceEntity(Customer $cloneCustomer, Customer $customer)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($customer->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($customer->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_CUSTOMER);
     $trace->setActionId2($customer->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneCustomer->getLabel() != $customer->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('Customer.label.label') . '</td><td>';
         if ($cloneCustomer->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getLabel();
         }
         $msg .= '</td><td>';
         if ($customer->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getNumber() != $customer->getNumber()) {
         $msg .= '<tr><td>' . $this->translate('Customer.number.label') . '</td><td>';
         if ($cloneCustomer->getNumber() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getNumberFormated();
         }
         $msg .= '</td><td>';
         if ($customer->getNumber() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getNumberFormated();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getFisc() != $customer->getFisc()) {
         $msg .= '<tr><td>' . $this->translate('Customer.fisc.label') . '</td><td>';
         if ($cloneCustomer->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getFisc();
         }
         $msg .= '</td><td>';
         if ($customer->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getFisc();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getPhysicaltype() != $customer->getPhysicaltype()) {
         $msg .= '<tr><td>' . $this->translate('Customer.physicaltype.label') . '</td><td>';
         if ($cloneCustomer->getPhysicaltype() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Customer.physicaltype.' . $cloneCustomer->getPhysicaltype());
         }
         $msg .= '</td><td>';
         if ($customer->getSexe() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Customer.physicaltype.' . $customer->getPhysicaltype());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getCin() != $customer->getCin()) {
         $msg .= '<tr><td>' . $this->translate('Customer.cin.label') . '</td><td>';
         if ($cloneCustomer->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getCin();
         }
         $msg .= '</td><td>';
         if ($customer->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getCin();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getPassport() != $customer->getPassport()) {
         $msg .= '<tr><td>' . $this->translate('Customer.passport.label') . '</td><td>';
         if ($cloneCustomer->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getPassport();
         }
         $msg .= '</td><td>';
         if ($customer->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getPassport();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getCommercialRegister() != $customer->getCommercialRegister()) {
         $msg .= '<tr><td>' . $this->translate('Customer.commercialRegister.label') . '</td><td>';
         if ($cloneCustomer->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getCommercialRegister();
         }
         $msg .= '</td><td>';
         if ($customer->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getCommercialRegister();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getStreetNum() != $customer->getStreetNum()) {
         $msg .= '<tr><td>' . $this->translate('Customer.streetNum.label') . '</td><td>';
         if ($cloneCustomer->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getStreetNum();
         }
         $msg .= '</td><td>';
         if ($customer->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getStreetNum();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getAddress() != $customer->getAddress()) {
         $msg .= '<tr><td>' . $this->translate('Customer.address.label') . '</td><td>';
         if ($cloneCustomer->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getAddress();
         }
         $msg .= '</td><td>';
         if ($customer->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getAddress();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getAddress2() != $customer->getAddress2()) {
         $msg .= '<tr><td>' . $this->translate('Customer.address2.label') . '</td><td>';
         if ($cloneCustomer->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getAddress2();
         }
         $msg .= '</td><td>';
         if ($customer->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getAddress2();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getTown() != $customer->getTown()) {
         $msg .= '<tr><td>' . $this->translate('Customer.town.label') . '</td><td>';
         if ($cloneCustomer->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getTown();
         }
         $msg .= '</td><td>';
         if ($customer->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getTown();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getZipCode() != $customer->getZipCode()) {
         $msg .= '<tr><td>' . $this->translate('Customer.zipCode.label') . '</td><td>';
         if ($cloneCustomer->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getZipCode();
         }
         $msg .= '</td><td>';
         if ($customer->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getZipCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getCountry() != $customer->getCountry()) {
         $msg .= '<tr><td>' . $this->translate('Customer.country.label') . '</td><td>';
         if ($cloneCustomer->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getCountry();
         }
         $msg .= '</td><td>';
         if ($customer->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getCountry();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getPhone() != $customer->getPhone()) {
         $msg .= '<tr><td>' . $this->translate('Customer.phone.label') . '</td><td>';
         if ($cloneCustomer->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getPhone();
         }
         $msg .= '</td><td>';
         if ($customer->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getPhone();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getMobile() != $customer->getMobile()) {
         $msg .= '<tr><td>' . $this->translate('Customer.mobile.label') . '</td><td>';
         if ($cloneCustomer->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getMobile();
         }
         $msg .= '</td><td>';
         if ($customer->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getMobile();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getFax() != $customer->getFax()) {
         $msg .= '<tr><td>' . $this->translate('Customer.fax.label') . '</td><td>';
         if ($cloneCustomer->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getFax();
         }
         $msg .= '</td><td>';
         if ($customer->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getFax();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getEmail() != $customer->getEmail()) {
         $msg .= '<tr><td>' . $this->translate('Customer.email.label') . '</td><td>';
         if ($cloneCustomer->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getEmail();
         }
         $msg .= '</td><td>';
         if ($customer->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getEmail();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCustomer->getOtherInfos() != $customer->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Customer.otherInfos.label') . '</td><td>';
         if ($cloneCustomer->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCustomer->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($customer->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $customer->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if (\count(\array_diff($customer->getDocs()->toArray(), $cloneCustomer->getDocs()->toArray())) != 0 || \count(\array_diff($cloneCustomer->getDocs()->toArray(), $customer->getDocs()->toArray())) != 0) {
         $msg .= '<tr><td>' . $this->translate('Customer.docs.label') . '</td><td>';
         if (\count($cloneCustomer->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($cloneCustomer->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td><td>';
         if (\count($customer->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($customer->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Customer.traceEdit', array('%customer%' => $customer->getLabel(), '%company%' => $customer->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 6
0
 protected function traceEntity(Buy $cloneBuy, Buy $buy)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($buy->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($buy->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_BUY);
     $trace->setActionId2($buy->getMonthlyBalance()->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $trace->setActionId3($buy->getMonthlyBalance()->getId());
     $trace->setActionEntity2(Trace::AE_MBPURCHASE);
     $msg = '';
     if ($cloneBuy->getNumber() != $buy->getNumber()) {
         $msg .= '<tr><td>' . $this->translate('Buy.number.label') . '</td><td>';
         if ($cloneBuy->getNumber() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getNumberFormated();
         }
         $msg .= '</td><td>';
         if ($buy->getNumber() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getNumberFormated();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getDtActivation() != $buy->getDtActivation()) {
         $msg .= '<tr><td>' . $this->translate('Buy.dtActivation.label') . '</td><td>';
         if ($cloneBuy->getDtActivation() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getDtActivation()->format('Y-m-d');
         }
         $msg .= '</td><td>';
         if ($buy->getDtActivation() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getDtActivation()->format('Y-m-d');
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getBill() != $buy->getBill()) {
         $msg .= '<tr><td>' . $this->translate('Buy.bill.label') . '</td><td>';
         if ($cloneBuy->getBill() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getBill();
         }
         $msg .= '</td><td>';
         if ($buy->getBill() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getBill();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getRelation() != $buy->getRelation()) {
         $msg .= '<tr><td>' . $this->translate('Buy.relation.label') . '</td><td>';
         if ($cloneBuy->getRelation() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getRelation()->getLabel();
         }
         $msg .= '</td><td>';
         if ($buy->getRelation() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getRelation()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getLabel() != $buy->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('Buy.label.label') . '</td><td>';
         if ($cloneBuy->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getLabel();
         }
         $msg .= '</td><td>';
         if ($buy->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getDevise() != $buy->getDevise()) {
         $msg .= '<tr><td>' . $this->translate('Buy.devise.label') . '</td><td>';
         if ($cloneBuy->getDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getDevise();
         }
         $msg .= '</td><td>';
         if ($buy->getDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getDevise();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getConversionRate() != $buy->getConversionRate()) {
         $msg .= '<tr><td>' . $this->translate('Buy.conversionRate.label') . '</td><td>';
         if ($cloneBuy->getConversionRate() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getConversionRate();
         }
         $msg .= '</td><td>';
         if ($buy->getConversionRate() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getConversionRate();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getVat() != $buy->getVat()) {
         $msg .= '<tr><td>' . $this->translate('Buy.vat.label') . '</td><td>';
         if ($cloneBuy->getVat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getVat();
         }
         $msg .= '</td><td>';
         if ($buy->getVat() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getVat();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getStamp() != $buy->getStamp()) {
         $msg .= '<tr><td>' . $this->translate('Buy.stamp.label') . '</td><td>';
         if ($cloneBuy->getStamp() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getStamp();
         }
         $msg .= '</td><td>';
         if ($buy->getStamp() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getStamp();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getBalanceTtc() != $buy->getBalanceTtc()) {
         $msg .= '<tr><td>' . $this->translate('Buy.balanceTtc.label') . '</td><td>';
         if ($cloneBuy->getBalanceTtc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getBalanceTtc();
         }
         $msg .= '</td><td>';
         if ($buy->getBalanceTtc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getBalanceTtc();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getBalanceNet() != $buy->getBalanceNet()) {
         $msg .= '<tr><td>' . $this->translate('Buy.balanceNet.label') . '</td><td>';
         if ($cloneBuy->getBalanceNet() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getBalanceNet();
         }
         $msg .= '</td><td>';
         if ($buy->getBalanceNet() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getBalanceNet();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getVatDevise() != $buy->getVatDevise()) {
         $msg .= '<tr><td>' . $this->translate('Buy.vatDevise.label') . '</td><td>';
         if ($cloneBuy->getVatDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getVatDevise();
         }
         $msg .= '</td><td>';
         if ($buy->getVatDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getVatDevise();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getStampDevise() != $buy->getStampDevise()) {
         $msg .= '<tr><td>' . $this->translate('Buy.stampDevise.label') . '</td><td>';
         if ($cloneBuy->getStampDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getStampDevise();
         }
         $msg .= '</td><td>';
         if ($buy->getStampDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getStampDevise();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getBalanceTtcDevise() != $buy->getBalanceTtcDevise()) {
         $msg .= '<tr><td>' . $this->translate('Buy.balanceTtcDevise.label') . '</td><td>';
         if ($cloneBuy->getBalanceTtcDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getBalanceTtcDevise();
         }
         $msg .= '</td><td>';
         if ($buy->getBalanceTtcDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getBalanceTtcDevise();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getBalanceNetDevise() != $buy->getBalanceNetDevise()) {
         $msg .= '<tr><td>' . $this->translate('Buy.balanceNetDevise.label') . '</td><td>';
         if ($cloneBuy->getBalanceNetDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getBalanceNetDevise();
         }
         $msg .= '</td><td>';
         if ($buy->getBalanceNetDevise() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getBalanceNetDevise();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getVatInfo() != $buy->getVatInfo()) {
         $msg .= '<tr><td>' . $this->translate('Buy.vatInfo.label') . '</td><td>';
         if ($cloneBuy->getVatInfo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Buy.vatInfo.' . $cloneBuy->getVatInfo());
         }
         $msg .= '</td><td>';
         if ($buy->getVatInfo() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Buy.vatInfo.' . $buy->getVatInfo());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getRegime() != $buy->getRegime()) {
         $msg .= '<tr><td>' . $this->translate('Buy.regime.label') . '</td><td>';
         if ($cloneBuy->getRegime() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Buy.regime.' . $cloneBuy->getRegime());
         }
         $msg .= '</td><td>';
         if ($buy->getRegime() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Buy.regime.' . $buy->getRegime());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getWithholding() != $buy->getWithholding()) {
         $msg .= '<tr><td>' . $this->translate('Buy.withholding.label') . '</td><td>';
         if ($cloneBuy->getWithholding() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getWithholding()->getLabel();
         }
         $msg .= '</td><td>';
         if ($buy->getWithholding() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getWithholding()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getPaymentType() != $buy->getPaymentType()) {
         $msg .= '<tr><td>' . $this->translate('Buy.paymentType.label') . '</td><td>';
         if ($cloneBuy->getPaymentType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.paymentType.' . $cloneBuy->getPaymentType());
         }
         $msg .= '</td><td>';
         if ($buy->getPaymentType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.paymentType.' . $buy->getPaymentType());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getDtPayment() != $buy->getDtPayment()) {
         $msg .= '<tr><td>' . $this->translate('Buy.dtPayment.label') . '</td><td>';
         if ($cloneBuy->getDtPayment() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getDtPayment()->format('Y-m-d');
         }
         $msg .= '</td><td>';
         if ($buy->getDtPayment() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getDtActivation()->format('Y-m-d');
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getAccount() != $buy->getAccount()) {
         $msg .= '<tr><td>' . $this->translate('Buy.account.label') . '</td><td>';
         if ($cloneBuy->getAccount() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getAccount()->getLabel();
         }
         $msg .= '</td><td>';
         if ($buy->getAccount() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getAccount()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getNature() != $buy->getNature()) {
         $msg .= '<tr><td>' . $this->translate('Buy.nature.label') . '</td><td>';
         if ($cloneBuy->getNature() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getNature()->getLabel();
         }
         $msg .= '</td><td>';
         if ($buy->getNature() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getNature()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getTransactionStatus() != $buy->getTransactionStatus()) {
         $msg .= '<tr><td>' . $this->translate('Buy.transactionStatus.label') . '</td><td>';
         if ($cloneBuy->getTransactionStatus() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.transactionStatus.' . $cloneBuy->getTransactionStatus());
         }
         $msg .= '</td><td>';
         if ($buy->getTransactionStatus() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.transactionStatus.' . $buy->getTransactionStatus());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getValidated() != $buy->getValidated()) {
         $msg .= '<tr><td>' . $this->translate('Buy.validated.label') . '</td><td>';
         if ($cloneBuy->getValidated() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.validated.' . $cloneBuy->getValidated());
         }
         $msg .= '</td><td>';
         if ($buy->getValidated() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Transaction.validated.' . $buy->getValidated());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneBuy->getOtherInfos() != $buy->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Buy.otherInfos.label') . '</td><td>';
         if ($cloneBuy->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneBuy->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($buy->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $buy->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if (\count(\array_diff($buy->getDocs()->toArray(), $cloneBuy->getDocs()->toArray())) != 0 || \count(\array_diff($cloneBuy->getDocs()->toArray(), $buy->getDocs()->toArray())) != 0) {
         $msg .= '<tr><td>' . $this->translate('Buy.docs.label') . '</td><td>';
         if (\count($cloneBuy->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($cloneBuy->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td><td>';
         if (\count($buy->getDocs()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($buy->getDocs() as $doc) {
                 $msg .= '<li><a href="' . $this->generateUrl('_admin_doc_editGet', array('uid' => $doc->getId())) . '">' . $doc->getOriginalName() . '</a></li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Buy.traceEdit', array('%buy%' => $buy->getLabel(), '%mbpurchase%' => $buy->getMonthlyBalance()->getRef(), '%company%' => $buy->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
 protected function traceEntity(CompanyNature $cloneCompanyNature, CompanyNature $companyNature)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($companyNature->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($companyNature->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_NATURE);
     $trace->setActionId2($companyNature->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneCompanyNature->getLabel() != $companyNature->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('CompanyNature.label.label') . '</td><td>';
         if ($cloneCompanyNature->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompanyNature->getLabel();
         }
         $msg .= '</td><td>';
         if ($companyNature->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $companyNature->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyNature->getColor() != $companyNature->getColor()) {
         $msg .= '<tr><td>' . $this->translate('CompanyNature.color.label') . '</td><td>';
         if ($cloneCompanyNature->getColor() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompanyNature->getColor() . ' &nbsp; <span style="display:inline-block; background-color: ' . $cloneCompanyNature->getColor() . ';  border: 1px solid ' . $cloneCompanyNature->getColor() . '; width: 60px; height: 20px;"></span>&nbsp;';
         }
         $msg .= '</td><td>';
         if ($companyNature->getColor() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $companyNature->getColor() . ' &nbsp; <span style="display:inline-block; background-color: ' . $companyNature->getColor() . ';  border: 1px solid ' . $companyNature->getColor() . '; width: 60px; height: 20px;"></span>&nbsp;';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('CompanyNature.traceEdit', array('%companyNature%' => $companyNature->getLabel(), '%company%' => $companyNature->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 8
0
 protected function traceEntity(Company $cloneCompany, Company $company)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($company->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($company->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneCompany->getRef() != $company->getRef()) {
         $msg .= '<tr><td>' . $this->translate('Company.ref.label') . '</td><td>';
         if ($cloneCompany->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getRef();
         }
         $msg .= '</td><td>';
         if ($company->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getRef();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCorporateName() != $company->getCorporateName()) {
         $msg .= '<tr><td>' . $this->translate('Company.corporateName.label') . '</td><td>';
         if ($cloneCompany->getCorporateName() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCorporateName();
         }
         $msg .= '</td><td>';
         if ($company->getCorporateName() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCorporateName();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getType() != $company->getType()) {
         $msg .= '<tr><td>' . $this->translate('Company.type.label') . '</td><td>';
         if ($cloneCompany->getType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getType()->getLabel();
         }
         $msg .= '</td><td>';
         if ($company->getType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getType()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getTribunal() != $company->getTribunal()) {
         $msg .= '<tr><td>' . $this->translate('Company.tribunal.label') . '</td><td>';
         if ($cloneCompany->getTribunal() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getTribunal();
         }
         $msg .= '</td><td>';
         if ($company->getTribunal() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getTribunal();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getFisc() != $company->getFisc()) {
         $msg .= '<tr><td>' . $this->translate('Company.fisc.label') . '</td><td>';
         if ($cloneCompany->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getFisc();
         }
         $msg .= '</td><td>';
         if ($company->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getFisc();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCommercialRegister() != $company->getCommercialRegister()) {
         $msg .= '<tr><td>' . $this->translate('Company.commercialRegister.label') . '</td><td>';
         if ($cloneCompany->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCommercialRegister();
         }
         $msg .= '</td><td>';
         if ($company->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCommercialRegister();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCommercialRegisterBureau() != $company->getCommercialRegisterBureau()) {
         $msg .= '<tr><td>' . $this->translate('Company.commercialRegisterBureau.label') . '</td><td>';
         if ($cloneCompany->getCommercialRegisterBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCommercialRegisterBureau();
         }
         $msg .= '</td><td>';
         if ($company->getCommercialRegisterBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCommercialRegisterBureau();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCnss() != $company->getCnss()) {
         $msg .= '<tr><td>' . $this->translate('Company.cnss.label') . '</td><td>';
         if ($cloneCompany->getCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCnss();
         }
         $msg .= '</td><td>';
         if ($company->getCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCnss();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCnssBureau() != $company->getCnssBureau()) {
         $msg .= '<tr><td>' . $this->translate('Company.cnssBureau.label') . '</td><td>';
         if ($cloneCompany->getCnssBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCnssBureau();
         }
         $msg .= '</td><td>';
         if ($company->getCnssBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCnssBureau();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPhysicalType() != $company->getPhysicalType()) {
         $msg .= '<tr><td>' . $this->translate('Company.physicalType.label') . '</td><td>';
         if ($cloneCompany->getPhysicalType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Company.physicalType.' . $cloneCompany->getPhysicalType());
         }
         $msg .= '</td><td>';
         if ($company->getPhysicalType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Company.physicalType.' . $company->getPhysicalType());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCin() != $company->getCin()) {
         $msg .= '<tr><td>' . $this->translate('Company.cin.label') . '</td><td>';
         if ($cloneCompany->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCin();
         }
         $msg .= '</td><td>';
         if ($company->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCin();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPassport() != $company->getPassport()) {
         $msg .= '<tr><td>' . $this->translate('Company.passport.label') . '</td><td>';
         if ($cloneCompany->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getPassport();
         }
         $msg .= '</td><td>';
         if ($company->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getPassport();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCustomsCode() != $company->getCustomsCode()) {
         $msg .= '<tr><td>' . $this->translate('Company.customsCode.label') . '</td><td>';
         if ($cloneCompany->getCustomsCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCustomsCode();
         }
         $msg .= '</td><td>';
         if ($company->getCustomsCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCustomsCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getActionvn() != $company->getActionvn()) {
         $msg .= '<tr><td>' . $this->translate('Company.actionvn.label') . '</td><td>';
         if ($cloneCompany->getActionvn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getActionvn();
         }
         $msg .= '</td><td>';
         if ($company->getActionvn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getActionvn();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getStreetNum() != $company->getStreetNum()) {
         $msg .= '<tr><td>' . $this->translate('Company.streetNum.label') . '</td><td>';
         if ($cloneCompany->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getStreetNum();
         }
         $msg .= '</td><td>';
         if ($company->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getStreetNum();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getAddress() != $company->getAddress()) {
         $msg .= '<tr><td>' . $this->translate('Company.address.label') . '</td><td>';
         if ($cloneCompany->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getAddress();
         }
         $msg .= '</td><td>';
         if ($company->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getAddress();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getAddress2() != $company->getAddress2()) {
         $msg .= '<tr><td>' . $this->translate('Company.address2.label') . '</td><td>';
         if ($cloneCompany->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getAddress2();
         }
         $msg .= '</td><td>';
         if ($company->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getAddress2();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getTown() != $company->getTown()) {
         $msg .= '<tr><td>' . $this->translate('Company.town.label') . '</td><td>';
         if ($cloneCompany->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getTown();
         }
         $msg .= '</td><td>';
         if ($company->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getTown();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getZipCode() != $company->getZipCode()) {
         $msg .= '<tr><td>' . $this->translate('Company.zipCode.label') . '</td><td>';
         if ($cloneCompany->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getZipCode();
         }
         $msg .= '</td><td>';
         if ($company->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getZipCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCountry() != $company->getCountry()) {
         $msg .= '<tr><td>' . $this->translate('Company.country.label') . '</td><td>';
         if ($cloneCompany->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCountry();
         }
         $msg .= '</td><td>';
         if ($company->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCountry();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPhone() != $company->getPhone()) {
         $msg .= '<tr><td>' . $this->translate('Company.phone.label') . '</td><td>';
         if ($cloneCompany->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getPhone();
         }
         $msg .= '</td><td>';
         if ($company->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getPhone();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getMobile() != $company->getMobile()) {
         $msg .= '<tr><td>' . $this->translate('Company.mobile.label') . '</td><td>';
         if ($cloneCompany->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getMobile();
         }
         $msg .= '</td><td>';
         if ($company->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getMobile();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getFax() != $company->getFax()) {
         $msg .= '<tr><td>' . $this->translate('Company.fax.label') . '</td><td>';
         if ($cloneCompany->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getFax();
         }
         $msg .= '</td><td>';
         if ($company->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getFax();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getEmail() != $company->getEmail()) {
         $msg .= '<tr><td>' . $this->translate('Company.email.label') . '</td><td>';
         if ($cloneCompany->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getEmail();
         }
         $msg .= '</td><td>';
         if ($company->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getEmail();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getOtherInfos() != $company->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Company.otherInfos.label') . '</td><td>';
         if ($cloneCompany->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($company->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if (\count(\array_diff($company->getSectors()->toArray(), $cloneCompany->getSectors()->toArray())) != 0 || \count(\array_diff($cloneCompany->getSectors()->toArray(), $company->getSectors()->toArray())) != 0) {
         $msg .= '<tr><td>' . $this->translate('Company.sectors.label') . '</td><td>';
         if (\count($cloneCompany->getSectors()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($cloneCompany->getSectors() as $sector) {
                 $msg .= '<li>' . $sector->getLabel() . '</li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td><td>';
         if (\count($company->getSectors()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($company->getSectors() as $sector) {
                 $msg .= '<li>' . $sector->getLabel() . '</li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Company.traceEdit', array('%company%' => $company->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 9
0
 protected function traceEntity(Phone $clonePhone, Phone $phone)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($phone->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($phone->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_PHONE);
     $trace->setActionId2($phone->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($clonePhone->getLabel() != $phone->getLabel()) {
         $msg .= '<tr><td>' . $this->translate('Phone.label.label') . '</td><td>';
         if ($clonePhone->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePhone->getLabel();
         }
         $msg .= '</td><td>';
         if ($phone->getLabel() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $phone->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePhone->getPhone() != $phone->getPhone()) {
         $msg .= '<tr><td>' . $this->translate('Phone.phone.label') . '</td><td>';
         if ($clonePhone->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePhone->getPhone();
         }
         $msg .= '</td><td>';
         if ($phone->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $phone->getPhone();
         }
         $msg .= '</td></tr>';
     }
     if ($clonePhone->getContact() != $phone->getContact()) {
         $msg .= '<tr><td>' . $this->translate('Phone.contact.label') . '</td><td>';
         if ($clonePhone->getContact() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $clonePhone->getContact();
         }
         $msg .= '</td><td>';
         if ($phone->getContact() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $phone->getContact();
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Phone.traceEdit', array('%phone%' => $phone->getPhone(), '%company%' => $phone->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
Exemplo n.º 10
0
 protected function traceEntity(CompanyUser $cloneCompanyUser, CompanyUser $companyUser)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($companyUser->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($companyUser->getCompany()->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_CUSER);
     $trace->setActionId2($companyUser->getCompany()->getId());
     $trace->setActionEntity2(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneCompanyUser->getEditCompanyinfos() != $companyUser->getEditCompanyinfos()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editCompanyinfos.label') . '</td><td>';
         if ($cloneCompanyUser->getEditCompanyinfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditCompanyinfos());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditCompanyinfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditCompanyinfos());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddAddresses() != $companyUser->getAddAddresses()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addAddresses.label') . '</td><td>';
         if ($cloneCompanyUser->getAddAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddAddresses());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddAddresses());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditAddresses() != $companyUser->getEditAddresses()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editAddresses.label') . '</td><td>';
         if ($cloneCompanyUser->getEditAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditAddresses());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditAddresses());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteAddresses() != $companyUser->getDeleteAddresses()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteAddresses.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteAddresses());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteAddresses() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteAddresses());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddPhones() != $companyUser->getAddPhones()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addPhones.label') . '</td><td>';
         if ($cloneCompanyUser->getAddPhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddPhones());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddPhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddPhones());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditPhones() != $companyUser->getEditPhones()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editPhones.label') . '</td><td>';
         if ($cloneCompanyUser->getEditPhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditPhones());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditPhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditPhones());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeletePhones() != $companyUser->getDeletePhones()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deletePhones.label') . '</td><td>';
         if ($cloneCompanyUser->getDeletePhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeletePhones());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeletePhones() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeletePhones());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddFrames() != $companyUser->getAddFrames()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addFrames.label') . '</td><td>';
         if ($cloneCompanyUser->getAddFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddFrames());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddFrames());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditFrames() != $companyUser->getEditFrames()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editFrames.label') . '</td><td>';
         if ($cloneCompanyUser->getEditFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditFrames());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditFrames());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteFrames() != $companyUser->getDeleteFrames()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteFrames.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteFrames());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteFrames() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteFrames());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocs() != $companyUser->getAddDocs()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocs.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocs());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocs());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocs() != $companyUser->getEditDocs()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocs.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocs());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocs());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteDocs() != $companyUser->getDeleteDocs()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteDocs.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteDocs());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteDocs() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteDocs());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddSuppliers() != $companyUser->getAddSuppliers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addSuppliers.label') . '</td><td>';
         if ($cloneCompanyUser->getAddSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddSuppliers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddSuppliers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditSuppliers() != $companyUser->getEditSuppliers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editSuppliers.label') . '</td><td>';
         if ($cloneCompanyUser->getEditSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditSuppliers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditSuppliers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteSuppliers() != $companyUser->getDeleteSuppliers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteSuppliers.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteSuppliers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteSuppliers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteSuppliers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddCustomers() != $companyUser->getAddCustomers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addCustomers.label') . '</td><td>';
         if ($cloneCompanyUser->getAddCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddCustomers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddCustomers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditCustomers() != $companyUser->getEditCustomers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editCustomers.label') . '</td><td>';
         if ($cloneCompanyUser->getEditCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditCustomers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditCustomers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteCustomers() != $companyUser->getDeleteCustomers()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteCustomers.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteCustomers());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteCustomers() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteCustomers());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddSales() != $companyUser->getAddSales()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addSales.label') . '</td><td>';
         if ($cloneCompanyUser->getAddSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddSales());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddSales());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditSales() != $companyUser->getEditSales()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editSales.label') . '</td><td>';
         if ($cloneCompanyUser->getEditSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditSales());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditSales());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteSales() != $companyUser->getDeleteSales()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteSales.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteSales());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteSales() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteSales());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddBuys() != $companyUser->getAddBuys()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addBuys.label') . '</td><td>';
         if ($cloneCompanyUser->getAddBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddBuys());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddBuys());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditBuys() != $companyUser->getEditBuys()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editBuys.label') . '</td><td>';
         if ($cloneCompanyUser->getEditBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditBuys());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditBuys());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getDeleteBuys() != $companyUser->getDeleteBuys()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.deleteBuys.label') . '</td><td>';
         if ($cloneCompanyUser->getDeleteBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getDeleteBuys());
         }
         $msg .= '</td><td>';
         if ($companyUser->getDeleteBuys() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getDeleteBuys());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupComptables() != $companyUser->getAddDocgroupComptables()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupComptables.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupComptables() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupComptables());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupComptables() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupComptables());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupComptables() != $companyUser->getEditDocgroupComptables()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupComptables.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupComptables() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupComptables());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupComptables() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupComptables());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupBanks() != $companyUser->getAddDocgroupBanks()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupBanks.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupBanks() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupBanks());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupBanks() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupBanks());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupBanks() != $companyUser->getEditDocgroupBanks()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupBanks.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupBanks() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupBanks());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupBanks() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupBanks());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupJuridics() != $companyUser->getAddDocgroupJuridics()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupJuridics.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupJuridics() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupJuridics());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupJuridics() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupJuridics());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupJuridics() != $companyUser->getEditDocgroupJuridics()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupJuridics.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupJuridics() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupJuridics());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupJuridics() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupJuridics());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupFiscals() != $companyUser->getAddDocgroupFiscals()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupFiscals.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupFiscals() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupFiscals());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupFiscals() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupFiscals());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupFiscals() != $companyUser->getEditDocgroupFiscals()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupFiscals.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupFiscals() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupFiscals());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupFiscals() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupFiscals());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupPersos() != $companyUser->getAddDocgroupPersos()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupPersos.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupPersos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupPersos());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupPersos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupPersos());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupPersos() != $companyUser->getEditDocgroupPersos()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupPersos.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupPersos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupPersos());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupPersos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupPersos());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getAddDocgroupSysts() != $companyUser->getAddDocgroupSysts()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.addDocgroupSysts.label') . '</td><td>';
         if ($cloneCompanyUser->getAddDocgroupSysts() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getAddDocgroupSysts());
         }
         $msg .= '</td><td>';
         if ($companyUser->getAddDocgroupSysts() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getAddDocgroupSysts());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompanyUser->getEditDocgroupSysts() != $companyUser->getEditDocgroupSysts()) {
         $msg .= '<tr><td>' . $this->translate('CompanyUser.editDocgroupSysts.label') . '</td><td>';
         if ($cloneCompanyUser->getEditDocgroupSysts() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $cloneCompanyUser->getEditDocgroupSysts());
         }
         $msg .= '</td><td>';
         if ($companyUser->getEditDocgroupSysts() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('CompanyUser.tf.' . $companyUser->getEditDocgroupSysts());
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('CompanyUser.traceEdit', array('%user%' => $companyUser->getUser()->getFullName(), '%company%' => $companyUser->getCompany()->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }