Management of the "Copy of" when cloning projects.
This commit is contained in:
parent
30e6dd93a6
commit
ee1ee1eee7
@ -1032,7 +1032,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->ref_supplier))
|
if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->ref_supplier))
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("RefSupplier"));
|
$this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("RefSupplier")).'. '.$langs->trans('RemoveString',$langs->transnoentitiesnoconv("CopyOf"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -737,6 +737,7 @@ Miscellaneous=Miscellaneous
|
|||||||
Calendar=Calendar
|
Calendar=Calendar
|
||||||
GroupBy=Group by...
|
GroupBy=Group by...
|
||||||
ViewFlatList=View flat list
|
ViewFlatList=View flat list
|
||||||
|
RemoveString=Remove string '%s'
|
||||||
# Week day
|
# Week day
|
||||||
Monday=Monday
|
Monday=Monday
|
||||||
Tuesday=Tuesday
|
Tuesday=Tuesday
|
||||||
|
|||||||
@ -661,7 +661,7 @@ else
|
|||||||
{
|
{
|
||||||
$formquestion=array(
|
$formquestion=array(
|
||||||
'text' => $langs->trans("ConfirmClone"),
|
'text' => $langs->trans("ConfirmClone"),
|
||||||
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int')>0?GETPOST('socid', 'int'):$object->socid, 'socid', '', "None")),
|
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int')>0?GETPOST('socid', 'int'):$object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200')),
|
||||||
array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
|
array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
|
||||||
array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
|
array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
|
||||||
array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
|
array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
|
||||||
@ -670,7 +670,7 @@ else
|
|||||||
array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
|
array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
|
||||||
);
|
);
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 300);
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 300, 590);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -705,6 +705,13 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
if ($this->statut != 1)
|
if ($this->statut != 1)
|
||||||
{
|
{
|
||||||
|
// Check parameters
|
||||||
|
if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->title))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("Label")).'. '.$langs->trans('RemoveString',$langs->transnoentitiesnoconv("CopyOf"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "projet";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "projet";
|
||||||
@ -1196,6 +1203,7 @@ class Project extends CommonObject
|
|||||||
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
||||||
|
|
||||||
$clone_project->ref=$defaultref;
|
$clone_project->ref=$defaultref;
|
||||||
|
$clone_project->title=$langs->trans("CopyOf").' '.$clone_project->title;
|
||||||
|
|
||||||
// Create clone
|
// Create clone
|
||||||
$result=$clone_project->create($user,$notrigger);
|
$result=$clone_project->create($user,$notrigger);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user