当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Model_Filter_FilterGroup::addFilterGroup方法代码示例

本文整理汇总了PHP中Tinebase_Model_Filter_FilterGroup::addFilterGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Model_Filter_FilterGroup::addFilterGroup方法的具体用法?PHP Tinebase_Model_Filter_FilterGroup::addFilterGroup怎么用?PHP Tinebase_Model_Filter_FilterGroup::addFilterGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Model_Filter_FilterGroup的用法示例。


在下文中一共展示了Tinebase_Model_Filter_FilterGroup::addFilterGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _addDefaultFilter

 /**
  * adds default filter on search
  * @see Tinebase_Controller_Record_Abstract::_addDefaultFilter()
  */
 protected function _addDefaultFilter(Tinebase_Model_Filter_FilterGroup $_filter = NULL)
 {
     if ($this->_rightsLessSearch || Tinebase_Core::getUser()->hasRight('Sipgate', 'admin')) {
         return;
     }
     if (!Tinebase_Core::getUser()->hasRight('Sipgate', Sipgate_Acl_Rights::MANAGE_ACCOUNTS)) {
         throw new Tinebase_Exception_AccessDenied('You don\'t have insufficient permissions to manage accounts!');
     }
     $fg = new Sipgate_Model_AccountFilter(array(), 'OR');
     if (Tinebase_Core::getUser()->hasRight('Sipgate', Sipgate_Acl_Rights::MANAGE_PRIVATE_ACCOUNTS)) {
         $fg1 = new Sipgate_Model_AccountFilter(array(), 'AND');
         $fg1->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'type', 'operator' => 'equals', 'value' => 'private')));
         $fg1->addFilter(new Tinebase_Model_Filter_Id(array('field' => 'created_by', 'operator' => 'equals', 'value' => Tinebase_Core::getUser()->getId())));
         $fg->addFilterGroup($fg1);
         $_filter->addFilterGroup($fg);
     }
     if (Tinebase_Core::getUser()->hasRight('Sipgate', Sipgate_Acl_Rights::MANAGE_SHARED_ACCOUNTS)) {
         $fg->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'type', 'operator' => 'equals', 'value' => 'shared')));
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:24,代码来源:Account.php

示例2: printReceiptsByFilter

 public function printReceiptsByFilter($preview = false, $outputType, $filters, $userOptions, $types, $sort, $additionalOptions)
 {
     $additionalOptions = Zend_Json::decode($additionalOptions);
     if ($additionalOptions['addressLabels'] == true) {
         $this->printAddressLabelsByFilter($outputType, $filters, $userOptions, $types, $sort);
         return;
     }
     $sortField = 'creation_time';
     $sortDir = 'ASC';
     $sort = Zend_Json::decode($sort);
     $this->setUseSorting(true);
     if (is_array($sort) && array_key_exists('field', $sort) && array_key_exists('order', $sort)) {
         if (in_array($sort['field'], array('creation_time', 'order_nr'))) {
             $sortField = $sort['field'];
         }
         if (in_array($sort['order'], array('ASC', 'DESC'))) {
             $sortDir = $sort['order'];
         }
     }
     $this->setTypes(Zend_Json::decode($types));
     $this->setOutputType($outputType);
     $this->setPreview($preview);
     $this->setFilters($filters);
     $this->setUserOptions($userOptions);
     if ($additionalOptions['preview'] == true) {
         $this->setPreview(true);
     }
     if ($additionalOptions['copy'] == true) {
         $this->setCopy(true);
     }
     $filters = $this->createFilters();
     $firstGroup = new Tinebase_Model_Filter_FilterGroup(array(), 'AND');
     $firstGroup->addFilterGroup($filters);
     if (!$this->preview && !$this->copy) {
         // only print receipts with empty print date!
         $firstGroup->addFilter(new Tinebase_Model_Filter_Date('print_date', 'isnull'));
     }
     $typesGroup = new Tinebase_Model_Filter_FilterGroup(array(), 'OR');
     $inoviceFilter = null;
     $shippingFilter = null;
     if ($this->types['invoice'] == true) {
         $invoiceFilter = new Tinebase_Model_Filter_Text('type', 'equals', Billing_Model_Receipt::TYPE_INVOICE);
     }
     if ($this->types['credit'] == true) {
         $invoiceFilter = new Tinebase_Model_Filter_Text('type', 'equals', Billing_Model_Receipt::TYPE_CREDIT);
     }
     if ($this->types['shipping'] == true) {
         $shippingFilter = new Tinebase_Model_Filter_Text('type', 'equals', Billing_Model_Receipt::TYPE_SHIPPING);
     }
     if (!$invoiceFilter && !$shippingFilter) {
         $invoiceFilter = new Tinebase_Model_Filter_Text('type', 'equals', Billing_Model_Receipt::TYPE_INVOICE);
     }
     if ($invoiceFilter) {
         $typesGroup->addFilter($invoiceFilter);
     }
     if ($shippingFilter) {
         $typesGroup->addFilter($shippingFilter);
     }
     $firstGroup->addFilterGroup($typesGroup);
     $paging = new Tinebase_Model_Pagination(array('sort' => $sortField, 'dir' => $sortDir));
     // -> get ids only
     $this->receiptIds = $this->_receiptController->search($firstGroup, $paging, false, TRUE);
     $this->runTransaction(self::PROCESS_RECEIPTS);
 }
开发者ID:carriercomm,项目名称:Billing-5,代码行数:64,代码来源:Print.php

示例3: directDebit

 public function directDebit($paymentTypeKeys, $filters)
 {
     $db = Tinebase_Core::getDb();
     $tm = Tinebase_TransactionManager::getInstance();
     try {
         require_once 'Payment/DTA.php';
         if (!is_array($filters)) {
             $filters = Zend_Json::decode($filters);
         }
         if (!is_array($paymentTypeKeys)) {
             $paymentTypeKeys = Zend_Json::decode($paymentTypeKeys);
         }
         $filters[] = array('field' => 'banking_exp_date', 'operator' => 'isnull', 'value' => '');
         $rawFilters = $filters;
         $paymentTypeCount = count($paymentTypeKeys);
         $filters[] = array('field' => 'payment_method_id', 'operator' => 'equals', 'value' => $paymentTypeKeys[1]);
         $filter1 = new Billing_Model_OpenItemFilter($filters, 'AND');
         $filter = new Tinebase_Model_Filter_FilterGroup(array(), 'OR');
         $filter->addFilterGroup($filter1);
         if ($paymentTypeCount > 1) {
             unset($paymentTypeKeys[1]);
             foreach ($paymentTypeKeys as $paymentTypeKey) {
                 $newFilters = $rawFilters;
                 $newFilters[] = array('field' => 'payment_method_id', 'operator' => 'equals', 'value' => $paymentTypeKey);
                 $pFilterGroup = new Billing_Model_OpenItemFilter($newFilters, 'AND');
                 $filter->addFilterGroup($pFilterGroup);
             }
         }
         // start transaction
         $tId = $tm->startTransaction($db);
         // count membership matching filters
         $openItemIds = $this->search($filter, new Tinebase_Model_Pagination(array('sort' => 'due_date', 'dir' => 'ASC')), false, true);
         $tempFilePath = CSopen::instance()->getCustomerPath() . '/customize/data/documents/temp/';
         $mandators = \Tinebase_Config::getInstance()->getConfig('mandators', NULL, TRUE)->value;
         $mandator = $mandators[1]['bankdata'];
         $hash = md5(serialize($mandator) . microtime());
         $dtaFile = new DTA(DTA_DEBIT);
         $dtaFile->setAccountFileSender(array("name" => $mandator['account_holder'], "bank_code" => $mandator['bank_code'], "account_number" => $mandator['account_number']));
         // 		create DTA file
         foreach ($openItemIds as $openItemId) {
             $openItem = $this->get($openItemId);
             // value
             $val = (double) $openItem->__get('open_sum');
             $usage = $openItem->__get('usage');
             $u = explode(',', $usage);
             $u1 = $u2 = '';
             if (count($u) > 0) {
                 $u1 = $u[0];
                 $u2 = $u[1];
             } else {
                 $u1 = $usage;
             }
             if ($val > 0) {
                 $debitor = $openItem->getForeignRecordBreakNull('debitor_id', Billing_Controller_Debitor::getInstance());
                 if (!$debitor) {
                     continue;
                 }
                 $contact = $debitor->getForeignRecordBreakNull('contact_id', Addressbook_Controller_Contact::getInstance());
                 if (!$contact) {
                     continue;
                 }
                 $receipt = $openItem->getForeignRecordBreakNull('receipt_id', Billing_Controller_Receipt::getInstance());
                 $dtaFile->addExchange(array("name" => $contact->__get('bank_account_name'), "bank_code" => $contact->__get('bank_code'), "account_number" => $contact->__get('bank_account_number')), (string) $val, array($u1, $u2));
             }
             $openItem->__set('banking_exp_date', new Zend_Date());
             $this->update($openItem);
         }
         $dtaFile->saveFile($tempFilePath . 'DTAUS0' . $hash);
         $meta = $dtaFile->getMetaData();
         $date = strftime("%d.%m.%y", $meta["date"]);
         $execDate = strftime("%d.%m.%y", $meta["exec_date"]);
         $count = $meta["count"];
         $sumEUR = $meta["sum_amounts"];
         $sumKto = $meta["sum_accounts"];
         $sumBankCodes = $meta["sum_bankcodes"];
         $sender = $mandator['account_holder'];
         $senderBank = $mandator['bank'];
         $senderBankCode = $mandator['bank_code'];
         $senderAccount = $mandator['account_number'];
         $handoutContent = "Datenträger-Begleitzettel\n\tErstellungsdatum: {$date} \n\tAusführungsdatum: {$execDate}\n\tAnzahl der Lastschriften: {$count}\n\tSumme der Beträge in EUR: {$sumEUR}\n\tKontrollsumme Kontonummern: {$sumKto}\n\tKontrollsumme Bankleitzahlen: {$sumBankCodes}\n\tAuftraggeber: {$sender}\n\tBeauftragtes Bankinstitut: {$senderBank}\n\tBankleitzahl: {$senderBankCode}\n\tKontonummer: {$senderAccount}";
         $zip = new ZipArchive();
         $filename = "{$tempFilePath}/DTAUS0-{$ogNr}.zip";
         if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
             exit("cannot open <{$filename}>\n");
         }
         $zip->addFromString("begleitzettel.txt", $handoutContent);
         $zip->addFile($tempFilePath . 'DTAUS0' . $hash, 'DTAUS0');
         $zip->close();
         header("Content-type: application/zip;\n");
         header("Content-Transfer-Encoding: binary");
         $len = filesize($filename);
         header("Content-Length: {$len};\n");
         $outname = "DTAUS0-{$ogNr}.zip";
         header("Content-Disposition: attachment; filename=\"{$outname}\";\n\n");
         readfile($filename);
         unlink($filename);
         $tm->commitTransaction($tId);
     } catch (Exception $e) {
         $tm->rollback($tId);
     }
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:Billing-5,代码行数:101,代码来源:OpenItem.php


注:本文中的Tinebase_Model_Filter_FilterGroup::addFilterGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。