本文整理汇总了PHP中ExtraFields::fetch_name_optionals_label方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtraFields::fetch_name_optionals_label方法的具体用法?PHP ExtraFields::fetch_name_optionals_label怎么用?PHP ExtraFields::fetch_name_optionals_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtraFields
的用法示例。
在下文中一共展示了ExtraFields::fetch_name_optionals_label方法的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: insertExtraFields
/**
* Add/Update all extra fields values for the current object.
* All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd')
*
* @return void
*/
function insertExtraFields()
{
global $langs;
$error = 0;
if (!empty($this->array_options)) {
// Check parameters
$langs->load('admin');
require_once DOL_DOCUMENT_ROOT . "/core/class/extrafields.class.php";
$extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->elementType);
foreach ($this->array_options as $key => $value) {
$attributeKey = substr($key, 8);
// Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
$attributeSize = $extrafields->attribute_size[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey];
switch ($attributeType) {
case 'int':
if (!is_numeric($value) && $value != '') {
$error++;
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
} elseif ($value == '') {
$this->array_options[$key] = null;
}
break;
}
}
$this->db->begin();
$sql_del = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . "_extrafields WHERE fk_object = " . $this->id;
dol_syslog(get_class($this) . "::insertExtraFields delete sql=" . $sql_del);
$this->db->query($sql_del);
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . "_extrafields (fk_object";
foreach ($this->array_options as $key => $value) {
// Add field of attribut
$sql .= "," . substr($key, 8);
// Remove 'options_' prefix
}
$sql .= ") VALUES (" . $this->id;
foreach ($this->array_options as $key => $value) {
// Add field o fattribut
if ($this->array_options[$key] != '') {
$sql .= ",'" . $this->array_options[$key] . "'";
} else {
$sql .= ",null";
}
}
$sql .= ")";
dol_syslog(get_class($this) . "::insertExtraFields insert sql=" . $sql);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return 1;
}
} else {
return 0;
}
}
示例3: 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;
}
示例4: restrictedArea
if ($id == "") {
dol_print_error('', 'Missing parameter id');
exit;
}
// Security check
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id);
$object->fetch_optionals($id, $extralabels);
if ($result <= 0) {
dol_print_error($db, $object->error);
exit;
}
$type = $object->type;
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/*
* Actions
*/
// Remove element from category
if ($id > 0 && $removeelem > 0) {
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$tmpobject = new Product($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'product';
} else {
if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) {
$tmpobject = new Societe($db);
示例5: ExtraFields
// 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);
if ($resql)
{
print '<tr><td>Check availability of extra field for '.$tableextra."<br>\n";
$i=0;
while($obj=$db->fetch_object($resql))
{
$fieldname=$fieldtype='';
if (preg_match('/mysql/',$db->type))
{
$fieldname=$obj->Field;
$fieldtype=$obj->Type;
示例6: 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();
//.........这里部分代码省略.........
示例7: updateActionComm
/**
* Create ActionComm
*
* @param array $authentication Array of authentication information
* @param ActionComm $actioncomm $actioncomm
* @return array Array result
*/
function updateActionComm($authentication, $actioncomm)
{
global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateActionComm login=" . $authentication['login']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if (empty($actioncomm['id'])) {
$error++;
$errorcode = 'KO';
$errorlabel = "Actioncomm id is mandatory.";
}
if (!$error) {
$objectfound = false;
$object = new ActionComm($db);
$result = $object->fetch($actioncomm['id']);
if (!empty($object->id)) {
$objectfound = true;
$object->datep = $actioncomm['datep'];
$object->datef = $actioncomm['datef'];
$object->type_code = $actioncomm['type_code'];
$object->societe->id = $actioncomm['socid'];
$object->fk_project = $actioncomm['projectid'];
$object->note = $actioncomm['note'];
$object->contact->id = $actioncomm['contactid'];
$object->usertodo->id = $actioncomm['usertodo'];
$object->userdone->id = $actioncomm['userdone'];
$object->label = $actioncomm['label'];
$object->percentage = $actioncomm['percentage'];
$object->priority = $actioncomm['priority'];
$object->fulldayevent = $actioncomm['fulldayevent'];
$object->location = $actioncomm['location'];
$object->fk_element = $actioncomm['fk_element'];
$object->elementtype = $actioncomm['elementtype'];
//Retreive all extrafield for actioncomm
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('actioncomm', true);
foreach ($extrafields->attribute_label as $key => $label) {
$key = 'options_' . $key;
$object->array_options[$key] = $actioncomm[$key];
}
$db->begin();
$result = $object->update($fuser);
if ($result <= 0) {
$error++;
}
}
if (!$error && $objectfound) {
$db->commit();
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $object->id);
} elseif ($objectfound) {
$db->rollback();
$error++;
$errorcode = 'KO';
$errorlabel = $object->error;
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Actioncomm id=' . $actioncomm['id'] . ' cannot be found';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
示例8: fetch
//.........这里部分代码省略.........
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_paiement as p ON f.fk_mode_reglement = p.id';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_incoterms as i ON f.fk_incoterms = i.rowid';
$sql .= ' WHERE f.entity = ' . $conf->entity;
if ($rowid) {
$sql .= " AND f.rowid=" . $rowid;
}
if ($ref) {
$sql .= " AND f.facnumber='" . $this->db->escape($ref) . "'";
}
if ($ref_ext) {
$sql .= " AND f.ref_ext='" . $this->db->escape($ref_ext) . "'";
}
if ($ref_int) {
$sql .= " AND f.ref_int='" . $this->db->escape($ref_int) . "'";
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->ref = $obj->facnumber;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
$this->type = $obj->type;
$this->date = $this->db->jdate($obj->df);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->total_ht = $obj->total;
$this->total_tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc;
$this->revenuestamp = $obj->revenuestamp;
$this->paye = $obj->paye;
$this->close_code = $obj->close_code;
$this->close_note = $obj->close_note;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->fk_account = $obj->fk_account > 0 ? $obj->fk_account : null;
$this->fk_project = $obj->fk_projet;
$this->fk_facture_source = $obj->fk_facture_source;
$this->note = $obj->note_private;
// deprecated
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid;
$this->modelpdf = $obj->model_pdf;
$this->situation_cycle_ref = $obj->situation_cycle_ref;
$this->situation_counter = $obj->situation_counter;
$this->situation_final = $obj->situation_final;
$this->extraparams = (array) json_decode($obj->extraparams, true);
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
if ($this->statut == self::STATUS_DRAFT) {
$this->brouillon = 1;
}
// Retrieve all extrafield for invoice
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id, $extralabels);
/*
* Lines
*/
$this->lines = array();
$result = $this->fetch_lines();
if ($result < 0) {
$this->error = $this->db->error();
return -3;
}
return 1;
} else {
$this->error = 'Bill with id ' . $rowid . ' or ref ' . $ref . ' not found sql=' . $sql;
dol_syslog(get_class($this) . "::fetch Error " . $this->error, LOG_ERR);
return 0;
}
} else {
$this->error = $this->db->error();
return -1;
}
}
示例9: fetch
/**
* Load a bank account into memory from database
*
* @param int $id Id of bank account to get
* @param string $ref Ref of bank account to get
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $ref = '')
{
global $conf;
if (empty($id) && empty($ref)) {
$this->error = "ErrorBadParameters";
return -1;
}
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
$sql .= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
$sql .= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
$sql .= " ba.account_number, ba.accountancy_journal, ba.currency_code,";
$sql .= " ba.min_allowed, ba.min_desired, ba.comment,";
$sql .= ' c.code as country_code, c.label as country,';
$sql .= ' d.code_departement as state_code, d.nom as state';
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account as ba";
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as c ON ba.fk_pays = c.rowid';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_departements as d ON ba.state_id = d.rowid';
$sql .= " WHERE entity IN (" . getEntity($this->element, 1) . ")";
if ($id) {
$sql .= " AND ba.rowid = " . $id;
}
if ($ref) {
$sql .= " AND ba.ref = '" . $this->db->escape($ref) . "'";
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
// deprecated
$this->ref = $obj->ref;
$this->label = $obj->label;
$this->type = $obj->courant;
$this->courant = $obj->courant;
$this->bank = $obj->bank;
$this->clos = $obj->clos;
$this->rappro = $obj->rappro;
$this->url = $obj->url;
$this->code_banque = $obj->code_banque;
$this->code_guichet = $obj->code_guichet;
$this->number = $obj->number;
$this->cle_rib = $obj->cle_rib;
$this->bic = $obj->bic;
$this->iban = $obj->iban;
$this->domiciliation = $obj->domiciliation;
$this->proprio = $obj->proprio;
$this->owner_address = $obj->owner_address;
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
$this->state = $obj->state;
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
$this->country = $obj->country;
$this->account_number = $obj->account_number;
$this->accountancy_journal = $obj->accountancy_journal;
$this->currency_code = $obj->currency_code;
$this->account_currency_code = $obj->currency_code;
$this->min_allowed = $obj->min_allowed;
$this->min_desired = $obj->min_desired;
$this->comment = $obj->comment;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id, $extralabels);
return 1;
} else {
return 0;
}
} else {
dol_print_error($this->db);
return -1;
}
}
示例10: fetch
/**
* Load member from database
*
* @param int $rowid Id of object to load
* @param string $ref To load member from its ref
* @param int $fk_soc To load member from its link to third party
* @param string $ref_ext External reference
* @return int >0 if OK, 0 if not found, <0 if KO
*/
function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '')
{
global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql .= " d.note_public,";
$sql .= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql .= " d.datec as datec,";
$sql .= " d.tms as datem,";
$sql .= " d.datefin as datefin,";
$sql .= " d.birth as birthday,";
$sql .= " d.datevalid as datev,";
$sql .= " d.country,";
$sql .= " d.state_id,";
$sql .= " c.rowid as country_id, c.code as country_code, c.label as country,";
$sql .= " dep.nom as state, dep.code_departement as state_code,";
$sql .= " t.libelle as type, t.cotisation as cotisation,";
$sql .= " u.rowid as user_id, u.login as user_login";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t, " . MAIN_DB_PREFIX . "adherent as d";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON d.country = c.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as dep ON d.state_id = dep.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u ON d.rowid = u.fk_member";
$sql .= " WHERE d.fk_adherent_type = t.rowid";
if ($rowid) {
$sql .= " AND d.rowid=" . $rowid;
} elseif ($ref || $fk_soc) {
$sql .= " AND d.entity IN (" . getEntity() . ")";
if ($ref) {
$sql .= " AND d.rowid='" . $this->db->escape($ref) . "'";
} elseif ($fk_soc) {
$sql .= " AND d.fk_soc='" . $fk_soc . "'";
}
} elseif ($ref_ext) {
$sql .= " AND d.ref_ext='" . $this->db->escape($ref_ext) . "'";
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->entity = $obj->entity;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_id;
$this->firstname = $obj->firstname;
$this->lastname = $obj->lastname;
$this->login = $obj->login;
$this->pass = $obj->pass;
$this->societe = $obj->company;
$this->company = $obj->company;
$this->fk_soc = $obj->fk_soc;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_id ? $obj->state_code : '';
$this->state = $obj->state_id ? $obj->state : '';
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
if ($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) {
$this->country = $langs->transnoentitiesnoconv("Country" . $obj->country_code);
} else {
$this->country = $obj->country;
}
$this->phone = $obj->phone;
$this->phone_perso = $obj->phone_perso;
$this->phone_mobile = $obj->phone_mobile;
$this->email = $obj->email;
$this->skype = $obj->skype;
$this->photo = $obj->photo;
$this->statut = $obj->statut;
$this->public = $obj->public;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->datefin = $this->db->jdate($obj->datefin);
$this->datevalid = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday);
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->morphy = $obj->morphy;
$this->typeid = $obj->fk_adherent_type;
$this->type = $obj->type;
$this->need_subscription = $obj->cotisation == 'yes' ? 1 : 0;
$this->user_id = $obj->user_id;
$this->user_login = $obj->user_login;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
//.........这里部分代码省略.........
示例11: fetch
//.........这里部分代码省略.........
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_paiement as p ON (c.fk_mode_reglement = p.id)';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_availability as ca ON (c.fk_availability = ca.rowid)';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_incoterms as i ON c.fk_incoterms = i.rowid';
$sql .= " WHERE c.entity IN (" . getEntity('commande', 1) . ")";
if ($id) {
$sql .= " AND c.rowid=" . $id;
}
if ($ref) {
$sql .= " AND c.ref='" . $this->db->escape($ref) . "'";
}
if ($ref_ext) {
$sql .= " AND c.ref_ext='" . $this->db->escape($ref_ext) . "'";
}
if ($ref_int) {
$sql .= " AND c.ref_int='" . $this->db->escape($ref_int) . "'";
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj) {
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->total_localtax1;
$this->total_localtax2 = $obj->total_localtax2;
$this->total_ttc = $obj->total_ttc;
$this->date = $this->db->jdate($obj->date_commande);
$this->date_commande = $this->db->jdate($obj->date_commande);
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->facturee = $obj->billed;
// deprecated
$this->billed = $obj->billed;
$this->note = $obj->note_private;
// deprecated
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->fk_account = $obj->fk_account;
$this->availability_id = $obj->fk_availability;
$this->availability_code = $obj->availability_code;
$this->availability = $obj->availability_label;
$this->demand_reason_id = $obj->fk_input_reason;
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = $obj->fk_shipping_method > 0 ? $obj->fk_shipping_method : null;
$this->warehouse_id = $obj->fk_warehouse > 0 ? $obj->fk_warehouse : null;
$this->fk_delivery_address = $obj->fk_delivery_address;
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->lines = array();
if ($this->statut == self::STATUS_DRAFT) {
$this->brouillon = 1;
}
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id, $extralabels);
$this->db->free($result);
/*
* Lines
*/
$result = $this->fetch_lines();
if ($result < 0) {
return -3;
}
return 1;
} else {
$this->error = 'Order with id ' . $id . ' not found sql=' . $sql;
return 0;
}
} else {
$this->error = $this->db->error();
return -1;
}
}
示例12: Header
// Action confirmation suppression
if ($action == 'confirm_delete' && $confirm == 'yes') {
if ($object->delete($object->id)) {
$url = !empty($urlfrom) ? $urlfrom : 'liste.php';
Header("Location: " . $url);
exit;
}
}
if (!empty($_POST["cancel"])) {
$action = '';
}
/*
* View
*/
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('mailing');
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
llxHeader('', $langs->trans("Mailing"), $help_url);
$form = new Form($db);
$htmlother = new FormOther($db);
if ($action == 'create') {
// EMailing in creation mode
print '<form name="new_mailing" action="' . $_SERVER['PHP_SELF'] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
print_fiche_titre($langs->trans("NewMailing"));
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans("MailTitle") . '</td><td><input class="flat" name="titre" size="40" value="' . $_POST['titre'] . '"></td></tr>';
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans("MailFrom") . '</td><td><input class="flat" name="from" size="40" value="' . $conf->global->MAILING_EMAIL_FROM . '"></td></tr>';
print '<tr><td width="25%">' . $langs->trans("MailErrorsTo") . '</td><td><input class="flat" name="errorsto" size="40" value="' . (!empty($conf->global->MAILING_EMAIL_ERRORSTO) ? $conf->global->MAILING_EMAIL_ERRORSTO : $conf->global->MAIN_MAIL_ERRORS_TO) . '"></td></tr>';
示例13: ExtraFields
$contextpage = 'prospectlist';
if ($search_type == '') {
$search_type = '2,3';
}
}
if ($type == 'f') {
$contextpage = 'supplierlist';
if ($search_type == '') {
$search_type = '4';
}
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
$search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array('s.nom' => "ThirdPartyName", 's.name_alias' => "AliasNameShort", 's.code_client' => "CustomerCode", "s.code_fournisseur" => "SupplierCode", 's.email' => "EMail", 's.url' => "URL", 's.tva_intra' => "VATIntra", 's.siren' => "ProfId1", 's.siret' => "ProfId2", 's.ape' => "ProfId3");
if (($tmp = $langs->transnoentities("ProfId4" . $mysoc->country_code)) && $tmp != "ProfId4" . $mysoc->country_code && $tmp != '-') {
$fieldstosearchall['s.idprof4'] = 'ProfId4';
}
if (($tmp = $langs->transnoentities("ProfId5" . $mysoc->country_code)) && $tmp != "ProfId5" . $mysoc->country_code && $tmp != '-') {
$fieldstosearchall['s.idprof5'] = 'ProfId5';
}
if (($tmp = $langs->transnoentities("ProfId6" . $mysoc->country_code)) && $tmp != "ProfId6" . $mysoc->country_code && $tmp != '-') {
$fieldstosearchall['s.idprof6'] = 'ProfId6';
}
if (!empty($conf->barcode->enabled)) {
$fieldstosearchall['s.barcode'] = 'Gencod';
}
示例14: fetch
//.........这里部分代码省略.........
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->ref_int = $obj->ref_int;
$this->ref_ext = $obj->ref_ext;
$this->ldap_sid = $obj->ldap_sid;
$this->lastname = $obj->lastname;
$this->firstname = $obj->firstname;
$this->employee = $obj->employee;
$this->login = $obj->login;
$this->gender = $obj->gender;
$this->pass_indatabase = $obj->pass;
$this->pass_indatabase_crypted = $obj->pass_crypted;
$this->pass = $obj->pass;
$this->pass_temp = $obj->pass_temp;
$this->api_key = $obj->api_key;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_id ? $obj->country_code : '';
$this->country = $obj->country_id ? $langs->trans('Country' . $obj->country_code) != 'Country' . $obj->country_code ? $langs->transnoentities('Country' . $obj->country_code) : $obj->country : '';
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
$this->state = $obj->state != '-' ? $obj->state : '';
$this->office_phone = $obj->office_phone;
$this->office_fax = $obj->office_fax;
$this->user_mobile = $obj->user_mobile;
$this->email = $obj->email;
$this->skype = $obj->skype;
$this->job = $obj->job;
$this->signature = $obj->signature;
$this->admin = $obj->admin;
$this->note = $obj->note;
$this->statut = $obj->statut;
$this->photo = $obj->photo;
$this->openid = $obj->openid;
$this->lang = $obj->lang;
$this->entity = $obj->entity;
$this->accountancy_code = $obj->accountancy_code;
$this->thm = $obj->thm;
$this->tjm = $obj->tjm;
$this->salary = $obj->salary;
$this->salaryextra = $obj->salaryextra;
$this->weeklyhours = $obj->weeklyhours;
$this->color = $obj->color;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->datelastlogin = $this->db->jdate($obj->datel);
$this->datepreviouslogin = $this->db->jdate($obj->datep);
$this->societe_id = $obj->fk_soc;
// deprecated
$this->contact_id = $obj->fk_socpeople;
// deprecated
$this->socid = $obj->fk_soc;
$this->contactid = $obj->fk_socpeople;
$this->fk_member = $obj->fk_member;
$this->fk_user = $obj->fk_user;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id, $extralabels);
$this->db->free($result);
} else {
$this->error = "USERNOTFOUND";
dol_syslog(get_class($this) . "::fetch user not found", LOG_DEBUG);
$this->db->free($result);
return 0;
}
} else {
$this->error = $this->db->error();
return -1;
}
// To get back the global configuration unique to the user
if ($loadpersonalconf) {
$sql = "SELECT param, value FROM " . MAIN_DB_PREFIX . "user_param";
$sql .= " WHERE fk_user = " . $this->id;
$sql .= " AND entity = " . $conf->entity;
//dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$p = !empty($obj->param) ? $obj->param : '';
if (!empty($p)) {
$this->conf->{$p} = $obj->value;
}
$i++;
}
$this->db->free($resql);
} else {
$this->error = $this->db->error();
return -2;
}
}
return 1;
}
示例15: fetch
/**
* Load a contract from database
*
* @param int $id Id of contract to load
* @param string $ref Ref
* @return int <0 if KO, id of contract if OK
*/
function fetch($id, $ref = '')
{
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
$sql .= " fk_user_mise_en_service, date_contrat as datecontrat,";
$sql .= " fk_user_author,";
$sql .= " fk_projet,";
$sql .= " fk_commercial_signature, fk_commercial_suivi,";
$sql .= " note_private, note_public, model_pdf, extraparams";
$sql .= " ,ref_supplier";
$sql .= " ,ref_ext";
$sql .= " FROM " . MAIN_DB_PREFIX . "contrat";
if ($ref) {
$sql .= " WHERE ref='" . $this->db->escape($ref) . "'";
$sql .= " AND entity IN (" . getEntity('contract') . ")";
} else {
$sql .= " WHERE rowid=" . $id;
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$result = $this->db->fetch_array($resql);
if ($result) {
$this->id = $result["rowid"];
$this->ref = !isset($result["ref"]) || !$result["ref"] ? $result["rowid"] : $result["ref"];
$this->ref_supplier = $result["ref_supplier"];
$this->ref_ext = $result["ref_ext"];
$this->statut = $result["statut"];
$this->mise_en_service = $this->db->jdate($result["datemise"]);
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
$this->date_creation = $this->db->jdate($result["datecontrat"]);
$this->user_author_id = $result["fk_user_author"];
$this->commercial_signature_id = $result["fk_commercial_signature"];
$this->commercial_suivi_id = $result["fk_commercial_suivi"];
$this->note = $result["note_private"];
// deprecated
$this->note_private = $result["note_private"];
$this->note_public = $result["note_public"];
$this->modelpdf = $result["model_pdf"];
$this->fk_projet = $result["fk_projet"];
// deprecated
$this->fk_project = $result["fk_projet"];
$this->socid = $result["fk_soc"];
$this->fk_soc = $result["fk_soc"];
$this->extraparams = (array) json_decode($result["extraparams"], true);
$this->db->free($resql);
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id, $extralabels);
/*
* Lines
*/
$this->lines = array();
$result = $this->fetch_lines();
if ($result < 0) {
$this->error = $this->db->lasterror();
return -3;
}
return $this->id;
} else {
dol_syslog(get_class($this) . "::Fetch Erreur contrat non trouve");
$this->error = "Contract not found";
return -2;
}
} else {
dol_syslog(get_class($this) . "::Fetch Erreur lecture contrat");
$this->error = $this->db->error();
return -1;
}
}