/**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setPublicationId($this->getValue("publication_id"));
     $j->setStatusId($this->getValue("status_id"));
     $j->setEvent($this->getValue("event"));
     $j->setDate($this->getValue("date"));
     $j->setStartTime($this->getValue("start_time"));
     $j->setEndTime($this->getValue("end_time"));
     $j->setDueDate($this->getValue("due_date"));
     $j->setContactName($this->getValue("contact_name"));
     $j->setContactPhone($this->getValue("contact_phone"));
     $j->setContactEmail($this->getValue("contact_email"));
     $j->setAcctNum($this->getValue("acct_num"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Basic info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
Ejemplo n.º 2
0
 public function save(PropelPDO $con = null)
 {
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Delivery");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     // this is a new job
     if ($this->isNew()) {
         $logEntry->setMessage("Delivery created.");
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_create"));
     } else {
         $logEntry->setMessage("Delivery updated.");
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     }
     parent::save($con);
     $logEntry->setPropelId($this->getId());
     $logEntry->save();
 }
Ejemplo n.º 3
0
 public static function addEmailLogMessage($jobId, $emailType, $toUser)
 {
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage($emailType . " sent to user " . $toUser);
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_email"));
     $logEntry->setPropelId($jobId);
     $logEntry->save();
 }
Ejemplo n.º 4
0
 public function delete(PropelPDO $con = null)
 {
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Project");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Project deleted.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_delete"));
     $logEntry->setPropelId($this->getId());
     $logEntry->save();
     parent::delete($con);
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setEstimate($this->getValue("estimate"));
     $j->setProcessing($this->getValue("processing"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Billing info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setState($this->getValue("state"));
     $j->setCity($this->getValue("city"));
     $j->setZip($this->getValue("zip"));
     $j->setStreet($this->getValue("street"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Shoot info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setPhotoType(implode(", ", $this->getValue("photo_type")));
     $j->setQues1($this->getValue("ques1"));
     $j->setQues2($this->getValue("ques2"));
     $j->setQues3($this->getValue("ques3"));
     $j->setOther($this->getValue("other"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Photography info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
Ejemplo n.º 8
0
 public function testUpDelete()
 {
     $this->objLog->setLog('Test', 'testUpdadeDelete', false);
     $criteria = new Criteria();
     $criteria->add(LogPeer::MESSAGE, 'testUpdadeDelete');
     $log = new Log();
     /* @var $obj Log */
     $obj = $log->doSelectOne($criteria);
     $test = $obj instanceof Log;
     $this->assertTrue($test);
     $test = $obj->getId();
     $log = new Log();
     $log->setId($test);
     $log->setMessage('removeTest');
     $log->save();
     $criteria = new Criteria();
     $criteria->add(LogPeer::MESSAGE, 'removeTest');
     $log = new Log();
     /* @var $obj Log */
     $obj = $log->doSelectOne($criteria);
     $this->assertEquals('removeTest', $obj->getMessage());
     $obj->delete();
 }
Ejemplo n.º 9
0
 /**
  * Converts the object to the object class
  * @param stdClass $stdClass
  * @return object
  */
 private function ConvertingObject(stdClass $stdClass)
 {
     $ObjLogPeer = new Log();
     $ObjLogPeer->setId($stdClass->id);
     $ObjLogPeer->setDate($stdClass->date);
     $ObjLogPeer->setFile($stdClass->file);
     $ObjLogPeer->setMessage($stdClass->message);
     $ObjLogPeer->setIsError($stdClass->is_error);
     return $ObjLogPeer;
 }
Ejemplo n.º 10
0
 public function save(PropelPDO $con = null)
 {
     $isNew = $this->isNew();
     // see if we need to do revision control on the notes
     $updateNotes = in_array(JobPeer::NOTES, $this->modifiedColumns) && strlen($this->getNotes() > 1);
     if (is_null($con)) {
         $con = Propel::getConnection(JobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $ret = parent::save($con);
         $con->commit();
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
     $arr = $this->createCalendarArray();
     if (!is_null(sfContext::getInstance()->getUser())) {
         $uid = sfContext::getInstance()->getUser()->getUserId();
     } else {
         $uid = 1;
     }
     if ($isNew) {
         $logEntry = new Log();
         $logEntry->setWhen(time());
         $logEntry->setPropelClass("Job");
         $logEntry->setSfGuardUserProfileId($uid);
         $logEntry->setMessage("Job created.");
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_create"));
         $logEntry->setPropelId($this->getId());
         $logEntry->save();
         if ($this->getDate("U") > 0) {
             $event = sfGCalendar::createJobEvent($arr);
             $this->setGCalId($event->id);
             parent::save($con);
         }
     } else {
         if ($this->getDate("U") > 0) {
             if (is_null($this->getGCalId())) {
                 $event = sfGCalendar::createJobEvent($arr);
                 $this->setGCalId($event->id);
                 parent::save($con);
             } else {
                 sfGCalendar::updateJobEventById($this->getGCalId(), $arr);
             }
             if (!is_null($this->getGCalIdCustomUrl())) {
                 if (!is_null($this->getGCalIdCustom())) {
                     $arr["calUrl"] = $this->getGCalIdCustomUrl();
                     sfGCalendar::updateJobEventById($this->getGCalIdCustom(), $arr);
                 } else {
                     $arr["calUrl"] = $url;
                     $event = sfGCalendar::createJobEvent($arr);
                     $this->setGCalIdCustom($event->id);
                 }
             }
         }
     }
     if ($updateNotes) {
         $c = new Criteria();
         $c->add(JobNotesPeer::JOB_ID, $this->getId());
         $c->addDescendingOrderByColumn(JobNotesPeer::ID);
         $old = JobNotesPeer::doSelectOne($c);
         $rev = !is_null($old) ? $old->getRevision() + 1 : 1;
         $jn = new JobNotes();
         $jn->setJobId($this->getId());
         $jn->setNotes($this->getNotes());
         $jn->setRevision($rev);
         $jn->setUserId(sfContext::getInstance()->getUser()->getUserId());
         $jn->save();
     }
 }