diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 8878495fd66..db9725ce9f6 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel @@ -657,7 +657,6 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param = '&id='.$id; if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; @@ -1036,7 +1035,6 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') global $form; global $region_id; global $elementList,$sourceList; - global $bc; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 2b47ea80378..681030a179f 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -456,7 +456,6 @@ if ($id) if ($tabname[$id]) { $alabelisused=0; - $var=false; $fieldlist=explode(',',$tabfield[$id]); @@ -550,7 +549,6 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param = '&id='.$id; if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index a7462306ef3..925dcc0dc4e 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -417,7 +417,6 @@ if ($id) if ($tabname[$id]) { $alabelisused=0; - $var=false; $fieldlist=explode(',',$tabfield[$id]); @@ -497,7 +496,6 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param = '&id='.$id; if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index f89b8da20f6..a3033ec090d 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -36,13 +36,12 @@ $langs = $GLOBALS['langs']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("members"); -$var=true; $total=0; foreach($linkedObjectBlock as $key => $objectlink) { ?> - > + trans("Subscription"); ?> getNomUrl(1); ?> diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 4c1b49d75e6..f40ab648e42 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -148,7 +148,6 @@ print "
\n"; $selectedvalue=$conf->global->AGENDA_DISABLE_EXT; if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; -$var=true; print ""; print ""; @@ -202,7 +201,6 @@ print ''; print ""; $i=1; -$var=true; while ($i <= $MAXAGENDA) { $key=$i; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 313a852e384..db2b85fa986 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -157,7 +157,6 @@ foreach($dirbarcode as $reldir) /* * CHOIX ENCODAGE */ -$var=true; print '
'; print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); @@ -185,7 +184,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=true; while ($i < $num) { @@ -277,7 +275,6 @@ print ""; print ''; print ""; -$var=true; print '
'.$langs->trans("Color").'
'; print ''; print ''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 86b38283649..0d2363f60c8 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -1,7 +1,7 @@ * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2013-2014 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify @@ -31,11 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; -$langs->load("admin"); -$langs->load("companies"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("banks"); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","companies","bills","other","banks")); if (!$user->admin) accessforbidden(); @@ -133,8 +130,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; - while (($file = readdir($handle))!==false) { if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) @@ -166,7 +161,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var = !$var; print ''; print ''; print ''; print "\n"; -$var=true; - -$var=! $var; $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index e9224ba4688..582131b22f3 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -72,8 +72,6 @@ print ''; print ''; print ''; -$var=true; - print '
'.$langs->trans("Parameter").'
'; print (empty($module->name)?$name:$module->name); print "\n"; @@ -254,9 +248,6 @@ print ''.$langs->trans("Parameters").'  
'; print ''; print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 5db56c82aa2..cd4f4ca4ab2 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -286,7 +286,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; while (($file = readdir($handle))!==false) { @@ -406,7 +405,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -537,7 +535,6 @@ print ''; print ''; print "\n"; print "\n"; -$var=true; $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); @@ -545,7 +542,6 @@ $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; $htmltext.='
'; -$var=! $var; print ''; print ''; print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 83c3634c35c..82fa51e5ca8 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * * 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 @@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; -$langs->load("admin"); -$langs->load("errors"); -$langs->load("contracts"); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","errors","contracts")); if (!$user->admin) accessforbidden(); @@ -220,7 +219,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; while (($file = readdir($handle))!==false) { @@ -339,7 +337,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -377,7 +374,6 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - $var = !$var; print ''; print ''; print ''; print "\n"; -$var=true; $substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); @@ -480,7 +475,6 @@ $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; $htmltext.='
'; -$var=! $var; print '
'.$langs->trans("Name").'
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; print (empty($module->name)?$name:$module->name); print "\n"; @@ -472,7 +468,6 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); print '
'; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 37f66427225..4cf423b317f 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -144,7 +144,7 @@ if ($action == 'update') $plus=''; if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; // Update values - for($i=0;$i<4;$i++) { + for($i=0; $i<4; $i++) { if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity); } @@ -172,7 +172,6 @@ if ($action == 'edit') print ''; print ''; print ''; - $var=true; print ''; print ''; @@ -215,7 +214,6 @@ else print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'; print ''; - $var=true; foreach($modules as $module => $delays) { @@ -241,7 +239,6 @@ else print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'; print ''; - $var=false; print ''; print ''; diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 2d8bd936b50..cf1992dce5f 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -80,7 +80,6 @@ print ''; print ''."\n"; print ''; -$var=true; $form = new Form($db); // Mail required for members diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index b2d9bd97980..6f4dce93e8c 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -31,9 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; if (!$user->admin) accessforbidden(); -$langs->load("users"); -$langs->load("admin"); -$langs->load("other"); +// Load traductions files requiredby by page +$langs->loadLangs(array("users","admin","other")); $action=GETPOST('action','aZ09'); @@ -42,7 +41,6 @@ $securityevent=new Events($db); $eventstolog=$securityevent->eventstolog; - /* * Actions */ @@ -88,8 +86,6 @@ $head=security_prepare_head(); dol_fiche_head($head, 'audit', $langs->trans("Security"), -1); - -$var=true; print "
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").'' . yn($conf->global->MAIN_DISABLE_METEO) . '
 '.$langs->trans("Value").'
"; print ""; print ""; @@ -98,8 +94,7 @@ print "\n"; foreach ($eventstolog as $key => $arr) { if ($arr['id']) - { - + { print ''; print ''; print '\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/expensereport/doc"); @@ -376,7 +373,6 @@ foreach ($dirmodels as $reldir) if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); @@ -480,7 +476,6 @@ print ''; print ''; print ''; print "\n"; -$var=true; $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); @@ -488,7 +483,6 @@ $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; $htmltext.='
'; -$var=! $var; print ''; echo ''; - $var=true; - echo ''; + echo ''; echo ''; echo ''; echo ''; -$var=true; foreach ($rules as $rule) { - echo ''; + echo ''; echo ''; - echo ''; echo ''; - $var=!$var; } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 4a184aa95a0..a1d542203cf 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -250,8 +250,6 @@ if ($resql) $rssparser=new RssParser($db); $result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp); - $var=true; - print "
"; print ""; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 70b79acb931..53a2f8bf2da 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -139,8 +139,6 @@ $linkback=''; -$var=true; - if (empty($conf->use_javascript_ajax)) { setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); @@ -158,7 +156,6 @@ else { // Si condition non remplie, on ne propose pas l'option if (! $conditions[$const]) continue; - print ''; print ''; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index bf588ca90ae..59ce46921a7 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php'; if (!$user->admin) accessforbidden(); -$langs->load("admin"); -$langs->load("errors"); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","errors")); $action = GETPOST('action','aZ09'); @@ -94,7 +94,6 @@ else } // Mode -$var=true; print ''; print ''; print ''; @@ -105,7 +104,6 @@ print ''; print "\n"; - print ''; print ''; if (is_array($resCached)) { - $var = ! $var; print ''; print ""; print ''; print ""; - $var = ! $var; + print ''; print ""; print ''; @@ -301,17 +291,16 @@ if (is_array($resCached) || is_array($resRemoved)) { } if (is_array($resRemoved)) { - $var = ! $var; print ''; print ""; print ''; print ""; - $var = ! $var; + print ''; print ""; print ''; print ""; - $var = ! $var; + print ''; print ""; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ec14ec3da14..dbce9c2e76d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -983,15 +983,13 @@ if (empty($reshook)) // Add link between credit note and origin if(! empty($object->fk_facture_source)) { $facture_source->fetch($object->fk_facture_source); - } - $facture_source->fetchObjectLinked(); + $facture_source->fetchObjectLinked(); - if(! empty($facture_source->linkedObjectsIds)) { - $linkedObjectIds = $facture_source->linkedObjectsIds; - $sourcetype = key($linkedObjectIds); - $fk_origin = current($facture_source->linkedObjectsIds[$sourcetype]); - - $object->add_object_linked($sourcetype, $fk_origin); + if(! empty($facture_source->linkedObjectsIds)) { + foreach($facture_source->linkedObjectsIds as $sourcetype => $TIds) { + $object->add_object_linked($sourcetype, current($TIds)); + } + } } } } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 846de3a2611..a665e976145 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -113,7 +113,7 @@ if ($modecompta=="CREANCES-DETTES") $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'
','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $periodlink=($year_start?"".img_previous()."".img_next()."":""); + $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); @@ -127,7 +127,7 @@ else if ($modecompta=="RECETTES-DEPENSES") $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $periodlink=($year_start?"".img_previous()."".img_next()."":""); + $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); @@ -140,7 +140,7 @@ else if ($modecompta=="BOOKKEEPING") $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $periodlink=($year_start?"".img_previous()."".img_next()."":""); + $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCATotalSaleJournal"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6b0b2573042..4b70f5d424c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5555,6 +5555,41 @@ abstract class CommonObject // If prefix is 'search_', field is used as a filter, we use a common text field. $out=''; } + elseif ($type == 'array') + { + $newval = $val; + $newval['type'] = 'varchar(256)'; + + $out=''; + + $inputs = array(); + if(! empty($value)) { + foreach($value as $option) { + $out.= ' '; + $out.= $this->showInputField($newval, $keyprefix.$key.$keysuffix.'[]', $option, $moreparam, '', '', $showsize).'
'; + } + } + + $out.= ''; + + $newInput = ' '; + $newInput.= $this->showInputField($newval, $keyprefix.$key.$keysuffix.'[]', '', $moreparam, '', '', $showsize).'
'; + + if(! empty($conf->use_javascript_ajax)) { + $out.= ' + '; + } + } if (!empty($hidden)) { $out=''; } @@ -5926,6 +5961,10 @@ abstract class CommonObject { $value=preg_replace('/./i','*',$value); } + elseif ($type == 'array') + { + $value = implode('
', $value); + } //print $type.'-'.$size; $out=$value; @@ -6614,7 +6653,14 @@ abstract class CommonObject } else if($this->isArray($info)) { - $queryarray[$field] = serialize($this->{$field}); + if(! empty($this->{$field})) { + if(! is_array($this->{$field})) { + $this->{$field} = array($this->{$field}); + } + $queryarray[$field] = serialize($this->{$field}); + } else { + $queryarray[$field] = NULL; + } } else if($this->isInt($info)) { @@ -6658,9 +6704,13 @@ abstract class CommonObject } elseif($this->isArray($info)) { - $this->{$field} = @unserialize($obj->{$field}); - // Hack for data not in UTF8 - if($this->{$field } === false) @unserialize(utf8_decode($obj->{$field})); + if(! empty($obj->{$field})) { + $this->{$field} = @unserialize($obj->{$field}); + // Hack for data not in UTF8 + if($this->{$field } === false) @unserialize(utf8_decode($obj->{$field})); + } else { + $this->{$field} = array(); + } } elseif($this->isInt($info)) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 264bb748762..ee3b575d5d1 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -583,56 +583,70 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $ { $countryfound=1; - // Definition des dates feriees fixes - if($jour == 1 && $mois == 1) $ferie=true; // 1er janvier - if($jour == 1 && $mois == 5) $ferie=true; // 1er mai - if($jour == 8 && $mois == 5) $ferie=true; // 5 mai - if($jour == 14 && $mois == 7) $ferie=true; // 14 juillet - if($jour == 15 && $mois == 8) $ferie=true; // 15 aout - if($jour == 1 && $mois == 11) $ferie=true; // 1 novembre - if($jour == 11 && $mois == 11) $ferie=true; // 11 novembre - if($jour == 25 && $mois == 12) $ferie=true; // 25 decembre + // Definition of fixed working days + if($jour == 1 && $mois == 1) $ferie=true; // 1er january + if($jour == 1 && $mois == 5) $ferie=true; // 1er may + if($jour == 8 && $mois == 5) $ferie=true; // 5 may + if($jour == 14 && $mois == 7) $ferie=true; // 14 july + if($jour == 15 && $mois == 8) $ferie=true; // 15 august + if($jour == 1 && $mois == 11) $ferie=true; // 1 november + if($jour == 11 && $mois == 11) $ferie=true; // 11 november + if($jour == 25 && $mois == 12) $ferie=true; // 25 december - // Calcul du jour de paques + // Calculation for easter date $date_paques = easter_date($annee); $jour_paques = date("d", $date_paques); $mois_paques = date("m", $date_paques); if($jour_paques == $jour && $mois_paques == $mois) $ferie=true; - // Paques + // Pâques - // Calcul du jour de l ascension (38 jours apres Paques) + // Calculation for the monday of easter date + $date_lundi_paques = mktime( + date("H", $date_paques), + date("i", $date_paques), + date("s", $date_paques), + date("m", $date_paques), + date("d", $date_paques) + 1, + date("Y", $date_paques) + ); + $jour_lundi_ascension = date("d", $date_lundi_paques); + $mois_lundi_ascension = date("m", $date_lundi_paques); + if($jour_lundi_ascension == $jour && $mois_lundi_ascension == $mois) $ferie=true; + // Lundi de Pâques + + // Calcul du jour de l'ascension (38 days after easter day) $date_ascension = mktime( date("H", $date_paques), date("i", $date_paques), date("s", $date_paques), date("m", $date_paques), - date("d", $date_paques) + 38, + date("d", $date_paques) + 39, date("Y", $date_paques) ); $jour_ascension = date("d", $date_ascension); $mois_ascension = date("m", $date_ascension); if($jour_ascension == $jour && $mois_ascension == $mois) $ferie=true; - //Ascension + // Ascension - // Calcul de Pentecote (11 jours apres Paques) + // Calculation of "Pentecote" (11 days after easter day) $date_pentecote = mktime( - date("H", $date_ascension), - date("i", $date_ascension), - date("s", $date_ascension), - date("m", $date_ascension), - date("d", $date_ascension) + 11, - date("Y", $date_ascension) + date("H", $date_paques), + date("i", $date_paques), + date("s", $date_paques), + date("m", $date_paques), + date("d", $date_paques) + 49, + date("Y", $date_paques) ); $jour_pentecote = date("d", $date_pentecote); $mois_pentecote = date("m", $date_pentecote); if($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie=true; - //Pentecote + // "Pentecote" // Calul des samedis et dimanches $jour_julien = unixtojd($timestampStart); $jour_semaine = jddayofweek($jour_julien, 0); if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true; - //Samedi (6) et dimanche (0) + // Samedi (6) et dimanche (0) } // Pentecoste and Ascensione in Italy go to the sunday after: isn't holiday. diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index eedb994baed..731f8859eba 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -97,7 +97,7 @@ function product_prepare_head($object) $head[$h][2] = 'referers'; $h++; - if (!empty($conf->variants->enabled) && $object->isProduct()) { + if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { global $db; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1e35af900e6..dba45be1bc5 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -62,6 +62,8 @@ if (empty($conf->stock->enabled)) { accessforbidden(); } +$hookmanager->initHooks(array('ordersupplierdispatch')); + // Recuperation de l'id de projet $projectid = 0; if ($_GET["projectid"]) @@ -85,6 +87,10 @@ if ($id > 0 || ! empty($ref)) { * Actions */ +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { $error=0; @@ -431,6 +437,9 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print "
".$langs->trans("LogEvents")."
'.$arr['id'].''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 28ced963f87..6d164b25282 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * * 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 @@ -233,8 +233,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; - while (($file = readdir($handle))!==false) { if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -351,7 +349,6 @@ print "
'.$langs->trans("Parameter").'
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename='EXPENSEREPORT_FREE_TEXT'; diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index bf615676f81..ef915e196a2 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -30,11 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php'; -$langs->load('admin'); -$langs->load('other'); -$langs->load('trips'); -$langs->load('errors'); -$langs->load('dict'); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","other","trips","errors","dict")); if (!$user->admin) accessforbidden(); @@ -176,8 +173,7 @@ if ($action != 'edit') echo '
 
'; echo '
'.$form->selectarray('apply_to', $tab_apply, '', 0).'
'; echo '
'.$form->select_dolusers('', 'fk_user').'
'; @@ -220,10 +216,9 @@ echo '
'.$langs->trans('ExpenseReportRestrictive').' 
'; if ($action == 'edit' && $object->id == $rule->id) @@ -260,7 +255,6 @@ foreach ($rules as $rule) echo ''; if ($action == 'edit' && $object->id == $rule->id) { @@ -335,7 +329,6 @@ foreach ($rules as $rule) echo '
'.img_object("",$picto[$const]).''.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").''; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 07910185956..a16f147586a 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -32,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -$langs->load("admin"); -$langs->load("errors"); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","errors")); if (!$user->admin) accessforbidden(); @@ -117,15 +117,12 @@ print ''; print ''; print ''; -$var=true; print ''; print ''; print "\n"; - // DN Pour les contacts - print ''; @@ -133,7 +130,6 @@ print ''; print ''; // List of object class used to define attributes in structure - print ''; @@ -143,7 +139,6 @@ print ''; print '
'.$langs->trans("LDAPSynchronizeContacts").'
'.$langs->trans("LDAPContactDn").''; print ''; print ''.$langs->trans("LDAPContactDnExample").' 
'.$langs->trans("LDAPContactObjectClassList").''; print ''; print ''.$langs->trans("LDAPContactObjectClassListExample").'
'; print '
'; print ''; -$var=true; print ''; print ''; @@ -152,7 +147,6 @@ print ''; print "\n"; // Common name - print ''; @@ -160,7 +154,6 @@ print ''; @@ -168,7 +161,6 @@ print ''; @@ -176,7 +168,6 @@ print ''; @@ -184,7 +175,6 @@ print ''; @@ -192,7 +182,6 @@ print ''; @@ -200,7 +189,6 @@ print ''; @@ -208,7 +196,6 @@ print ''; @@ -216,7 +203,6 @@ print ''; @@ -224,7 +210,6 @@ print ''; @@ -232,7 +217,6 @@ print ''; @@ -240,7 +224,6 @@ print ''; @@ -248,7 +231,6 @@ print ''; @@ -256,7 +238,6 @@ print ''; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 5a4e36b7792..a1d69c7216b 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -33,8 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php'; -$langs->load("admin"); -$langs->load("errors"); +// Load traductions files requiredby by page +$langs->loadLangs(array("admin","errors")); if (!$user->admin) accessforbidden(); @@ -109,14 +109,12 @@ print ''; $form=new Form($db); print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").''.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").''.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").''.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").''.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").''.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").''.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").''.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").''.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").''.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").''.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").''.$langs->trans("LDAPFieldCountry").''; print ''; print ' 
'; -$var=true; print ''; print ''; print "\n"; // DN pour les groupes - print ''; @@ -124,7 +122,6 @@ print ''; print ''; // List of object class used to define attributes in structure - print ''; @@ -134,7 +131,6 @@ print ''; print '
'.$langs->trans("LDAPSynchronizeGroups").'
'.$langs->trans("LDAPGroupDn").''; print ''; print ''.$langs->trans("LDAPGroupDnExample").' 
'.$langs->trans("LDAPGroupObjectClassList").''; print ''; print ''.$langs->trans("LDAPGroupObjectClassListExample").'
'; print '
'; print ''; -$var=true; print ''; print ''; @@ -145,7 +141,6 @@ print "\n"; // Filtre // Common name - print ''; @@ -162,7 +157,6 @@ print ''; */ // Description - print ''; @@ -170,7 +164,6 @@ print ''; diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index eee003b0872..82e8481c2dd 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -140,7 +140,7 @@ $configfilelib=array( 'Limit nb of email sent by page', 'Strict mode is on/off' ); -$var=true; + print '
'.$langs->trans("LDAPDolibarrMapping").'
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldCommonNameExample").'
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''.$langs->trans("LDAPFieldGroupMembers").''; print ''; print ''.$langs->trans("LDAPFieldGroupMembersExample").'
'; print ''; print ''; diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index 68d56bd2ded..d3253c02514 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -116,8 +116,7 @@ function revcompare($x, $y) */ function create_script_table($list) { - global $sortby,$bc,$langs; - $var=true; + global $sortby,$langs; if (GETPOT('order') == "asc" || GETPOST('order') =="desc") { $order = GETPOST('order'); @@ -173,7 +172,6 @@ function create_script_table($list) } foreach($list as $script) { - $var = ! $var; print ''; print ''; print ''; @@ -194,8 +192,7 @@ function create_script_table($list) */ function create_key_table($list) { - global $bc,$langs; - $var=true; + global $langs; print '
'.$langs->trans("Label").''.$langs->trans("Parameter").'
'.dol_trunc($script['file'],80,'left').''.dol_print_date($script['mtime'],'dayhour').'
'; print ''; @@ -206,7 +203,6 @@ function create_key_table($list) print ''; foreach($list as $key) { - $var = !$var; print ''; print ''; print ''; @@ -229,54 +225,49 @@ function create_key_table($list) $form=new Form($db); print load_fiche_titre('Dolibarr eAccelerator '.$info['version'].' control panel','','title_setup'); -$var=true; - print '
'; - print '
'.dol_trunc($key['name'],80,'left').''.dol_print_date($key['created'],'dayhour').'
'; print ''; print ''; print ''; -$var = !$var; + print ''; print ''; print ''; print ''; -$var = !$var; + print ''; print ''; print ''; print ''; -$var = !$var; + print ''; print ''; print ''; print ''; -$var = ! $var; + print ''; print ''; print ''; print ''; -$var = ! $var; + print ''; print ''; print ''; print ''; -$var = ! $var; + print ''; print ''; print ''; print ''; -$var = ! $var; + print ''; print ''; print ''; print ''; print '
Information
Caching enabled'.($info['cache']?'yes':'no').'
Optimizer enabled'.$info['optimizer']?'yes':'no'.'
Memory usage'.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)
Free memory in reserved cache'.number_format($info['memoryAvailable']/(1024*1024), 2).'MB
Cached scripts'.$info['cachedScripts'].'
Removed scripts'.$info['removedScripts'].'
Cached keys'.(isset($info['cachedKeys'])?$info['cachedKeys']:'').'
'; -$var=true; - $resCached = @eaccelerator_cached_scripts(); // If success return an array $resRemoved = @eaccelerator_removed_scripts(); @@ -288,12 +279,11 @@ if (is_array($resCached) || is_array($resRemoved)) { print '
Actions
Caching
Optimizer
Clear cache
Clean cache
Purge cache ' . $author->getNomUrl(1, '', 0, 0, 0) . '
"; print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 549eca022b0..a0ab4508d9c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1771,7 +1771,7 @@ else } //Parent product. - if (!empty($conf->variants->enabled) && $object->isProduct()) { + if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { $combination = new ProductCombination($db); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 04f53e55d21..dbc413542c4 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -71,7 +71,7 @@ if ($cancel) { unset($_SESSION['addvariant_'.$object->id]); } -if (! $object->isProduct()) { +if (! $object->isProduct() && ! $object->isService()) { header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2)); exit(); } @@ -327,11 +327,31 @@ if (! empty($id) || ! empty($ref)) if ($action == 'add') { $title = $langs->trans('NewProductCombination'); + print dol_fiche_head(); + $features = $_SESSION['addvariant_'.$object->id]; + //First, sanitize + print '
'; + if (! empty($features)) { + foreach ($features as $feature) { + + $explode = explode(':', $feature); + + if ($prodattr->fetch($explode[0]) < 0) { + continue; + } + + if ($prodattr_val->fetch($explode[1]) < 0) { + continue; + } + + print '' . $prodattr->label . ':'. $prodattr_val->value . ' '; + } + } + print '
'; + print dol_fiche_end(); } else { $title = $langs->trans('EditProductCombination'); } - - print '
'; print_fiche_titre($title); if ($action == 'add') { @@ -346,8 +366,8 @@ if (! empty($id) || ! empty($ref)) foreach ($prodattr_all as $each) { $prodattr_alljson[$each->id] = $each; } - - ?> + + ?>