2
0
forked from Wavyzz/dolibarr

Add now button

This commit is contained in:
Laurent Destailleur
2008-12-03 21:41:07 +00:00
parent 65cd4531c4
commit a29b1c3b3d
4 changed files with 34 additions and 32 deletions

View File

@@ -509,32 +509,17 @@ if ($_GET["action"] == 'create')
// Date start
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("DateActionStart").'</td><td>';
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datep,'ap',1,1,0,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datep,'ap',1,1,1,"action");
else $html->select_date($actioncomm->datep,'ap',1,1,1,"action");
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datep,'ap',1,1,0,"action",1,1);
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datep,'ap',1,1,1,"action",1,1);
else $html->select_date($actioncomm->datep,'ap',1,1,1,"action",1,1);
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
else $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datef,'p2',1,1,1,"action",1,1);
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datef,'p2',1,1,1,"action",1,1);
else $html->select_date($actioncomm->datef,'p2',1,1,1,"action",1,1);
print '</td></tr>';
// Date start done
/*
print '<tr><td>'.$langs->trans("DateActionDoneStart").'</td><td>';
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->date,'ad',1,1,1,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->date,'ad',1,1,0,"action");
else $html->select_date($actioncomm->date,'ad',1,1,1,"action");
print '</td></tr>';
// Date end done
print '<tr><td>'.$langs->trans("DateActionDoneEnd").'</td><td>';
if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->dateend,'a2',1,1,1,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->dateend,'a2',1,1,0,"action");
else $html->select_date($actioncomm->dateend,'a2',1,1,1,"action");
print '</td></tr>';
*/
// Avancement
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
@@ -704,16 +689,16 @@ if ($_GET["id"])
// Date start
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
if ($_REQUEST["afaire"] == 1) $html->select_date($act->datep,'ap',1,1,0,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datep,'ap',1,1,1,"action");
else $html->select_date($act->datep,'ap',1,1,1,"action");
if ($_REQUEST["afaire"] == 1) $html->select_date($act->datep,'ap',1,1,0,"action",1,1);
else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datep,'ap',1,1,1,"action",1,1);
else $html->select_date($act->datep,'ap',1,1,1,"action",1,1);
if ($act->percentage == 0 && $act->datep && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late"));
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if ($_REQUEST["afaire"] == 1) $html->select_date($act->datef,'p2',1,1,1,"action");
else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datef,'p2',1,1,1,"action");
else $html->select_date($act->datef,'p2',1,1,1,"action");
if ($_REQUEST["afaire"] == 1) $html->select_date($act->datef,'p2',1,1,1,"action",1,1);
else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datef,'p2',1,1,1,"action",1,1);
else $html->select_date($act->datef,'p2',1,1,1,"action",1,1);
if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late"));
print '</td></tr>';

View File

@@ -166,6 +166,7 @@ Previous=Previous
Next=Next
Cards=Cards
Card=Card
Now=Now
Date=Date
DateStart=Date start
DateEnd=Date end

View File

@@ -165,6 +165,7 @@ Previous=Pr
Next=Suivant
Cards=Fiches
Card=Fiche
Now=Maintenant
Date=Date
DateStart=Date d<>but
DateEnd=Date fin

View File

@@ -135,6 +135,16 @@ function showDP(base,dateFieldID,format)
document.body.appendChild(showDP.box);
}
function resetDP(base,dateFieldID,format)
{
var dateField=getObjectFromID(dateFieldID);
dateField.value = formatDate(new Date(), format);
dpChangeDay(dateFieldID, format);
var alreadybox=getObjectFromID("DPCancel");
if (alreadybox) showDP(base,dateFieldID,format);
}
function loadMonth(base,month,year,ymd)
{
showDP.box.innerHTML="Loading...";
@@ -416,7 +426,9 @@ function formatDate(date,format)
var month=date.getMonth()+1;
var day=date.getDate();
var hour=date.getHours();
var min=date.getMinutes();
// Fixed by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html)
// The variable is later called "minute", not "min"
var minute=date.getMinutes();
var seconde=date.getSeconds();
var i=0;
@@ -436,10 +448,13 @@ function formatDate(date,format)
else if (substr == 'MM') { result=result+(month<1||month>9?"":"0")+month; }
else if (substr == 'd') { result=result+day; }
else if (substr == 'dd') { result=result+(day<1||day>9?"":"0")+day; }
else if (substr == 'hh') { if (hour > 12) hour-=12; result=result+(hour<1||hour>9?"":"0")+hour; }
else if (substr == 'HH') { result=result+(hour<1||hour>9?"":"0")+hour; }
else if (substr == 'mm') { result=result+(minute<1||minute>9?"":"0")+minute; }
else if (substr == 'ss') { result=result+(seconde<1||seconde>9?"":"0")+seconde; }
// Fixed by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html)
// An hour, minute, or second of "0" is valid, so we must also add a "0" in this case
// So, the condition should begin with "hour/minute/seconde<0", not "<1"
else if (substr == 'hh') { if (hour > 12) hour-=12; result=result+(hour<0||hour>9?"":"0")+hour; }
else if (substr == 'HH') { result=result+(hour<0||hour>9?"":"0")+hour; }
else if (substr == 'mm') { result=result+(minute<0||minute>9?"":"0")+minute; }
else if (substr == 'ss') { result=result+(seconde<0||seconde>9?"":"0")+seconde; }
else { result=result+substr; }
i+=substr.length;