Skip to content

Commit

Permalink
Merge branch 'KreizIT-task1218' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 13, 2014
2 parents 4343d82 + 69d23b3 commit 3cc3d4d
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 6 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ For users:
- New: Intervention documents are now available in ECM module
- New: Add attachments on user card + in ECM module
- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template.
- New: [ task #1204 ] add a External reference to contract
- New: [ task #1204 ] add Numering contrat module free (like leopard in product module)
- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice
- New: Enable supplier price log table
- New: [ task #1204 ] add a External reference to contract
- New: [ task #1218 ] Can drag and drop an event from calendar to change its day.
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
Expand Down
42 changes: 42 additions & 0 deletions htdocs/comm/action/fiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -384,7 +385,48 @@
}
}

/*
* Action move update, used when user move an event in calendar by drag'n drop
*/
if ($action == 'mupdate')
{
$object->fetch($id);
$shour = dol_print_date($object->datep,"%H");
$smin = dol_print_date($object->datep, "%M");

$newdate=GETPOST('newdate','alpha');
if (empty($newdate) || strpos($newdate,'dayevent_') != 0 )
{
header("Location: ".$backtopage);
exit;
}

$datep=dol_mktime($shour, $smin, 0, substr($newdate,13,2), substr($newdate,15,2), substr($newdate,9,4));
if ($datep!=$object->datep)
{
if (!empty($object->datef))
{
$object->datef+=$datep-$object->datep;
}
$object->datep=$datep;
$result=$object->update($user);
if ($result < 0)
{
setEventMessage($object->error,'errors');
setEventMessage($object->errors,'errors');
}
}
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else
{
$action='';
}

}
/*
* View
*/
Expand Down
46 changes: 41 additions & 5 deletions htdocs/comm/action/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -330,7 +331,12 @@
$s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
$s.='jQuery(".family_birthday").toggle();' . "\n";
$s.='});' . "\n";
if ($action=="show_week" || $action=="show_month" || empty($action))
{
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s.='});' . "\n";
$s.='</script>' . "\n";
if (! empty($conf->use_javascript_ajax))
{
Expand Down Expand Up @@ -932,6 +938,12 @@
echo " </tr>\n";
}
echo "</table>\n";
echo '<form id="move_event" action="" method="POST"><input type="hidden" name="action" value="mupdate">';
echo '<input type="hidden" name="backtopage" value="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
echo '<input type="hidden" name="newdate" id="newdate">' ;
echo '</form>';

}
elseif ($action == 'show_week') // View by week
{
Expand Down Expand Up @@ -992,6 +1004,11 @@
echo " </tr>\n";

echo "</table>\n";
echo '<form id="move_event" action="" method="POST"><input type="hidden" name="action" value="mupdate">';
echo '<input type="hidden" name="backtopage" value="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
echo '<input type="hidden" name="newdate" id="newdate">' ;
echo '</form>';
}
else // View by day
{
Expand Down Expand Up @@ -1089,7 +1106,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '</a>';
}
print '</td></tr>';
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="nowrap" style="padding-bottom: 2px;">';
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="nowrap sortable" style="padding-bottom: 2px;">';

//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
Expand Down Expand Up @@ -1134,9 +1151,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$numicals[dol_string_nospecial($event->icalname)]++;
}
$color=$event->icalcolor;
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other');
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
}
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); }
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); }
else { $numother++; $cssclass='family_other'; }
if ($color == -1) // Color was not forced. Set color according to color index.
{
Expand All @@ -1158,6 +1175,24 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;

if (empty($event->fulldayevent))
{
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{
$tmpyearend = date('Y',$event->date_end_in_calendar);
$tmpmonthend = date('m',$event->date_end_in_calendar);
$tmpdayend = date('d',$event->date_end_in_calendar);
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
{
$cssclass.= " unsortable";
}
}
if ($event->type_code =='AC_OTH_AUTO')
{
$cssclass.= " unsortable";
}
}

// Show rect of event
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'">';
print '<ul class="cal_event"><li class="cal_event">';
Expand Down Expand Up @@ -1327,8 +1362,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// TODO Loop on each element of day $ymd and start to toggle once $maxprint has been reached
print 'jQuery(".family_mytasks_day_'.$ymd.'").toggle();';
print '}'."\n";

print '});'."\n";

print '</script>'."\n";
}

Expand Down

0 comments on commit 3cc3d4d

Please sign in to comment.