Work on #18448
This commit is contained in:
parent
3598816763
commit
77e9f15360
@ -499,7 +499,7 @@ print "</tr>\n";
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
$form->buttonsSaveCancel("Save", '');
|
print $form->buttonsSaveCancel("Save", '');
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,8 @@ $permissionnote = $user->rights->asset->write; // Used by the include of actions
|
|||||||
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
|
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
|
||||||
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -93,12 +95,17 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$error = 0;
|
$backurlforlist = DOL_URL_ROOT.'/asset/list.php';
|
||||||
|
|
||||||
$backurlforlist = dol_buildpath('/asset/list.php', 1);
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
// Actions cancel, add, update or delete
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
|
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||||
|
|||||||
@ -90,6 +90,7 @@ $hookmanager->initHooks(array('assettypecard', 'globalcard'));
|
|||||||
|
|
||||||
$permissiontoadd = $user->rights->asset->setup_advance;
|
$permissiontoadd = $user->rights->asset->setup_advance;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -396,7 +397,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
$form->buttonsSaveCancel("Add");
|
print $form->buttonsSaveCancel("Add");
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
@ -502,12 +503,12 @@ if ($rowid > 0) {
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
if ($user->rights->asset->write) {
|
if ($user->rights->asset->write) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&rowid='.((int) $object->id).'">'.$langs->trans("Modify").'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->asset->write) {
|
if ($user->rights->asset->write) {
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $object->id).'">'.$langs->trans("DeleteType").'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|||||||
@ -147,8 +147,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/comm/propal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,8 +138,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/commande/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/commande/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,26 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/compta/bank/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -172,8 +172,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/compta/facture/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/compta/facture/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,29 @@ if ($reshook < 0) {
|
|||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/contrat/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/contrat/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||||
|
|||||||
@ -274,11 +274,15 @@ class FormTicket
|
|||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
// Categories
|
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
|
||||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
|
||||||
print "</td></tr>";
|
if (count($cate_arbo)) {
|
||||||
|
// Categories
|
||||||
|
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attached files
|
// Attached files
|
||||||
@ -467,13 +471,19 @@ class FormTicket
|
|||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br>';
|
||||||
|
|
||||||
|
print $form->buttonsSaveCancel((($this->withthreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
|
||||||
|
|
||||||
|
/*
|
||||||
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "CreateTicket")).'" />';
|
print '<input type="submit" class="button" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "CreateTicket")).'" />';
|
||||||
if ($this->withcancel) {
|
if ($this->withcancel) {
|
||||||
print " ";
|
print " ";
|
||||||
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
*/
|
||||||
|
|
||||||
print '<input type="hidden" name="page_y">'."\n";
|
print '<input type="hidden" name="page_y">'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -84,259 +84,284 @@ if ($reshook < 0) {
|
|||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action reopen object
|
if (empty($reshook)) {
|
||||||
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
|
$backurlforlist = DOL_URL_ROOT.'/don/list.php';
|
||||||
$object->fetch($id);
|
|
||||||
|
|
||||||
$result = $object->reopen($user);
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
if ($result >= 0) {
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
// Define output language
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
$backtopage = $backurlforlist;
|
||||||
if (method_exists($object, 'generateDocument')) {
|
} else {
|
||||||
$outputlangs = $langs;
|
$backtopage = DOL_URL_ROOT.'/don/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
|
||||||
$newlang = GETPOST('lang_id', 'aZ09');
|
|
||||||
}
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
}
|
|
||||||
if (!empty($newlang)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
$model = $object->model_pdf;
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
|
||||||
|
|
||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Action update object
|
|
||||||
if ($action == 'update') {
|
|
||||||
if (!empty($cancel)) {
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id));
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = 0;
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
if (empty($donation_date)) {
|
header("Location: ".$backtopageforcancel);
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
exit;
|
||||||
$action = "create";
|
} elseif (!empty($backtopage)) {
|
||||||
$error++;
|
header("Location: ".$backtopage);
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($amount)) {
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
|
||||||
$action = "create";
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$object->fetch($id);
|
|
||||||
|
|
||||||
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
|
||||||
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
|
||||||
$object->societe = (string) GETPOST("societe", 'alpha');
|
|
||||||
$object->address = (string) GETPOST("address", 'alpha');
|
|
||||||
$object->amount = price2num(GETPOST("amount", 'alpha'));
|
|
||||||
$object->town = (string) GETPOST("town", 'alpha');
|
|
||||||
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
|
||||||
$object->country_id = (int) GETPOST('country_id', 'int');
|
|
||||||
$object->email = (string) GETPOST("email", 'alpha');
|
|
||||||
$object->date = $donation_date;
|
|
||||||
$object->public = $public_donation;
|
|
||||||
$object->fk_project = (int) GETPOST("fk_project", 'int');
|
|
||||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
|
||||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
|
||||||
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($object->update($user) > 0) {
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
$action = '';
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Action add/create object
|
|
||||||
if ($action == 'add') {
|
|
||||||
if (!empty($cancel)) {
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = 0;
|
// Action reopen object
|
||||||
|
if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
|
$result = $object->reopen($user);
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
|
if ($result >= 0) {
|
||||||
$action = "create";
|
// Define output language
|
||||||
$error++;
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
}
|
if (method_exists($object, 'generateDocument')) {
|
||||||
if (empty($donation_date)) {
|
$outputlangs = $langs;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
$newlang = '';
|
||||||
$action = "create";
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||||
$error++;
|
$newlang = GETPOST('lang_id', 'aZ09');
|
||||||
}
|
}
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
|
||||||
|
$newlang = $object->thirdparty->default_lang;
|
||||||
|
}
|
||||||
|
if (!empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$model = $object->model_pdf;
|
||||||
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
if (empty($amount)) {
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
}
|
||||||
$action = "create";
|
}
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
$object->socid = (int) GETPOST("socid", 'int');
|
|
||||||
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
|
||||||
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
|
||||||
$object->societe = (string) GETPOST("societe", 'alpha');
|
|
||||||
$object->address = (string) GETPOST("address", 'alpha');
|
|
||||||
$object->amount = price2num(GETPOST("amount", 'alpha'));
|
|
||||||
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
|
||||||
$object->town = (string) GETPOST("town", 'alpha');
|
|
||||||
$object->country_id = (int) GETPOST('country_id', 'int');
|
|
||||||
$object->email = (string) GETPOST('email', 'alpha');
|
|
||||||
$object->date = $donation_date;
|
|
||||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
|
||||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
|
||||||
$object->public = $public_donation;
|
|
||||||
$object->fk_project = (int) GETPOST("fk_project", 'int');
|
|
||||||
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = $object->create($user);
|
|
||||||
if ($res > 0) {
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
|
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Action delete object
|
|
||||||
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) {
|
// Action update object
|
||||||
$object->fetch($id);
|
if ($action == 'update') {
|
||||||
$result = $object->delete($user);
|
if (!empty($cancel)) {
|
||||||
if ($result > 0) {
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id));
|
||||||
header("Location: index.php");
|
exit;
|
||||||
exit;
|
}
|
||||||
} else {
|
|
||||||
dol_syslog($object->error, LOG_DEBUG);
|
$error = 0;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
|
if (empty($donation_date)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
|
$action = "create";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($amount)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||||
|
$action = "create";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
|
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
||||||
|
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
||||||
|
$object->societe = (string) GETPOST("societe", 'alpha');
|
||||||
|
$object->address = (string) GETPOST("address", 'alpha');
|
||||||
|
$object->amount = price2num(GETPOST("amount", 'alpha'));
|
||||||
|
$object->town = (string) GETPOST("town", 'alpha');
|
||||||
|
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
||||||
|
$object->country_id = (int) GETPOST('country_id', 'int');
|
||||||
|
$object->email = (string) GETPOST("email", 'alpha');
|
||||||
|
$object->date = $donation_date;
|
||||||
|
$object->public = $public_donation;
|
||||||
|
$object->fk_project = (int) GETPOST("fk_project", 'int');
|
||||||
|
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||||
|
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||||
|
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($object->update($user) > 0) {
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Action validation
|
|
||||||
if ($action == 'valid_promesse') {
|
// Action add/create object
|
||||||
$object->fetch($id);
|
if ($action == 'add') {
|
||||||
if ($object->valid_promesse($id, $user->id) >= 0) {
|
if (!empty($cancel)) {
|
||||||
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
|
header("Location: index.php");
|
||||||
$action = '';
|
exit;
|
||||||
} else {
|
}
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
|
||||||
|
$action = "create";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if (empty($donation_date)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
|
$action = "create";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($amount)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||||
|
$action = "create";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$object->socid = (int) GETPOST("socid", 'int');
|
||||||
|
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
||||||
|
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
||||||
|
$object->societe = (string) GETPOST("societe", 'alpha');
|
||||||
|
$object->address = (string) GETPOST("address", 'alpha');
|
||||||
|
$object->amount = price2num(GETPOST("amount", 'alpha'));
|
||||||
|
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
||||||
|
$object->town = (string) GETPOST("town", 'alpha');
|
||||||
|
$object->country_id = (int) GETPOST('country_id', 'int');
|
||||||
|
$object->email = (string) GETPOST('email', 'alpha');
|
||||||
|
$object->date = $donation_date;
|
||||||
|
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||||
|
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||||
|
$object->public = $public_donation;
|
||||||
|
$object->fk_project = (int) GETPOST("fk_project", 'int');
|
||||||
|
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $object->create($user);
|
||||||
|
if ($res > 0) {
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Action cancel
|
// Action delete object
|
||||||
if ($action == 'set_cancel') {
|
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($object->set_cancel($id) >= 0) {
|
$result = $object->delete($user);
|
||||||
$action = '';
|
if ($result > 0) {
|
||||||
} else {
|
header("Location: index.php");
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
exit;
|
||||||
|
} else {
|
||||||
|
dol_syslog($object->error, LOG_DEBUG);
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Action set paid
|
// Action validation
|
||||||
if ($action == 'set_paid') {
|
if ($action == 'valid_promesse') {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($object->setPaid($id, $modepayment) >= 0) {
|
if ($object->valid_promesse($id, $user->id) >= 0) {
|
||||||
$action = '';
|
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
|
||||||
} else {
|
$action = '';
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
} else {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action cancel
|
||||||
|
if ($action == 'set_cancel') {
|
||||||
|
$object->fetch($id);
|
||||||
|
if ($object->set_cancel($id) >= 0) {
|
||||||
|
$action = '';
|
||||||
|
} else {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action set paid
|
||||||
|
if ($action == 'set_paid') {
|
||||||
|
$object->fetch($id);
|
||||||
|
if ($object->setPaid($id, $modepayment) >= 0) {
|
||||||
|
$action = '';
|
||||||
|
} else {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
} elseif ($action == 'classin' && $user->rights->don->creer) {
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->setProject($projectid);
|
||||||
}
|
}
|
||||||
} elseif ($action == 'classin' && $user->rights->don->creer) {
|
|
||||||
$object->fetch($id);
|
|
||||||
$object->setProject($projectid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
// Remove file in doc form
|
// Remove file in doc form
|
||||||
/*if ($action == 'remove_file')
|
/*if ($action == 'remove_file')
|
||||||
{
|
|
||||||
$object = new Don($db, 0, GETPOST('id', 'int'));
|
|
||||||
if ($object->fetch($id))
|
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
$object = new Don($db, 0, GETPOST('id', 'int'));
|
||||||
|
if ($object->fetch($id))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$upload_dir = $conf->don->dir_output;
|
$upload_dir = $conf->don->dir_output;
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$file = $upload_dir . '/' . GETPOST('file');
|
||||||
$ret=dol_delete_file($file,0,0,0,$object);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build doc
|
* Build doc
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
if ($action == 'builddoc')
|
if ($action == 'builddoc')
|
||||||
{
|
|
||||||
$object = new Don($db);
|
|
||||||
$result=$object->fetch($id);
|
|
||||||
|
|
||||||
// Save last template used to generate document
|
|
||||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$object = new Don($db);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$result=$object->fetch($id);
|
||||||
}
|
|
||||||
$result=don_create($db, $object->id, '', $object->model_pdf, $outputlangs);
|
// Save last template used to generate document
|
||||||
if ($result <= 0)
|
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||||
{
|
|
||||||
dol_print_error($db,$result);
|
// Define output language
|
||||||
exit;
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$result=don_create($db, $object->id, '', $object->model_pdf, $outputlangs);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -138,8 +138,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/expensereport/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/expensereport/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,8 +113,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/fichinter/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -995,6 +1010,7 @@ if ($action == 'create') {
|
|||||||
} else {
|
} else {
|
||||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="create">'; // We go back to create action
|
||||||
|
|
||||||
print dol_get_fiche_head('');
|
print dol_get_fiche_head('');
|
||||||
|
|
||||||
|
|||||||
@ -168,6 +168,17 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||||
|
|||||||
@ -140,8 +140,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/fourn/facture/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/fourn/facture/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,8 +124,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/holiday/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/holiday/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -915,37 +930,41 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
|||||||
|
|
||||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||||
|
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
function valider()
|
$( document ).ready(function() {
|
||||||
{
|
$("input.button-save").click("submit", function(e) {
|
||||||
if(document.demandeCP.date_debut_.value != "")
|
console.log("Call valider()");
|
||||||
{
|
if (document.demandeCP.date_debut_.value != "")
|
||||||
if(document.demandeCP.date_fin_.value != "")
|
{
|
||||||
{
|
if(document.demandeCP.date_fin_.value != "")
|
||||||
if(document.demandeCP.valideur.value != "-1") {
|
{
|
||||||
return true;
|
if(document.demandeCP.valideur.value != "-1") {
|
||||||
}
|
return true;
|
||||||
else {
|
}
|
||||||
alert("'.dol_escape_js($langs->transnoentities('InvalidValidatorCP')).'");
|
else {
|
||||||
return false;
|
alert("'.dol_escape_js($langs->transnoentities('InvalidValidatorCP')).'");
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
|
{
|
||||||
return false;
|
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
|
{
|
||||||
return false;
|
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Formulaire de demande
|
// Formulaire de demande
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="demandeCP">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'" />'."\n";
|
print '<input type="hidden" name="token" value="'.newToken().'" />'."\n";
|
||||||
print '<input type="hidden" name="action" value="add" />'."\n";
|
print '<input type="hidden" name="action" value="add" />'."\n";
|
||||||
|
|
||||||
@ -1084,11 +1103,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
|||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
print '<div class="center">';
|
print $form->buttonsSaveCancel("SendRequestCP");
|
||||||
print '<input type="submit" value="'.$langs->trans("SendRequestCP").'" name="bouton" class="button">';
|
|
||||||
print ' ';
|
|
||||||
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button button-cancel" onclick="history.go(-1)">';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</from>'."\n";
|
print '</from>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,6 +103,8 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/projet/list.php';
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (GETPOST("comefromclone") == 1) {
|
if (GETPOST("comefromclone") == 1) {
|
||||||
@ -115,11 +117,26 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")), null, 'errors');
|
setEventMessages($langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($backtopage) {
|
}
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ if ($reshook < 0) {
|
|||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
// Add file in email form
|
// Add file in email form
|
||||||
if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) {
|
||||||
////$res = $object->fetch('','',GETPOST('track_id'));
|
////$res = $object->fetch('','',GETPOST('track_id'));
|
||||||
////if($res > 0)
|
////if($res > 0)
|
||||||
////{
|
////{
|
||||||
@ -112,7 +112,7 @@ if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp directory
|
// Set tmp directory
|
||||||
@ -124,7 +124,7 @@ if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha
|
|||||||
$action = 'create_ticket';
|
$action = 'create_ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$origin_email = GETPOST('email', 'alpha');
|
$origin_email = GETPOST('email', 'alpha');
|
||||||
if (empty($origin_email)) {
|
if (empty($origin_email)) {
|
||||||
|
|||||||
@ -60,6 +60,7 @@ $id = GETPOST('id', 'int');
|
|||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
$cancel = GETPOST('cancel');
|
||||||
$origin = GETPOST('origin', 'alpha');
|
$origin = GETPOST('origin', 'alpha');
|
||||||
$originid = GETPOST('originid', 'int');
|
$originid = GETPOST('originid', 'int');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
@ -132,8 +133,23 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/supplier_proposal/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,17 +144,31 @@ if (empty($reshook)) {
|
|||||||
$search_agenda_label = '';
|
$search_agenda_label = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/ticket/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = 'view';
|
$action = 'view';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action to add an action (not a message)
|
// Action to add an action (not a message)
|
||||||
if (GETPOST('add', 'alpha') && !empty($user->rights->ticket->write)) {
|
if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (!GETPOST("subject", 'alphanohtml')) {
|
if (!GETPOST("subject", 'alphanohtml')) {
|
||||||
@ -276,9 +290,13 @@ if (empty($reshook)) {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
$url = $backtopage;
|
if (empty($id)) {
|
||||||
|
$url = $backtopage;
|
||||||
|
} else {
|
||||||
|
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$url = 'card.php?track_id='.$object->track_id;
|
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
@ -342,9 +360,13 @@ if (empty($reshook)) {
|
|||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
} else {
|
} else {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
$url = $backtopage;
|
if (empty($id)) {
|
||||||
|
$url = $backtopage;
|
||||||
|
} else {
|
||||||
|
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$url = 'card.php?track_id='.$object->track_id;
|
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.$url);
|
header('Location: '.$url);
|
||||||
@ -427,9 +449,13 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
$url = $backtopage;
|
if (empty($id)) {
|
||||||
|
$url = $backtopage;
|
||||||
|
} else {
|
||||||
|
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$url = 'card.php?action=view&track_id='.$object->track_id;
|
$url = 'card.php?action=view&track_id='.urlencode($object->track_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
@ -707,6 +733,8 @@ if ($action == 'create' || $action == 'presend') {
|
|||||||
$formticket->withextrafields = 1;
|
$formticket->withextrafields = 1;
|
||||||
$formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
|
$formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
|
||||||
|
|
||||||
|
$formticket->withcancel = 1;
|
||||||
|
|
||||||
$formticket->showForm(1, 'create', 0);
|
$formticket->showForm(1, 'create', 0);
|
||||||
/*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
|
/*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
|
||||||
$formticket = new FormTicket($db);
|
$formticket = new FormTicket($db);
|
||||||
|
|||||||
@ -138,6 +138,29 @@ if ($reshook < 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$backurlforlist = DOL_URL_ROOT.'/user/list.php';
|
||||||
|
|
||||||
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||||
|
$backtopage = $backurlforlist;
|
||||||
|
} else {
|
||||||
|
$backtopage = DOL_URL_ROOT.'/user/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
if (!empty($backtopageforcancel)) {
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
} elseif (!empty($backtopage)) {
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) {
|
if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) {
|
||||||
if ($id != $user->id) { // A user can't disable itself
|
if ($id != $user->id) { // A user can't disable itself
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user