function getRefByType($type) { $select = parent::getAll(null, false); $select->where('R_TypeRef = ?', $type); $result = $this->_db->fetchAll($select); return $result; }
public static function usedBy($search_data = null, &$errors = array(), $defaults = null, $params = array()) { $search = new SelectorItemSearch($defaults); $search->addSearchField('target_id', 'Target', 'hidden', '', 'hidden'); // Search by Product $config = SelectorCollection::getTypeDetails($params['type']); $search->addSearchField('parent_id', implode('/', $config['itemFields']), 'treesearch', -1, 'basic'); if (empty($search_data)) { $search_data = null; } $search->setSearchData($search_data, $errors, 'selectProduct'); // Populate the parent_id field using the last selected value // it will be -1 if no previous selected value $parent_id = $search->getValue('parent_id'); $cc = new ConstraintChain(); if ($parent_id != '-1') { $cc->add(new Constraint('parent_id', '=', $parent_id)); } else { $cc->add(new Constraint('parent_id', 'IS', 'NULL')); } $model = new DataObject('so_product_selector'); $options = array($parent_id => 'Select an option'); $options += $model->getAll($cc); $search->setOptions('parent_id', $options); if ($parent_id != '-1') { $data = array('target_id' => $search->getValue('target_id')); $search->setBreadcrumbs('parent_id', $model, 'parent_id', $parent_id, 'name', 'description', $data); } return $search; }
/** * Fetches data of the files to import and filter according to the file type * * @param int $langId Language id * @param string $type Value defining the section where files are used. * * @return array */ public function getAllByType($langId, $type = null) { $select = parent::getAll($langId, false); if (!is_null($type)) { $select->where('FI_Type = ?', $type); } return $select; }
public function getData($langId = null, $bannerId = null) { $select = parent::getAll($langId, false); $select->order('IF_ImgID ASC'); if ($bannerId) { $select->where('IF_DataID = ?', $bannerId); } $data = $this->_db->fetchAll($select); return $data; }
public function getVideosList() { $select = parent::getAll(null, false); $select->where('VI_LanguageID = ?', Cible_Controller_Action::getDefaultEditLanguage()); $select->order('V_Alias ASC'); //echo $select; // exit; $data = $this->_db->fetchAll($select); return $data; }
public function getData($langId = null, $bannerId = null) { $select = parent::getAll($langId, false); $select->order('IF_ImgID ASC'); $select->join('Videos', 'Videos.V_ID = IFI_Video'); $select->join('VideosIndex', 'Videos.V_ID = VideosIndex.VI_ID'); $select->where('VI_LanguageID = ?', $langId); if ($bannerId) { $select->where('IF_DataID = ?', $bannerId); } // echo $select; $data = $this->_db->fetchAll($select); return $data; }
public static function selectProduct($search_data = null, &$errors = array(), $defaults = null) { $search = new sordersSearch($defaults); // Search by Customer $customer = DataObjectFactory::Factory('SLCustomer'); $customers = $customer->getAll(null, false, true, '', ''); $options = array('NULL' => 'None'); $options += $customers; if (!isset($search->defaults['slmaster_id'])) { $search->defaults['slmaster_id'] = key($options); } $search->addSearchField('slmaster_id', 'Customer', 'select', $search->defaults['slmaster_id'], 'basic'); $search->setOptions('slmaster_id', $options); // Search by Product Group $prod_group = DataObjectFactory::Factory('STProductgroup'); $prod_group_list = $prod_group->getAll(); $search->addSearchField('prod_group_id', 'Product Group', 'select', '', 'basic'); $options = array('' => 'None'); $options += $prod_group_list; $search->setOptions('prod_group_id', $options); // Search by Description $search->addSearchField('description', 'description contains', 'contains', '', 'basic'); // Search by Product $config = SelectorCollection::getTypeDetails('sales_order'); $search->addSearchField('parent_id', implode('/', $config['itemFields']), 'treesearch', -1, 'basic'); if (empty($search_data)) { $search_data = null; } $search->setSearchData($search_data, $errors, 'selectProduct'); // Populate the parent_id field using the last selected value // it will be -1 if no previous selected value $parent_id = $search->getValue('parent_id'); $cc = new ConstraintChain(); if ($parent_id != '-1') { $cc->add(new Constraint('parent_id', '=', $parent_id)); } else { $cc->add(new Constraint('parent_id', 'IS', 'NULL')); } $model = new DataObject('so_product_selector'); $options = array($parent_id => 'Select an option'); $options += $model->getAll($cc); $search->setOptions('parent_id', $options); if ($parent_id != '-1') { $data = array('slmaster_id' => $search->getValue('slmaster_id')); $search->setBreadcrumbs('parent_id', $model, 'parent_id', $parent_id, 'name', 'description', $data); } return $search; }
function getAll(ConstraintChain $cc = null, $ignore_tree = FALSE, $use_collection = FALSE, $limit = '') { return parent::getAll($cc, $ignore_tree, TRUE, $limit); }
public function getAll(ConstraintChain $cc = null, $ignore_tree = false, $use_collection = false, $limit = '') { return parent::getAll($cc, $ignore_tree, true, $limit); }
/** * Set filters for search by keywords. * * @param Zend_Db_Select $select The begining of the query to complete. * * @return void */ public function autocompleteSearch($value, $langId = 1) { $select = parent::getAll($langId, false); // $select->where('P_Type = ?', 'catalog'); $this->keywordExist(array($value), $select, $langId); $products = $this->_db->fetchAll($select); return $products; }
// | checknum | varchar(25) | | | | | // +-------------+--------------+------+-----+------------+----------------+ // mysql> desc expense_import; // +------------------+--------------+------+-----+------------+----------------+ // | Field | Type | Null | Key | Default | Extra | // +------------------+--------------+------+-----+------------+----------------+ // | idexpense_import | int(10) | | PRI | NULL | auto_increment | // | category | varchar(60) | | | | | // | debit_date | date | | | 0000-00-00 | | // | description | varchar(250) | | | | | // | payment_method | varchar(60) | | | | | // | amount | float(10,2) | | | 0.00 | | // +------------------+--------------+------+-----+------------+----------------+ $do_import_expense = new DataObject($this->getDbCon()); $do_import_expense->setTable("expense_import"); $do_import_expense->getAll(); $do_expense = new DataObject($this->getDbCon()); $do_expense->setTable("expense"); while ($do_import_expense->next()) { $category = 0; $suplier = 0; if ($do_import_expense->category == "Airlines / Transportation") { $category = 10; } if ($do_import_expense->category == "ATM Withdrawals") { $category = 46; } if ($do_import_expense->category == "Auto / Gas") { $category = 8; } if ($do_import_expense->category == "Building Supply / Wholesale") {
static function copyItems($_data = '', &$errors = array()) { if (empty($_data['tablename'])) { $errors[] = 'No table name provided'; } if (empty($_data['from_item_id'])) { $errors[] = 'From item not provided'; } if (empty($_data['to_item_id'])) { $errors[] = 'To item not provided'; } if (count($errors) > 0) { return false; } $do = new DataObject($_data['tablename']); $do->identifierField = 'target_id'; $cc = new ConstraintChain(); $cc->add(new Constraint('item_id', '=', $_data['from_item_id'])); $copyitems = $do->getAll($cc); foreach ($copyitems as $target_id) { $link_data[] = array('item_id' => $_data['to_item_id'], 'target_id' => $target_id); } return self::saveAssociations($link_data, $_data['tablename'], $errors); }
public function getAll(ConstraintChain $cc = null, $ignore_tree = false, $use_collection = true, $limit = '', $active = true) { if (!$cc instanceof ConstraintChain) { $cc = new ConstraintChain(); } if ($active === TRUE) { $cc->add(new Constraint('date_inactive', 'IS', 'NULL')); } elseif ($active === FALSE) { $cc->add(new Constraint('date_inactive', 'IS NOT', 'NULL')); } return parent::getAll($cc, $ignore_tree, TRUE, $limit); }
/** * @see DataObject::getAll() * * @param type $langId * @param type $array * @param type $id * * @return Zend_Db_Select */ public function getAll($langId = null, $array = true, $id = null) { $select = parent::getAll($langId, $array, $id); if ($select instanceof Zend_Db_Select && $this->_moduleId > 0) { $select->where('L_ModuleID = ?', $this->_moduleId); } return $select; }
public function print_component_list($status = 'generate') { // build options array $options = array('type' => array('pdf' => '', 'xml' => ''), 'output' => array('print' => '', 'save' => '', 'email' => '', 'view' => ''), 'filename' => 'Component_list_' . fix_date(date(DATE_FORMAT)), 'report' => 'selector_components'); // simply return the options if we're only at the dialog stage if (strtolower($status) === "dialog") { return $options; } $errors = array(); $messages = array(); if (!isset($this->_data) || !$this->loadData()) { // we are viewing data, but either no id has been provided // or the data for the supplied id does not exist $this->dataError(); sendBack(); } $current = $this->_uses[$this->modeltype]; $parent = $this->getHierarchy($current->parent_id, $current->description); $title_template = '<fo:table-row>' . "\r\n"; $title_template .= ' <fo:table-cell padding="1mm" width="%s" text-align="%s">' . "\r\n"; $title_template .= ' <fo:block >%s</fo:block>' . "\r\n"; $title_template .= ' </fo:table-cell>' . "\r\n"; $title_template .= ' <fo:table-cell padding="1mm" text-align="%s" >' . "\r\n"; $title_template .= ' <fo:block font-weight="bold">%s</fo:block>' . "\r\n"; $title_template .= ' </fo:table-cell>' . "\r\n"; $title_template .= '</fo:table-row>' . "\r\n"; // load the model $link = new DataObject($this->linkTableName); $link->idField = $link->identifierField = 'target_id'; $cc = new ConstraintChain(); $cc->add(new Constraint('item_id', '=', $current->id)); $selected_ids = $link->getAll($cc); $selectorobjects = $this->getComponents($selected_ids); $width = strlen($current->description); foreach ($parent as $item_detail) { $width = strlen($item_detail['description']) > $width ? strlen($item_detail['description']) : $width; } $item_list = ''; foreach (array_reverse($parent) as $item_detail) { $item_list .= sprintf($title_template, $width * 2 . 'mm', 'left', prettify($item_detail['description']), 'left', $item_detail['name']); } $item_list .= sprintf($title_template, $width * 2 . 'mm', 'left', prettify($current->description), 'left', $current->name); $headings = $selectorobjects->getheadings(); $targetHeadings = array(); foreach ($this->targetFields as $key => $field) { if (isset($headings[$field])) { $targetHeadings[$field] = $headings[$field]; } } $report_title = 'List of Component ' . (empty($title) ? prettify($this->getPageName('', '')) : 'items') . ' for Item, Printed on ' . date(DATE_TIME_FORMAT); // build the custom XSL $xsl = $this->build_custom_xsl($selectorobjects, 'selector_components', $report_title, $targetHeadings, '', array()); if ($xsl === FALSE) { return FALSE; } $xsl = $this->process_xsl($xsl, array('ITEM_LIST' => $item_list)); $options['xslSource'] = $xsl; $options['xmlSource'] = $this->generate_xml(array('model' => $selectorobjects, 'extra' => $extra, 'load_relationships' => FALSE)); // execute the print output function, echo the returned json for jquery echo $this->generate_output($this->_data['print'], $options); exit; }