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


PHP Task::add_contact方法代码示例

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


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

示例1: createFromClone


//.........这里部分代码省略.........
        	}

			//Duplicate file
			if ($clone_file)
			{
				require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");

				//retreive project origin ref to know folder to copy
				$projectstatic=new Project($this->db);
	        	$projectstatic->fetch($ori_project_id);
	        	$ori_project_ref=$projectstatic->ref;

	        	if ($ori_project_id!=$project_id)
	        	{
	        		$projectstatic->fetch($project_id);
	        		$clone_project_ref=$projectstatic->ref;
	        	}
	        	else
	        	{
	        		$clone_project_ref=$ori_project_ref;
	        	}

				$clone_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($clone_project_ref). "/" . dol_sanitizeFileName($clone_task_id);
				$ori_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($ori_project_ref). "/" . dol_sanitizeFileName($fromid);

				$filearray=dol_dir_list($ori_task_dir,"files",0,'','\.meta$','',SORT_ASC,1);
				foreach($filearray as $key => $file)
				{
					if (!file_exists($clone_task_dir))
					{
						if (dol_mkdir($clone_task_dir) < 0)
						{
							$this->error.=$langs->trans('ErrorInternalErrorDetected').':dol_mkdir';
							$error++;
						}
					}

					$rescopy = dol_copy($ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name'],0,1);
					if (is_numeric($rescopy) && $rescopy < 0)
					{
						$this->error.=$langs->trans("ErrorFailToCopyFile",$ori_task_dir . '/' . $file['name'],$clone_task_dir . '/' . $file['name']);
						$error++;
					}
				}
			}

			// clone affectation
			if ($clone_affectation)
			{
				$origin_task = new Task($this->db);
				$origin_task->fetch($fromid);

				foreach(array('internal','external') as $source)
				{
					$tab = $origin_task->liste_contact(-1,$source);
					$num=count($tab);
					$i = 0;
					while ($i < $num)
					{
						$clone_task->add_contact($tab[$i]['id'], $tab[$i]['code'], $tab[$i]['source']);
						if ($clone_task->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
						{
							$langs->load("errors");
							$this->error.=$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
							$error++;
						}
						else
						{
							if ($clone_task->error!='')
							{
								$this->error.=$clone_task->error;
								$error++;
							}
						}
						$i++;
					}
				}
			}

			if($clone_time)
			{
				//TODO clone time of affectation
			}

			if (! $error)
			{
				return $clone_task_id;
			}
			else
			{
				dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : " . $this->error, LOG_ERR);
				return -1;
			}
		}
		else
		{
			$this->db->rollback();
			return -1;
		}
	}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:task.class.php

示例2: setEventMessages

 if ($taskid > 0) {
     $result = $object->fetch($taskid, $ref);
     if ($result < 0) {
         $error++;
     }
 } else {
     setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
     $error++;
 }
 if (!GETPOST('type')) {
     setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
     $error++;
 }
 if (!$error) {
     $idfortaskuser = $user->id;
     $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
     if ($result >= 0 || $result == -2) {
         // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
         $sql = 'SELECT ec.rowid FROM ' . MAIN_DB_PREFIX . 'element_contact as ec, ' . MAIN_DB_PREFIX . 'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
         $sql .= ' AND ec.fk_socpeople = ' . $idfortaskuser . " AND ec.element_id = '.{$object->fk_project}.' AND tc.element = 'project' AND source = 'internal'";
         $resql = $db->query($sql);
         if ($resql) {
             $obj = $db->fetch_object($resql);
             if (!$obj) {
                 $project = new Project($db);
                 $project->fetch($object->fk_project);
                 // Get type
                 $listofprojcontact = $project->liste_type_contact('internal');
                 if (count($listofprojcontact)) {
                     $typeforprojectcontact = reset(array_keys($listofprojcontact));
                     $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:perday.php

示例3: GETPOST

 * Actions
 */
// Add new contact
if ($action == 'addcontact' && $user->rights->projet->creer) {
    $result = $object->fetch($id, $ref);
    if ($result > 0 && $id > 0) {
        $idfortaskuser = GETPOST("contactid") != 0 ? GETPOST("contactid") : GETPOST("userid");
        // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
        if ($idfortaskuser == -2) {
            $result = $projectstatic->fetch($object->fk_project);
            if ($result <= 0) {
                dol_print_error($db, $projectstatic->error, $projectstatic->errors);
            } else {
                $contactsofproject = $projectstatic->getListContactId('internal');
                foreach ($contactsofproject as $key => $val) {
                    $result = $object->add_contact($val, GETPOST("type"), GETPOST("source"));
                }
            }
        } else {
            $result = $object->add_contact($idfortaskuser, GETPOST("type"), GETPOST("source"));
        }
    }
    if ($result >= 0) {
        header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $object->id . ($withproject ? '&withproject=1' : ''));
        exit;
    } else {
        if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
            setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
        } else {
            setEventMessage($object->error, 'errors');
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:contact.php

示例4: Task

			$task = new Task($db);

			$task->fk_project = $projectid;
			$task->label = $_POST["label"];
			$task->description = $_POST['description'];
			$task->fk_task_parent = $task_parent;
			$task->date_c = dol_now();
			$task->date_start = $date_start;
			$task->date_end = $date_end;
			$task->progress = $_POST['progress'];

			$taskid = $task->create($user);

			if ($taskid > 0)
			{
				$result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
			}
		}

		if (! $error)
		{
			if (empty($projectid))
			{
				Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($_REQUEST["mode"])?'':'?mode='.$_REQUEST["mode"]));
				exit;
			}
			else
			{
				Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid);
				exit;
			}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:tasks.php

示例5: _set_user_in_task

function _set_user_in_task($taskid, $userid)
{
    global $db;
    $task = new Task($db);
    $task->fetch($taskid);
    return $task->add_contact($userid, 180, 'internal');
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_scrumboard,代码行数:7,代码来源:interface.php

示例6: Task

$object = new Task($db);
$projectstatic = new Project($db);


/*
 * Actions
 */

// Add new contact
if ($action == 'addcontact' && $user->rights->projet->creer)
{
	$result = $object->fetch($id);

    if ($result > 0 && $id > 0)
    {
  		$result = $object->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
    }

	if ($result >= 0)
	{
		Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject?'&withproject=1':''));
		exit;
	}
	else
	{
		if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
		{
			$langs->load("errors");
			$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
		}
		else
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:contact.php

示例7: Task

/*
 * Actions
 */

// Add new contact
if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer)
{

	$result = 0;
	$task = new Task($db);
	$result = $task->fetch($taskid);

    if ($result > 0 && $taskid > 0)
    {
  		$result = $task->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
    }

	if ($result >= 0)
	{
		Header("Location: contact.php?id=".$task->id);
		exit;
	}
	else
	{
		if ($task->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
		{
			$langs->load("errors");
			$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
		}
		else
开发者ID:remyyounes,项目名称:dolibarr,代码行数:30,代码来源:contact.php


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