Signatures of methods createFromClone() has been standardized. All
methods requires the object User as first parameter.
This commit is contained in:
parent
e08959484d
commit
091132de2f
@ -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
|
* 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.
|
convention of extension .inc.php for files to be included.
|
||||||
* All methods set_draft() were renamed into setDraft().
|
* 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.
|
* 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.
|
* 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.
|
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
|
||||||
|
|||||||
@ -1409,16 +1409,14 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new BookKeeping($this->db);
|
$object = new BookKeeping($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -604,11 +604,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Edit") . '</a>' . "\n";
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Edit") . '</a></div>';
|
||||||
|
|
||||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=collect">' . $langs->trans("CollectNow") . '</a>' . "\n";
|
// Clone
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||||
|
|
||||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a>' . "\n";
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=collect">' . $langs->trans("CollectNow") . '</a></div>';
|
||||||
|
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||||
}
|
}
|
||||||
print '</div>' . "\n";
|
print '</div>' . "\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -164,7 +164,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
|||||||
reset($object->socpeopleassigned);
|
reset($object->socpeopleassigned);
|
||||||
$object->contactid = key($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) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@ -504,13 +504,13 @@ class ActionComm extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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
|
* @param int $socid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
@ -529,20 +529,6 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
$this->id=0;
|
$this->id=0;
|
||||||
|
|
||||||
if (!is_object($fuser))
|
|
||||||
{
|
|
||||||
if ($fuser > 0)
|
|
||||||
{
|
|
||||||
$u = new User($db);
|
|
||||||
$u->fetch($fuser);
|
|
||||||
$fuser = $u;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$fuser = $user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create clone
|
// Create clone
|
||||||
$this->context['createfromclone']='createfromclone';
|
$this->context['createfromclone']='createfromclone';
|
||||||
$result=$this->create($fuser);
|
$result=$this->create($fuser);
|
||||||
|
|||||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
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)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
|||||||
@ -266,14 +266,15 @@ class Mailing extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @param int $option1 1=Copy content, 0=Forget content
|
* @param int $option1 1=Copy content, 0=Forget content
|
||||||
* @param int $option2 Not used
|
* @param int $option2 Not used
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -192,7 +192,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->createFromClone($socid);
|
$result = $object->createFromClone($user, $socid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@ -1226,12 +1226,13 @@ class Propal extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @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');
|
dol_include_once('/projet/class/project.class.php');
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if (empty($reshook))
|
|||||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||||
$orig = clone $object;
|
$orig = clone $object;
|
||||||
|
|
||||||
$result=$object->createFromClone($socid);
|
$result=$object->createFromClone($user, $socid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
|||||||
@ -1070,10 +1070,11 @@ class Commande extends CommonOrder
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($socid = 0)
|
public function createFromClone(User $user, $socid = 0)
|
||||||
{
|
{
|
||||||
global $conf, $user,$hookmanager;
|
global $conf, $user,$hookmanager;
|
||||||
|
|
||||||
|
|||||||
@ -269,13 +269,12 @@ class BankCateg // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object = new BankCateg($this->db);
|
$object = new BankCateg($this->db);
|
||||||
|
|||||||
@ -393,13 +393,12 @@ class PaymentTerm // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new PaymentTerm($this->db);
|
$object=new PaymentTerm($this->db);
|
||||||
|
|||||||
@ -346,15 +346,14 @@ class Cchargesociales
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Cchargesociales($this->db);
|
$object = new Cchargesociales($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -448,13 +448,12 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new PaymentSocialContribution($this->db);
|
$object=new PaymentSocialContribution($this->db);
|
||||||
|
|||||||
@ -1072,7 +1072,7 @@ if (empty($reshook))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->createFromClone($socid);
|
$result = $object->createFromClone($user, $socid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@ -2388,13 +2388,14 @@ class Contrat extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int New id of clone
|
* @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');
|
dol_include_once('/projet/class/project.class.php');
|
||||||
|
|
||||||
|
|||||||
@ -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
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -404,15 +404,14 @@ class Ctyperesource
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Ctyperesource($this->db);
|
$object = new Ctyperesource($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class modEmailCollector extends DolibarrModules
|
|||||||
$this->descriptionlong = "EmailCollectorDescription";
|
$this->descriptionlong = "EmailCollectorDescription";
|
||||||
|
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
// 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)
|
// 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);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
// Name of image file used for this module.
|
// Name of image file used for this module.
|
||||||
|
|||||||
@ -736,13 +736,12 @@ class Cronjob extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Cronjob($this->db);
|
$object=new Cronjob($this->db);
|
||||||
|
|||||||
@ -408,13 +408,12 @@ class PaymentDonation extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new PaymentDonation($this->db);
|
$object=new PaymentDonation($this->db);
|
||||||
|
|||||||
@ -707,15 +707,14 @@ class EcmFiles extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Ecmfiles($this->db);
|
$object = new Ecmfiles($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -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
|
// Because createFromClone modifies the object, we must clone it so that we can restore it later if it fails
|
||||||
$orig = clone $object;
|
$orig = clone $object;
|
||||||
|
|
||||||
$result=$object->createFromClone(GETPOST('fk_user_author', 'int'));
|
$result=$object->createFromClone($user, GETPOST('fk_user_author', 'int'));
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
|||||||
@ -314,12 +314,13 @@ class ExpenseReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @param int $fk_user_author Id of new user
|
* @param int $fk_user_author Id of new user
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -414,13 +414,12 @@ class PaymentExpenseReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new PaymentExpenseReport($this->db);
|
$object=new PaymentExpenseReport($this->db);
|
||||||
|
|||||||
@ -134,7 +134,7 @@ if (empty($reshook))
|
|||||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||||
$orig = clone $object;
|
$orig = clone $object;
|
||||||
|
|
||||||
$result=$object->createFromClone($socid);
|
$result=$object->createFromClone($user, $socid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
|||||||
@ -1144,12 +1144,13 @@ class Fichinter extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -1409,11 +1409,12 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User making the clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone()
|
public function createFromClone(User $user)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs,$hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -472,13 +472,12 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Commandefournisseurdispatch($this->db);
|
$object=new Commandefournisseurdispatch($this->db);
|
||||||
|
|||||||
@ -955,7 +955,7 @@ $result = $object->updateline(
|
|||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$result=$object->createFromClone();
|
$result=$object->createFromClone($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
|||||||
@ -1829,6 +1829,7 @@ MailboxSourceDirectory=Mailbox source directory
|
|||||||
MailboxTargetDirectory=Mailbox target directory
|
MailboxTargetDirectory=Mailbox target directory
|
||||||
EmailcollectorOperations=Operations to do by collector
|
EmailcollectorOperations=Operations to do by collector
|
||||||
CollectNow=Collect now
|
CollectNow=Collect now
|
||||||
|
ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ?
|
||||||
DateLastCollectResult=Date latest collect tried
|
DateLastCollectResult=Date latest collect tried
|
||||||
DateLastcollectResultOk=Date latest collect successfull
|
DateLastcollectResultOk=Date latest collect successfull
|
||||||
LastResult=Latest result
|
LastResult=Latest result
|
||||||
|
|||||||
@ -327,13 +327,12 @@ class Productbatch extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Productbatch($this->db);
|
$object=new Productbatch($this->db);
|
||||||
|
|||||||
@ -895,14 +895,12 @@ class Productcustomerprice extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
* @param int $fromid of object to clone
|
* @param User $user User making the clone
|
||||||
|
* @param int $fromid ID of object to clone
|
||||||
* @return int id of clone
|
* @return int id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $user, $langs;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object = new Productcustomerprice($this->db);
|
$object = new Productcustomerprice($this->db);
|
||||||
|
|||||||
@ -560,13 +560,12 @@ class Propalmergepdfproduct extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Propalmergepdfproduct($this->db);
|
$object=new Propalmergepdfproduct($this->db);
|
||||||
|
|||||||
@ -426,15 +426,14 @@ class Productlot extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Productlot($this->db);
|
$object = new Productlot($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -420,15 +420,14 @@ class ProductStockEntrepot extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
*
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
global $user;
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new ProductStockEntrepot($this->db);
|
$object = new ProductStockEntrepot($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -429,7 +429,7 @@ if (empty($reshook))
|
|||||||
$move_date=GETPOST('move_date')?1:0;
|
$move_date=GETPOST('move_date')?1:0;
|
||||||
$clone_thirdparty=GETPOST('socid', 'int')?GETPOST('socid', 'int'):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)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
|||||||
@ -1274,6 +1274,7 @@ class Project extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* 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 $fromid Id of object to clone
|
||||||
* @param bool $clone_contact Clone contact of project
|
* @param bool $clone_contact Clone contact of project
|
||||||
* @param bool $clone_task Clone task of project
|
* @param bool $clone_task Clone task of project
|
||||||
@ -1285,9 +1286,9 @@ class Project extends CommonObject
|
|||||||
* @param int $newthirdpartyid New thirdparty id
|
* @param int $newthirdpartyid New thirdparty id
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
|
|
||||||
@ -1477,7 +1478,7 @@ class Project extends CommonObject
|
|||||||
// Loop on each task, to clone it
|
// Loop on each task, to clone it
|
||||||
foreach ($tasksarray as $tasktoclone)
|
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)
|
if ($result_clone <= 0)
|
||||||
{
|
{
|
||||||
$this->error.=$result_clone->error;
|
$this->error.=$result_clone->error;
|
||||||
|
|||||||
@ -1587,6 +1587,7 @@ class Task extends CommonObject
|
|||||||
|
|
||||||
/** Load an object from its id and create a new one in database
|
/** 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 $fromid Id of object to clone
|
||||||
* @param int $project_id Id of project to attach clone task
|
* @param int $project_id Id of project to attach clone task
|
||||||
* @param int $parent_task_id Id of task 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
|
* @param bool $clone_prog clone progress of project
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -136,7 +136,7 @@ if (empty($reshook))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->createFromClone($socid);
|
$result = $object->createFromClone($user, $socid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@ -1117,12 +1117,13 @@ class SupplierProposal extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
* @param int $socid Id of thirdparty
|
* @param User $user User making the clone
|
||||||
|
* @param int $fromid Id of thirdparty
|
||||||
* @return int New id of clone
|
* @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;
|
$error=0;
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
@ -1139,9 +1140,9 @@ class SupplierProposal extends CommonObject
|
|||||||
$objsoc=new Societe($this->db);
|
$objsoc=new Societe($this->db);
|
||||||
|
|
||||||
// Change socid if needed
|
// 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->socid = $objsoc->id;
|
||||||
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||||
|
|||||||
@ -950,13 +950,12 @@ class Ticket extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User that clone
|
||||||
* @param int $fromid Id of object to clone
|
* @param int $fromid Id of object to clone
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid)
|
public function createFromClone(User $user, $fromid)
|
||||||
{
|
{
|
||||||
global $user, $langs;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$object = new Ticket($this->db);
|
$object = new Ticket($this->db);
|
||||||
|
|||||||
@ -519,7 +519,7 @@ class Website extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function createFromClone($user, $fromid, $newref, $newlang = '')
|
public function createFromClone($user, $fromid, $newref, $newlang = '')
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager, $langs;
|
global $conf, $hookmanager;
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user