Merge pull request #3389 from aspangaro/develop-57
New: Add number of expense reports to pay in dashboard and a grace period
This commit is contained in:
commit
3e45cab352
@ -97,6 +97,12 @@ $modules=array(
|
|||||||
'img' => 'user'
|
'img' => 'user'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'expensereport' => array(
|
||||||
|
array(
|
||||||
|
'code' => 'MAIN_DELAY_EXPENSEREPORTS',
|
||||||
|
'img' => 'trip'
|
||||||
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
|
|||||||
@ -474,6 +474,7 @@ class Conf
|
|||||||
$this->adherent->cotisation = new stdClass();
|
$this->adherent->cotisation = new stdClass();
|
||||||
$this->bank->rappro = new stdClass();
|
$this->bank->rappro = new stdClass();
|
||||||
$this->bank->cheque = new stdClass();
|
$this->bank->cheque = new stdClass();
|
||||||
|
$this->expensereport->payment = new stdClass();
|
||||||
$this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
$this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||||
$this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60;
|
$this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60;
|
||||||
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
|
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
|
||||||
@ -486,6 +487,7 @@ class Conf
|
|||||||
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
|
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
|
||||||
$this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60;
|
$this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60;
|
||||||
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
|
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
|
||||||
|
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
|
||||||
|
|
||||||
// For modules that want to disable top or left menu
|
// For modules that want to disable top or left menu
|
||||||
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
|
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
|
||||||
|
|||||||
@ -1465,6 +1465,89 @@ class ExpenseReport extends CommonObject
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb pour le tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$this->nb=array();
|
||||||
|
|
||||||
|
$sql = "SELECT count(ex.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
||||||
|
$sql.= " WHERE ex.fk_statut > 0";
|
||||||
|
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["expensereports"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
|
*
|
||||||
|
* @param User $user Objet user
|
||||||
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
|
*/
|
||||||
|
function load_board($user)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
$sql = "SELECT ex.rowid, ex.date_valid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
||||||
|
$sql.= " WHERE ex.fk_statut = 5";
|
||||||
|
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$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';
|
||||||
|
$response->img=img_object($langs->trans("ExpenseReports"),"user");
|
||||||
|
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$response->nbtodo++;
|
||||||
|
|
||||||
|
if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) {
|
||||||
|
$response->nbtodolate++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,8 @@ if (empty($user->societe_id))
|
|||||||
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
||||||
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
|
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
|
||||||
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire,
|
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire,
|
||||||
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire);
|
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire,
|
||||||
|
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire);
|
||||||
// Class file containing the method load_state_board for each line
|
// Class file containing the method load_state_board for each line
|
||||||
$includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
$includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||||
@ -171,7 +172,8 @@ if (empty($user->societe_id))
|
|||||||
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
|
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
|
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
||||||
|
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php");
|
||||||
// Name class containing the method load_state_board for each line
|
// Name class containing the method load_state_board for each line
|
||||||
$classes=array('Client',
|
$classes=array('Client',
|
||||||
'Client',
|
'Client',
|
||||||
@ -184,7 +186,8 @@ if (empty($user->societe_id))
|
|||||||
'Facture',
|
'Facture',
|
||||||
'Contrat',
|
'Contrat',
|
||||||
'CommandeFournisseur',
|
'CommandeFournisseur',
|
||||||
'FactureFournisseur');
|
'FactureFournisseur',
|
||||||
|
'ExpenseReport');
|
||||||
// Cle array returned by the method load_state_board for each line
|
// Cle array returned by the method load_state_board for each line
|
||||||
$keys=array('customers',
|
$keys=array('customers',
|
||||||
'prospects',
|
'prospects',
|
||||||
@ -197,7 +200,8 @@ if (empty($user->societe_id))
|
|||||||
'invoices',
|
'invoices',
|
||||||
'Contracts',
|
'Contracts',
|
||||||
'supplier_orders',
|
'supplier_orders',
|
||||||
'supplier_invoices');
|
'supplier_invoices',
|
||||||
|
'expensereports');
|
||||||
// Dashboard Icon lines
|
// Dashboard Icon lines
|
||||||
$icons=array('company',
|
$icons=array('company',
|
||||||
'company',
|
'company',
|
||||||
@ -210,7 +214,8 @@ if (empty($user->societe_id))
|
|||||||
'bill',
|
'bill',
|
||||||
'order',
|
'order',
|
||||||
'order',
|
'order',
|
||||||
'bill');
|
'bill',
|
||||||
|
'trip');
|
||||||
// Translation keyword
|
// Translation keyword
|
||||||
$titres=array("ThirdPartyCustomersStats",
|
$titres=array("ThirdPartyCustomersStats",
|
||||||
"ThirdPartyProspectsStats",
|
"ThirdPartyProspectsStats",
|
||||||
@ -223,7 +228,8 @@ if (empty($user->societe_id))
|
|||||||
"BillsCustomers",
|
"BillsCustomers",
|
||||||
"Contracts",
|
"Contracts",
|
||||||
"SuppliersOrders",
|
"SuppliersOrders",
|
||||||
"SuppliersInvoices");
|
"SuppliersInvoices",
|
||||||
|
"ExpenseReports");
|
||||||
// Dashboard Link lines
|
// Dashboard Link lines
|
||||||
$links=array(DOL_URL_ROOT.'/comm/list.php',
|
$links=array(DOL_URL_ROOT.'/comm/list.php',
|
||||||
DOL_URL_ROOT.'/comm/prospect/list.php',
|
DOL_URL_ROOT.'/comm/prospect/list.php',
|
||||||
@ -236,7 +242,8 @@ if (empty($user->societe_id))
|
|||||||
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
|
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
|
||||||
DOL_URL_ROOT.'/contrat/list.php',
|
DOL_URL_ROOT.'/contrat/list.php',
|
||||||
DOL_URL_ROOT.'/fourn/commande/list.php',
|
DOL_URL_ROOT.'/fourn/commande/list.php',
|
||||||
DOL_URL_ROOT.'/fourn/facture/list.php');
|
DOL_URL_ROOT.'/fourn/facture/list.php',
|
||||||
|
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm');
|
||||||
// Translation lang files
|
// Translation lang files
|
||||||
$langfile=array("companies",
|
$langfile=array("companies",
|
||||||
"prospects",
|
"prospects",
|
||||||
@ -247,7 +254,8 @@ if (empty($user->societe_id))
|
|||||||
"propal",
|
"propal",
|
||||||
"orders",
|
"orders",
|
||||||
"bills",
|
"bills",
|
||||||
"contracts");
|
"contracts",
|
||||||
|
"trips");
|
||||||
|
|
||||||
|
|
||||||
// Loop and displays each line of table
|
// Loop and displays each line of table
|
||||||
@ -402,6 +410,15 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use
|
|||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Number of expense reports to pay
|
||||||
|
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
$board=new ExpenseReport($db);
|
||||||
|
|
||||||
|
$dashboardlines[] = $board->load_board($user);
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate total nb of late
|
// Calculate total nb of late
|
||||||
$totallate=0;
|
$totallate=0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|||||||
@ -75,6 +75,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_NOT
|
|||||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0);
|
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0);
|
||||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0);
|
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0);
|
||||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0);
|
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0);
|
||||||
|
insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@ -18,5 +18,8 @@
|
|||||||
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
||||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
|
||||||
|
|
||||||
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
||||||
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
||||||
|
|||||||
@ -102,3 +102,5 @@ ConfirmSaveTrip=Are you sure you want to validate this expense report ?
|
|||||||
|
|
||||||
NoTripsToExportCSV=No expense report to export for this period.
|
NoTripsToExportCSV=No expense report to export for this period.
|
||||||
ExpenseReportPayment=Expense report payment
|
ExpenseReportPayment=Expense report payment
|
||||||
|
|
||||||
|
ExpenseReportsToPay=Expense reports to pay
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user