Esempio n. 1
0
 public function executeRaykupoints()
 {
     $this->amount = $this->getRequestParameter('amount');
     $this->currentpoints = $this->getRequestParameter('raykupoints');
     $expert_id = $this->getUSer()->getRaykuUserId();
     $c = new Criteria();
     $c->add(UserPeer::ID, $this->getUser()->getRaykuUserId());
     $user = UserPeer::doSelectOne($c);
     $points = $user->getPoints() + $this->currentpoints;
     $user->setPoints($points);
     $user->save();
     $expertsdebit = new ExpertsDebitDetails();
     $expertsdebit->setExpertId($expert_id);
     $expertsdebit->setAmount($this->amount);
     $expertsdebit->setTime(date('Y-m-d H:i:s'));
     $expertsdebit->save();
     $c = new Criteria();
     $c->add(ExpertsFinalCreditPeer::EXPERT_ID, $expert_id);
     $current = ExpertsFinalCreditPeer::doSelectOne($c);
     if ($current != NULL) {
         $finalamount = $current->getAmount() - $this->amount;
         $current->setAmount($finalamount);
         $current->save();
     }
 }
Esempio n. 2
0
 public function executeUnpaidExperties()
 {
     if ($this->getRequestParameter('e_id') != NULL) {
         $c = new Criteria();
         $c->add(ExpertsAdminPayoutPeer::ID, $this->getRequestParameter('id'));
         $c->add(ExpertsAdminPayoutPeer::EXPERT_ID, $this->getRequestParameter('e_id'));
         $expertspaid = ExpertsAdminPayoutPeer::doSelectOne($c);
         $expertspaid->setPaid(1);
         $expertspaid->save();
         $expertsdebit = new ExpertsDebitDetails();
         $expertsdebit->setExpertId($this->getRequestParameter('e_id'));
         $expertsdebit->setAmount($expertspaid->getAmount());
         $expertsdebit->setTime(date('Y-m-d H:i:s'));
         $expertsdebit->save();
         $c = new Criteria();
         $c->add(ExpertsFinalCreditPeer::EXPERT_ID, $this->getRequestParameter('e_id'));
         $current = ExpertsFinalCreditPeer::doSelectOne($c);
         if ($current != NULL) {
             $finalamount = $current->getAmount() - $expertspaid->getAmount();
             $current->setAmount($finalamount);
             $current->save();
         }
         $c = new Criteria();
         $c->add(ExpertsAdminPayoutPeer::PAID, 0);
         $this->expertspayouts = ExpertsAdminPayoutPeer::doSelect($c);
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      ExpertsDebitDetails $value A ExpertsDebitDetails object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(ExpertsDebitDetails $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }