diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 422058f2203..95da2e01d10 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -814,10 +814,10 @@ class FormOther foreach($boxactivated as $box) $arrayboxactivatedid[$box->id]=$box->id; $selectboxlist=''; - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax)) { $emptyuser=new User($db); - $boxavailable=InfoBox::listboxes($db,'activated',$areacode,$emptyuser,$arrayboxactivatedid); // Available here is activated for empty user + $boxavailable=InfoBox::listboxes($db,'activated',$areacode,$emptyuser,$arrayboxactivatedid); // Get list of box available for empty user (minus already activated for user) $arrayboxtoactivatelabel=array(); foreach($boxavailable as $box) @@ -852,9 +852,11 @@ class FormOther '; } - print load_fiche_titre((count($boxactivated)?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes'); + $nbboxactivated=count($boxactivated); - if (count($boxactivated)) + print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes'); + + if ($nbboxactivated) { print ''; print '
'."\n"; @@ -871,7 +873,8 @@ class FormOther $ii=0; foreach ($boxactivated as $key => $box) { - if (preg_match('/^A/i',$box->box_order)) // column A + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 + if (preg_match('/^A/i',$box->box_order)) // column A { $ii++; //print 'box_id '.$boxactivated[$ii]->box_id.' '; @@ -899,7 +902,8 @@ class FormOther $ii=0; foreach ($boxactivated as $key => $box) { - if (preg_match('/^B/i',$box->box_order)) // colonne B + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 + if (preg_match('/^B/i',$box->box_order)) // colonne B { $ii++; //print 'box_id '.$boxactivated[$ii]->box_id.' '; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 750865189c2..8c9fd112013 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -37,7 +37,7 @@ class InfoBox * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude * @return array Array of boxes */ - static function listBoxes($db, $mode,$zone,$user,$excludelist=array()) + static function listBoxes($db, $mode, $zone, $user, $excludelist=array()) { global $conf; @@ -52,7 +52,7 @@ class InfoBox $sql.= " WHERE b.box_id = d.rowid"; $sql.= " AND d.entity = ".$conf->entity; if ($zone >= 0) $sql.= " AND b.position = ".$zone; - if ($user->id && $user->conf->$confuserzone) $sql.= " AND b.fk_user = ".$user->id; + if ($user->id && ! empty($user->conf->$confuserzone)) $sql.= " AND b.fk_user = ".$user->id; else $sql.= " AND b.fk_user = 0"; $sql.= " ORDER BY b.box_order"; } @@ -99,7 +99,7 @@ class InfoBox $box->box_order = (! empty($obj->box_order) ? $obj->box_order : ''); $box->fk_user = (! empty($obj->fk_user) ? $obj->fk_user : ''); $box->sourcefile=$relsourcefile; - if ($mode == 'activated' && (! $user->id || ! $user->conf->$confuserzone)) + if ($mode == 'activated' && (! $user->id || empty($user->conf->$confuserzone))) // List of activated box was not yet personalized into database { if (is_numeric($box->box_order)) { diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index a37207eddaa..04938436d69 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -24,8 +24,9 @@ * \brief File that defines the balance of paid holiday of users. */ -include 'common.inc.php'; -require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php'; +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 6f32fff0b15..4c6e0799053 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -22,12 +22,13 @@ * \brief Form and file creation of paid holiday. */ -include 'common.inc.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; -require_once DOL_DOCUMENT_ROOT. '/user/class/usergroup.class.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/CMailFile.class.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/html.formmail.class.php'; +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Get parameters $myparam = GETPOST("myparam"); diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 61a6e4318df..ce466d1807a 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -23,11 +23,12 @@ * \brief List of holiday. */ -include 'common.inc.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; -require_once DOL_DOCUMENT_ROOT. '/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT. '/user/class/usergroup.class.php'; +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 36a3212c0d1..1349ef1e364 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -22,10 +22,11 @@ * \brief Monthly report of paid holiday. */ -include 'common.inc.php'; +require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index ffe000bf04d..ef21ee4cde1 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -23,8 +23,9 @@ * \ingroup holiday */ -include 'common.inc.php'; -require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php'; +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/index.php b/htdocs/index.php index e356d9433a4..efcd24e7811 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -145,7 +145,7 @@ if ($user->societe_id == 0) ! empty($conf->propal->enabled) && $user->rights->propale->lire, ! empty($conf->commande->enabled) && $user->rights->commande->lire, ! empty($conf->facture->enabled) && $user->rights->facture->lire, - ! empty($conf->societe->enabled) && $user->rights->contrat->activer); + ! empty($conf->contrat->enabled) && $user->rights->contrat->activer); // Class file containing the method load_state_board for each line $includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/comm/prospect/class/prospect.class.php", diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 46c9e7d941e..85b9854eb07 100755 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -3,7 +3,7 @@ CHARSET= UTF-8 CPTitreMenu=Holidays MenuReportMonth=Monthly statement -MenuAddCP=Demand for holidays +MenuAddCP=Apply for holidays NotActiveModCP=You must enable the module holidays to view this page. NotConfigModCP=You must configure the module holidays to view this page. To do this, click here . NoCPforUser=You don't have a demand for holidays. @@ -23,7 +23,7 @@ ListeCP=List of holidays ValidateByCP=Will be validated by DescCP=Description SendRequestCP=Creating demand for holidays -DelayToRequestCP=Applications for holidays must be made at least % s day before them. +DelayToRequestCP=Applications for holidays must be made at least %s day(s) before them. MenuConfCP=Define the holidays UpdateAllCP=Update the holidays SoldeCPUser=Your balance of holidays is %s days. diff --git a/test/phpunit/jenkins_phpunittest.xml b/test/phpunit/jenkins_phpunittest.xml index 9e29f2f9650..ccdd46bf5d8 100644 --- a/test/phpunit/jenkins_phpunittest.xml +++ b/test/phpunit/jenkins_phpunittest.xml @@ -45,6 +45,7 @@ ../../htdocs/boutique/osc_master.inc.php ../../htdocs/compta/bank/pre.inc.php ../../htdocs/compta/paiement/cheque/pre.inc.php + ../../htdocs/holiday/common.inc.php ../../htdocs/ftp/pre.inc.php diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml index 13d0d7e4154..5900b5f322e 100644 --- a/test/phpunit/phpunittest.xml +++ b/test/phpunit/phpunittest.xml @@ -47,6 +47,7 @@ ../../htdocs/boutique/osc_master.inc.php ../../htdocs/compta/bank/pre.inc.php ../../htdocs/compta/paiement/cheque/pre.inc.php + ../../htdocs/holiday/common.inc.php ../../htdocs/ftp/pre.inc.php