NEW Add Expense report to approve into workboard
NEW Selection of boxes is move on top
This commit is contained in:
parent
4b94c2ade7
commit
6bccac5691
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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 '<script type="text/javascript" language="javascript">
|
||||
$selectboxlist.='<script type="text/javascript" language="javascript">
|
||||
|
||||
// To update list of activated boxes
|
||||
function updateBoxOrder(closing) {
|
||||
@ -1058,8 +1059,8 @@ class FormOther
|
||||
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=addbox&boxid=\'+boxid;
|
||||
}
|
||||
});';
|
||||
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
|
||||
print '
|
||||
if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();';
|
||||
$selectboxlist.='
|
||||
|
||||
jQuery("#left, #right").sortable({
|
||||
/* placeholder: \'ui-state-highlight\', */
|
||||
@ -1084,12 +1085,11 @@ class FormOther
|
||||
|
||||
});'."\n";
|
||||
|
||||
print '</script>'."\n";
|
||||
$selectboxlist.='</script>'."\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 '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td class="notopnoleftnoright">'."\n";
|
||||
$boxlist.='<table width="100%" class="notopnoleftnoright">';
|
||||
$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
|
||||
print '<div class="fichehalfleft">';
|
||||
$boxlist.='<div class="fichehalfleft">';
|
||||
|
||||
print "\n<!-- Box left container -->\n";
|
||||
print '<div id="left" class="connectedSortable">'."\n";
|
||||
$boxlist.="\n<!-- Box left container -->\n";
|
||||
$boxlist.='<div id="left" class="connectedSortable">'."\n";
|
||||
|
||||
// Define $box_max_lines
|
||||
$box_max_lines=5;
|
||||
@ -1122,7 +1122,7 @@ class FormOther
|
||||
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||
// 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 "</div>\n";
|
||||
print "<!-- End box left container -->\n";
|
||||
$boxlist.= "</div>\n";
|
||||
$boxlist.= "<!-- End box left container -->\n";
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print "\n<!-- Box right container -->\n";
|
||||
print '<div id="right" class="connectedSortable">'."\n";
|
||||
$boxlist.= "\n<!-- Box right container -->\n";
|
||||
$boxlist.= '<div id="right" class="connectedSortable">'."\n";
|
||||
|
||||
$ii=0;
|
||||
foreach ($boxactivated as $key => $box)
|
||||
@ -1153,7 +1153,7 @@ class FormOther
|
||||
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||
// 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 "</div>\n";
|
||||
print "<!-- End box right container -->\n";
|
||||
$boxlist.= "</div>\n";
|
||||
$boxlist.= "<!-- End box right container -->\n";
|
||||
|
||||
print '</div></div>';
|
||||
print "\n";
|
||||
$boxlist.= '</div></div>';
|
||||
$boxlist.= "\n";
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
$boxlist.= "</td></tr>";
|
||||
$boxlist.= "</table>";
|
||||
}
|
||||
|
||||
return count($boxactivated);
|
||||
return array('selectboxlist'=>$nbboxactivated?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlist'=>$boxlist);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 '</table>'; // End table array
|
||||
print '</div></div></div><div class="fichecenter"><br>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Show boxes
|
||||
*/
|
||||
|
||||
FormOther::printBoxesArea($user,"0");
|
||||
|
||||
print $resultboxes['boxlist'];
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -593,12 +593,12 @@ div.fichecenter {
|
||||
}
|
||||
div.fichethirdleft {
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 35%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
|
||||
}
|
||||
div.fichetwothirdright {
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 65%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
|
||||
}
|
||||
div.fichehalfleft {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user