Signatures of methods createFromClone() has been standardized. All

methods requires the object User as first parameter.
This commit is contained in:
Laurent Destailleur 2019-04-25 12:11:32 +02:00
parent e08959484d
commit 091132de2f
44 changed files with 138 additions and 173 deletions

View File

@ -28,6 +28,7 @@ Following changes may create regressions for some external modules, but were nec
* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming
convention of extension .inc.php for files to be included.
* All methods set_draft() were renamed into setDraft().
* Signatures of methods createFromClone() has been standardized. All methods requires the object User as first parameter.
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.

View File

@ -1409,16 +1409,14 @@ class BookKeeping extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new BookKeeping($this->db);

View File

@ -604,11 +604,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook))
{
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=edit">' . $langs->trans("Edit") . '</a>' . "\n";
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=edit">' . $langs->trans("Edit") . '</a></div>';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=collect">' . $langs->trans("CollectNow") . '</a>' . "\n";
// Clone
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=order">' . $langs->trans("ToClone") . '</a></div>';
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=delete">' . $langs->trans('Delete') . '</a>' . "\n";
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=collect">' . $langs->trans("CollectNow") . '</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=delete">' . $langs->trans('Delete') . '</a></div>';
}
print '</div>' . "\n";
}

View File

@ -164,7 +164,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
}
$result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid'));
$result = $object->createFromClone($user, GETPOST('fk_userowner'), GETPOST('socid'));
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();

View File

@ -87,14 +87,14 @@ class ActionComm extends CommonObject
* @var string Agenda event label
*/
public $label;
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
/**
* Date modification record (tms)
*
@ -129,14 +129,14 @@ class ActionComm extends CommonObject
* @var int
*/
public $usermodid;
/**
* Date action start (datep)
*
* @var integer
*/
public $datep;
/**
* Date action end (datep2)
*
@ -504,13 +504,13 @@ class ActionComm extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param user $fuser Object user making action
* @param User $fuser Object user making action
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
public function createFromClone($fuser, $socid)
public function createFromClone(User $fuser, $socid)
{
global $db, $user, $langs, $conf, $hookmanager;
global $db, $conf, $hookmanager;
$error=0;
$now=dol_now();
@ -529,20 +529,6 @@ class ActionComm extends CommonObject
$this->id=0;
if (!is_object($fuser))
{
if ($fuser > 0)
{
$u = new User($db);
$u->fetch($fuser);
$fuser = $u;
}
else
{
$fuser = $user;
}
}
// Create clone
$this->context['createfromclone']='createfromclone';
$result=$this->create($fuser);

View File

@ -97,7 +97,7 @@ if (empty($reshook))
}
else
{
$result=$object->createFromClone($object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
$result=$object->createFromClone($user, $object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -266,14 +266,15 @@ class Mailing extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @param int $option1 1=Copy content, 0=Forget content
* @param int $option2 Not used
* @return int New id of clone
*/
public function createFromClone($fromid, $option1, $option2)
public function createFromClone(User $user, $fromid, $option1, $option2)
{
global $user,$langs;
global $langs;
$error=0;

View File

@ -192,7 +192,7 @@ if (empty($reshook))
}
}
$result = $object->createFromClone($socid);
$result = $object->createFromClone($user, $socid);
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();

View File

@ -473,7 +473,7 @@ class Propal extends CommonObject
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@ -690,7 +690,7 @@ class Propal extends CommonObject
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if (empty($type)) $type=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@ -1226,12 +1226,13 @@ class Propal extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @return int New id of clone
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
public function createFromClone($socid = 0)
public function createFromClone(User $user, $socid = 0)
{
global $user,$conf,$hookmanager;
global $conf,$hookmanager;
dol_include_once('/projet/class/project.class.php');

View File

@ -142,7 +142,7 @@ if (empty($reshook))
// Because createFromClone modifies the object, we must clone it so that we can restore it later
$orig = clone $object;
$result=$object->createFromClone($socid);
$result=$object->createFromClone($user, $socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -1070,10 +1070,11 @@ class Commande extends CommonOrder
/**
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @return int New id of clone
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
public function createFromClone($socid = 0)
public function createFromClone(User $user, $socid = 0)
{
global $conf, $user,$hookmanager;

View File

@ -269,13 +269,12 @@ class BankCateg // extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user;
$error = 0;
$object = new BankCateg($this->db);

View File

@ -393,13 +393,12 @@ class PaymentTerm // extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new PaymentTerm($this->db);

View File

@ -346,15 +346,14 @@ class Cchargesociales
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Cchargesociales($this->db);

View File

@ -448,13 +448,12 @@ class PaymentSocialContribution extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new PaymentSocialContribution($this->db);

View File

@ -1072,7 +1072,7 @@ if (empty($reshook))
else
{
if ($object->id > 0) {
$result = $object->createFromClone($socid);
$result = $object->createFromClone($user, $socid);
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();

View File

@ -2388,13 +2388,14 @@ class Contrat extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int New id of clone
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int New id of clone
*/
public function createFromClone($socid = 0, $notrigger = 0)
public function createFromClone(User $user, $socid = 0, $notrigger = 0)
{
global $db, $user, $langs, $conf, $hookmanager, $extrafields;
global $db, $langs, $conf, $hookmanager, $extrafields;
dol_include_once('/projet/class/project.class.php');

View File

@ -195,23 +195,6 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
}
}
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
{
$objectutil = dol_clone($object); // To avoid to denaturate loaded object when setting some properties for clone
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
$result = $objectutil->createFromClone($id);
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result);
exit();
} else {
$langs->load("errors");
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
$action = '';
}
}
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
{

View File

@ -404,15 +404,14 @@ class Ctyperesource
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Ctyperesource($this->db);

View File

@ -64,7 +64,7 @@ class modEmailCollector extends DolibarrModules
$this->descriptionlong = "EmailCollectorDescription";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'experimental';
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.

View File

@ -736,13 +736,12 @@ class Cronjob extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new Cronjob($this->db);

View File

@ -408,13 +408,12 @@ class PaymentDonation extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new PaymentDonation($this->db);

View File

@ -707,15 +707,14 @@ class EcmFiles extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Ecmfiles($this->db);

View File

@ -171,7 +171,7 @@ if (empty($reshook))
// Because createFromClone modifies the object, we must clone it so that we can restore it later if it fails
$orig = clone $object;
$result=$object->createFromClone(GETPOST('fk_user_author', 'int'));
$result=$object->createFromClone($user, GETPOST('fk_user_author', 'int'));
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -314,12 +314,13 @@ class ExpenseReport extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fk_user_author Id of new user
* @return int New id of clone
* @param User $user User making the clone
* @param int $fk_user_author Id of new user
* @return int New id of clone
*/
public function createFromClone($fk_user_author)
public function createFromClone(User $user, $fk_user_author)
{
global $user,$hookmanager;
global $hookmanager;
$error=0;

View File

@ -414,13 +414,12 @@ class PaymentExpenseReport extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new PaymentExpenseReport($this->db);

View File

@ -134,7 +134,7 @@ if (empty($reshook))
// Because createFromClone modifies the object, we must clone it so that we can restore it later
$orig = clone $object;
$result=$object->createFromClone($socid);
$result=$object->createFromClone($user, $socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -1144,12 +1144,13 @@ class Fichinter extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @return int New id of clone
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
public function createFromClone($socid = 0)
public function createFromClone(User $user, $socid = 0)
{
global $user,$hookmanager;
global $hookmanager;
$error=0;

View File

@ -1409,11 +1409,12 @@ class CommandeFournisseur extends CommonOrder
/**
* Load an object from its id and create a new one in database
*
* @return int New id of clone
* @param User $user User making the clone
* @return int New id of clone
*/
public function createFromClone()
public function createFromClone(User $user)
{
global $conf,$user,$langs,$hookmanager;
global $hookmanager;
$error=0;

View File

@ -472,13 +472,12 @@ class CommandeFournisseurDispatch extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new Commandefournisseurdispatch($this->db);

View File

@ -955,7 +955,7 @@ $result = $object->updateline(
{
if ($object->id > 0)
{
$result=$object->createFromClone();
$result=$object->createFromClone($user);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);

View File

@ -1829,6 +1829,7 @@ MailboxSourceDirectory=Mailbox source directory
MailboxTargetDirectory=Mailbox target directory
EmailcollectorOperations=Operations to do by collector
CollectNow=Collect now
ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ?
DateLastCollectResult=Date latest collect tried
DateLastcollectResultOk=Date latest collect successfull
LastResult=Latest result

View File

@ -327,13 +327,12 @@ class Productbatch extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new Productbatch($this->db);

View File

@ -895,14 +895,12 @@ class Productcustomerprice extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid of object to clone
* @return int id of clone
* @param User $user User making the clone
* @param int $fromid ID of object to clone
* @return int id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user, $langs;
$error = 0;
$object = new Productcustomerprice($this->db);

View File

@ -560,13 +560,12 @@ class Propalmergepdfproduct extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user,$langs;
$error=0;
$object=new Propalmergepdfproduct($this->db);

View File

@ -426,15 +426,14 @@ class Productlot extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Productlot($this->db);

View File

@ -420,15 +420,14 @@ class ProductStockEntrepot extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new ProductStockEntrepot($this->db);

View File

@ -429,7 +429,7 @@ if (empty($reshook))
$move_date=GETPOST('move_date')?1:0;
$clone_thirdparty=GETPOST('socid', 'int')?GETPOST('socid', 'int'):0;
$result=$object->createFromClone($object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
$result=$object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1274,20 +1274,21 @@ class Project extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @param bool $clone_contact Clone contact of project
* @param bool $clone_task Clone task of project
* @param bool $clone_project_file Clone file of project
* @param bool $clone_task_file Clone file of task (if task are copied)
* @param bool $clone_note Clone note of project
* @param bool $move_date Move task date on clone
* @param integer $notrigger No trigger flag
* @param int $newthirdpartyid New thirdparty id
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @param bool $clone_contact Clone contact of project
* @param bool $clone_task Clone task of project
* @param bool $clone_project_file Clone file of project
* @param bool $clone_task_file Clone file of task (if task are copied)
* @param bool $clone_note Clone note of project
* @param bool $move_date Move task date on clone
* @param integer $notrigger No trigger flag
* @param int $newthirdpartyid New thirdparty id
* @return int New id of clone
*/
public function createFromClone($fromid, $clone_contact = false, $clone_task = true, $clone_project_file = false, $clone_task_file = false, $clone_note = true, $move_date = true, $notrigger = 0, $newthirdpartyid = 0)
public function createFromClone(User $user, $fromid, $clone_contact = false, $clone_task = true, $clone_project_file = false, $clone_task_file = false, $clone_note = true, $move_date = true, $notrigger = 0, $newthirdpartyid = 0)
{
global $user,$langs,$conf;
global $langs,$conf;
$error=0;
@ -1477,7 +1478,7 @@ class Project extends CommonObject
// Loop on each task, to clone it
foreach ($tasksarray as $tasktoclone)
{
$result_clone = $taskstatic->createFromClone($tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false);
$result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false);
if ($result_clone <= 0)
{
$this->error.=$result_clone->error;

View File

@ -1587,6 +1587,7 @@ class Task extends CommonObject
/** Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $fromid Id of object to clone
* @param int $project_id Id of project to attach clone task
* @param int $parent_task_id Id of task to attach clone task
@ -1598,9 +1599,9 @@ class Task extends CommonObject
* @param bool $clone_prog clone progress of project
* @return int New id of clone
*/
public function createFromClone($fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false)
public function createFromClone(User $user, $fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false)
{
global $user,$langs,$conf;
global $langs,$conf;
$error=0;

View File

@ -136,7 +136,7 @@ if (empty($reshook))
else
{
if ($object->id > 0) {
$result = $object->createFromClone($socid);
$result = $object->createFromClone($user, $socid);
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();

View File

@ -1117,12 +1117,13 @@ class SupplierProposal extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @return int New id of clone
* @param User $user User making the clone
* @param int $fromid Id of thirdparty
* @return int New id of clone
*/
public function createFromClone($socid = 0)
public function createFromClone(User $user, $fromid = 0)
{
global $user,$langs,$conf,$hookmanager;
global $conf,$hookmanager;
$error=0;
$now=dol_now();
@ -1139,9 +1140,9 @@ class SupplierProposal extends CommonObject
$objsoc=new Societe($this->db);
// Change socid if needed
if (! empty($socid) && $socid != $this->socid)
if (! empty($fromid) && $fromid != $this->socid)
{
if ($objsoc->fetch($socid) > 0)
if ($objsoc->fetch($fromid) > 0)
{
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);

View File

@ -950,13 +950,12 @@ class Ticket extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @return int New id of clone
* @param User $user User that clone
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
public function createFromClone(User $user, $fromid)
{
global $user, $langs;
$error = 0;
$object = new Ticket($this->db);

View File

@ -519,7 +519,7 @@ class Website extends CommonObject
*/
public function createFromClone($user, $fromid, $newref, $newlang = '')
{
global $conf, $hookmanager, $langs;
global $conf, $hookmanager;
global $dolibarr_main_data_root;
$now = dol_now();