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


PHP ExtraFields::addExtraField方法代码示例

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


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

示例1: Header

    {
        // Check values
        if (GETPOST('type')=='varchar' && GETPOST('size') > 255)
        {
            $error++;
            $langs->load("errors");
            $mesg=$langs->trans("ErrorSizeTooLongForVarcharType");
            $action = 'create';
        }

        if (! $error)
        {
            // Type et taille non encore pris en compte => varchar(255)
            if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
            {
                $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$_POST['size'],$elementtype);
                if ($result > 0)
                {
                    Header("Location: ".$_SERVER["PHP_SELF"]);
                    exit;
                }
                else
                {
                    $error++;
                    $mesg=$extrafields->error;
                }
            }
            else
            {
                $error++;
                $langs->load("errors");
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:societe_extrafields.php

示例2: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/of/config.php');
     dol_include_once('/of/script/create-maj-base.php');
     $result = $this->_load_tables('/of/sql/');
     dol_include_once('/core/class/extrafields.class.php');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('fk_of', 'Ordre de Fabrication', 'sellist', 0, '', 'projet_task', 0, 0, '', serialize(array('options' => array('assetOf:numero:rowid' => null))));
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('fk_product', 'Produit à fabriquer', 'sellist', 0, '', 'projet_task', 0, 0, '', serialize(array('options' => array('product:label:rowid' => null))));
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_of,代码行数:22,代码来源:modof.class.php

示例3: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/factor/config.php');
     dol_include_once('/factor/script/create-maj-base.php');
     dol_include_once('/core/class/extrafields.class.php');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('fk_soc_factor', 'Fournisseur du factor', 'sellist', 0, '', 'societe', 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:32:"societe:nom:rowid::fournisseur=1";N;}}'));
     //Ne peut prendre de order by
     $res = $extrafields->addExtraField('factor_suivi', 'Utiliser le factor', 'select', 0, '', 'societe', 0, 0, '', array("options" => array(2 => 'Non', 1 => 'Oui')));
     $res = $extrafields->addExtraField('factor_depot', 'Déposé au factor', 'select', 0, '', 'facture', 0, 0, '', array("options" => array(2 => 'A déposer', 1 => 'Oui')));
     $result = $this->_load_tables('/factor/sql/');
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_factor,代码行数:23,代码来源:modFactor.class.php

示例4: showParameters

// Change this following line to use the correct relative path from htdocs (do not remove DOL_DOCUMENT_ROOT)
dol_include_once('/core/lib/admin.lib.php');
dol_include_once('/core/class/extrafields.class.php');
// Access control
if (!$user->admin) {
    accessforbidden();
}
// Parameters
$action = GETPOST('action', 'alpha');
if ($action == 'save') {
    foreach ($_REQUEST['TDivers'] as $name => $param) {
        dolibarr_set_const($db, $name, $param);
        if ($name == 'SCRUM_USE_PROJECT_PRIORITY' && $param == 1) {
            $extrafields = new ExtraFields($db);
            $default_value = array('options' => array(0 => $langs->trans('Normal'), 1 => $langs->trans('Important')));
            $res = $extrafields->addExtraField('priority', 'Priorité', 'select', 1, 0, 'projet', false, false, '', serialize($default_value));
        }
        /*else if($name == 'SCRUM_GROUP_TASK_BY_PRODUCT' && $param == 1) {
              $extrafields=new ExtraFields($db);
              $res = $extrafields->addExtraField('grou', 'Priorité', 'select', 1, 0, 'projet', false, false, '', serialize( $default_value ) );
          }*/
    }
    setEventMessage($langs->trans('RegisterSuccess'));
}
llxHeader('', 'Gestion de scrumboard, à propos', '');
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre('Scrumboard', $linkback, 'setup');
showParameters();
function showParameters()
{
    global $db, $conf, $langs;
开发者ID:vinclar,项目名称:dolibarr_module_scrumboard,代码行数:31,代码来源:scrumboard_setup.php

示例5: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     global $db;
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/propalautosend/config.php');
     dol_include_once('/propalautosend/script/create-maj-base.php');
     dol_include_once('/core/class/extrafields.class.php');
     $result = $this->_load_tables('/propalautosend/sql/');
     $e = new ExtraFields($db);
     $e->addExtraField('date_relance', 'Date de relance', 'date', 0, '', 'propal');
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_propalautosend,代码行数:21,代码来源:modpropalAutoSend.class.php

示例6: accessforbidden

if (!$user->admin) {
    accessforbidden();
}
// Parameters
$action = GETPOST('action', 'alpha');
if (preg_match('/set_(.*)/', $action, $reg)) {
    $code = $reg[1];
    if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) {
        if ($code == 'SCRUM_USE_PROJECT_PRIORITY') {
            $extrafields = new ExtraFields($db);
            $default_value = array('options' => array(0 => $langs->trans('Normal'), 1 => $langs->trans('Important')));
            $res = $extrafields->addExtraField('priority', 'Priorité', 'select', 1, 0, 'projet', false, false, '', serialize($default_value));
        } else {
            if ($code == 'SCRUM_GROUP_TASK_BY_RAL' && GETPOST($code) == 1) {
                $extrafields = new ExtraFields($db);
                $res = $extrafields->addExtraField('fk_product_ral', 'RALLinkedToOrder', 'varchar', '', 255, 'projet_task');
            }
        }
        /*else if($name == 'SCRUM_GROUP_TASK_BY_PRODUCT' && $param == 1) {
              $extrafields=new ExtraFields($db);
              $res = $extrafields->addExtraField('grou', 'Priorité', 'select', 1, 0, 'projet', false, false, '', serialize( $default_value ) );
          }*/
        setEventMessage($langs->trans('RegisterSuccess'));
        header("Location: " . $_SERVER["PHP_SELF"]);
        exit;
    } else {
        dol_print_error($db);
    }
}
if (preg_match('/del_(.*)/', $action, $reg)) {
    $code = $reg[1];
开发者ID:ATM-Consulting,项目名称:dolibarr_module_scrumboard,代码行数:31,代码来源:scrumboard_setup.php

示例7: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/contratconcurrent/config.php');
     dol_include_once('/contratconcurrent/script/create-maj-base.php');
     dol_include_once('/core/class/extrafields.class.php');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('concurrent', 'Contrat concurrent', 'select', 1, '', 'contrat', 0, 0, '', array("options" => array('non', 'oui')));
     $result = $this->_load_tables('/contratconcurrent/sql/');
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_contratconcurrent,代码行数:20,代码来源:modContratConcurrent.class.php

示例8: create_extrafield

function create_extrafield($code, $label, $type, $elementtype, $options = array())
{
    global $db;
    $e = new ExtraFields($db);
    $e->addExtraField($code, $label, $type, '', '', $elementtype, 0, 0, '', $options);
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_shippableorder,代码行数:6,代码来源:shippableorder_setup.php

示例9: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/mandarin/config.php');
     dol_include_once('/mandarin/script/create-maj-base.php');
     $result = $this->_load_tables('/mandarin/sql/');
     dol_include_once('/core/class/extrafields.class.php');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('contrat', 'Contrat', 'varchar', 0, 150, 'user');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('thm', 'THM', 'double', 0, '', 'user');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('horaire', 'Horaire contractuel', 'varchar', 0, 150, 'user');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('dds', 'Date de sortie', 'date', 0, 10, 'user');
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_mandarin,代码行数:26,代码来源:modmandarin.class.php

示例10: init

    /**
     * Function called when module is enabled.
     * The init function add constants, boxes, permissions and menus
     * (defined in constructor) into Dolibarr database.
     * It also creates data directories
     *
     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
     * 	@return		int					1 if OK, 0 if KO
     */
    public function init($options = '')
    {
        global $db;
        $sql = array();
        $result = $this->loadTables();
        $db->query("ALTER TABLE `" . MAIN_DB_PREFIX . "projet_task` \n\t\t\t\t\tADD `grid_col` FLOAT NOT NULL DEFAULT '0',\n\t\t\t\t\tADD `grid_row` FLOAT NOT NULL DEFAULT '999999'");
        $db->query("ALTER TABLE `" . MAIN_DB_PREFIX . "projet_task`\n\t\t\t\t\tADD grid_height FLOAT NOT NULL DEFAULT 0");
        $db->query('ALTER TABLE `' . MAIN_DB_PREFIX . 'projet_task`
				ADD INDEX `grid_row_grid_col` (`grid_row`, `grid_col`)');
        $db->query("ALTER TABLE " . MAIN_DB_PREFIX . "projet_task\n\t\t\t\tADD date_estimated_start DATETIME NOT NULL \n\t\t\t  , ADD date_estimated_end DATETIME NOT NULL \n\t\t\t  , ADD INDEX (date_estimated_start, date_estimated_end)");
        dol_include_once('/core/class/extrafields.class.php');
        $extrafields = new ExtraFields($this->db);
        $res = $extrafields->addExtraField('color', 'Couleur du projet', 'varchar', 1, 8, 'projet', false, false, '');
        $extrafields = new ExtraFields($this->db);
        $res = $extrafields->addExtraField('grid_use', 'Afficher sur la grille de planning', 'boolean', 0, '', 'projet_task');
        $extrafields = new ExtraFields($this->db);
        $res = $extrafields->addExtraField('needed_ressource', 'nb ressources nécessaires', 'int', 0, '', 'projet_task');
        return $this->_init($sql, $options);
    }
开发者ID:vinclar,项目名称:dolibarr_module_scrumboard,代码行数:28,代码来源:modscrumboard.class.php

示例11: init

 /**
  *		Function called when module is enabled.
  *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  *		It also creates data directories
  *
  *      @param      string	$options    Options when enabling module ('', 'noboxes')
  *      @return     int             	1 if OK, 0 if KO
  */
 function init($options = '')
 {
     $sql = array();
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/facturecourrier/config.php');
     dol_include_once('/facturecourrier/script/create-maj-base.php');
     dol_include_once('/core/class/extrafields.class.php');
     $extrafields = new ExtraFields($this->db);
     $res = $extrafields->addExtraField('facture_papier', 'Facture par courrier', 'select', 0, '', 'societe', 0, 0, '', array("options" => array(1 => 'Non', 2 => 'Oui')));
     $res = $extrafields->addExtraField('courrier_envoi', 'Facture envoyée par courrier', 'date', 0, '', 'facture', 0, 0, '');
     $result = $this->_load_tables('/facturecourrier/sql/');
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_facturecourrier,代码行数:21,代码来源:modFactureCourrier.class.php

示例12: setEventMessage

        break;
    case 'saveIDCategToExclude':
        if (_saveConst($db, 'REMISE_ID_CATEG_TO_EXCLUDE', $_REQUEST['idcategtoexclude'])) {
            setEventMessage($langs->trans('IDCategSaved'));
        } else {
            setEventMessage($langs->trans('IDCategNotSaved'), 'errors');
        }
    case 'save':
        $const_name = array_keys($_REQUEST['TDivers'])[0];
        $val = $conf->global->{$const_name};
        $val = !$val;
        if ($const_name === 'REMISE_USE_THIRDPARTY_DISCOUNT' && !empty($val)) {
            dolibarr_set_const($db, 'REMISE_USE_THIRDPARTY_DISCOUNT', $val);
            dolibarr_set_const($db, 'REMISE_USE_WEIGHT', !$val);
            $e = new ExtraFields($db);
            $e->addExtraField('remsup', 'Remise supplémentaire', 'double', '', '24,8', 'societe');
        } elseif ($const_name === 'REMISE_USE_WEIGHT' && !empty($val)) {
            dolibarr_set_const($db, 'REMISE_USE_WEIGHT', $val);
            dolibarr_set_const($db, 'REMISE_USE_THIRDPARTY_DISCOUNT', !$val);
        } else {
            dolibarr_set_const($db, $const_name, $val);
        }
    default:
        break;
}
/*
 * View
 */
//print_r($TFraisDePort);
$page_name = "RemiseSetup";
llxHeader('', $langs->trans($page_name));
开发者ID:ATM-Consulting,项目名称:dolibarr_module_remise,代码行数:31,代码来源:admin_remise.php

示例13: init

 /**
  * Function called when module is enabled.
  * The init function add constants, boxes, permissions and menus
  * (defined in constructor) into Dolibarr database.
  * It also creates data directories
  *
  * 	@param		string	$options	Options when enabling module ('', 'noboxes')
  * 	@return		int					1 if OK, 0 if KO
  */
 public function init($options = '')
 {
     global $db, $conf;
     $sql = array();
     $result = $this->loadTables();
     // Création extrafield pour choix si remise doit apparaitre sur doc.
     dol_include_once('/core/class/extrafields.class.php');
     //function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0,$default_value='', $param=0)
     $ext = new ExtraFields($db);
     $res = $ext->addExtraField("use_remise", 'Automatisation des remises', 'select', 0, "", 'propal', 0, 0, '', array("options" => array("Oui" => "Oui", "Non" => "Non")));
     $res = $ext->addExtraField("use_remise", 'Automatisation des remises', 'select', 0, "", 'commande', 0, 0, '', array("options" => array("Oui" => "Oui", "Non" => "Non")));
     $res = $ext->addExtraField("use_remise", 'Automatisation des remises', 'select', 0, "", 'facture', 0, 0, '', array("options" => array("Oui" => "Oui", "Non" => "Non")));
     define('INC_FROM_DOLIBARR', true);
     dol_include_once('/remise/config.php');
     dol_include_once('/remise/class/remise.class.php');
     $PDOdb = new TPDOdb();
     $o = new TRemise();
     $o->init_db_by_vars($PDOdb);
     if (!empty($conf->global->REMISE_WEIGHT_ARRAY)) {
         $TRemise = unserialize($conf->global->REMISE_WEIGHT_ARRAY);
         foreach ($TRemise as $remise) {
             $o = new TRemise();
             $o->palier = $remise['weight'];
             $o->remise = $remise['remise'];
             $o->zip = $remise['zip'];
             $o->type = 'WEIGHT';
             $o->save($PDOdb);
         }
         dolibarr_del_const($db, 'REMISE_WEIGHT_ARRAY');
     }
     if (!empty($conf->global->REMISE_ARRAY)) {
         $TRemise = unserialize($conf->global->REMISE_ARRAY);
         foreach ($TRemise as $palier => $remise) {
             $o = new TRemise();
             $o->palier = $palier;
             $o->remise = $remise;
             $o->type = 'AMOUNT';
             $o->save($PDOdb);
         }
         dolibarr_del_const($db, 'REMISE_ARRAY');
     }
     return $this->_init($sql, $options);
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_remise,代码行数:52,代码来源:modRemise.class.php


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