Debug module supplier proposal

This commit is contained in:
Laurent Destailleur 2016-03-04 16:08:51 +01:00
parent e7511dd267
commit c63ee8ceb5
5 changed files with 74 additions and 19 deletions

View File

@ -2565,7 +2565,7 @@ class Propal extends CommonObject
if ($mode == 'signed') { if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay; $delay_warning=$conf->propal->facturation->warning_delay;
$statut = self::STATUS_SIGNED; $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(); $response = new WorkboardResponse();

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_proposal/modules_supplie
class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
{ {
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $prefix='DF'; var $prefix='RQ'; // RQ = Request for quotation
var $error=''; var $error='';
var $nom = "Marbre"; var $nom = "Marbre";

View File

@ -170,6 +170,7 @@ if (empty($user->societe_id))
! empty($conf->contrat->enabled) && $user->rights->contrat->activer, ! 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_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_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->expensereport->enabled) && $user->rights->expensereport->lire,
! empty($conf->projet->enabled) && $user->rights->projet->lire ! empty($conf->projet->enabled) && $user->rights->projet->lire
); );
@ -188,6 +189,7 @@ if (empty($user->societe_id))
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."/supplier_proposal/class/supplier_proposal.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
DOL_DOCUMENT_ROOT."/projet/class/project.class.php" DOL_DOCUMENT_ROOT."/projet/class/project.class.php"
); );
@ -205,6 +207,7 @@ if (empty($user->societe_id))
'Contrat', 'Contrat',
'CommandeFournisseur', 'CommandeFournisseur',
'FactureFournisseur', 'FactureFournisseur',
'SupplierProposal',
'ExpenseReport', 'ExpenseReport',
'Project' 'Project'
); );
@ -222,6 +225,7 @@ if (empty($user->societe_id))
'Contracts', 'Contracts',
'supplier_orders', 'supplier_orders',
'supplier_invoices', 'supplier_invoices',
'askprice',
'expensereports', 'expensereports',
'projects' 'projects'
); );
@ -239,6 +243,7 @@ if (empty($user->societe_id))
'order', 'order',
'order', 'order',
'bill', 'bill',
'propal',
'trip', 'trip',
'project' 'project'
); );
@ -256,6 +261,7 @@ if (empty($user->societe_id))
"Contracts", "Contracts",
"SuppliersOrders", "SuppliersOrders",
"SuppliersInvoices", "SuppliersInvoices",
"SupplierProposalShort",
"ExpenseReports", "ExpenseReports",
"Projects" "Projects"
); );
@ -274,6 +280,7 @@ if (empty($user->societe_id))
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.'/supplier_proposal/list.php',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm',
DOL_URL_ROOT.'/projet/list.php?mainmenu=project' DOL_URL_ROOT.'/projet/list.php?mainmenu=project'
); );
@ -288,6 +295,7 @@ if (empty($user->societe_id))
"propal", "propal",
"orders", "orders",
"bills", "bills",
"supplier_proposal",
"contracts", "contracts",
"trips", "trips",
"projects" "projects"
@ -392,6 +400,16 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$dashboardlines[] = $board->load_board($user,"signed"); $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 // Number of customer orders a deal
if (! empty($conf->commande->enabled) && $user->rights->commande->lire) if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{ {

View File

@ -1076,7 +1076,7 @@ if ($action == 'create')
print '</td>'; print '</td>';
} else { } else {
print '<td colspan="2">'; 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 '</td>';
} }
print '</tr>' . "\n"; print '</tr>' . "\n";

View File

@ -139,6 +139,29 @@ class SupplierProposal extends CommonObject
var $multicurrency_total_tva; var $multicurrency_total_tva;
var $multicurrency_total_ttc; 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 * Constructor
* *
@ -2087,7 +2110,7 @@ class SupplierProposal extends CommonObject
*/ */
function load_board($user,$mode) function load_board($user,$mode)
{ {
global $conf, $user; global $conf, $user, $langs;
$now=dol_now(); $now=dol_now();
@ -2110,29 +2133,43 @@ class SupplierProposal extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($mode == 'opened') $delay_warning=$conf->supplier_proposal->cloture->warning_delay; if ($mode == 'opened') {
if ($mode == 'signed') $delay_warning=$conf->supplier_proposal->facturation->warning_delay; $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. // This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $response->nbtodo++;
if ($mode == 'opened') if ($mode == 'opened')
{ {
$datelimit = $this->db->jdate($obj->datefin); $datelimit = $this->db->jdate($obj->datefin);
if ($datelimit < ($now - $delay_warning)) if ($datelimit < ($now - $delay_warning))
{ {
$this->nbtodolate++; $response->nbtodolate++;
} }
} }
// TODO Definir regle des propales a facturer en retard // TODO Definir regle des propales a facturer en retard
// if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; // if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++;
} }
return 1; return $response;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -2257,7 +2294,7 @@ class SupplierProposal extends CommonObject
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }