Fix: Wrong status for contracts
This commit is contained in:
parent
e604d48519
commit
bb668c898c
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
@ -74,8 +74,8 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* Constructor of classe
|
||||||
* \param DB Databse handler
|
* @param DB Databse handler
|
||||||
*/
|
*/
|
||||||
function Contrat($DB)
|
function Contrat($DB)
|
||||||
{
|
{
|
||||||
@ -264,9 +264,9 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load a contract from database
|
* Load a contract from database
|
||||||
* \param id Id of contract to load
|
* @param id Id of contract to load
|
||||||
* \return int <0 if KO, id of contract if OK
|
* @return int <0 if KO, id of contract if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$ref='')
|
function fetch($id,$ref='')
|
||||||
{
|
{
|
||||||
@ -335,7 +335,8 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load lignes array
|
* Load lignes array into this->lignes
|
||||||
|
* @return Array Return array of contract lines
|
||||||
*/
|
*/
|
||||||
function fetch_lignes()
|
function fetch_lignes()
|
||||||
{
|
{
|
||||||
@ -344,7 +345,11 @@ class Contrat extends CommonObject
|
|||||||
$this->nbofservicesexpired=0;
|
$this->nbofservicesexpired=0;
|
||||||
$this->nbofservicesclosed=0;
|
$this->nbofservicesclosed=0;
|
||||||
|
|
||||||
$now=gmmktime();
|
$total_ttc=0;
|
||||||
|
$total_vat=0;
|
||||||
|
$total_ht=0;
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
// Selectionne les lignes contrats liees a un produit
|
// Selectionne les lignes contrats liees a un produit
|
||||||
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
||||||
@ -426,6 +431,10 @@ class Contrat extends CommonObject
|
|||||||
if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
||||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||||
|
|
||||||
|
$total_ttc+=$objp->total_ttc; // TODO Not saved into database
|
||||||
|
$total_vat+=$objp->total_tva;
|
||||||
|
$total_ht+=$objp->total_ht;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
@ -508,6 +517,11 @@ class Contrat extends CommonObject
|
|||||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||||
|
|
||||||
$this->lignes[] = $ligne;
|
$this->lignes[] = $ligne;
|
||||||
|
|
||||||
|
$total_ttc+=$objp->total_ttc;
|
||||||
|
$total_vat+=$objp->total_tva;
|
||||||
|
$total_ht+=$objp->total_ht;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,6 +535,9 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->nbofservices=sizeof($this->lignes);
|
$this->nbofservices=sizeof($this->lignes);
|
||||||
|
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||||
|
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||||
|
$this->total_ht = price2num($total_ht); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||||
|
|
||||||
return $this->lignes;
|
return $this->lignes;
|
||||||
}
|
}
|
||||||
@ -1021,9 +1038,9 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le libelle du statut du contrat
|
* Return label of a contract status
|
||||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services
|
||||||
* \return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode)
|
function getLibStatut($mode)
|
||||||
{
|
{
|
||||||
@ -1031,10 +1048,10 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi le libelle d'un statut donne
|
* Renvoi label of a given contrat status
|
||||||
* \param statut id statut
|
* @param statut Status id
|
||||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services
|
||||||
* \return string Libelle
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode)
|
function LibStatut($statut,$mode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,7 +30,7 @@ print_titre($langs->trans('RelatedContracts'));
|
|||||||
<tr class="liste_titre">
|
<tr class="liste_titre">
|
||||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
<td align="right"> </td>
|
||||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@ -38,13 +38,14 @@ $var=true;
|
|||||||
for ($i = 0 ; $i < $num ; $i++)
|
for ($i = 0 ; $i < $num ; $i++)
|
||||||
{
|
{
|
||||||
$linkedObjectBlock->fetch($objectid[$i]);
|
$linkedObjectBlock->fetch($objectid[$i]);
|
||||||
|
$linkedObjectBlock->fetch_lignes();
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
?>
|
?>
|
||||||
<tr <?php echo $bc[$var]; ?> ><td>
|
<tr <?php echo $bc[$var]; ?> ><td>
|
||||||
<a href="<?php echo DOL_URL_ROOT.'/contrat/fiche.php?id='.$linkedObjectBlock->id ?>"><?php echo img_object($langs->trans("ShowContract"),"contract").' '.$linkedObjectBlock->ref; ?></a></td>
|
<a href="<?php echo DOL_URL_ROOT.'/contrat/fiche.php?id='.$linkedObjectBlock->id ?>"><?php echo img_object($langs->trans("ShowContract"),"contract").' '.$linkedObjectBlock->ref; ?></a></td>
|
||||||
<td align="center"><?php echo dol_print_date($linkedObjectBlock->date,'day'); ?></td>
|
<td align="center"><?php echo dol_print_date($linkedObjectBlock->date_contrat,'day'); ?></td>
|
||||||
<td align="right"><?php echo price($linkedObjectBlock->total_ht); ?></td>
|
<td align="right"> </td>
|
||||||
<td align="right"><?php echo $linkedObjectBlock->getLibStatut(3); ?></td>
|
<td align="right"><?php echo $linkedObjectBlock->getLibStatut(6); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$total = $total + $linkedObjectBlock->total_ht;
|
$total = $total + $linkedObjectBlock->total_ht;
|
||||||
|
|||||||
@ -1351,6 +1351,7 @@ class CommonObject
|
|||||||
if ($object == 'facture') $tplpath = 'compta/'.$object; $classpath = $tplpath.'/class'; // To work with non standard path
|
if ($object == 'facture') $tplpath = 'compta/'.$object; $classpath = $tplpath.'/class'; // To work with non standard path
|
||||||
if ($object == 'propal') $tplpath = 'comm/'.$object; $classpath = $tplpath.'/class'; // To work with non standard path
|
if ($object == 'propal') $tplpath = 'comm/'.$object; $classpath = $tplpath.'/class'; // To work with non standard path
|
||||||
|
|
||||||
|
//print $classpath." - ".$tplpath;
|
||||||
$classname = ucfirst($object);
|
$classname = ucfirst($object);
|
||||||
if(!class_exists($classname)) require(DOL_DOCUMENT_ROOT."/".$classpath."/".$object.".class.php");
|
if(!class_exists($classname)) require(DOL_DOCUMENT_ROOT."/".$classpath."/".$object.".class.php");
|
||||||
$linkedObjectBlock = new $classname($this->db);
|
$linkedObjectBlock = new $classname($this->db);
|
||||||
|
|||||||
@ -87,11 +87,11 @@ class FormActions
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Show list of actions for element
|
* Show list of actions for element
|
||||||
* \param object Object
|
* @param object Object
|
||||||
* \param typeelement 'invoice','propal','order'
|
* @param typeelement 'invoice','propal','order'
|
||||||
* \param socid socid of user
|
* @param socid socid of user
|
||||||
* \return int <0 if KO, >=0 if OK
|
* @return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function showactions($object,$typeelement,$socid=0)
|
function showactions($object,$typeelement,$socid=0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user