本文整理汇总了PHP中ExtraFields类的典型用法代码示例。如果您正苦于以下问题:PHP ExtraFields类的具体用法?PHP ExtraFields怎么用?PHP ExtraFields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtraFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doActions
function doActions($parameters, &$object, &$action, $hookmanager)
{
if (GETPOST('addcontratline')) {
$fk_line_contrat_origin = GETPOST('fk_line_contrat_origin', 'int');
if ($fk_line_contrat_origin > 0) {
global $db;
dol_include_once('/contrat/class/contrat.class.php');
$lineContrat = new ContratLigne($db);
$res = $lineContrat->fetch($fk_line_contrat_origin);
if ($res > 0) {
$linePropal = new PropaleLigne($db);
$array_options = array();
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($db);
$TExtra = $extrafields->fetch_name_optionals_label($linePropal->table_element);
// Récupération des extrafields de la ligne contrat vers la ligne propal
$lineContrat->fetch_optionals();
foreach ($lineContrat->array_options as $key => $val) {
$subkey = substr($key, 8);
if (isset($TExtra[$subkey])) {
$array_options[$key] = $val;
}
}
if (isset($TExtra['fk_contratdet_origin'])) {
$array_options['options_fk_contratdet_origin'] = $lineContrat->id;
}
$object->addline($lineContrat->description, $lineContrat->subprice, $lineContrat->qty, $lineContrat->tva_tx, $lineContrat->localtax1_tx, $lineContrat->localtax2_tx, $lineContrat->fk_product, $lineContrat->remise_percent, 'HT', 0.0, $lineContrat->info_bits, 1, -1, 0, 0, 0, $lineContrat->pa_ht, '', $lineContrat->date_ouverture_prevue, $lineContrat->date_fin_validite, $array_options, $lineContrat->fk_unit);
}
}
}
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_contratconcurrent,代码行数:31,代码来源:actions_contratconcurrent.class.php
示例2: __construct
/**
* Constructor de la classe
*
* @param DoliDb $db Database handler
*/
function __construct($db) {
$this->db = $db;
parent::__construct($db);
$fk_extrafields = new ExtraFields($db);
$this->fk_extrafields = $fk_extrafields->load("extrafields:" . get_class($this), true); // load and cache
$this->couchAdmin = new couchAdmin($this->couchdb);
return 0;
}
示例3: __construct
function __construct($db)
{
global $couch;
parent::__construct($db);
try {
$this->global = $couch->getDoc("const");
} catch (Exception $e) {
dol_print_error('', "Error : no const document in database" . $e->getMessage());
}
$fk_extrafields = new ExtraFields($db);
$this->fk_extrafields = $fk_extrafields->load("extrafields:DolibarrModules", true);
// load and cache
}
示例4: __construct
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
parent::__construct($db);
try {
$this->couchdb->useDatabase('adherent');
$fk_extrafields = new ExtraFields($db);
$fk_extrafields->useDatabase('adherent');
$this->fk_extrafields = $fk_extrafields->load("extrafields:" . get_class($this), true);
// load and cache
} catch (Exception $e) {
dol_print_error('', $e->getMessage());
exit;
}
return 1;
}
示例5: __construct
/**
* Constructor
*
* @param Client $db Database handler
*/
public function __construct($db) {
parent::__construct($db);
try {
$fk_extrafields = new ExtraFields($db);
$this->fk_extrafields = $fk_extrafields->load("extrafields:" . get_class($this), true); // load and cache
$this->fk_country = $this->couchdb->getDoc("dict:fk_country"); //load country table
} catch (Exception $e) {
$error = "Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n";
print $error;
exit;
}
return 1;
}
示例6: configure
public function configure()
{
$this->widgetSchema['extra_fields'] = new sfWidgetFormChoice(array('choices' => ExtraFields::getFieldsByType('tickets'), 'expanded' => true, 'multiple' => true));
$this->widgetSchema['active'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
$this->setDefault('active', 1);
$this->widgetSchema['name']->setAttribute('class', 'required');
$this->widgetSchema['sort_order']->setAttribute('size', '3');
$this->widgetSchema->setLabels(array('sort_order' => 'Sort Order', 'background_color' => 'Background', 'default_value' => 'Default?', 'active' => 'Active?', 'extra_fields' => 'Extra Fields'));
}
示例7: getTypeNameByKey
public static function getTypeNameByKey($k)
{
$t = ExtraFields::getTypesChoices();
if (isset($t[$k])) {
return $t[$k];
} else {
return '';
}
}
示例8: configure
public function configure()
{
$this->widgetSchema['active'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
$this->setDefault('active', 1);
$this->widgetSchema['display_in_list'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
$this->setDefault('display_in_list', 0);
$this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => ExtraFields::getTypesChoices()));
$this->widgetSchema['bind_type'] = new sfWidgetFormInputHidden();
$this->widgetSchema['name']->setAttribute('class', 'required');
$this->widgetSchema['sort_order']->setAttribute('size', '3');
$this->widgetSchema->setLabels(array('display_in_list' => 'Display in Listing?', 'sort_order' => 'Sort Order', 'active' => 'Active?'));
}
示例9: getProductsForCategory
/**
* Get list of products for a category
*
* @param array $authentication Array of authentication information
* @param array $id Category id
* @param $lang $lang Force lang
* @return array Array result
*/
function getProductsForCategory($authentication, $id, $lang = '')
{
global $db, $conf, $langs;
$langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
$langs->setDefaultLang($langcode);
dol_syslog("Function: getProductsForCategory login=" . $authentication['login'] . " id=" . $id);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
if (!$error && !$id) {
$error++;
$errorcode = 'BAD_PARAMETERS';
$errorlabel = "Parameter id must be provided.";
}
if (!$error) {
$langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
$langs->setDefaultLang($langcode);
$fuser->getrights();
if ($fuser->rights->produit->lire) {
$categorie = new Categorie($db);
$result = $categorie->fetch($id);
if ($result > 0) {
$table = "product";
$field = "product";
$sql = "SELECT fk_" . $field . " FROM " . MAIN_DB_PREFIX . "categorie_" . $table;
$sql .= " WHERE fk_categorie = " . $id;
$sql .= " ORDER BY fk_" . $field . " ASC";
dol_syslog("getProductsForCategory get id of product into category", LOG_DEBUG);
$res = $db->query($sql);
if ($res) {
while ($rec = $db->fetch_array($res)) {
$obj = new Product($db);
$obj->fetch($rec['fk_' . $field]);
$iProduct = 0;
if ($obj->status > 0) {
$dir = !empty($conf->product->dir_output) ? $conf->product->dir_output : $conf->service->dir_output;
$pdir = get_exdir($obj->id, 2) . $obj->id . "/photos/";
$dir = $dir . '/' . $pdir;
$products[] = array('id' => $obj->id, 'ref' => $obj->ref, 'ref_ext' => $obj->ref_ext, 'label' => !empty($obj->multilangs[$langs->defaultlang]["label"]) ? $obj->multilangs[$langs->defaultlang]["label"] : $obj->label, 'description' => !empty($obj->multilangs[$langs->defaultlang]["description"]) ? $obj->multilangs[$langs->defaultlang]["description"] : $obj->description, 'date_creation' => dol_print_date($obj->date_creation, 'dayhourrfc'), 'date_modification' => dol_print_date($obj->date_modification, 'dayhourrfc'), 'note' => !empty($obj->multilangs[$langs->defaultlang]["note"]) ? $obj->multilangs[$langs->defaultlang]["note"] : $obj->note, 'status_tosell' => $obj->status, 'status_tobuy' => $obj->status_buy, 'type' => $obj->type, 'barcode' => $obj->barcode, 'barcode_type' => $obj->barcode_type, 'country_id' => $obj->country_id > 0 ? $obj->country_id : '', 'country_code' => $obj->country_code, 'custom_code' => $obj->customcode, 'price_net' => $obj->price, 'price' => $obj->price_ttc, 'vat_rate' => $obj->tva_tx, 'price_base_type' => $obj->price_base_type, 'stock_real' => $obj->stock_reel, 'stock_alert' => $obj->seuil_stock_alerte, 'pmp' => $obj->pmp, 'import_key' => $obj->import_key, 'dir' => $pdir, 'images' => $obj->liste_photos($dir, $nbmax = 10));
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
//Get extrafield values
$product->fetch_optionals($obj->id, $extralabels);
foreach ($extrafields->attribute_label as $key => $label) {
$products[$iProduct] = array_merge($products[$iProduct], array('options_' . $key => $product->array_options['options_' . $key]));
}
$iProduct++;
}
}
// Retour
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'products' => $products);
} else {
$errorcode = 'NORECORDS_FOR_ASSOCIATION';
$errorlabel = 'No products associated' . $sql;
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
dol_syslog("getProductsForCategory:: " . $c->error, LOG_DEBUG);
}
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Object not found for id=' . $id;
}
} else {
$error++;
$errorcode = 'PERMISSION_DENIED';
$errorlabel = 'User does not have permission for this request';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
示例10: GETPOST
$langs->load("companies");
$langs->load("commercial");
$langs->load("bills");
$langs->load("banks");
$langs->load("users");
if ($conf->notification->enabled) $langs->load("mails");
$mesg=''; $error=0; $errors=array();
$action = (GETPOST('action') ? GETPOST('action') : 'view');
$confirm = GETPOST('confirm');
$socid = GETPOST('socid');
if ($user->societe_id) $socid=$user->societe_id;
$object = new Societe($db);
$extrafields = new ExtraFields($db);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($socid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
if (! empty($canvas))
{
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
$objcanvas = new Canvas($db, $action);
$objcanvas->getCanvas('thirdparty', 'card', $canvas);
}
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
示例11: GETPOST
$qty = GETPOST('qty');
// Define info_bits
$info_bits = 0;
if (preg_match('/\\*/', $vat_rate)) {
$info_bits |= 0x1;
}
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : '');
// If buying_price is '0', we muste keep this value
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
}
}
// Define special_code for special lines
$special_code = GETPOST('special_code');
if (!GETPOST('qty')) {
$special_code = 3;
}
$line = new FactureLigne($db);
示例12: substr
{
print '<tr><td class="nowrap">';
print $langs->trans("Script").'</td><td align="right">'.$file.'</td></tr>';
$name = substr($file, 0, dol_strlen($file) - 4);
// Run sql script
$ok=run_sql($dir.$file, 0, '', 1);
}
}
// sync_extrafields: Search list of fields declared and list of fields created into databases and create fields missing
if ($ok)
{
$extrafields=new ExtraFields($db);
$listofmodulesextra=array('societe'=>'societe','adherent'=>'adherent','product'=>'product',
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm',
'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task');
foreach($listofmodulesextra as $tablename => $elementtype)
{
// Get list of fields
$tableextra=MAIN_DB_PREFIX.$tablename.'_extrafields';
// Define $arrayoffieldsdesc
$arrayoffieldsdesc=$extrafields->fetch_name_optionals_label($elementtype);
// Define $arrayoffieldsfound
$arrayoffieldsfound=array();
$resql=$db->DDLDescTable($tableextra);
示例13: fetch_all
/**
* 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();
//.........这里部分代码省略.........
示例14: ExtraFields
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/categories/admin/categorie_extrafields.php
* \ingroup societe
* \brief Page to setup extra fields of category
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/categories.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$langs->load("categories");
$langs->load("admin");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->trans($val);
}
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'categories';
//Must be the $element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();
}
/*
示例15: GETPOST
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "DESC";
}
if (!$sortfield) {
$sortfield = "d.lastname";
}
$label = GETPOST("libelle", "alpha");
$cotisation = GETPOST("cotisation", "int");
$vote = GETPOST("vote", "int");
$comment = GETPOST("comment");
$mail_valid = GETPOST("mail_valid");
// Security check
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('adherent_type');
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
$search_lastname = "";
$search_login = "";
$search_email = "";
$type = "";
$sall = "";
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('membertypecard', 'globalcard'));
/*
* Actions
*/
if ($action == 'add' && $user->rights->adherent->configurer) {