New: After creating an event, go back to original page.
This commit is contained in:
parent
e3562687be
commit
55a4f545ed
@ -65,20 +65,21 @@ $contact = new Contact($db);
|
|||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'add_action')
|
if ($_POST["action"] == 'add_action')
|
||||||
{
|
{
|
||||||
if ($_POST["contactid"])
|
$backtopage='';
|
||||||
|
if (! empty($_POST["backtopage"])) $backtopage=$_POST["backtopage"];
|
||||||
|
if (! $backtopage)
|
||||||
|
{
|
||||||
|
if ($socid > 0) $backtopage = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid;
|
||||||
|
else $backtopage=DOL_URL_ROOT.'/comm/action/index.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["contactid"])
|
||||||
{
|
{
|
||||||
$result=$contact->fetch($_POST["contactid"]);
|
$result=$contact->fetch($_POST["contactid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['cancel'])
|
if ($_POST['cancel'])
|
||||||
{
|
{
|
||||||
$backtopage='';
|
|
||||||
if (! empty($_POST["backtopage"])) $backtopage=$_POST["backtopage"];
|
|
||||||
if (! $backtopage)
|
|
||||||
{
|
|
||||||
if ($socid > 0) $backtopage = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid;
|
|
||||||
else $backtopage=DOL_URL_ROOT.'/comm/action/index.php';
|
|
||||||
}
|
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -226,10 +227,10 @@ if ($_POST["action"] == 'add_action')
|
|||||||
if (! $actioncomm->error)
|
if (! $actioncomm->error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
if ($_POST["from"])
|
if (! empty($backtopage))
|
||||||
{
|
{
|
||||||
dol_syslog("Back to ".$_POST["from"]);
|
dol_syslog("Back to ".$backtopage);
|
||||||
Header("Location: ".$_POST["from"]);
|
Header("Location: ".$backtopage);
|
||||||
}
|
}
|
||||||
elseif($idaction)
|
elseif($idaction)
|
||||||
{
|
{
|
||||||
@ -396,11 +397,16 @@ if (GETPOST("action") == 'update')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! empty($_POST["from"]))
|
if (! empty($_POST["from"])) // deprecated. Use backtopage instead
|
||||||
{
|
{
|
||||||
header("Location: ".$_POST["from"]);
|
header("Location: ".$_POST["from"]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if (! empty($_POST["backtopage"]))
|
||||||
|
{
|
||||||
|
header("Location: ".$_POST["backtopage"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +723,7 @@ if ($id)
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
if (GETPOST("backtopage")) print '<input type="hidden" name="from" value="'.(GETPOST("from") ? GETPOST("from") : $_SERVER["HTTP_REFERER"]).'">';
|
if (GETPOST("backtopage")) print '<input type="hidden" name="backtopage" value="'.(GETPOST("backtopage") ? GETPOST("backtopage") : $_SERVER["HTTP_REFERER"]).'">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
|||||||
@ -439,7 +439,7 @@ if ($_GET["action"] != 'show_day') // View by month
|
|||||||
{
|
{
|
||||||
$style='cal_other_month';
|
$style='cal_other_month';
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events ($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength);
|
show_day_events ($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
/* Show days of the current month */
|
/* Show days of the current month */
|
||||||
@ -455,7 +455,7 @@ if ($_GET["action"] != 'show_day') // View by month
|
|||||||
$style='cal_current_month';
|
$style='cal_current_month';
|
||||||
|
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events($db, $tmpday, $month, $year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength);
|
show_day_events($db, $tmpday, $month, $year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
/* Show days after the current month (next month) */
|
/* Show days after the current month (next month) */
|
||||||
@ -463,7 +463,7 @@ if ($_GET["action"] != 'show_day') // View by month
|
|||||||
{
|
{
|
||||||
$style='cal_other_month';
|
$style='cal_other_month';
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength);
|
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $actionarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxlength, $newparam);
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
}
|
}
|
||||||
$tmpday++;
|
$tmpday++;
|
||||||
@ -504,15 +504,16 @@ llxFooter('$Date$ - $Revision$');
|
|||||||
* @param $day Day
|
* @param $day Day
|
||||||
* @param $month Month
|
* @param $month Month
|
||||||
* @param $year Year
|
* @param $year Year
|
||||||
* @param $monthshown Month shown in calendar view
|
* @param $monthshown Current month shown in calendar view
|
||||||
* @param $style Style to use for this day
|
* @param $style Style to use for this day
|
||||||
* @param $actionarray Array of actions
|
* @param $actionarray Array of actions
|
||||||
* @param $maxPrint Nb of actions to show each day on month view (0 means non limit)
|
* @param $maxPrint Nb of actions to show each day on month view (0 means non limit)
|
||||||
* @param maxnbofchar Nb of characters to show for event line
|
* @param $maxnbofchar Nb of characters to show for event line
|
||||||
* @param companystatic Object thirdparty
|
* @param $newparam Parameters on current URL
|
||||||
* @param contactstatic Object contact
|
* @param $companystatic Object thirdparty
|
||||||
|
* @param $contactstatic Object contact
|
||||||
*/
|
*/
|
||||||
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$actionarray, $maxPrint=0, $maxnbofchar=14)
|
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$actionarray, $maxPrint=0, $maxnbofchar=14, $newparam='')
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
global $filter, $filtera, $filtert, $filterd, $status;
|
global $filter, $filtera, $filtert, $filterd, $status;
|
||||||
@ -531,7 +532,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$action
|
|||||||
print '</td><td align="right" nowrap="nowrap">';
|
print '</td><td align="right" nowrap="nowrap">';
|
||||||
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">';
|
//$param='month='.$monthshown.'&year='.$year;
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||||
print img_picto($langs->trans("NewAction"),'edit_add.png');
|
print img_picto($langs->trans("NewAction"),'edit_add.png');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user