Fix clone in recruitment module

This commit is contained in:
Laurent Destailleur 2020-11-09 09:13:24 +01:00
parent c5349a07a7
commit 136abc44e1
4 changed files with 18 additions and 12 deletions

View File

@ -71,3 +71,5 @@ YourCandidature=Your application
YourCandidatureAnswerMessage=Thanks you for your application.<br>...
JobClosedTextCandidateFound=The job position is closed. The position has been filled.
JobClosedTextCanceled=The job position is closed.
ExtrafieldsJobPosition=Complementary attributes (job positions)
ExtrafieldsCandidatures=Complementary attributes (job applications)

View File

@ -308,11 +308,12 @@ class MyObject extends CommonObject
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default'];
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
$object->status = self::STATUS_DRAFT;
if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)

View File

@ -277,11 +277,13 @@ class RecruitmentCandidature extends CommonObject
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default'];
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
$object->status = self::STATUS_DRAFT;
if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)

View File

@ -290,11 +290,12 @@ class RecruitmentJobPosition extends CommonObject
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default'];
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
$object->status = self::STATUS_DRAFT;
if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)