Esempio n. 1
0
 public function delete()
 {
     foreach ($this->getChildRows('Prices') as $price) {
         if (count($price->getChildRows('OrderProducts')) > 0) {
             throw new Kwf_Exception_Client("Es sind Bestellungen für dieses Produkt vorhanden, Produkt kann nicht gelöscht werden");
         }
     }
     parent::delete();
 }
 protected function _beforeSave()
 {
     parent::_beforeSave();
     //add_component_id darf leer sein, passiert wenn eine bestellung im backend angelegt wird
     if (!$this->add_component_class) {
         $e = new Kwf_Exception("add_component_class is required");
         $e->logOrThrow();
     }
 }
Esempio n. 3
0
 protected function _afterSave()
 {
     parent::_afterSave();
     if ($this->isDirty('login_kwf_upload_id')) {
         Kwf_Media::clearCache('Kwf_Util_Model_Welcome', $this->id, 'LoginImage');
         Kwf_Media::clearCache('Kwf_Util_Model_Welcome', $this->id, 'LoginImageLarge');
     }
     if ($this->isDirty('kwf_upload_id')) {
         Kwf_Media::clearCache('Kwf_Util_Model_Welcome', $this->id, 'WelcomeImage');
     }
 }
Esempio n. 4
0
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if ($this->status != 'cart' && !$this->number) {
         $s = $this->getModel()->select();
         $s->limit(1);
         $s->order('number', 'DESC');
         if ($this->_groupNumbersByCheckoutComponent) {
             $s->whereEquals('checkout_component_id', $this->checkout_component_id);
         }
         $row = $this->getModel()->getRow($s);
         $maxNumber = 0;
         if ($row) {
             $maxNumber = $row->number;
         }
         $this->number = $maxNumber + 1;
     }
 }
Esempio n. 5
0
 public function __set($name, $value)
 {
     if ($name === 'totalTimeStr') {
         $timeParts = explode(":", $value);
         try {
             $hours = intval($timeParts[0]);
             $minutes = 0;
             if (count($timeParts) > 1) {
                 $minutes = intval($timeParts[1]);
             }
             parent::__set('totalTimeInMinutes', $hours * 60 + $minutes);
         } catch (Exception $e) {
         }
         parent::__set('totalTimeStr', $value);
     } else {
         return parent::__set($name, $value);
     }
 }
Esempio n. 6
0
 protected function _afterInsert()
 {
     parent::_afterInsert();
     $c = Kwc_Shop_Cart_Checkout_Payment_Wirecard_LogModel::decodeCallback($this->custom);
     if ($c && $c['cb']) {
         $ret = false;
         if (Kwf_Loader::isValidClass($c['cb'])) {
             $ret = call_user_func(array($c['cb'], 'processIpn'), $this, $c['data']);
         } else {
             if (Kwf_Component_Data_Root::getComponentClass()) {
                 $component = Kwf_Component_Data_Root::getInstance()->getComponentById($c['cb']);
                 if ($component) {
                     $ret = $component->getComponent()->processIpn($this, $c['data']);
                 }
             }
         }
         $this->callback_success = $ret;
         $this->save();
     }
 }
 public function getSilblingRow()
 {
     $rows = parent::_getSiblingRows();
     return $rows[$this->type];
 }
Esempio n. 8
0
 protected function _afterInsert()
 {
     parent::_afterInsert();
     self::$insertCount += 1;
 }