Clean code
This commit is contained in:
parent
75dee7538b
commit
e402f68593
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/actions_addupdatedelete.inc.php
|
* \file htdocs/core/actions_addupdatedelete.inc.php
|
||||||
* \brief Code for common actions cancel / add / update / delete
|
* \brief Code for common actions cancel / add / update / delete / clone
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -183,3 +183,33 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
|||||||
else setEventMessages($object->error, null, 'errors');
|
else setEventMessages($object->error, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Action clone object
|
||||||
|
if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd))
|
||||||
|
{
|
||||||
|
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
|
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||||
|
$orig = clone $object;
|
||||||
|
|
||||||
|
$result=$object->createFromClone($socid);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$object = $orig;
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -123,9 +123,9 @@ if (empty($reshook))
|
|||||||
$permissiontodelete = $user->rights->mymodule->delete;
|
$permissiontodelete = $user->rights->mymodule->delete;
|
||||||
if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id=__ID__';
|
if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id=__ID__';
|
||||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);
|
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);
|
||||||
$triggermodname = 'MYMODULE_MODIFY';
|
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
// Actions cancel, add, update or delete
|
// Actions cancel, add, update, delete or clone
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||||
|
|
||||||
// Actions when printing a doc from card
|
// Actions when printing a doc from card
|
||||||
|
|||||||
@ -80,12 +80,15 @@ $result = restrictedArea($user, 'ticket', $object->id);
|
|||||||
$triggermodname = 'TICKETSUP_MODIFY';
|
$triggermodname = 'TICKETSUP_MODIFY';
|
||||||
$permissiontoadd = $user->rights->ticket->write;
|
$permissiontoadd = $user->rights->ticket->write;
|
||||||
|
|
||||||
|
$actionobject = new ActionsTicket($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO Replace actions with common includes actions_addupdatedelete.inc.php
|
||||||
|
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
{
|
{
|
||||||
if (! empty($backtopage))
|
if (! empty($backtopage))
|
||||||
@ -96,8 +99,7 @@ if ($cancel)
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do action
|
||||||
$actionobject = new ActionsTicket($db);
|
|
||||||
$actionobject->doActions($action, $object);
|
$actionobject->doActions($action, $object);
|
||||||
|
|
||||||
// Action to update one extrafield
|
// Action to update one extrafield
|
||||||
|
|||||||
@ -106,8 +106,8 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
$trigger_name='WEBSITEACCOUNT_SENTBYMAIL';
|
||||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
$autocopy='MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO';
|
||||||
$trackid='websiteaccount'.$object->id;
|
$trackid='websiteaccount'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user