Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6bf0b9b107
@ -38,6 +38,7 @@ $id=GETPOST('id','int');
|
|||||||
$ref=GETPOST('ref','alpha');
|
$ref=GETPOST('ref','alpha');
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$backtopage=GETPOST('backtopage','alpha');
|
$backtopage=GETPOST('backtopage','alpha');
|
||||||
|
$cancel=GETPOST('cancel','alpha');
|
||||||
|
|
||||||
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
|
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
|
||||||
|
|
||||||
@ -51,13 +52,10 @@ $object = new Project($db);
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$ret = $object->fetch($id,$ref);
|
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$id=$object->id;
|
$id=$object->id;
|
||||||
} else {
|
|
||||||
setEventMessage($object->error, 'errors');
|
|
||||||
$action='';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,9 +81,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
if (GETPOST("cancel") && ! empty($backtopage))
|
if ($cancel)
|
||||||
{
|
{
|
||||||
if (GETPOST("comefromclone")==1)
|
if (GETPOST("comefromclone")==1)
|
||||||
{
|
{
|
||||||
@ -101,24 +98,13 @@ if (empty($reshook))
|
|||||||
setEventMessage($langs->trans("CantRemoveProject"), 'errors');
|
setEventMessage($langs->trans("CantRemoveProject"), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if cancel and come from clone then delete the cloned project
|
$action = '';
|
||||||
if (GETPOST("cancel") && (GETPOST("comefromclone")==1))
|
|
||||||
{
|
|
||||||
$result=$object->delete($user);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog($object->error,LOG_DEBUG);
|
|
||||||
setEventMessage($langs->trans("CantRemoveProject"), 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->projet->creer)
|
if ($action == 'add' && $user->rights->projet->creer)
|
||||||
@ -156,7 +142,7 @@ if (empty($reshook))
|
|||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result > 0)
|
if (! $error && $result > 0)
|
||||||
{
|
{
|
||||||
// Add myself as project leader
|
// Add myself as project leader
|
||||||
$result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
|
$result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
|
||||||
|
|||||||
@ -303,7 +303,7 @@ class Project extends CommonObject
|
|||||||
if (empty($id) && empty($ref)) return -1;
|
if (empty($id) && empty($ref)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT rowid, ref, title, description, public, datec, budget_amount,";
|
$sql = "SELECT rowid, ref, title, description, public, datec, budget_amount,";
|
||||||
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, note_private, note_public,model_pdf";
|
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, note_private, note_public, model_pdf";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
|
||||||
if (! empty($id))
|
if (! empty($id))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user