diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index 5b07404223f..ac51e43f2ef 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -179,8 +179,8 @@ class modMyModule extends DolibarrModules
// Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add
- // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
- // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
+ // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600),
+ // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
// );
// Permissions
diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index 808af6a68b9..359384b5c4d 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -168,7 +168,28 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
}
}
-
+
+ /**
+ * Standard method to get content of a box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ *
+ * @return string
+ */
+ function outputBox($head = null, $contents = null)
+ {
+ global $langs, $user, $conf;
+
+ // Trick to get result into a var from a function that makes print instead of return
+ ob_start();
+ $result = $this->showBox($head, $contents);
+ $output = ob_get_contents();
+ ob_end_clean();
+
+ return $output;
+ }
+
/**
*Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*
@@ -177,7 +198,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
*
* @return void
*/
- function showBox($head, $contents)
+ function showBox($head = null, $contents = null)
{
global $langs, $user, $conf;
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 1727db5f227..81ff60f885b 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -967,7 +967,7 @@ class FormOther
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
- * @return int <0 if KO, Nb of boxes shown of OK (0 to n)
+ * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlist'=>)
*/
static function printBoxesArea($user,$areacode)
{
@@ -977,14 +977,15 @@ class FormOther
$confuserzone='MAIN_BOXES_'.$areacode;
+ $selectboxlist=$boxlist='';
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of common+user (or common only if user has no specific setup)
+
$boxidactivatedforuser=array();
foreach($boxactivated as $box)
{
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
}
- $selectboxlist='';
$arrayboxtoactivatelabel=array();
if (! empty($user->conf->$confuserzone))
{
@@ -1019,7 +1020,7 @@ class FormOther
// Javascript code for dynamic actions
if (! empty($conf->use_javascript_ajax))
{
- print ''."\n";
+ $selectboxlist.=''."\n";
}
$nbboxactivated=count($boxidactivatedforuser);
-
- print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
+ //print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
if ($nbboxactivated)
{
@@ -1098,13 +1098,13 @@ class FormOther
$emptybox=new ModeleBoxes($db);
- print '
';
- print ''."\n";
+ $boxlist.='';
+ $boxlist.=''."\n";
- print '';
+ $boxlist.=' ';
- print "\n\n";
- print ' '."\n";
+ $boxlist.="\n\n";
+ $boxlist.=' '."\n";
// Define $box_max_lines
$box_max_lines=5;
@@ -1122,7 +1122,7 @@ class FormOther
//print 'box_order '.$boxactivated[$ii]->box_order.' ';
// Affichage boite key
$box->loadBox($box_max_lines);
- $box->showBox();
+ $boxlist.= $box->outputBox();
}
}
@@ -1131,15 +1131,15 @@ class FormOther
$emptybox->box_id='A';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
- $emptybox->showBox(array(),array());
+ $boxlist.= $emptybox->outputBox(array(),array());
}
- print " \n";
- print "\n";
+ $boxlist.= " \n";
+ $boxlist.= "\n";
- print ' ';
+ $boxlist.= ' ';
- print "\n\n";
- print ' '."\n";
+ $boxlist.= "\n\n";
+ $boxlist.= ' '."\n";
$ii=0;
foreach ($boxactivated as $key => $box)
@@ -1153,7 +1153,7 @@ class FormOther
//print 'box_order '.$boxactivated[$ii]->box_order.' ';
// Affichage boite key
$box->loadBox($box_max_lines);
- $box->showBox();
+ $boxlist.= $box->outputBox();
}
}
@@ -1162,19 +1162,19 @@ class FormOther
$emptybox->box_id='B';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
- $emptybox->showBox(array(),array());
+ $boxlist.= $emptybox->outputBox(array(),array());
}
- print " \n";
- print "\n";
+ $boxlist.= " \n";
+ $boxlist.= "\n";
- print ' ';
- print "\n";
+ $boxlist.= ' ';
+ $boxlist.= "\n";
- print " | ";
- print " ";
+ $boxlist.= " |
";
+ $boxlist.= "
";
}
- return count($boxactivated);
+ return array('selectboxlist'=>$nbboxactivated?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlist'=>$boxlist);
}
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 5a9d98b758d..3996a2ca710 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -105,7 +105,19 @@ class modFacture extends DolibarrModules
2=>array('file'=>'box_graph_invoices_permonth.php','enabledbydefaulton'=>'Home')
);
- // Permissions
+ // Cronjobs
+ $this->cronjobs = array(
+ 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'Facture', 'method'=>'generateRecurringInvoices', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24),
+ // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
+ );
+ // List of cron jobs entries to add
+ // Example:
+ // $this->cronjobs=array(
+ // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600),
+ // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600)
+ // );
+
+ // Permissions
$this->rights = array();
$this->rights_class = 'facture';
$r=0;
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index b781d4f3dc6..7de87b8bb47 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1509,9 +1509,10 @@ class ExpenseReport extends CommonObject
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
+ * @param string $option 'topay' or 'toapprove'
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
- function load_board($user)
+ function load_board($user, $option='topay')
{
global $conf, $langs;
@@ -1521,7 +1522,8 @@ class ExpenseReport extends CommonObject
$sql = "SELECT ex.rowid, ex.date_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
- $sql.= " WHERE ex.fk_statut = 5";
+ if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
+ else $sql.= " WHERE ex.fk_statut = 5";
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
$resql=$this->db->query($sql);
@@ -1530,18 +1532,36 @@ class ExpenseReport extends CommonObject
$langs->load("members");
$response = new WorkboardResponse();
- $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
- $response->label=$langs->trans("ExpenseReportsToPay");
- $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5';
+ if ($option == 'toapprove')
+ {
+ $response->warning_delay=$conf->expensereport->approve->warning_delay/60/60/24;
+ $response->label=$langs->trans("ExpenseReportsToApprove");
+ $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=2';
+ }
+ else
+ {
+ $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
+ $response->label=$langs->trans("ExpenseReportsToPay");
+ $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5';
+ }
$response->img=img_object($langs->trans("ExpenseReports"),"trip");
while ($obj=$this->db->fetch_object($resql))
{
$response->nbtodo++;
-
- if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) {
- $response->nbtodolate++;
- }
+
+ if ($option == 'toapprove')
+ {
+ if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->approve->warning_delay)) {
+ $response->nbtodolate++;
+ }
+ }
+ else
+ {
+ if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) {
+ $response->nbtodolate++;
+ }
+ }
}
return $response;
diff --git a/htdocs/index.php b/htdocs/index.php
index 8d818c7afc9..86f35d52810 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -71,7 +71,11 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeAr
llxHeader('',$title);
-print load_fiche_titre($langs->trans("HomeArea"),'','title_home');
+
+$resultboxes=FormOther::printBoxesArea($user,"0");
+
+
+print load_fiche_titre($langs->trans("HomeArea"),$resultboxes['selectboxlist'],'title_home');
if (! empty($conf->global->MAIN_MOTD))
{
@@ -417,13 +421,22 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use
$dashboardlines[] = $board->load_board($user);
}
-// Number of expense reports to pay
-if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
+// Number of expense reports to approve
+if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->approve)
{
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board=new ExpenseReport($db);
- $dashboardlines[] = $board->load_board($user);
+ $dashboardlines[] = $board->load_board($user,'toapprove');
+}
+
+// Number of expense reports to pay
+if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid)
+{
+ include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
+ $board=new ExpenseReport($db);
+
+ $dashboardlines[] = $board->load_board($user,'topay');
}
// Calculate total nb of late
@@ -491,13 +504,11 @@ print ''; // End table array
print '
';
-
/*
* Show boxes
*/
-FormOther::printBoxesArea($user,"0");
-
+print $resultboxes['boxlist'];
print '
';
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 73793f868c8..c08d6ae6186 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -33,4 +33,5 @@ UPDATE llx_projet as p set opp_percent = (SELECT percent from llx_c_lead_status
ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(lang, transkey);
+ALTER TABLE llx_cronjob MODIFY COLUMN unitfrequency varchar(255) NOT NULL DEFAULT '3600';
diff --git a/htdocs/install/mysql/tables/llx_cronjob.sql b/htdocs/install/mysql/tables/llx_cronjob.sql
index dfe9ef127ff..a70051d4c11 100644
--- a/htdocs/install/mysql/tables/llx_cronjob.sql
+++ b/htdocs/install/mysql/tables/llx_cronjob.sql
@@ -40,7 +40,7 @@ CREATE TABLE llx_cronjob
datelastresult datetime, -- date last run end
lastresult text,
lastoutput text,
- unitfrequency integer NOT NULL DEFAULT 0,
+ unitfrequency varchar(255) NOT NULL DEFAULT '3600',
frequency integer NOT NULL DEFAULT 0,
maxrun integer NOT NULL DEFAULT 0, -- set this to 1 for a job queued for on run only
nbrun integer, -- nb of run complete (failed or not)
diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang
index 83208d88c90..9b96843f98d 100644
--- a/htdocs/langs/en_US/trips.lang
+++ b/htdocs/langs/en_US/trips.lang
@@ -99,4 +99,5 @@ ConfirmSaveTrip=Are you sure you want to validate this expense report ?
NoTripsToExportCSV=No expense report to export for this period.
ExpenseReportPayment=Expense report payment
+ExpenseReportsToApprove=Expense reports to approve
ExpenseReportsToPay=Expense reports to pay
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 1179494de8c..b157fa9d47d 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -593,12 +593,12 @@ div.fichecenter {
}
div.fichethirdleft {
browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
- browser->layout != 'phone') { print "width: 35%;\n"; } ?>
+ browser->layout != 'phone') { print "width: 50%;\n"; } ?>
browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
}
div.fichetwothirdright {
browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
- browser->layout != 'phone') { print "width: 65%;\n"; } ?>
+ browser->layout != 'phone') { print "width: 50%;\n"; } ?>
browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
}
div.fichehalfleft {