當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。