'."\n";
// Show title
@@ -944,7 +944,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
{
$out = $hookmanager->resPrint;
}
-
+
return $out;
}
@@ -1003,7 +1003,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
-
+
if ($object->element == 'product')
{
$width=80; $cssclass='photoref';
@@ -1011,7 +1011,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
';
- else
+ else
{
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
$nophoto='';
@@ -1023,11 +1023,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
}
}
}
- else
+ else
{
- if ($showimage)
+ if ($showimage)
{
- if ($modulepart != 'unknown')
+ if ($modulepart != 'unknown')
{
$phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos);
if ($phototoshow)
@@ -1040,7 +1040,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
elseif ($conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
{
$morehtmlleft.='
';
- if ($object->element == 'action')
+ if ($object->element == 'action')
{
$cssclass='photorefcenter';
$nophoto=img_picto('', 'title_agenda', '', false, 1);
@@ -1061,7 +1061,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($showbarcode) $morehtmlleft.='
'.$form->showbarcode($object).'
';
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
- }
+ }
elseif ($object->element == 'product')
{
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
@@ -1081,39 +1081,39 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
elseif ($object->element == 'facture' || $object->element == 'invoice' || $object->element == 'invoice_supplier')
{
$tmptxt=$object->getLibStatut(6, $object->totalpaye);
- if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt;
}
elseif ($object->element == 'chargesociales')
{
$tmptxt=$object->getLibStatut(6, $object->totalpaye);
- if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt;
}
elseif ($object->element == 'loan')
{
$tmptxt=$object->getLibStatut(6, $object->totalpaye);
- if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt;
}
- elseif ($object->element == 'contrat')
+ elseif ($object->element == 'contrat')
{
if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2);
else $morehtmlstatus.=$object->getLibStatut(4);
}
else { // Generic case
$tmptxt=$object->getLibStatut(6);
- if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
$morehtmlstatus.=$tmptxt;
}
if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty
-
+
if ($object->element == 'product' || $object->element == 'bank_account')
{
if(! empty($object->label)) $morehtmlref.='
'.$object->label.'
';
}
- if ($object->element != 'product' && $object->element != 'bookmark')
+ if ($object->element != 'product' && $object->element != 'bookmark')
{
$morehtmlref.='
';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
@@ -1125,7 +1125,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;
$morehtmlref.='
';
}
-
+
print '
';
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
print '
';
@@ -1301,9 +1301,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
$reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0;
$formatwithoutreduce = preg_replace('/reduceformat/','',$format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
-
+
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
- // TODO Add format daysmallyear and dayhoursmallyear
+ // TODO Add format daysmallyear and dayhoursmallyear
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
@@ -1375,7 +1375,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
if (preg_match('/__b__/i',$format))
{
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
- $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this
+ $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
+ $month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
if ($encodetooutput)
{
$monthtext=$outputlangs->transnoentities('Month'.$month);
@@ -1805,7 +1806,7 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
$newphone=($separ!=''?'(':'').substr($newphone,0,3).($separ!=''?')':'').$separ.substr($newphone,3,3).($separ!=''?'-':'').substr($newphone,6,4);
}
}
-
+
if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
{
if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone
@@ -1935,7 +1936,7 @@ function dol_user_country()
* @param int $mode thirdparty|contact|member|other
* @param int $id Id of object
* @param int $noprint No output. Result is the function return
- * @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br.
+ * @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br.
* @return string|void Nothing if noprint is 0, formatted address if noprint is 1
* @see dol_format_address
*/
@@ -1956,7 +1957,7 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0, $charfornl
{
if (empty($charfornl)) $out.=nl2br($address);
else $out.=preg_replace('/[\r\n]+/', $charfornl, $address);
-
+
$showgmap=$showomap=0;
// TODO Add a hook here
@@ -2084,7 +2085,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
print '
'.$langs->trans("NotEnoughDataYet").'
';
return;
}
-
+
if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot';
$datacolor=array();
@@ -2253,7 +2254,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
global $conf;
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
-
+
if (empty($stringencoding)) $stringencoding='UTF-8';
// reduce for small screen
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
@@ -3206,7 +3207,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder)
* @param string $sortfield Field to sort on ('' by default)
* @param string $sortorder Order to sort ('' by default)
- * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
+ * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
* @param int $num Number of records found by select with limit+1
* @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown.
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
@@ -3220,11 +3221,11 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
{
global $conf,$langs;
-
+
$savlimit = $limit;
$savtotalnboflines = $totalnboflines;
$totalnboflines=abs($totalnboflines);
-
+
if ($picto == 'setup') $picto='title_setup.png';
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
if ($limit < 0) $limit = $conf->liste_limit;
@@ -3237,7 +3238,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$nextpage = 0;
}
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
-
+
print "\n";
print "\n";
print '
';
@@ -3338,7 +3339,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
-
+
print '';
+ print '';
}
if ($page > 0)
{
@@ -3417,7 +3418,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
{
$morelabel='';
-
+
if (preg_match('/%/',$rate))
{
$rate=str_replace('%','',$rate);
@@ -3620,7 +3621,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/**
* Output a dimension with best unit
- *
+ *
* @param float $dimension Dimension
* @param int $unit Unit of dimension (0, -3, ...)
* @param string $type 'weight', 'volume', ...
@@ -3632,16 +3633,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
-
- if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
+
+ if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
{
$dimension = $dimension * 1000000;
- $unit = $unit - 6;
+ $unit = $unit - 6;
}
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
{
$dimension = $dimension * 1000;
- $unit = $unit - 3;
+ $unit = $unit - 3;
}
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
{
@@ -3653,9 +3654,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
$dimension = $dimension / 1000;
$unit = $unit + 3;
}
-
+
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
-
+
return $ret;
}
@@ -3686,12 +3687,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2];
}
-
+
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
{
return 0;
}*/
-
+
// Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
{
@@ -3732,7 +3733,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
{
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
}
-
+
// Search local taxes
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
{
@@ -3789,7 +3790,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2;
}
-
+
return 0;
}
@@ -3849,7 +3850,7 @@ function get_localtax_by_third($local)
/**
* Get vat rate and npr from id.
- * You can call getLocalTaxesFromRate after to get other fields
+ * You can call getLocalTaxesFromRate after to get other fields
*
* @param int $vatrowid Line ID into vat rate table.
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
@@ -3903,7 +3904,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
-
+
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
@@ -3976,7 +3977,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
/**
* Return vat rate of a product in a particular selling country or default country vat if product is unknown
* Function called by get_default_tva
- *
+ *
* @param int $idprod Id of product or 0 if not a predefined product
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
@@ -4014,7 +4015,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
}
else
{
- // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
+ // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
}
}
@@ -4324,7 +4325,7 @@ function yn($yesno, $case=1, $color=0)
/**
* Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
- * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
+ * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
*
* @param string $num Id of object (deprecated, $object will be used in future)
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
@@ -4341,7 +4342,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
$path = '';
$arrayforoldpath=array('cheque','user','category','holiday','shipment','supplier_invoice','invoice_supplier','mailing');
- if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
+ if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
@@ -4494,7 +4495,7 @@ function dolGetFirstLineOfText($text)
{
$firstline=preg_replace('/
]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
$firstline=preg_replace('/]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
-
+
}
else
{
@@ -5400,7 +5401,7 @@ function picto_from_langcode($codelang)
}
/**
- * Complete or removed entries into a head array (used to build tabs).
+ * Complete or removed entries into a head array (used to build tabs).
* For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab'].
* Or by change using hook completeTabsHead
*
@@ -5430,7 +5431,7 @@ function picto_from_langcode($codelang)
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{
global $hookmanager;
-
+
if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type]))
{
foreach ($conf->modules_parts['tabs'][$type] as $value)
@@ -5496,7 +5497,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
}
}
}
-
+
// No need to make a return $head. Var is modified as a reference
if (! empty($hookmanager))
{
@@ -5534,11 +5535,11 @@ function printCommonFooter($zone='private')
{
print ''."\n";
print ''."\n";
}
-
+
// Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
{
@@ -5717,9 +5718,9 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
{
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
}
-
+
$value = preg_replace('/\s*\|\s*/','|', $value);
-
+
$crits = explode(' ', $value);
$res = '';
if (! is_array($fields)) $fields = array($fields);
@@ -5774,15 +5775,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
$tmpcrit=trim($tmpcrit);
$tmpcrit2=$tmpcrit;
$tmpbefore='%'; $tmpafter='%';
- if (preg_match('/^[\^\$]/', $tmpcrit))
- {
+ if (preg_match('/^[\^\$]/', $tmpcrit))
+ {
$tmpbefore='';
- $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
+ $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
}
- if (preg_match('/[\^\$]$/', $tmpcrit))
- {
+ if (preg_match('/[\^\$]$/', $tmpcrit))
+ {
$tmpafter='';
- $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
+ $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
}
$newres .= $tmpbefore;
$newres .= $db->escape($tmpcrit2);
@@ -5848,7 +5849,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
function getAdvancedPreviewUrl($modulepart, $relativepath, $param='')
{
global $conf;
-
+
if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php
index 02d85164d79..645993d8659 100644
--- a/test/phpunit/DateLibTest.php
+++ b/test/phpunit/DateLibTest.php
@@ -179,32 +179,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
-
+
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
-
+
$result=num_public_holiday($date1,$date2,'FR',1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days
-
+
$result=num_public_holiday($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown)
-
+
// With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
-
+
$result=num_public_holiday($date1,$date2,'FR',1);
print __METHOD__." result=".$result."\n";
- $this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
-
+ $this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
+
$result=num_public_holiday($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown)
}
-
+
/**
* testNumOpenDay
*
@@ -217,32 +217,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
-
+
// With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
-
+
$result=num_open_day($date1,$date2,0,1,0,'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days
-
+
$result=num_open_day($date1,$date2,0,1,0,'XX');
print __METHOD__." result=".$result."\n";
$this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown)
-
+
// With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
-
+
$result=num_open_day($date1,$date2,0,1,0,'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed
-
+
$result=num_open_day($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown)
}
-
+
/**
* testConvertTime2Seconds
*
@@ -335,6 +335,11 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals('02/01/1970 00:00',$result);
+ // Check %a and %b format for fr_FR
+ $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals('Jeu Jan. Janvier',$result);
+
// Check day format for en_US
$outputlangs=new Translate('',$conf);
$outputlangs->setDefaultLang('en_US');
@@ -345,9 +350,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals('01/02/1970',$result);
// Check %a and %b format for en_US
- $result=dol_print_date(0,'%a %b',true,$outputlangs);
+ $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
print __METHOD__." result=".$result."\n";
- $this->assertEquals('Thu Jan',$result);
+ $this->assertEquals('Thu Jan January',$result);
return $result;
}