Clean code
This commit is contained in:
parent
4570da5463
commit
dbc5f5742f
@ -100,11 +100,11 @@ if (empty($xmlremote)) {
|
||||
}
|
||||
if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), '', 'errors');
|
||||
setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), null, 'errors');
|
||||
$error++;
|
||||
} elseif ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), '', 'errors');
|
||||
setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -2776,7 +2776,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
if (!empty($object->lines)) {
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
$ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 1);
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
|
||||
@ -2763,7 +2763,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
setEventMessages($langs->trans('Updated'), '', 'mesgs');
|
||||
setEventMessages($langs->trans('Updated'), null, 'mesgs');
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors');
|
||||
|
||||
@ -2037,13 +2037,13 @@ class ExtraFields
|
||||
/**
|
||||
* Fill array_options property of object by extrafields value (using for data sent by forms)
|
||||
*
|
||||
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
|
||||
* @param object $object Object
|
||||
* @param string $onlykey Only some keys are filled:
|
||||
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
|
||||
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
|
||||
* @param int $todefaultifmissing 1=Set value to the default value in database if value is mandatory and missing
|
||||
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
|
||||
* @param array|null $extralabels Deprecated (old $array of extrafields, now set this to null)
|
||||
* @param object $object Object
|
||||
* @param string $onlykey Only some keys are filled:
|
||||
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
|
||||
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
|
||||
* @param int $todefaultifmissing 1=Set value to the default value in database if value is mandatory and missing
|
||||
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
|
||||
*/
|
||||
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $todefaultifmissing = 0)
|
||||
{
|
||||
|
||||
@ -1022,7 +1022,7 @@ class FormTicket
|
||||
}
|
||||
$stringtoprint .= '<option '.$iselected.' class="'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
|
||||
if (empty($tabscript[$groupcodefather])) {
|
||||
$tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").val() == "'.dol_escape_js($groupcodefather).'"){
|
||||
$tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ?'_child_'.($levelid-1):'').'").val() == "'.dol_escape_js($groupcodefather).'"){
|
||||
$(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show()
|
||||
console.log("We show childs tickets of '.$groupcodefather.' group ticket")
|
||||
}else{
|
||||
@ -1040,7 +1040,7 @@ class FormTicket
|
||||
|
||||
$stringtoprint .='<script>';
|
||||
$stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';'; // when the last visible combo list is number x, this is the array of group
|
||||
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").val())){
|
||||
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.($levelid-1):'').'").val())){
|
||||
console.log("'.$htmlname.'_child_'.$levelid.'")
|
||||
if($("#'.$htmlname.'_child_'.$levelid.'").val() == "" && ($("#'.$htmlname.'_child_'.$levelid.'").attr("child_id")>'.$child_id.')){
|
||||
$("#'.$htmlname.'_child_'.$levelid.'").hide();
|
||||
@ -1052,7 +1052,7 @@ class FormTicket
|
||||
console.log("We choose '.$htmlname.' input and reload hidden input");
|
||||
}
|
||||
}
|
||||
$("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").change(function() {
|
||||
$("#'.$htmlname.($levelid > 1 ?'_child_'.($levelid-1):'').'").change(function() {
|
||||
child_id = $("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid:'').'").attr("child_id");
|
||||
|
||||
/* Change of value to select this value*/
|
||||
|
||||
@ -646,12 +646,14 @@ class Utils
|
||||
if (!$errormsg && $keeplastnfiles > 0) {
|
||||
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
|
||||
$i = 0;
|
||||
foreach ($tmpfiles as $key => $val) {
|
||||
$i++;
|
||||
if ($i <= $keeplastnfiles) {
|
||||
continue;
|
||||
if (is_array($tmpfiles)) {
|
||||
foreach ($tmpfiles as $key => $val) {
|
||||
$i++;
|
||||
if ($i <= $keeplastnfiles) {
|
||||
continue;
|
||||
}
|
||||
dol_delete_file($val['fullname'], 0, 0, 0, null, false, 0);
|
||||
}
|
||||
dol_delete_file($val['fullname'], 0, 0, 0, null, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1290,6 +1292,7 @@ class Utils
|
||||
$message = dol_escape_htmltag($langs->trans('MakeSendLocalDatabaseDumpShort'));
|
||||
}
|
||||
|
||||
$tmpfiles = array();
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
if ($filename) {
|
||||
if (dol_is_file($conf->admin->dir_output.'/backup/'.$filename)) {
|
||||
@ -1298,7 +1301,7 @@ class Utils
|
||||
} else {
|
||||
$tmpfiles = dol_most_recent_file($conf->admin->dir_output.'/backup', $filter);
|
||||
}
|
||||
if ($tmpfiles) {
|
||||
if ($tmpfiles && is_array($tmpfiles)) {
|
||||
foreach ($tmpfiles as $key => $val) {
|
||||
if ($key == 'fullname') {
|
||||
$filepath = array($val);
|
||||
|
||||
@ -1751,7 +1751,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
if ($allowoverwrite) {
|
||||
// Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS
|
||||
} else {
|
||||
setEventMessages('WarningFailedToAddFileIntoDatabaseIndex', '', 'warnings');
|
||||
setEventMessages('WarningFailedToAddFileIntoDatabaseIndex', null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2420,7 +2420,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
||||
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @param int $nohook Disable all hooks
|
||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||
* @return string Full path to most recent file
|
||||
* @return array Array with properties (full path, date, ...) of to most recent file
|
||||
*/
|
||||
function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = false, $mode = '')
|
||||
{
|
||||
|
||||
@ -971,7 +971,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages("NOT_AUTHOR", '', 'errors');
|
||||
setEventMessages("NOT_AUTHOR", null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -125,12 +125,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
} elseif (!empty($socid) && $socid > 0) {
|
||||
$fourn = new Fournisseur($db);
|
||||
$ret = $fourn->fetch($socid);
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
$object->socid = $fourn->id;
|
||||
$object->socid = $socid;
|
||||
$ret = $object->fetch_thirdparty();
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
@ -1874,19 +1869,13 @@ if ($action == 'create') {
|
||||
print "</form>\n";
|
||||
} elseif (!empty($object->id)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$societe = new Fournisseur($db);
|
||||
$result = $societe->fetch($object->socid);
|
||||
if ($result < 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$societe = $object->thirdparty;
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
|
||||
$head = ordersupplier_prepare_head($object);
|
||||
|
||||
$title = $langs->trans("SupplierOrder");
|
||||
@ -2415,7 +2404,7 @@ if ($action == 'create') {
|
||||
|
||||
// Show object lines
|
||||
if (!empty($object->lines)) {
|
||||
$ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1);
|
||||
$ret = $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 1);
|
||||
}
|
||||
|
||||
$num = count($object->lines);
|
||||
|
||||
@ -188,7 +188,7 @@ if (empty($reshook)) {
|
||||
$db->commit();
|
||||
|
||||
if ($nbok > 0) {
|
||||
setEventMessages('UpdateConfCPOK', '', 'mesgs');
|
||||
setEventMessages('UpdateConfCPOK', null, 'mesgs');
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
@ -29,6 +29,8 @@ use OAuth\Common\Storage\Exception\TokenNotFoundException;
|
||||
use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException;
|
||||
use DoliDB;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage storage of OAUTH2 in Dolibarr
|
||||
*/
|
||||
@ -68,7 +70,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
* @param Conf $conf Conf object
|
||||
* @param string $keyforprovider Key to manage several providers of the same type. For example 'abc' will be added to 'Google' to defined storage key.
|
||||
*/
|
||||
public function __construct(DoliDB $db, $conf, $keyforprovider = '')
|
||||
public function __construct(DoliDB $db, Conf $conf, $keyforprovider = '')
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->conf = $conf;
|
||||
|
||||
@ -197,11 +197,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST('type')) {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
@ -398,8 +398,8 @@ $tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0)
|
||||
if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
|
||||
$tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
|
||||
}
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
//var_dump($usertoprocess);
|
||||
//var_dump($projectsrole);
|
||||
//var_dump($taskrole);
|
||||
|
||||
@ -141,11 +141,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST('type')) {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -324,8 +324,8 @@ $tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0)
|
||||
if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
|
||||
$tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
|
||||
}
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($projectsrole);
|
||||
//var_dump($taskrole);
|
||||
|
||||
@ -203,11 +203,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST('type')) {
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -415,8 +415,8 @@ $tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0)
|
||||
if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
|
||||
$tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
|
||||
}
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($projectsrole);
|
||||
//var_dump($taskrole);
|
||||
|
||||
@ -296,7 +296,7 @@ class Projects extends DolibarrApi
|
||||
$userp = new User($this->db);
|
||||
$userp->fetch($userid);
|
||||
}
|
||||
$this->project->roles = $taskstatic->getUserRolesForProjectsOrTasks($userp, 0, $id, 0);
|
||||
$this->project->roles = $taskstatic->getUserRolesForProjectsOrTasks($userp, null, $id, 0);
|
||||
$result = array();
|
||||
foreach ($this->project->roles as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
|
||||
@ -296,7 +296,7 @@ class Tasks extends DolibarrApi
|
||||
$usert = new User($this->db);
|
||||
$usert->fetch($userid);
|
||||
}
|
||||
$this->task->roles = $this->task->getUserRolesForProjectsOrTasks(0, $usert, 0, $id);
|
||||
$this->task->roles = $this->task->getUserRolesForProjectsOrTasks(null, $usert, 0, $id);
|
||||
$result = array();
|
||||
foreach ($this->task->roles as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
|
||||
@ -971,12 +971,12 @@ class Task extends CommonObjectLine
|
||||
|
||||
if ($loadRoleMode) {
|
||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, null, $obj->projectid, 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (is_object($usert)) { // If we ask a filter on a user affected to a task
|
||||
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
|
||||
if (!$this->getUserRolesForProjectsOrTasks(null, $usert, $obj->projectid, $obj->taskid)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1056,12 +1056,12 @@ class Task extends CommonObjectLine
|
||||
/**
|
||||
* Return list of roles for a user for each projects or each tasks (or a particular project or a particular task).
|
||||
*
|
||||
* @param User $userp Return roles on project for this internal user. If set, usert and taskid must not be defined.
|
||||
* @param User $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter.
|
||||
* @param int $projectid Project id list separated with , to filter on project
|
||||
* @param int $taskid Task id to filter on a task
|
||||
* @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
|
||||
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
|
||||
* @param User|null $userp Return roles on project for this internal user. If set, usert and taskid must not be defined.
|
||||
* @param User|null $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter.
|
||||
* @param int $projectid Project id list separated with , to filter on project
|
||||
* @param int $taskid Task id to filter on a task
|
||||
* @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
|
||||
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
|
||||
*/
|
||||
public function getUserRolesForProjectsOrTasks($userp, $usert, $projectid = '', $taskid = 0, $filteronprojstatus = -1)
|
||||
{
|
||||
|
||||
@ -259,7 +259,7 @@ print load_fiche_titre($title, $linktotasks.' '.$linktocreatetask, 'proje
|
||||
// can have a parent that is not affected to him).
|
||||
$tasksarray = $task->getTasksArray(0, 0, ($object->id ? $object->id : $id), $socid, 0);
|
||||
// We load also tasks limited to a particular user
|
||||
//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : '');
|
||||
//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(null, $user, $object->id, 0) : '');
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($tasksrole);
|
||||
|
||||
|
||||
@ -357,7 +357,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) {
|
||||
} else {
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("projects");
|
||||
setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings');
|
||||
setEventMessages($langs->trans('NewTaskRefSuggested'), null, 'warnings');
|
||||
$duplicate_code_error = true;
|
||||
} else {
|
||||
setEventMessages($task->error, $task->errors, 'errors');
|
||||
@ -862,7 +862,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
$tmpuser->fetch($search_user_id);
|
||||
}
|
||||
|
||||
$tasksrole = ($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(0, $tmpuser, $object->id, 0) : '');
|
||||
$tasksrole = ($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(null, $tmpuser, $object->id, 0) : '');
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($tasksrole);
|
||||
|
||||
|
||||
@ -308,7 +308,7 @@ if ($action == 'add' && empty($cancel)) {
|
||||
$db->commit();
|
||||
|
||||
if (GETPOST('saveandnew', 'alpha')) {
|
||||
setEventMessages($langs->trans("RecordSaved"), '', 'mesgs');
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOST('paymenttype', 'az09')) . '&datepday=' . GETPOST("datepday", 'int') . '&datepmonth=' . GETPOST("datepmonth", 'int') . '&datepyear=' . GETPOST("datepyear", 'int'));
|
||||
exit;
|
||||
} else {
|
||||
|
||||
@ -1105,7 +1105,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->fournisseur = GETPOST('fournisseur') ? GETPOST('fournisseur', 'int') : $object->fournisseur;
|
||||
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
|
||||
} else {
|
||||
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings');
|
||||
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), null, 'warnings');
|
||||
}
|
||||
|
||||
$object->address = GETPOST('address', 'alphanohtml');
|
||||
|
||||
@ -543,7 +543,7 @@ if (empty($reshook)) {
|
||||
$sql .= ", fk_soc=".((int) $contact->socid);
|
||||
} elseif ($socid > 0) {
|
||||
$sql .= ", fk_soc = null";
|
||||
setEventMessages($langs->trans("WarningUserDifferentContactSocid"), '', 'warnings'); // Add message if post socid != $contact->socid
|
||||
setEventMessages($langs->trans("WarningUserDifferentContactSocid"), null, 'warnings'); // Add message if post socid != $contact->socid
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $object->id);
|
||||
} elseif ($socid > 0) {
|
||||
|
||||
@ -34,4 +34,9 @@ exclude:
|
||||
- name: PhpDeprecationInspection
|
||||
- name: PhpStatementHasEmptyBodyInspection
|
||||
- name: PhpConditionAlreadyCheckedInspection
|
||||
- name: PhpExpressionResultUnusedInspection
|
||||
- name: PhpUndefinedClassInspection
|
||||
- name: RegExpSimplifiable
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user