Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7
This commit is contained in:
commit
656ed0e9b8
@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -538,6 +539,7 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formactions = new FormActions($db);
|
||||
|
||||
if ($action == 'create')
|
||||
@ -1285,7 +1287,7 @@ if ($id > 0)
|
||||
|
||||
if (empty($conf->global->AGENDA_DISABLE_BUILDDOC))
|
||||
{
|
||||
print '<div style="clear:both;"> </div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<div style="clear:both;"> <br><br></div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
|
||||
@ -205,6 +205,8 @@ if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' |
|
||||
$param.="&maxprint=".$maxprint;
|
||||
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
//print "day=".$day." month=".$month." year=".$year;
|
||||
//var_dump($prev); exit;
|
||||
$prev_year = $prev['prev_year'];
|
||||
$prev_month = $prev['prev_month'];
|
||||
$prev_day = $prev['prev_day'];
|
||||
@ -223,6 +225,7 @@ $next_day = $next['day'];
|
||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||
//print $firstday.'-'.$first_month.'-'.$first_year;
|
||||
//print dol_print_date($firstdaytoshow,'dayhour');
|
||||
//print dol_print_date($lastdaytoshow,'dayhour');
|
||||
|
||||
@ -534,12 +537,16 @@ echo '<input type="hidden" name="newdate" id="newdate">' ;
|
||||
echo '</form>';
|
||||
|
||||
|
||||
// Table :
|
||||
// Line header with list of days
|
||||
|
||||
//print "begin_d=".$begin_d." end_d=".$end_d;
|
||||
|
||||
|
||||
echo '<table width="100%" class="nocellnopadd cal_month">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
$i=0;
|
||||
$i=0; // 0 = sunday,
|
||||
while ($i < 7)
|
||||
{
|
||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
||||
@ -679,7 +686,7 @@ foreach ($usernames as $username)
|
||||
|
||||
// Lopp on each day of week
|
||||
$i = 0;
|
||||
for ($iter_day = 0; $iter_day < 7; $iter_day++)
|
||||
for ($iter_day = 0; $iter_day < 8; $iter_day++)
|
||||
{
|
||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
||||
{
|
||||
|
||||
@ -26,17 +26,18 @@
|
||||
* \brief File to manage popup date selector
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
@ -195,9 +196,9 @@ function displayBox($selectedDate,$month,$year)
|
||||
<td width="15%"><?php echo $langs->trans("ShortThursday") ?></td>
|
||||
<td width="14%"><?php echo $langs->trans("ShortFriday") ?></td>
|
||||
<td width="14%"><?php echo $langs->trans("ShortSaturday") ?></td>
|
||||
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
|
||||
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
|
||||
<?php
|
||||
}else {?>
|
||||
}else {?>
|
||||
<td width="14%"><?php echo $langs->trans("ShortSunday") ?></td>
|
||||
<td width="14%"><?php echo $langs->trans("ShortMonday") ?></td>
|
||||
<td width="15%"><?php echo $langs->trans("ShortTuesday") ?></td>
|
||||
@ -209,28 +210,36 @@ function displayBox($selectedDate,$month,$year)
|
||||
}?>
|
||||
</tr>
|
||||
<?php
|
||||
//print "x ".$thedate." y";
|
||||
//print "x ".$thedate." y"; // $thedate = first day of month
|
||||
$firstdate=dol_getdate($thedate);
|
||||
$mydate=$firstdate;
|
||||
//var_dump($firstdateofweek);
|
||||
$mydate=dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date
|
||||
|
||||
// Loop on each day of month
|
||||
$stoploop=0; $day=1; $cols=0;
|
||||
while (! $stoploop)
|
||||
{
|
||||
//print_r($mydate);
|
||||
if($firstdate==$mydate) // At first run
|
||||
if ($mydate < $firstdate) // At first run
|
||||
{
|
||||
echo "<TR class=\"dpWeek\">";
|
||||
//echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
|
||||
$cols=0;
|
||||
for($i=0;$i< $mydate["wday"];$i++)
|
||||
for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
$w = ($i + $startday) % 7;
|
||||
if ($w == $firstdate["wday"])
|
||||
{
|
||||
$mydate = $firstdate;
|
||||
break;
|
||||
}
|
||||
echo "<TD> </TD>";
|
||||
$cols++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mydate["wday"]==0)
|
||||
if ($mydate["wday"] == $startday)
|
||||
{
|
||||
echo "<TR class=\"dpWeek\">";
|
||||
$cols=0;
|
||||
@ -254,7 +263,7 @@ function displayBox($selectedDate,$month,$year)
|
||||
echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
|
||||
$cols++;
|
||||
|
||||
if ($mydate["wday"]==6) echo "</TR>\n";
|
||||
if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n";
|
||||
|
||||
//$thedate=strtotime("tomorrow",$thedate);
|
||||
$day++;
|
||||
|
||||
@ -479,34 +479,36 @@ function dol_get_last_day($year,$month=12,$gm=false)
|
||||
return $datelim;
|
||||
}
|
||||
|
||||
/** Return first day of week for a date
|
||||
/** Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1.
|
||||
*
|
||||
* @param int $day Day
|
||||
* @param int $month Month
|
||||
* @param int $year Year
|
||||
* @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
|
||||
* @return array year,month,week,first_day,prev_year,prev_month,prev_day
|
||||
* @return array year,month,week,first_day,first_month,first_year,prev_day,prev_month,prev_year
|
||||
*/
|
||||
function dol_get_first_day_week($day,$month,$year,$gm=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//$day=2; $month=2; $year=2015;
|
||||
$date = dol_mktime(0,0,0,$month,$day,$year,$gm);
|
||||
|
||||
//Checking conf of start week
|
||||
$start_week = (isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1);
|
||||
|
||||
$tmparray = dol_getdate($date,true);
|
||||
$tmparray = dol_getdate($date,true); // detail of current day
|
||||
|
||||
//Calculate days to count
|
||||
//Calculate days = offset from current day
|
||||
$days = $start_week - $tmparray['wday'];
|
||||
if ($days>=1) $days=7-$days;
|
||||
$days = abs($days);
|
||||
$seconds = $days*24*60*60;
|
||||
//print 'start_week='.$start_week.' tmparray[wday]='.$tmparray['wday'].' day offset='.$days.' seconds offset='.$seconds.'<br>';
|
||||
|
||||
//Get first day of week
|
||||
$tmpday = date($tmparray[0])-$seconds;
|
||||
$tmpday = date("d",$tmpday);
|
||||
$tmpdaytms = date($tmparray[0])-$seconds; // $tmparray[0] is day of parameters
|
||||
$tmpday = date("d",$tmpdaytms);
|
||||
|
||||
//Check first day of week is in same month than current day or not
|
||||
if ($tmpday>$day)
|
||||
|
||||
@ -999,8 +999,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
/**
|
||||
* Return an array with locale date info.
|
||||
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
* WARNING: This function always use PHP server timezone to return locale informations.
|
||||
* WARNING: This function always use PHP server timezone to return locale informations !!!
|
||||
* Usage must be avoid.
|
||||
* FIXME: Replace this with PHP date function and a parameter $gm
|
||||
*
|
||||
* @param int $timestamp Timestamp
|
||||
* @param boolean $fast Fast mode
|
||||
@ -1010,7 +1011,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
* 'minutes' => $min,
|
||||
* 'hours' => $hour,
|
||||
* 'mday' => $day,
|
||||
* 'wday' => $dow,
|
||||
* 'wday' => $dow, 0=sunday, 6=saturday
|
||||
* 'mon' => $month,
|
||||
* 'year' => $year,
|
||||
* 'yday' => floor($secsInYear/$_day_power),
|
||||
@ -1044,7 +1045,7 @@ function dol_getdate($timestamp,$fast=false)
|
||||
{
|
||||
$arrayinfo=getdate($timestamp);
|
||||
|
||||
$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
|
||||
/*$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
|
||||
if($startday==1)
|
||||
{
|
||||
if ($arrayinfo["wday"]==0)
|
||||
@ -1055,7 +1056,7 @@ function dol_getdate($timestamp,$fast=false)
|
||||
{
|
||||
$arrayinfo["wday"]=$arrayinfo["wday"]-1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return $arrayinfo;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
-- Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
|
||||
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
|
||||
--
|
||||
@ -226,10 +226,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20
|
||||
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1);
|
||||
|
||||
-- SPAIN (id country=4)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21:-9:-2','1','VAT standard rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21:-9:-2','1','VAT reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21:-9:-2','1','VAT super-reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21:-9:-2','1','VAT Rate 0',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-19:-15:-9','5','VAT standard rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-19:-15:-9','5','VAT super-reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-19:-15:-9','5','VAT Rate 0',1);
|
||||
|
||||
-- SWEDEN (id country=20)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1);
|
||||
|
||||
@ -163,8 +163,8 @@ ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk
|
||||
|
||||
|
||||
-- Localtaxes by thirds
|
||||
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10);
|
||||
ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(10);
|
||||
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(20);
|
||||
ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(20);
|
||||
ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint after entity;
|
||||
ALTER TABLE llx_societe ADD COLUMN localtax1_value double(6,3) after localtax1_assuj;
|
||||
ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_assuj;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -23,9 +23,9 @@ create table llx_c_tva
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_pays integer NOT NULL,
|
||||
taux double NOT NULL,
|
||||
localtax1 varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax1 varchar(20) NOT NULL DEFAULT '0',
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2 varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2 varchar(20) NOT NULL DEFAULT '0',
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
recuperableonly integer NOT NULL DEFAULT 0,
|
||||
note varchar(128),
|
||||
|
||||
@ -22,15 +22,15 @@ ProductAccountancySellCode=Accountancy code (sell)
|
||||
ProductOrService=Product or Service
|
||||
ProductsAndServices=Products and Services
|
||||
ProductsOrServices=Products or Services
|
||||
ProductsAndServicesOnSell=Available Products and Services
|
||||
ProductsAndServicesNotOnSell=Obsolete Products and Services
|
||||
ProductsAndServicesOnSell=Products and Services for sale or for purchase
|
||||
ProductsAndServicesNotOnSell=Products and Services out of sale
|
||||
ProductsAndServicesStatistics=Products and Services statistics
|
||||
ProductsStatistics=Products statistics
|
||||
ProductsOnSell=Available products
|
||||
ProductsNotOnSell=Obsolete products
|
||||
ProductsOnSell=Product for sale or for pruchase
|
||||
ProductsNotOnSell=Product out of sale and out of purchase
|
||||
ProductsOnSellAndOnBuy=Products for sale and for purchase
|
||||
ServicesOnSell=Available services
|
||||
ServicesNotOnSell=Obsolete services
|
||||
ServicesOnSell=Services for sale or for purchase
|
||||
ServicesNotOnSell=Services out of sale
|
||||
ServicesOnSellAndOnBuy=Services for sale and for purchase
|
||||
InternalRef=Internal reference
|
||||
LastRecorded=Last products/services on sell recorded
|
||||
|
||||
@ -341,4 +341,24 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolGetFirstDayWeek
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolGetFirstDayWeek()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$day=3; $month=2; $year=2015;
|
||||
$conf->global->MAIN_START_WEEK = 1; // start on monday
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
$this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2
|
||||
|
||||
$day=3; $month=2; $year=2015;
|
||||
$conf->global->MAIN_START_WEEK = 0; // start on sunday
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
$this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -888,4 +888,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolGetDate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 0;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 1;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user