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


PHP Lead::fetch_optionals方法代码示例

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


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

示例1: array

 /**
  * Load object in memory from the database
  *
  * @param string $sortorder order
  * @param string $sortfield field
  * @param int $limit page
  * @param int $offset Offset results
  * @param array $filter output
  *
  * @return int <0 if KO, >0 if OK
  */
 function fetch_all($sortorder, $sortfield, $limit, $offset, $filter = array())
 {
     global $langs;
     $sql = "SELECT";
     $sql .= " t.rowid,";
     $sql .= " t.ref,";
     $sql .= " t.ref_ext,";
     $sql .= " t.ref_int,";
     $sql .= " t.fk_c_status,";
     $sql .= " t.fk_c_type,";
     $sql .= " t.fk_soc,";
     $sql .= " t.date_closure,";
     $sql .= " t.amount_prosp,";
     $sql .= " t.fk_user_resp,";
     $sql .= " t.description,";
     $sql .= " t.note_private,";
     $sql .= " t.note_public,";
     $sql .= " t.fk_user_author,";
     $sql .= " t.datec,";
     $sql .= " t.fk_user_mod,";
     $sql .= " t.tms";
     $sql .= " FROM " . MAIN_DB_PREFIX . "lead as t";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as so ON so.rowid=t.fk_soc";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as usr ON usr.rowid=t.fk_user_resp";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_lead_status as leadsta ON leadsta.rowid=t.fk_c_status";
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_lead_type as leadtype ON leadtype.rowid=t.fk_c_type";
     $sql .= " WHERE t.entity IN (" . getEntity('lead') . ")";
     if (is_array($filter)) {
         foreach ($filter as $key => $value) {
             if ($key == 't.fk_c_status' || $key == 't.rowid' || $key == 'so.rowid' || $key == 't.fk_c_type' || $key == 't.fk_user_resp') {
                 $sql .= ' AND ' . $key . ' = ' . $value;
             } elseif ($key == 't.date_closure<') {
                 // To allow $filter['YEAR(s.dated)']=>$year
                 $sql .= " AND t.date_closure<='" . $this->db->idate($value) . "'";
             } elseif (strpos($key, 'date')) {
                 // To allow $filter['YEAR(s.dated)']=>$year
                 $sql .= ' AND ' . $key . ' = \'' . $value . '\'';
             } elseif ($key == 't.fk_c_status !IN') {
                 $sql .= ' AND t.fk_c_status NOT IN (' . $value . ')';
             } elseif ($key == 't.rowid !IN') {
                 $sql .= ' AND t.rowid NOT IN (' . $value . ')';
             } else {
                 $sql .= ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
             }
         }
     }
     if (!empty($sortfield)) {
         $sql .= " ORDER BY " . $sortfield . ' ' . $sortorder;
     }
     if (!empty($limit)) {
         $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
     }
     dol_syslog(get_class($this) . "::fetch_all sql=" . $sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $this->lines = array();
         $num = $this->db->num_rows($resql);
         while ($obj = $this->db->fetch_object($resql)) {
             $line = new Lead($this->db, 1);
             $line->id = $obj->rowid;
             $line->ref = $obj->ref;
             $line->ref_ext = $obj->ref_ext;
             $line->ref_int = $obj->ref_int;
             $line->fk_c_status = $obj->fk_c_status;
             $line->fk_c_type = $obj->fk_c_type;
             $line->fk_soc = $obj->fk_soc;
             $line->date_closure = $this->db->jdate($obj->date_closure);
             $line->amount_prosp = $obj->amount_prosp;
             $line->fk_user_resp = $obj->fk_user_resp;
             $line->description = $obj->description;
             $line->note_private = $obj->note_private;
             $line->note_public = $obj->note_public;
             $line->fk_user_author = $obj->fk_user_author;
             $line->datec = $this->db->jdate($obj->datec);
             $line->fk_user_mod = $obj->fk_user_mod;
             $line->tms = $this->db->jdate($obj->tms);
             $line->status_label = $this->status[$line->fk_c_status];
             $line->type_label = $this->type[$line->fk_c_type];
             $extrafields = new ExtraFields($this->db);
             $extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
             if (count($extralabels) > 0) {
                 $line->fetch_optionals($line->id, $extralabels);
             }
             $this->lines[] = $line;
         }
         $this->db->free($resql);
         return $num;
     } else {
         $this->error = "Error " . $this->db->lasterror();
//.........这里部分代码省略.........
开发者ID:BebZ,项目名称:lead,代码行数:101,代码来源:lead.class.php


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