Skip to content

Commit

Permalink
Debug module supplier proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 4, 2016
1 parent e7511dd commit c63ee8c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 19 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/propal/class/propal.class.php
Expand Up @@ -2565,7 +2565,7 @@ function load_board($user,$mode)
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
$statut = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill");
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
}

$response = new WorkboardResponse();
Expand Down
Expand Up @@ -32,7 +32,7 @@
class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
{
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $prefix='DF';
var $prefix='RQ'; // RQ = Request for quotation
var $error='';
var $nom = "Marbre";

Expand Down
34 changes: 26 additions & 8 deletions htdocs/index.php
Expand Up @@ -170,6 +170,7 @@
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
! empty($conf->projet->enabled) && $user->rights->projet->lire
);
Expand All @@ -188,6 +189,7 @@
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
DOL_DOCUMENT_ROOT."/projet/class/project.class.php"
);
Expand All @@ -205,7 +207,8 @@
'Contrat',
'CommandeFournisseur',
'FactureFournisseur',
'ExpenseReport',
'SupplierProposal',
'ExpenseReport',
'Project'
);
// Cle array returned by the method load_state_board for each line
Expand All @@ -222,7 +225,8 @@
'Contracts',
'supplier_orders',
'supplier_invoices',
'expensereports',
'askprice',
'expensereports',
'projects'
);
// Dashboard Icon lines
Expand All @@ -239,6 +243,7 @@
'order',
'order',
'bill',
'propal',
'trip',
'project'
);
Expand All @@ -255,7 +260,8 @@
"BillsCustomers",
"Contracts",
"SuppliersOrders",
"SuppliersInvoices",
"SuppliersInvoices",
"SupplierProposalShort",
"ExpenseReports",
"Projects"
);
Expand All @@ -273,7 +279,8 @@
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
DOL_URL_ROOT.'/contrat/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.'/supplier_proposal/list.php',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm',
DOL_URL_ROOT.'/projet/list.php?mainmenu=project'
);
Expand All @@ -287,7 +294,8 @@
"produts",
"propal",
"orders",
"bills",
"bills",
"supplier_proposal",
"contracts",
"trips",
"projects"
Expand Down Expand Up @@ -387,9 +395,19 @@
{
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board=new Propal($db);
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
}

// Number of commercial proposals opened (expired)
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board=new SupplierProposal($db);
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
}

// Number of customer orders a deal
Expand Down
2 changes: 1 addition & 1 deletion htdocs/supplier_proposal/card.php
Expand Up @@ -1076,7 +1076,7 @@
print '</td>';
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.fournisseur = 1', 1);
print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print '</td>';
}
print '</tr>' . "\n";
Expand Down
53 changes: 45 additions & 8 deletions htdocs/supplier_proposal/class/supplier_proposal.class.php
Expand Up @@ -139,6 +139,29 @@ class SupplierProposal extends CommonObject
var $multicurrency_total_tva;
var $multicurrency_total_ttc;

/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Signed quote
*/
const STATUS_SIGNED = 2;
/**
* Not signed quote
*/
const STATUS_NOTSIGNED = 3;
/**
* Billed quote
*/
const STATUS_BILLED = 4;



/**
* Constructor
*
Expand Down Expand Up @@ -2087,7 +2110,7 @@ function LibStatut($statut,$mode=1)
*/
function load_board($user,$mode)
{
global $conf, $user;
global $conf, $user, $langs;

$now=dol_now();

Expand All @@ -2110,29 +2133,43 @@ function load_board($user,$mode)
$resql=$this->db->query($sql);
if ($resql)
{
if ($mode == 'opened') $delay_warning=$conf->supplier_proposal->cloture->warning_delay;
if ($mode == 'signed') $delay_warning=$conf->supplier_proposal->facturation->warning_delay;
if ($mode == 'opened') {
$delay_warning=$conf->supplier_proposal->cloture->warning_delay;
$statut = self::STATUS_VALIDATED;
$label = $langs->trans("SupplierProposalsToClose");
}
if ($mode == 'signed') {
$delay_warning=$conf->supplier_proposal->facturation->warning_delay;
$statut = self::STATUS_SIGNED;
$label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered
}

$response = new WorkboardResponse();
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut;
$response->img = img_object($langs->trans("SupplierProposals"),"propal");

// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql))
{
$this->nbtodo++;
$response->nbtodo++;
if ($mode == 'opened')
{
$datelimit = $this->db->jdate($obj->datefin);
if ($datelimit < ($now - $delay_warning))
{
$this->nbtodolate++;
$response->nbtodolate++;
}
}
// TODO Definir regle des propales a facturer en retard
// if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++;
}
return 1;
return $response;
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
Expand Down Expand Up @@ -2257,7 +2294,7 @@ function load_state_board()
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
Expand Down

0 comments on commit c63ee8c

Please sign in to comment.