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


PHP Propal::callHooks方法代码示例

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


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

示例1: createFromClone

 /**
  *		Load an object from its id and create a new one in database
  *		@param      fromid     		Id of object to clone
  *		@param		invertdetail	Reverse sign of amounts for lines
  *		@param		socid			Id of thirdparty
  * 	 	@return		int				New id of clone
  */
 function createFromClone($fromid, $invertdetail = 0, $socid = 0)
 {
     global $user, $langs, $conf;
     $error = 0;
     $now = dol_now();
     $object = new Propal($this->db);
     // Instantiate hooks of thirdparty module
     if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) {
         $object->callHooks('propalcard');
     }
     $this->db->begin();
     // Load source object
     $object->fetch($fromid);
     $objFrom = $object;
     $objsoc = new Societe($this->db);
     // Change socid if needed
     if (!empty($socid) && $socid != $object->socid) {
         if ($objsoc->fetch($socid) > 0) {
             $object->socid = $objsoc->id;
             $object->cond_reglement_id = !empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0;
             $object->mode_reglement_id = !empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0;
             $object->fk_project = '';
             $object->fk_delivery_address = '';
         }
         // TODO Change product price if multi-prices
     } else {
         $objsoc->fetch($object->socid);
     }
     $object->id = 0;
     $object->statut = 0;
     $objsoc->fetch($object->socid);
     if (empty($conf->global->PROPALE_ADDON) || !is_readable(DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php")) {
         $this->error = 'ErrorSetupNotComplete';
         return -1;
     }
     // Clear fields
     $object->user_author = $user->id;
     $object->user_valid = '';
     $object->date = '';
     $object->datep = $now;
     $object->fin_validite = $object->datep + $this->duree_validite * 24 * 3600;
     $object->ref_client = '';
     // Set ref
     require_once DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php";
     $obj = $conf->global->PROPALE_ADDON;
     $modPropale = new $obj();
     $object->ref = $modPropale->getNextValue($objsoc, $object);
     // Create clone
     $result = $object->create($user);
     // Other options
     if ($result < 0) {
         $this->error = $object->error;
         $error++;
     }
     if (!$error) {
         // Hook for external modules
         if (!empty($object->hooks)) {
             foreach ($object->hooks as $hook) {
                 if (!empty($hook['modules'])) {
                     foreach ($hook['modules'] as $module) {
                         if (method_exists($module, 'createfrom')) {
                             $result = $module->createfrom($objFrom, $result, $object->element);
                             if ($result < 0) {
                                 $error++;
                             }
                         }
                     }
                 }
             }
         }
         // Appel des triggers
         include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
         $interface = new Interfaces($this->db);
         $result = $interface->run_triggers('PROPAL_CLONE', $object, $user, $langs, $conf);
         if ($result < 0) {
             $error++;
             $this->errors = $interface->errors;
         }
         // Fin appel triggers
     }
     // End
     if (!$error) {
         $this->db->commit();
         return $object->id;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:rafso,项目名称:cliente,代码行数:96,代码来源:propal.class.php

示例2: if

	$module='societe';
	$dbtable='';
}
else if (isset($id) &&  $id > 0)
{
	$objectid=$id;
	$module='propale';
	$dbtable='propal';
}
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, $module, $objectid, $dbtable);

// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
{
	$object->callHooks('propalcard');
}


/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/

// Hook of actions
if (! empty($object->hooks))
{
	foreach($object->hooks as $hook)
	{
		if (! empty($hook['modules']))
		{
			foreach($hook['modules'] as $module)
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:propal.php


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