Example #1
0
 /**
  * 
  * Embed foreign records
  * @param Tinebase_Model_Record $record
  */
 protected function appendDependentRecords($record)
 {
     if ($record->__get('article_group_id')) {
         $this->appendForeignRecordToRecord($record, 'article_group_id', 'article_group_id', 'id', new Billing_Backend_ArticleGroup());
     }
     if ($record->__get('article_series_id')) {
         $this->appendForeignRecordToRecord($record, 'article_series_id', 'article_series_id', 'id', new Billing_Backend_ArticleSeries());
     }
     if ($record->__get('unit_id')) {
         $this->appendForeignRecordToRecord($record, 'unit_id', 'unit_id', 'id', new Billing_Backend_ArticleUnit());
     }
 }
Example #2
0
 /**
  * 
  * Get prices according to price groups
  * @param Tinebase_Model_Record $record
  */
 public function getPricesForPriceGroups($record)
 {
     $articleId = $record->__get('id');
     $sellPriceBackend = new Billing_Backend_SellPrice();
     $prices = $sellPriceBackend->getByArticleId($articleId);
     $result = array();
     foreach ($prices as $price) {
         $result[$price->__get('price_group_id')->__get('id')] = array('name' => $price->__get('price_group_id')->__get('name'), 'price_netto' => $price->__get('price_netto'), 'price_brutto' => $price->__get('price_brutto'), 'price2_netto' => 0, 'price2_brutto' => 0, 'price2_vat_id' => Billing_Controller_Vat::getInstance()->getByName('0'));
     }
     return $result;
 }