Better way to address the feature. Work in most cases, need less code
and less sql access.
This commit is contained in:
Laurent Destailleur 2018-11-15 18:20:38 +01:00
parent 103dfe2aa7
commit 7d5c9959bc
3 changed files with 21 additions and 3 deletions

View File

@ -431,4 +431,4 @@ SaleRepresentativeLogin=Login of sales representative
SaleRepresentativeFirstname=First name of sales representative
SaleRepresentativeLastname=Last name of sales representative
ErrorThirdpartiesMerge=There was an error when deleting the third parties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=New customer or vendor code suggested on duplicate code
NewCustomerSupplierCodeProposed=Customer or vendor code already used, a new code is suggested

View File

@ -184,6 +184,7 @@ ProjectsWithThisUserAsContact=Projects with this user as contact
TasksWithThisUserAsContact=Tasks assigned to this user
ResourceNotAssignedToProject=Not assigned to project
ResourceNotAssignedToTheTask=Not assigned to the task
NoUserAssignedToTheProject=No users assigned to this project
TimeSpentBy=Time spent by
TasksAssignedTo=Tasks assigned to
AssignTaskToMe=Assign task to me
@ -232,3 +233,4 @@ DontHaveTheValidateStatus=The project %s must be open to be closed
RecordsClosed=%s project(s) closed
SendProjectRef=Information project %s
ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Payment of employee wages' must be enabled to define employee hourly rate to have time spent valorized
NewTaskRefSuggested=Task ref already used, a new task ref is suggested

View File

@ -246,7 +246,16 @@ if ($action == 'createtask' && $user->rights->projet->creer)
}
else
{
setEventMessages($task->error,$task->errors,'errors');
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("projects");
setEventMessages($langs->trans('NewTaskRefSuggested'),'', 'warnings');
$duplicate_code_error = true;
}
else
{
setEventMessages($task->error,$task->errors,'errors');
}
$action = 'create';
$error++;
}
@ -464,7 +473,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
// Ref
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td>';
print ($_POST["ref"]?$_POST["ref"]:$defaultref);
if (empty($duplicate_code_error))
{
print (GETPOSTISSET("ref")?GETPOST("ref",'alpha'):$defaultref);
}
else
{
print $defaultref;
}
print '<input type="hidden" name="taskref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'">';
print '</td></tr>';