2
0
forked from Wavyzz/dolibarr

Add purchase orders awaiting reception to workboard

This commit is contained in:
ATM john
2019-09-10 22:10:20 +02:00
parent 9db2e27289
commit 337194023a
3 changed files with 20 additions and 5 deletions

View File

@@ -2804,9 +2804,10 @@ class CommandeFournisseur extends CommonOrder
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
* @param int $mode "opened", "awaiting" for orders awaiting reception
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user)
public function load_board($user, $mode = 'opened')
{
// phpcs:enable
global $conf, $langs;
@@ -2822,7 +2823,12 @@ class CommandeFournisseur extends CommonOrder
$clause = " AND";
}
$sql.= $clause." c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
if($mode==='awaiting'){
$sql.= " AND c.fk_statut = ".self::STATUS_ORDERSENT;
}
else{
$sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
}
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql);
@@ -2834,9 +2840,15 @@ class CommandeFournisseur extends CommonOrder
$response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24;
$response->label=$langs->trans("SuppliersOrdersToProcess");
$response->labelShort=$langs->trans("Opened");
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3&mainmenu=commercial&leftmenu=orders_suppliers';
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2&mainmenu=commercial&leftmenu=orders_suppliers';
$response->img=img_object('', "order");
if($mode==='awaiting'){
$response->label=$langs->trans("SuppliersOrdersAwaitingReception");
$response->labelShort=$langs->trans("AwaitingReception");
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers';
}
while ($obj=$this->db->fetch_object($resql))
{
$response->nbtodo++;

View File

@@ -425,7 +425,8 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
$board = new CommandeFournisseur($db);
$dashboardlines[$board->element] = $board->load_board($user);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting');
}
// Number of services enabled (delayed)
@@ -550,7 +551,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
array(
'groupName' => 'SuppliersOrders',
'stats' =>
array('order_supplier'),
array('order_supplier_opened', 'order_supplier_awaiting'),
),
'invoice_supplier' =>
array(

View File

@@ -25,6 +25,8 @@ OrdersToBill=Sales orders delivered
OrdersInProcess=Sales orders in process
OrdersToProcess=Sales orders to process
SuppliersOrdersToProcess=Purchase orders to process
SuppliersOrdersAwaitingReception=Purchase orders awaiting reception
AwaitingReception=Awaiting reception
StatusOrderCanceledShort=Canceled
StatusOrderDraftShort=Draft
StatusOrderValidatedShort=Validated